Commit 3fc19e59249dc2d9936b3493bdead136ec9f8cb9

Authored by 张志伟
1 parent e91e8035

升级erpsdk

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;
6 6 import cn.fw.valhalla.common.utils.StringUtils;
7 7 import cn.fw.valhalla.rpc.AbsBaseRpcService;
8 8 import cn.fw.valhalla.rpc.ehr.dto.StaffInfoDTO;
  9 +import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
9 10 import com.alibaba.fastjson.JSONObject;
10 11 import lombok.extern.slf4j.Slf4j;
11 12 import org.springframework.beans.BeanUtils;
... ... @@ -61,6 +62,26 @@ public class EhrRpcService extends AbsBaseRpcService {
61 62 return null;
62 63 }
63 64  
  65 + /**
  66 + * 查询人员信息
  67 + * @param userId
  68 + * @return
  69 + */
  70 + @Nullable
  71 + public UserInfoDTO user(final Long userId) {
  72 + StaffInfoDTO staffInfoDTO = queryStaffInfo(userId);
  73 + if (Objects.isNull(staffInfoDTO)) {
  74 + return null;
  75 + }
  76 + UserInfoDTO userInfoDTO = new UserInfoDTO();
  77 + userInfoDTO.setId(staffInfoDTO.getId());
  78 + userInfoDTO.setUserName(staffInfoDTO.getName());
  79 + userInfoDTO.setHeadImg(staffInfoDTO.getAvatar());
  80 + userInfoDTO.setMobile(staffInfoDTO.getMobile());
  81 + return userInfoDTO;
  82 +
  83 + }
  84 +
64 85 @Nullable
65 86 public StaffInfoDTO queryStaffInfoByMobile(final String mobile) {
66 87 if (StringUtils.isEmpty(mobile)) {
... ...
fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/erp/UserService.java
1 1 package cn.fw.valhalla.rpc.erp;
2 2  
3 3 import cn.fw.data.base.domain.common.Message;
4   -import cn.fw.erp.sdk.api.UserApi;
5 4 import cn.fw.erp.sdk.api.UserRoleApi;
6   -import cn.fw.erp.sdk.api.result.UserBaseInfo;
7 5 import cn.fw.erp.sdk.api.result.UserRoleDataRange;
8 6 import cn.fw.erp.sdk.api.result.UserRoleInfo;
9   -import cn.fw.valhalla.common.utils.StringUtils;
10 7 import cn.fw.valhalla.rpc.AbsBaseRpcService;
11 8 import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
12   -import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
13 9 import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO;
14 10 import com.alibaba.fastjson.JSONObject;
15 11 import lombok.Getter;
... ... @@ -27,8 +23,6 @@ import java.util.List;
27 23 import java.util.Objects;
28 24 import java.util.concurrent.TimeUnit;
29 25  
30   -import static org.apache.commons.lang3.Validate.isTrue;
31   -
32 26 /**
33 27 * 用户服务
34 28 * <p>
... ... @@ -41,10 +35,6 @@ import static org.apache.commons.lang3.Validate.isTrue;
41 35 @RequiredArgsConstructor
42 36 public class UserService extends AbsBaseRpcService {
43 37 /**
44   - * 用户服务
45   - */
46   - private final UserApi userApi;
47   - /**
48 38 * 岗位用户服务
49 39 */
50 40 private final UserRoleApi userRoleApi;
... ... @@ -53,41 +43,6 @@ public class UserService extends AbsBaseRpcService {
53 43 @Getter
54 44 private String keyPrefix;
55 45  
56   - /**
57   - * 根据用户ID获取用户信息
58   - *
59   - * @param userId 用户ID
60   - * @return 用户信息
61   - */
62   - public UserInfoDTO user(final Long userId) {
63   - if (Objects.isNull(userId)) {
64   - return null;
65   - }
66   - String key = generateKey(userId);
67   - String json = getFromCache(key);
68   - if (StringUtils.isValid(json)) {
69   - return JSONObject.parseObject(json, UserInfoDTO.class);
70   - }
71   - try {
72   - final Message<UserBaseInfo> msg = userApi.queryUserBaseInfo(userId);
73   - isTrue(msg.isSuccess(), String.format("调用ERP[根据用户ID[%s]获取用户信息]系统失败", msg.getResult()));
74   - final UserBaseInfo userBaseInfo = msg.getData();
75   - if (!msg.isSuccess() || Objects.isNull(msg.getData())) {
76   - return null;
77   - }
78   - UserInfoDTO userInfoDTO = new UserInfoDTO();
79   - userInfoDTO.setId(userBaseInfo.getUserId());
80   - userInfoDTO.setUserName(userBaseInfo.getUserName());
81   - userInfoDTO.setHeadImg(userBaseInfo.getHeadImg());
82   - userInfoDTO.setMobile(msg.getData().getMobile());
83   - setToCache(key, JSONObject.toJSONString(userInfoDTO), 60);
84   - return userInfoDTO;
85   - } catch (Exception e) {
86   - log.info("调用ERP[根据用户ID[{}]获取用户信息]系统失败", userId, e);
87   - }
88   - return null;
89   - }
90   -
91 46  
92 47 /**
93 48 * 获取某个流程角色的权限范围
... ...
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;
8 8 import cn.fw.valhalla.domain.db.pool.StammkundePool;
9 9 import cn.fw.valhalla.domain.db.report.CustomerRetentionRatio;
10 10 import cn.fw.valhalla.domain.enums.*;
  11 +import cn.fw.valhalla.rpc.ehr.EhrRpcService;
  12 +import cn.fw.valhalla.rpc.ehr.dto.StaffInfoDTO;
11 13 import cn.fw.valhalla.rpc.erp.UserService;
12 14 import cn.fw.valhalla.rpc.erp.dto.PostUserDTO;
13 15 import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
... ... @@ -43,6 +45,7 @@ import java.util.stream.Stream;
43 45 public class CustomerRetentionRatioBizService {
44 46 private final OopService oopService;
45 47 private final UserService userService;
  48 + private final EhrRpcService ehrRpcService;
46 49 private final CustomerRetentionRatioService customerRetentionRatioService;
47 50 private final StammkundePoolService stammkundePoolService;
48 51 private final FollowTaskService followTaskService;
... ... @@ -99,8 +102,8 @@ public class CustomerRetentionRatioBizService {
99 102 Long adviserId = pool.getAdviserId();
100 103 String adviserName = pool.getAdviserName();
101 104 if (StringUtils.isEmpty(adviserName)) {
102   - UserInfoDTO user = userService.user(adviserId);
103   - adviserName = Objects.nonNull(user) ? user.getUserName() : adviserName;
  105 + StaffInfoDTO staffInfoDTO = ehrRpcService.queryStaffInfo(adviserId);
  106 + adviserName = Objects.nonNull(staffInfoDTO) ? staffInfoDTO.getName() : adviserName;
104 107 }
105 108 set.add(new UserInfo(adviserId, adviserName));
106 109 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/LeaveNeedDoBizService.java
... ... @@ -430,7 +430,7 @@ public class LeaveNeedDoBizService {
430 430 .eq(LeaveNeedDo::getDone, Boolean.FALSE)
431 431 );
432 432 BV.isTrue(count == 0, () -> "已存在待分配记录,请勿重复添加");
433   - UserInfoDTO user = userService.user(userId);
  433 + UserInfoDTO user = ehrRpcService.user(userId);
434 434 BV.notNull(user, () -> "用户不存在");
435 435 boolean bool = customerService.count(Wrappers.<Customer>lambdaQuery()
436 436 .eq(Customer::getAdviserId, userId)
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/ReachLogBizService.java
... ... @@ -3,7 +3,7 @@ package cn.fw.valhalla.service.bus;
3 3 import cn.fw.valhalla.common.utils.DateUtil;
4 4 import cn.fw.valhalla.domain.db.customer.Customer;
5 5 import cn.fw.valhalla.domain.db.customer.CustomerReachLog;
6   -import cn.fw.valhalla.rpc.erp.UserService;
  6 +import cn.fw.valhalla.rpc.ehr.EhrRpcService;
7 7 import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
8 8 import cn.fw.valhalla.sdk.param.ReachLogReq;
9 9 import cn.fw.valhalla.service.data.CustomerReachLogService;
... ... @@ -30,7 +30,7 @@ import java.util.Objects;
30 30 public class ReachLogBizService {
31 31 private final CustomerService customerService;
32 32 private final CustomerReachLogService customerReachLogService;
33   - private final UserService userService;
  33 + private final EhrRpcService ehrRpcService;
34 34  
35 35 @Transactional(rollbackFor = Exception.class)
36 36 public void saveReachLog(ReachLogReq reachLogReq) {
... ... @@ -46,7 +46,7 @@ public class ReachLogBizService {
46 46 BeanUtils.copyProperties(reachLogReq, reachLog);
47 47 reachLog.setFrameNo(customer.getFrameNo());
48 48 reachLog.setAdviserId(customer.getAdviserId());
49   - UserInfoDTO user = userService.user(customer.getAdviserId());
  49 + UserInfoDTO user = ehrRpcService.user(customer.getAdviserId());
50 50 if (Objects.nonNull(user)) {
51 51 reachLog.setAdviserId(user.getId());
52 52 reachLog.setAdviserName(user.getUserName());
... ...
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;
14 14 import cn.fw.valhalla.domain.enums.StammkundeStatusEnum;
15 15 import cn.fw.valhalla.rpc.angel.InsurerRpcService;
16 16 import cn.fw.valhalla.rpc.angel.dto.InsuranceDTO;
  17 +import cn.fw.valhalla.rpc.ehr.EhrRpcService;
17 18 import cn.fw.valhalla.rpc.erp.UserService;
18 19 import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
19 20 import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO;
... ... @@ -47,6 +48,8 @@ public abstract class AbstractCustomerService {
47 48 @Autowired
48 49 protected UserService userService;
49 50 @Autowired
  51 + protected EhrRpcService ehrRpcService;
  52 + @Autowired
50 53 protected OopService oopService;
51 54 @Autowired
52 55 protected CustomerService customerService;
... ... @@ -130,7 +133,7 @@ public abstract class AbstractCustomerService {
130 133 dto.setArrivalTime(customer.getArrivalTime());
131 134 dto.setAdviserId(customer.getAdviserId());
132 135 dto.setArrivalCount(customer.getArrivalCount());
133   - UserInfoDTO user = userService.user(customer.getAdviserId());
  136 + UserInfoDTO user = ehrRpcService.user(customer.getAdviserId());
134 137 if (Objects.nonNull(user)) {
135 138 dto.setAdviserName(user.getUserName());
136 139 }
... ... @@ -281,7 +284,7 @@ public abstract class AbstractCustomerService {
281 284 StammkundePool stammkundePool = createSimpleInfo(customer);
282 285 if (Objects.nonNull(userId)) {
283 286 stammkundePool.setAdviserId(userId);
284   - UserInfoDTO user = userService.user(userId);
  287 + UserInfoDTO user = ehrRpcService.user(userId);
285 288 if (Objects.nonNull(user)) {
286 289 stammkundePool.setAdviserName(user.getUserName());
287 290 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
... ... @@ -364,7 +364,7 @@ public class CustomerBizService extends AbstractCustomerService {
364 364 * @return
365 365 */
366 366 public ReceptionResultDto queryReceivable(Long userId, String plateNo) {
367   - UserInfoDTO userInfo = userService.user(userId);
  367 + UserInfoDTO userInfo = ehrRpcService.user(userId);
368 368 if (Objects.isNull(userInfo)) {
369 369 return new ReceptionResultDto(false, "非服务顾问无法接待");
370 370 }
... ... @@ -677,7 +677,7 @@ public class CustomerBizService extends AbstractCustomerService {
677 677 }
678 678 CustomerDetailDto dto = CustomerDetailDto.with(memberVehicle);
679 679 dto.setAdviserId(customers.get(0).getAdviserId());
680   - UserInfoDTO user = userService.user(customers.get(0).getAdviserId());
  680 + UserInfoDTO user = ehrRpcService.user(customers.get(0).getAdviserId());
681 681 if (Objects.nonNull(user)) {
682 682 dto.setAdviserName(user.getUserName());
683 683 }
... ... @@ -703,7 +703,7 @@ public class CustomerBizService extends AbstractCustomerService {
703 703 }
704 704 CustomerDetailDto dto = CustomerDetailDto.with(memberVehicle);
705 705 dto.setAdviserId(customers.get(0).getAdviserId());
706   - UserInfoDTO user = userService.user(customers.get(0).getAdviserId());
  706 + UserInfoDTO user = ehrRpcService.user(customers.get(0).getAdviserId());
707 707 if (Objects.nonNull(user)) {
708 708 dto.setAdviserName(user.getUserName());
709 709 }
... ... @@ -847,7 +847,7 @@ public class CustomerBizService extends AbstractCustomerService {
847 847 .map(CarArchiveVO::with)
848 848 .filter(Objects::nonNull)
849 849 .peek(vo -> {
850   - UserInfoDTO dto = userService.user(vo.getAdviserId());
  850 + UserInfoDTO dto = ehrRpcService.user(vo.getAdviserId());
851 851 if (Objects.nonNull(dto)) {
852 852 vo.setAdviserName(dto.getUserName());
853 853 }
... ... @@ -999,7 +999,7 @@ public class CustomerBizService extends AbstractCustomerService {
999 999 private List<BasicsCustomerDTO> fromCustomer(String keyword, Long groupId) {
1000 1000 List<BasicsCustomerDTO> list = customerService.queryByKeyword(keyword, groupId);
1001 1001 for (BasicsCustomerDTO dto : list) {
1002   - UserInfoDTO user = userService.user(dto.getAdviserId());
  1002 + UserInfoDTO user = ehrRpcService.user(dto.getAdviserId());
1003 1003 if (Objects.nonNull(user)) {
1004 1004 dto.setAdviserName(user.getUserName());
1005 1005 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
... ... @@ -465,7 +465,7 @@ public class CustomerChangeBizService extends AbstractCustomerService {
465 465 stammkundeDto.setCustomerId(customer.getId());
466 466 stammkundeDto.setReason(reasonEnum);
467 467 stammkundeDto.setShopId(customer.getShopId());
468   - UserInfoDTO user = userService.user(adviserId);
  468 + UserInfoDTO user = ehrRpcService.user(adviserId);
469 469 stammkundeDto.setNewUserId(adviserId);
470 470 if (Objects.nonNull(user)) {
471 471 stammkundeDto.setNewUserName(user.getUserName());
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/PickUpCustomerService.java
... ... @@ -113,7 +113,7 @@ public class PickUpCustomerService extends AbstractCustomerService {
113 113 boolean canReception = true;
114 114 ShopDTO shop = Optional.ofNullable(queryDealId(userId, RoleCode.FWGW)).orElse(new ShopDTO());
115 115 if (Objects.nonNull(customer.getShopId()) && customer.getShopId().equals(shop.getId()) && Objects.nonNull(customer.getAdviserId())) {
116   - UserInfoDTO user = userService.user(customer.getAdviserId());
  116 + UserInfoDTO user = ehrRpcService.user(customer.getAdviserId());
117 117 String userName = Optional.ofNullable(user).map(UserInfoDTO::getUserName).orElse("");
118 118 detailVO.setAdviserName(userName);
119 119 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
... ... @@ -10,7 +10,7 @@ import cn.fw.valhalla.domain.enums.*;
10 10 import cn.fw.valhalla.domain.query.*;
11 11 import cn.fw.valhalla.domain.vo.AppPageVO;
12 12 import cn.fw.valhalla.domain.vo.pool.*;
13   -import cn.fw.valhalla.rpc.erp.UserService;
  13 +import cn.fw.valhalla.rpc.ehr.EhrRpcService;
14 14 import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
15 15 import cn.fw.valhalla.rpc.oop.OopService;
16 16 import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
... ... @@ -43,7 +43,7 @@ public class PoolBizService {
43 43 private final StammkundePoolService stammkundePoolService;
44 44 private final PublicCluePoolService publicCluePoolService;
45 45 private final OopService oopService;
46   - private final UserService userService;
  46 + private final EhrRpcService ehrRpcService;
47 47 private final AffiliationRecordService affiliationRecordService;
48 48 private final OrderRpcService orderRpcService;
49 49 private final ClueTaskService clueTaskService;
... ... @@ -240,7 +240,7 @@ public class PoolBizService {
240 240 BeanUtils.copyProperties(poolDTO, vo);
241 241 vo.setFollower(poolDTO.getFollowUserName());
242 242 if (StringUtils.isEmpty(poolDTO.getFollowUserName()) && Objects.nonNull(poolDTO.getUserId())) {
243   - UserInfoDTO user = userService.user(poolDTO.getUserId());
  243 + UserInfoDTO user = ehrRpcService.user(poolDTO.getUserId());
244 244 if (Objects.nonNull(user)) {
245 245 vo.setFollower(user.getUserName());
246 246 }
... ...