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 df27f06..ca6045d 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 @@ -16,6 +16,7 @@ import cn.fw.valhalla.domain.db.follow.FollowTask; import cn.fw.valhalla.domain.db.pool.CustomerCluePool; import cn.fw.valhalla.domain.db.pool.StammkundePool; import cn.fw.valhalla.domain.dto.LeaveAllocationDTO; +import cn.fw.valhalla.domain.dto.StammkundeDto; import cn.fw.valhalla.domain.enums.*; import cn.fw.valhalla.domain.query.LeaveQueryVO; import cn.fw.valhalla.domain.vo.LeaveNeedDoVO; @@ -26,6 +27,7 @@ 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 cn.fw.valhalla.rpc.oop.OopService; +import cn.fw.valhalla.rpc.oop.dto.ShopDTO; import cn.fw.valhalla.service.bus.follow.FollowBizService; import cn.fw.valhalla.service.data.*; import com.alibaba.fastjson.JSONObject; @@ -153,7 +155,6 @@ public class LeaveNeedDoBizService { dto.setType(typeEnum); LeaveNeedDo needDo = leaveNeedDoService.queryProcessableById(dto.getId()); BV.notNull(needDo, () -> "该条记录已处理或不存在,请刷新后重试"); - stammkundePoolService.reject(needDo.getUserId(), needDo.getShopId(), null, DefeatReasonEnum.OT); dto.setAdviserId(needDo.getUserId()); if (AllocationTypeEnum.ONE.equals(typeEnum)) { @@ -204,6 +205,7 @@ public class LeaveNeedDoBizService { customer.setShopId(dto.getShopId()); customer.setAdviserId(dto.getUserId()); spl.add(createPool(customer, userName)); + rejectPool(customer.getId(), dto.getShopId(), userName, dto.getUserId(), customer.getGroupId()); } customerService.updateBatchById(list); stammkundePoolService.saveBatch(spl); @@ -229,8 +231,9 @@ public class LeaveNeedDoBizService { customer.setShopId(shopId); customer.setAdviserId(Objects.requireNonNull(info, "服务顾问信息获取异常,请重试").getUserId()); info.setCount(info.getCount() + 1); - queue.offer(info); + rejectPool(customer.getId(), shopId, info.getUserName(), info.getUserId(), customer.getGroupId()); spl.add(createPool(customer, info.getUserName())); + queue.offer(info); } customerService.updateBatchById(list); stammkundePoolService.saveBatch(spl); @@ -333,6 +336,23 @@ public class LeaveNeedDoBizService { todoRpcService.complete(backLogItemDTO); } + private void rejectPool (Long customerId, Long shopId, String userName, Long userId, Long groupId) { + StammkundeDto stammkundeDto = new StammkundeDto(); + stammkundeDto.setCustomerId(customerId); + stammkundeDto.setReason(DefeatReasonEnum.OT); + stammkundeDto.setShopId(shopId); + stammkundeDto.setNewUserId(userId); + stammkundeDto.setNewUserName(userName); + ShopDTO shop = oopService.shop(shopId); + stammkundeDto.setNewShopId(shopId); + if (Objects.nonNull(shop)) { + stammkundeDto.setNewShopName(shop.getShortName()); + } + stammkundeDto.setGroupId(groupId); + + stammkundePoolService.reject(stammkundeDto); + } + private StammkundePool createPool(Customer customer, String userName) { StammkundePool sp = new StammkundePool(); sp.setCustomerId(customer.getId());