diff --git a/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/ehr/EhrRpcService.java b/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/ehr/EhrRpcService.java
index bbf0861..221fe74 100644
--- a/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/ehr/EhrRpcService.java
+++ b/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/ehr/EhrRpcService.java
@@ -6,6 +6,7 @@ import cn.fw.ehr.sdk.api.result.StaffInfo;
import cn.fw.valhalla.common.utils.StringUtils;
import cn.fw.valhalla.rpc.AbsBaseRpcService;
import cn.fw.valhalla.rpc.ehr.dto.StaffInfoDTO;
+import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -61,6 +62,26 @@ public class EhrRpcService extends AbsBaseRpcService {
return null;
}
+ /**
+ * 查询人员信息
+ * @param userId
+ * @return
+ */
+ @Nullable
+ public UserInfoDTO user(final Long userId) {
+ StaffInfoDTO staffInfoDTO = queryStaffInfo(userId);
+ if (Objects.isNull(staffInfoDTO)) {
+ return null;
+ }
+ UserInfoDTO userInfoDTO = new UserInfoDTO();
+ userInfoDTO.setId(staffInfoDTO.getId());
+ userInfoDTO.setUserName(staffInfoDTO.getName());
+ userInfoDTO.setHeadImg(staffInfoDTO.getAvatar());
+ userInfoDTO.setMobile(staffInfoDTO.getMobile());
+ return userInfoDTO;
+
+ }
+
@Nullable
public StaffInfoDTO queryStaffInfoByMobile(final String mobile) {
if (StringUtils.isEmpty(mobile)) {
diff --git a/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/UserService.java b/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/UserService.java
index 8fc88aa..f712f33 100644
--- a/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/UserService.java
+++ b/fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/UserService.java
@@ -1,15 +1,11 @@
package cn.fw.valhalla.rpc.erp;
import cn.fw.data.base.domain.common.Message;
-import cn.fw.erp.sdk.api.UserApi;
import cn.fw.erp.sdk.api.UserRoleApi;
-import cn.fw.erp.sdk.api.result.UserBaseInfo;
import cn.fw.erp.sdk.api.result.UserRoleDataRange;
import cn.fw.erp.sdk.api.result.UserRoleInfo;
-import cn.fw.valhalla.common.utils.StringUtils;
import cn.fw.valhalla.rpc.AbsBaseRpcService;
import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
-import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
@@ -27,8 +23,6 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
-import static org.apache.commons.lang3.Validate.isTrue;
-
/**
* 用户服务
*
@@ -41,10 +35,6 @@ import static org.apache.commons.lang3.Validate.isTrue;
@RequiredArgsConstructor
public class UserService extends AbsBaseRpcService {
/**
- * 用户服务
- */
- private final UserApi userApi;
- /**
* 岗位用户服务
*/
private final UserRoleApi userRoleApi;
@@ -53,41 +43,6 @@ public class UserService extends AbsBaseRpcService {
@Getter
private String keyPrefix;
- /**
- * 根据用户ID获取用户信息
- *
- * @param userId 用户ID
- * @return 用户信息
- */
- public UserInfoDTO user(final Long userId) {
- if (Objects.isNull(userId)) {
- return null;
- }
- String key = generateKey(userId);
- String json = getFromCache(key);
- if (StringUtils.isValid(json)) {
- return JSONObject.parseObject(json, UserInfoDTO.class);
- }
- try {
- final Message msg = userApi.queryUserBaseInfo(userId);
- isTrue(msg.isSuccess(), String.format("调用ERP[根据用户ID[%s]获取用户信息]系统失败", msg.getResult()));
- final UserBaseInfo userBaseInfo = msg.getData();
- if (!msg.isSuccess() || Objects.isNull(msg.getData())) {
- return null;
- }
- UserInfoDTO userInfoDTO = new UserInfoDTO();
- userInfoDTO.setId(userBaseInfo.getUserId());
- userInfoDTO.setUserName(userBaseInfo.getUserName());
- userInfoDTO.setHeadImg(userBaseInfo.getHeadImg());
- userInfoDTO.setMobile(msg.getData().getMobile());
- setToCache(key, JSONObject.toJSONString(userInfoDTO), 60);
- return userInfoDTO;
- } catch (Exception e) {
- log.info("调用ERP[根据用户ID[{}]获取用户信息]系统失败", userId, e);
- }
- return null;
- }
-
/**
* 获取某个流程角色的权限范围
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CustomerRetentionRatioBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CustomerRetentionRatioBizService.java
index da2c7b3..89865fe 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CustomerRetentionRatioBizService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CustomerRetentionRatioBizService.java
@@ -8,6 +8,8 @@ import cn.fw.valhalla.domain.db.follow.FollowTask;
import cn.fw.valhalla.domain.db.pool.StammkundePool;
import cn.fw.valhalla.domain.db.report.CustomerRetentionRatio;
import cn.fw.valhalla.domain.enums.*;
+import cn.fw.valhalla.rpc.ehr.EhrRpcService;
+import cn.fw.valhalla.rpc.ehr.dto.StaffInfoDTO;
import cn.fw.valhalla.rpc.erp.UserService;
import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
@@ -43,6 +45,7 @@ import java.util.stream.Stream;
public class CustomerRetentionRatioBizService {
private final OopService oopService;
private final UserService userService;
+ private final EhrRpcService ehrRpcService;
private final CustomerRetentionRatioService customerRetentionRatioService;
private final StammkundePoolService stammkundePoolService;
private final FollowTaskService followTaskService;
@@ -99,8 +102,8 @@ public class CustomerRetentionRatioBizService {
Long adviserId = pool.getAdviserId();
String adviserName = pool.getAdviserName();
if (StringUtils.isEmpty(adviserName)) {
- UserInfoDTO user = userService.user(adviserId);
- adviserName = Objects.nonNull(user) ? user.getUserName() : adviserName;
+ StaffInfoDTO staffInfoDTO = ehrRpcService.queryStaffInfo(adviserId);
+ adviserName = Objects.nonNull(staffInfoDTO) ? staffInfoDTO.getName() : adviserName;
}
set.add(new UserInfo(adviserId, adviserName));
}
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/LeaveNeedDoBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/LeaveNeedDoBizService.java
index 253f056..93fb363 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/LeaveNeedDoBizService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/LeaveNeedDoBizService.java
@@ -430,7 +430,7 @@ public class LeaveNeedDoBizService {
.eq(LeaveNeedDo::getDone, Boolean.FALSE)
);
BV.isTrue(count == 0, () -> "已存在待分配记录,请勿重复添加");
- UserInfoDTO user = userService.user(userId);
+ UserInfoDTO user = ehrRpcService.user(userId);
BV.notNull(user, () -> "用户不存在");
boolean bool = customerService.count(Wrappers.lambdaQuery()
.eq(Customer::getAdviserId, userId)
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/ReachLogBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/ReachLogBizService.java
index 2e5b199..c124210 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/ReachLogBizService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/ReachLogBizService.java
@@ -3,7 +3,7 @@ package cn.fw.valhalla.service.bus;
import cn.fw.valhalla.common.utils.DateUtil;
import cn.fw.valhalla.domain.db.customer.Customer;
import cn.fw.valhalla.domain.db.customer.CustomerReachLog;
-import cn.fw.valhalla.rpc.erp.UserService;
+import cn.fw.valhalla.rpc.ehr.EhrRpcService;
import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
import cn.fw.valhalla.sdk.param.ReachLogReq;
import cn.fw.valhalla.service.data.CustomerReachLogService;
@@ -30,7 +30,7 @@ import java.util.Objects;
public class ReachLogBizService {
private final CustomerService customerService;
private final CustomerReachLogService customerReachLogService;
- private final UserService userService;
+ private final EhrRpcService ehrRpcService;
@Transactional(rollbackFor = Exception.class)
public void saveReachLog(ReachLogReq reachLogReq) {
@@ -46,7 +46,7 @@ public class ReachLogBizService {
BeanUtils.copyProperties(reachLogReq, reachLog);
reachLog.setFrameNo(customer.getFrameNo());
reachLog.setAdviserId(customer.getAdviserId());
- UserInfoDTO user = userService.user(customer.getAdviserId());
+ UserInfoDTO user = ehrRpcService.user(customer.getAdviserId());
if (Objects.nonNull(user)) {
reachLog.setAdviserId(user.getId());
reachLog.setAdviserName(user.getUserName());
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java
index 2ee4433..a1411ec 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/AbstractCustomerService.java
@@ -14,6 +14,7 @@ import cn.fw.valhalla.domain.enums.StammkundeSourcesEnum;
import cn.fw.valhalla.domain.enums.StammkundeStatusEnum;
import cn.fw.valhalla.rpc.angel.InsurerRpcService;
import cn.fw.valhalla.rpc.angel.dto.InsuranceDTO;
+import cn.fw.valhalla.rpc.ehr.EhrRpcService;
import cn.fw.valhalla.rpc.erp.UserService;
import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO;
@@ -47,6 +48,8 @@ public abstract class AbstractCustomerService {
@Autowired
protected UserService userService;
@Autowired
+ protected EhrRpcService ehrRpcService;
+ @Autowired
protected OopService oopService;
@Autowired
protected CustomerService customerService;
@@ -130,7 +133,7 @@ public abstract class AbstractCustomerService {
dto.setArrivalTime(customer.getArrivalTime());
dto.setAdviserId(customer.getAdviserId());
dto.setArrivalCount(customer.getArrivalCount());
- UserInfoDTO user = userService.user(customer.getAdviserId());
+ UserInfoDTO user = ehrRpcService.user(customer.getAdviserId());
if (Objects.nonNull(user)) {
dto.setAdviserName(user.getUserName());
}
@@ -281,7 +284,7 @@ public abstract class AbstractCustomerService {
StammkundePool stammkundePool = createSimpleInfo(customer);
if (Objects.nonNull(userId)) {
stammkundePool.setAdviserId(userId);
- UserInfoDTO user = userService.user(userId);
+ UserInfoDTO user = ehrRpcService.user(userId);
if (Objects.nonNull(user)) {
stammkundePool.setAdviserName(user.getUserName());
}
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
index 61810e9..f035c13 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
@@ -364,7 +364,7 @@ public class CustomerBizService extends AbstractCustomerService {
* @return
*/
public ReceptionResultDto queryReceivable(Long userId, String plateNo) {
- UserInfoDTO userInfo = userService.user(userId);
+ UserInfoDTO userInfo = ehrRpcService.user(userId);
if (Objects.isNull(userInfo)) {
return new ReceptionResultDto(false, "非服务顾问无法接待");
}
@@ -677,7 +677,7 @@ public class CustomerBizService extends AbstractCustomerService {
}
CustomerDetailDto dto = CustomerDetailDto.with(memberVehicle);
dto.setAdviserId(customers.get(0).getAdviserId());
- UserInfoDTO user = userService.user(customers.get(0).getAdviserId());
+ UserInfoDTO user = ehrRpcService.user(customers.get(0).getAdviserId());
if (Objects.nonNull(user)) {
dto.setAdviserName(user.getUserName());
}
@@ -703,7 +703,7 @@ public class CustomerBizService extends AbstractCustomerService {
}
CustomerDetailDto dto = CustomerDetailDto.with(memberVehicle);
dto.setAdviserId(customers.get(0).getAdviserId());
- UserInfoDTO user = userService.user(customers.get(0).getAdviserId());
+ UserInfoDTO user = ehrRpcService.user(customers.get(0).getAdviserId());
if (Objects.nonNull(user)) {
dto.setAdviserName(user.getUserName());
}
@@ -847,7 +847,7 @@ public class CustomerBizService extends AbstractCustomerService {
.map(CarArchiveVO::with)
.filter(Objects::nonNull)
.peek(vo -> {
- UserInfoDTO dto = userService.user(vo.getAdviserId());
+ UserInfoDTO dto = ehrRpcService.user(vo.getAdviserId());
if (Objects.nonNull(dto)) {
vo.setAdviserName(dto.getUserName());
}
@@ -999,7 +999,7 @@ public class CustomerBizService extends AbstractCustomerService {
private List fromCustomer(String keyword, Long groupId) {
List list = customerService.queryByKeyword(keyword, groupId);
for (BasicsCustomerDTO dto : list) {
- UserInfoDTO user = userService.user(dto.getAdviserId());
+ UserInfoDTO user = ehrRpcService.user(dto.getAdviserId());
if (Objects.nonNull(user)) {
dto.setAdviserName(user.getUserName());
}
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
index ee88cbd..5b8c5e5 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
@@ -465,7 +465,7 @@ public class CustomerChangeBizService extends AbstractCustomerService {
stammkundeDto.setCustomerId(customer.getId());
stammkundeDto.setReason(reasonEnum);
stammkundeDto.setShopId(customer.getShopId());
- UserInfoDTO user = userService.user(adviserId);
+ UserInfoDTO user = ehrRpcService.user(adviserId);
stammkundeDto.setNewUserId(adviserId);
if (Objects.nonNull(user)) {
stammkundeDto.setNewUserName(user.getUserName());
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java
index 2a69ee0..cbb61a3 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java
@@ -113,7 +113,7 @@ public class PickUpCustomerService extends AbstractCustomerService {
boolean canReception = true;
ShopDTO shop = Optional.ofNullable(queryDealId(userId, RoleCode.FWGW)).orElse(new ShopDTO());
if (Objects.nonNull(customer.getShopId()) && customer.getShopId().equals(shop.getId()) && Objects.nonNull(customer.getAdviserId())) {
- UserInfoDTO user = userService.user(customer.getAdviserId());
+ UserInfoDTO user = ehrRpcService.user(customer.getAdviserId());
String userName = Optional.ofNullable(user).map(UserInfoDTO::getUserName).orElse("");
detailVO.setAdviserName(userName);
}
diff --git a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
index cee3b23..53df77c 100644
--- a/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
+++ b/fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
@@ -10,7 +10,7 @@ import cn.fw.valhalla.domain.enums.*;
import cn.fw.valhalla.domain.query.*;
import cn.fw.valhalla.domain.vo.AppPageVO;
import cn.fw.valhalla.domain.vo.pool.*;
-import cn.fw.valhalla.rpc.erp.UserService;
+import cn.fw.valhalla.rpc.ehr.EhrRpcService;
import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
import cn.fw.valhalla.rpc.oop.OopService;
import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
@@ -43,7 +43,7 @@ public class PoolBizService {
private final StammkundePoolService stammkundePoolService;
private final PublicCluePoolService publicCluePoolService;
private final OopService oopService;
- private final UserService userService;
+ private final EhrRpcService ehrRpcService;
private final AffiliationRecordService affiliationRecordService;
private final OrderRpcService orderRpcService;
private final ClueTaskService clueTaskService;
@@ -240,7 +240,7 @@ public class PoolBizService {
BeanUtils.copyProperties(poolDTO, vo);
vo.setFollower(poolDTO.getFollowUserName());
if (StringUtils.isEmpty(poolDTO.getFollowUserName()) && Objects.nonNull(poolDTO.getUserId())) {
- UserInfoDTO user = userService.user(poolDTO.getUserId());
+ UserInfoDTO user = ehrRpcService.user(poolDTO.getUserId());
if (Objects.nonNull(user)) {
vo.setFollower(user.getUserName());
}