Commit f7631225d9794276561bb574331d048bc5a4809c

Authored by 张志伟
2 parents aca8b720 a37fe1c7

Merge remote-tracking branch 'origin/dev' into test

fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
... ... @@ -279,7 +279,7 @@ public class CustomerChangeBizService extends AbstractCustomerService {
279 279 return true;
280 280 }
281 281 Long adviserId = changeAdviserReq.getAdviserId();
282   - if (changeAdviserReq.getAdviserId().equals(customer.getAdviserId())) {
  282 + if (adviserId.equals(customer.getAdviserId())) {
283 283 return true;
284 284 }
285 285 List<UserRoleDataRangeDTO> dataRange = userService.getUserRoleDataRange(adviserId, RoleCode.FWGW);
... ... @@ -297,12 +297,14 @@ public class CustomerChangeBizService extends AbstractCustomerService {
297 297 AffiliationRecord entity = createEntity(customer, adviserId, shopId);
298 298 entity.setReason(DefeatReasonEnum.SYS.getName());
299 299 affiliationRecordService.save(entity);
300   -
301   - StammkundePool pool = stammkundePoolService.queryAktivAble(customer.getId(), customer.getGroupId(), customer.getShopId());
  300 + StammkundePool pool = stammkundePoolService.getOne(Wrappers.<StammkundePool>lambdaQuery()
  301 + .eq(StammkundePool::getCustomerId, customer.getId())
  302 + .eq(StammkundePool::getGroupId, customer.getGroupId())
  303 + .eq(StammkundePool::getAdviserId, customer.getAdviserId())
  304 + .eq(StammkundePool::getAktiv, Boolean.TRUE)
  305 + );
302 306 if (Objects.nonNull(pool)) {
303   - stammkundePoolService.aktiv(pool.getId());
304   - } else {
305   - create(customer, adviserId, false);
  307 + stammkundePoolService.reject(customer.getId(), customer.getGroupId());
306 308 }
307 309 }
308 310 if (Objects.isNull(customer.getAdviserId()) && Objects.isNull(customer.getShopId())) {
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/FMFollowStrategy.java
... ... @@ -145,13 +145,16 @@ public class FMFollowStrategy extends AbstractFollowStrategy {
145 145 public boolean origin2task(OriginalData originalData) throws Exception {
146 146 Customer customer = customerService.queryById(originalData.getCustomerId());
147 147 BV.notNull(customer, () -> "档案不存在");
  148 + boolean bool = Objects.isNull(customer.getAdviserId()) || Objects.isNull(customer.getShopId());
  149 + BV.isFalse(bool, () -> "档案信息不完整");
  150 + CustomerCluePool cluePool = customerCluePoolService.queryByRefererId(customer.getId(), customer.getGroupId(), getFollowType());
148 151 if (DataTypeEnum.FM.equals(originalData.getType())) {
149   - CustomerCluePool cluePool = customerCluePoolService.queryByRefererId(customer.getId(), customer.getGroupId(), getFollowType());
150 152 completeClue(cluePool, originalData);
151 153 return true;
152 154 }
153   - boolean bool = Objects.isNull(customer.getAdviserId()) || Objects.isNull(customer.getShopId());
154   - BV.isFalse(bool, () -> "档案信息不完整");
  155 + if (DataTypeEnum.OD.equals(originalData.getType()) && Objects.nonNull(cluePool) && ClueStatusEnum.WAITING.equals(cluePool.getClueStatus())) {
  156 + customerCluePoolService.removeById(cluePool.getId());
  157 + }
155 158 CustomerCluePool clue = createClueInfo(originalData, getFollowType(), customer);
156 159 customerCluePoolService.save(clue);
157 160 createFirstNotice(clue, originalData.getGenerateTime());
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/RMFollowStrategy.java
... ... @@ -17,6 +17,8 @@ import cn.fw.valhalla.domain.vo.setting.SettingVO;
17 17 import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO;
18 18 import cn.fw.valhalla.rpc.oop.dto.ShopDTO;
19 19 import cn.fw.valhalla.sdk.enums.DataTypeEnum;
  20 +import cn.fw.valhalla.sdk.param.ChangeAdviserReq;
  21 +import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
20 22 import cn.fw.valhalla.service.bus.follow.strategy.AbstractFollowStrategy;
21 23 import cn.fw.valhalla.service.data.OriginalDataService;
22 24 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
... ... @@ -44,10 +46,13 @@ import static cn.fw.common.businessvalidator.Validator.BV;
44 46 @Component
45 47 public class RMFollowStrategy extends AbstractFollowStrategy {
46 48 private final OriginalDataService originalDataService;
  49 + private final CustomerChangeBizService changeBizService;
47 50  
48 51 @Autowired
49   - public RMFollowStrategy(final OriginalDataService originalDataService) {
  52 + public RMFollowStrategy(final OriginalDataService originalDataService,
  53 + final CustomerChangeBizService changeBizService) {
50 54 this.originalDataService = originalDataService;
  55 + this.changeBizService = changeBizService;
51 56 }
52 57  
53 58 @Override
... ... @@ -155,7 +160,18 @@ public class RMFollowStrategy extends AbstractFollowStrategy {
155 160 CustomerCluePool cluePool = customerCluePoolService.queryByRefererId(customer.getId(), customer.getGroupId(), getFollowType());
156 161 completeClue(cluePool, originalData);
157 162 boolean bool = Objects.isNull(customer.getAdviserId()) || Objects.isNull(customer.getShopId());
  163 + if (Objects.nonNull(originalData.getShopId()) && Objects.nonNull(originalData.getUserId()) && bool) {
  164 + ChangeAdviserReq req = new ChangeAdviserReq();
  165 + req.setAdviserId(originalData.getUserId());
  166 + req.setCusId(customer.getId());
  167 + if (changeBizService.changeAdviser(req)) {
  168 + customer.setAdviserId(originalData.getUserId());
  169 + customer.setShopId(originalData.getShopId());
  170 + bool = false;
  171 + }
  172 + }
158 173 BV.isFalse(bool, () -> "档案信息不完整");
  174 +
159 175 CustomerCluePool clue = createClueInfo(originalData, getFollowType(), customer);
160 176 customerCluePoolService.save(clue);
161 177 createFirstNotice(clue, originalData.getGenerateTime());
... ...