|
|
@ -29,6 +29,8 @@ import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
@ -60,16 +62,16 @@ import com.epmet.service.UserService; |
|
|
|
import com.epmet.util.ModuleConstant; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.ibatis.annotations.Param; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -100,6 +102,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
|
private OperCrmOpenFeignClient operCrmOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GovAccessFeignClient govAccessFeignClient; |
|
|
|
@Autowired |
|
|
|
private ExecutorService executorService; |
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<CustomerStaffDTO> page(Map<String, Object> params) { |
|
|
@ -739,7 +745,28 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<StaffBasicInfoResultDTO> selectStaffBasicInfo(String userId, String customerId) { |
|
|
|
StaffBasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId); |
|
|
|
StaffBasicInfoResultDTO resultDTO = null; |
|
|
|
String userBaseInfoKey = RedisKeys.getUserBaseInfoKey(userId); |
|
|
|
resultDTO = (StaffBasicInfoResultDTO)redisUtils.get(userBaseInfoKey); |
|
|
|
if(resultDTO == null){ |
|
|
|
resultDTO = getStaffBasicInfoResultDTO(userId, customerId, userBaseInfoKey); |
|
|
|
} |
|
|
|
//启用线程去查询 并替换redis
|
|
|
|
executorService.submit(() -> { |
|
|
|
try { |
|
|
|
getStaffBasicInfoResultDTO(userId, customerId, userBaseInfoKey); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("selectStaffBasicInfo exception", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return new Result<StaffBasicInfoResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@Nullable |
|
|
|
private StaffBasicInfoResultDTO getStaffBasicInfoResultDTO(String userId, String customerId, String userBaseInfoKey) { |
|
|
|
StaffBasicInfoResultDTO resultDTO; |
|
|
|
resultDTO = baseDao.selectStaffBasicInfo(userId); |
|
|
|
if (null != resultDTO) { |
|
|
|
resultDTO.setRoleList(baseDao.selectStaffRoles(userId, resultDTO.getCustomerId())); |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|
|
@ -767,7 +794,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao, |
|
|
|
resultDTO.setCustomerName(customerResult.getData().getCustomerName()); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result<StaffBasicInfoResultDTO>().ok(resultDTO); |
|
|
|
redisUtils.set(userBaseInfoKey,resultDTO); |
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|