Commit 8cd965a192459be7d4c02bd9cd3b9bf98c4f83ab
1 parent
2a40e3f8
feature(*): 续保跟进调整
- 续保跟进调整
Showing
4 changed files
with
41 additions
and
118 deletions
fw-valhalla-sdk/src/main/java/cn/fw/valhalla/sdk/result/CustomerInfoDto.java
fw-valhalla-service/src/main/java/cn/fw/valhalla/component/producer/CustomerChangeProducer.java
... | ... | @@ -16,13 +16,11 @@ public class CustomerChangeProducer { |
16 | 16 | @Autowired |
17 | 17 | private RocketMQTemplate rocketMQTemplate; |
18 | 18 | |
19 | - private final String TOPIC = "customer_change"; | |
20 | - | |
21 | 19 | @RequestMapping(value = "send") |
22 | 20 | public void send(CustomerInfoDto customerInfoDto) { |
23 | 21 | try { |
24 | 22 | log.info("售后保有客信息变更mq: body:[{}]", customerInfoDto); |
25 | - rocketMQTemplate.syncSend(TOPIC + ":*", customerInfoDto); | |
23 | + rocketMQTemplate.syncSend(CustomerInfoDto.TOPIC + ":*", customerInfoDto); | |
26 | 24 | } catch (Exception e) { |
27 | 25 | e.printStackTrace(); |
28 | 26 | } | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerChangeBizService.java
... | ... | @@ -3,9 +3,6 @@ package cn.fw.valhalla.service.bus.cust; |
3 | 3 | import cn.fw.common.cache.locker.DistributedLocker; |
4 | 4 | import cn.fw.common.web.annotation.DisLock; |
5 | 5 | import cn.fw.common.web.auth.LoginAuthBean; |
6 | -import cn.fw.data.base.domain.common.Message; | |
7 | -import cn.fw.hermes.sdk.api.para.BusinessType; | |
8 | -import cn.fw.hermes.sdk.api.para.MsgParamCondition; | |
9 | 6 | import cn.fw.passport.sdk.api.param.WxBCodeParam; |
10 | 7 | import cn.fw.valhalla.common.constant.RoleCode; |
11 | 8 | import cn.fw.valhalla.common.utils.DateUtil; |
... | ... | @@ -15,7 +12,6 @@ import cn.fw.valhalla.common.utils.StringUtils; |
15 | 12 | import cn.fw.valhalla.domain.db.customer.AffiliationRecord; |
16 | 13 | import cn.fw.valhalla.domain.db.customer.Customer; |
17 | 14 | import cn.fw.valhalla.domain.db.customer.CustomerBaseInfo; |
18 | -import cn.fw.valhalla.domain.db.follow.FollowClue; | |
19 | 15 | import cn.fw.valhalla.domain.db.follow.FollowRecord; |
20 | 16 | import cn.fw.valhalla.domain.db.follow.FollowRecordLog; |
21 | 17 | import cn.fw.valhalla.domain.db.pool.PublicCluePool; |
... | ... | @@ -25,7 +21,6 @@ import cn.fw.valhalla.domain.enums.*; |
25 | 21 | import cn.fw.valhalla.domain.vo.customer.CustomerChangeInfoVO; |
26 | 22 | import cn.fw.valhalla.domain.vo.customer.CustomerChangeQrCodeVO; |
27 | 23 | import cn.fw.valhalla.rpc.angel.dto.InsuranceDTO; |
28 | -import cn.fw.valhalla.rpc.erp.dto.PostUserDTO; | |
29 | 24 | import cn.fw.valhalla.rpc.erp.dto.UserInfoDTO; |
30 | 25 | import cn.fw.valhalla.rpc.erp.dto.UserRoleDataRangeDTO; |
31 | 26 | import cn.fw.valhalla.rpc.member.MemberRpcService; |
... | ... | @@ -186,6 +181,7 @@ public class CustomerChangeBizService extends AbstractCustomerService { |
186 | 181 | if (Objects.isNull(customer)) { |
187 | 182 | customerId = addCustomer(customerByFrameNo, dto, baseId, memberId); |
188 | 183 | } else { |
184 | + final CustomerInfoDto customerInfoDto = new CustomerInfoDto(); | |
189 | 185 | if (Objects.nonNull(customerByFrameNo)) { |
190 | 186 | if (!customerByFrameNo.getId().equals(customerId)) { |
191 | 187 | if (customer.getGroupId().equals(groupId)) { |
... | ... | @@ -195,11 +191,18 @@ public class CustomerChangeBizService extends AbstractCustomerService { |
195 | 191 | } |
196 | 192 | } |
197 | 193 | packageCustomer(customerByFrameNo, dto, baseId); |
194 | + BeanUtils.copyProperties(customerByFrameNo, customerInfoDto); | |
195 | + customerInfoDto.setConsultantId(customerByFrameNo.getAdviserId()); | |
196 | + customerInfoDto.setMemberId(memberId); | |
198 | 197 | customerService.updateById(customerByFrameNo); |
199 | 198 | } else { |
200 | 199 | packageCustomer(customer, dto, baseId); |
200 | + BeanUtils.copyProperties(customer, customerInfoDto); | |
201 | + customerInfoDto.setConsultantId(customer.getAdviserId()); | |
202 | + customerInfoDto.setMemberId(memberId); | |
201 | 203 | customerService.updateById(customer); |
202 | 204 | } |
205 | + this.customerChangeProducer.send(customerInfoDto); | |
203 | 206 | } |
204 | 207 | } |
205 | 208 | |
... | ... | @@ -380,85 +383,6 @@ public class CustomerChangeBizService extends AbstractCustomerService { |
380 | 383 | return updated; |
381 | 384 | } |
382 | 385 | |
383 | - /** | |
384 | - * 二次分配更换跟进人 | |
385 | - * | |
386 | - * @param clue | |
387 | - * @return | |
388 | - */ | |
389 | - @Transactional(rollbackFor = Exception.class) | |
390 | - public StammkundePool changeFollowUser(FollowClue clue) { | |
391 | - final Customer customer = customerService.getOne(Wrappers.<Customer>lambdaQuery() | |
392 | - .eq(Customer::getFrameNo, clue.getVin()) | |
393 | - .eq(Customer::getGroupId, clue.getGroupId()) | |
394 | - .eq(Customer::getYn, Boolean.TRUE) | |
395 | - , Boolean.FALSE | |
396 | - ); | |
397 | - if (Objects.isNull(customer)) { | |
398 | - log.info("档案信息异常,vin: [{}]", clue.getVin()); | |
399 | - } | |
400 | - BV.notNull(customer, () -> "档案信息不存在"); | |
401 | - List<PostUserDTO> userList = userService.getUserByRole(customer.getShopId(), RoleCode.FWGW); | |
402 | - | |
403 | - BV.isNotEmpty(userList, () -> String.format("更换跟进人员失败:门店[%s]没有服务顾问", customer.getShopId())); | |
404 | - Collections.shuffle(userList); | |
405 | - PostUserDTO userDTO = userList.stream() | |
406 | - .filter(u -> !u.getUserId().equals(customer.getAdviserId())) | |
407 | - .findAny() | |
408 | - .orElse(null); | |
409 | - if (Objects.isNull(userDTO)) { | |
410 | - return null; | |
411 | - } | |
412 | - AffiliationRecord entity = createEntity(customer, userDTO.getUserId(), customer.getShopId()); | |
413 | - DefeatReasonEnum reasonEnum = DefeatReasonEnum.OT; | |
414 | - if (FollowTypeEnum.FM.equals(clue.getClueType())) { | |
415 | - reasonEnum = DefeatReasonEnum.FM; | |
416 | - } | |
417 | - if (FollowTypeEnum.RM.equals(clue.getClueType())) { | |
418 | - reasonEnum = DefeatReasonEnum.RM; | |
419 | - } | |
420 | - entity.setReason(reasonEnum.getName()); | |
421 | - customer.setAdviserId(userDTO.getUserId()); | |
422 | - customerService.updateById(customer); | |
423 | - affiliationRecordService.save(entity); | |
424 | - | |
425 | - StammkundeDto stammkundeDto = new StammkundeDto(); | |
426 | - stammkundeDto.setCustomerId(customer.getId()); | |
427 | - stammkundeDto.setReason(reasonEnum); | |
428 | - stammkundeDto.setShopId(customer.getShopId()); | |
429 | - stammkundeDto.setNewUserId(userDTO.getUserId()); | |
430 | - stammkundeDto.setNewUserName(userDTO.getUserName()); | |
431 | - ShopDTO shop = oopService.shop(customer.getShopId()); | |
432 | - stammkundeDto.setNewShopId(customer.getShopId()); | |
433 | - if (Objects.nonNull(shop)) { | |
434 | - stammkundeDto.setNewShopName(shop.getShortName()); | |
435 | - } | |
436 | - stammkundeDto.setGroupId(customer.getGroupId()); | |
437 | - | |
438 | - StammkundePool stammkundePool = rejectAndNew(stammkundeDto); | |
439 | - stammkundePool.setSources(StammkundeSourcesEnum.REDISTRIBUTION); | |
440 | - stammkundePool.setPoolStatus(StammkundeStatusEnum.TWICE); | |
441 | - stammkundePool.setAktiv(Boolean.FALSE); | |
442 | - stammkundePool.setCreateTime(new Date()); | |
443 | - stammkundePool.setGroupId(customer.getGroupId()); | |
444 | - stammkundePoolService.save(stammkundePool); | |
445 | - return stammkundePool; | |
446 | - } | |
447 | - | |
448 | - /** | |
449 | - * 修改档案 | |
450 | - * | |
451 | - * @param customer | |
452 | - * @return | |
453 | - */ | |
454 | - private Long edit(Customer customer) { | |
455 | - boolean updated = customerService.updateById(customer); | |
456 | - if (updated) { | |
457 | - customerChangeHandler(customer); | |
458 | - } | |
459 | - return customer.getId(); | |
460 | - } | |
461 | - | |
462 | 386 | |
463 | 387 | private String createCode(String key, int expires, Long dealerId) { |
464 | 388 | final WxBCodeParam param = new WxBCodeParam(); |
... | ... | @@ -476,30 +400,6 @@ public class CustomerChangeBizService extends AbstractCustomerService { |
476 | 400 | } |
477 | 401 | |
478 | 402 | |
479 | - /** | |
480 | - * 消息发送 | |
481 | - * | |
482 | - * @param targetUserId | |
483 | - * @param done | |
484 | - */ | |
485 | - private void sendMsg(Long targetUserId, boolean done, String key) { | |
486 | - try { | |
487 | - String text = "档案变更通知"; | |
488 | - final String msgBizType = "customerChangeStatus"; | |
489 | - Map<String, Object> ext = new HashMap<>(3); | |
490 | - ext.put("type", msgBizType); | |
491 | - ext.put("done", done); | |
492 | - ext.put("key", key); | |
493 | - final MsgParamCondition msgPara = MsgParamCondition.getCustomMsg(text, "", ext, | |
494 | - 0, targetUserId, false).setBusinessType(BusinessType.INTERNAL_NOTIFICATION).build(); | |
495 | - final Message<Boolean> msg = imSendMessage.synSendMsg(msgPara); | |
496 | - log.info("给[{}]推送im消息结果:[{}]", targetUserId, msg.getResult()); | |
497 | - } catch (Exception e) { | |
498 | - e.printStackTrace(); | |
499 | - } | |
500 | - } | |
501 | - | |
502 | - | |
503 | 403 | private void create(Customer customer, Long adviserId, Long shopId) { |
504 | 404 | StammkundePool stammkundePool = createSimpleInfo(customer, adviserId); |
505 | 405 | stammkundePool.setSources(StammkundeSourcesEnum.NATURAL); | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/MemberVehicleBizService.java
... | ... | @@ -2,7 +2,10 @@ package cn.fw.valhalla.service.bus.cust; |
2 | 2 | |
3 | 3 | import cn.fw.common.data.mybatis.pagination.PageData; |
4 | 4 | import cn.fw.data.base.db.query.Page; |
5 | -import cn.fw.valhalla.common.utils.*; | |
5 | +import cn.fw.valhalla.common.utils.BeanUtils; | |
6 | +import cn.fw.valhalla.common.utils.PageUtils; | |
7 | +import cn.fw.valhalla.common.utils.StringUtils; | |
8 | +import cn.fw.valhalla.component.producer.CustomerChangeProducer; | |
6 | 9 | import cn.fw.valhalla.domain.db.MemberVehicle; |
7 | 10 | import cn.fw.valhalla.domain.db.customer.Customer; |
8 | 11 | import cn.fw.valhalla.domain.db.customer.CustomerBaseInfo; |
... | ... | @@ -14,7 +17,10 @@ import cn.fw.valhalla.rpc.member.MemberRpcService; |
14 | 17 | import cn.fw.valhalla.rpc.member.dto.MemberUserDTO; |
15 | 18 | import cn.fw.valhalla.sdk.enums.CarUseTypeEnum; |
16 | 19 | import cn.fw.valhalla.sdk.enums.CusTypeEnum; |
17 | -import cn.fw.valhalla.service.data.*; | |
20 | +import cn.fw.valhalla.sdk.result.CustomerInfoDto; | |
21 | +import cn.fw.valhalla.service.data.CustomerBaseInfoService; | |
22 | +import cn.fw.valhalla.service.data.CustomerService; | |
23 | +import cn.fw.valhalla.service.data.MemberVehicleService; | |
18 | 24 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
19 | 25 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
20 | 26 | import lombok.RequiredArgsConstructor; |
... | ... | @@ -23,7 +29,9 @@ import org.apache.commons.collections4.CollectionUtils; |
23 | 29 | import org.springframework.stereotype.Service; |
24 | 30 | import org.springframework.transaction.annotation.Transactional; |
25 | 31 | |
26 | -import java.util.*; | |
32 | +import java.util.Collections; | |
33 | +import java.util.List; | |
34 | +import java.util.Objects; | |
27 | 35 | |
28 | 36 | import static cn.fw.common.businessvalidator.Validator.V; |
29 | 37 | |
... | ... | @@ -46,6 +54,7 @@ public class MemberVehicleBizService { |
46 | 54 | private final CustomerService customerService; |
47 | 55 | |
48 | 56 | private final CustomerBaseInfoService customerBaseInfoService; |
57 | + private final CustomerChangeProducer customerChangeProducer; | |
49 | 58 | |
50 | 59 | public List<MemberVehicleVO> getVehicleList(Long memberId) { |
51 | 60 | List<MemberVehicle> memberVehicleList = memberVehicleService.list(Wrappers.<MemberVehicle>lambdaQuery() |
... | ... | @@ -60,7 +69,7 @@ public class MemberVehicleBizService { |
60 | 69 | |
61 | 70 | @Transactional(rollbackFor = Exception.class) |
62 | 71 | public void saveVehicle(NewVehicleDTO dto) { |
63 | - V.notNull(dto,"车辆认证信息不能为空"); | |
72 | + V.notNull(dto, "车辆认证信息不能为空"); | |
64 | 73 | //是否有认证车辆信息 |
65 | 74 | MemberVehicle memberVehicle = memberVehicleService.getVehicle(dto.getFrameNo()); |
66 | 75 | if (Objects.isNull(memberVehicle)) { |
... | ... | @@ -94,12 +103,12 @@ public class MemberVehicleBizService { |
94 | 103 | customer.setRegDate(dto.getRegDate()); |
95 | 104 | customer.setPlateNo(dto.getPlateNo()); |
96 | 105 | customer.setUseType(CarUseTypeEnum.ofValue(dto.getUseType())); |
97 | - if(Objects.isNull(customer.getSpecCode())){ | |
106 | + if (Objects.isNull(customer.getSpecCode())) { | |
98 | 107 | customer.setSpecCode(dto.getSpecCode()); |
99 | 108 | } |
100 | 109 | CustomerBaseInfo customerBaseInfo = customerBaseInfoService.queryById(customer.getBaseId()); |
101 | - if (Objects.nonNull(customerBaseInfo) && Objects.equals(dto.getMemberId(),customerBaseInfo.getMemberId()) && | |
102 | - Objects.equals(CusTypeEnum.ofValue(dto.getCusType()),customerBaseInfo.getCusType())) { | |
110 | + if (Objects.nonNull(customerBaseInfo) && Objects.equals(dto.getMemberId(), customerBaseInfo.getMemberId()) && | |
111 | + Objects.equals(CusTypeEnum.ofValue(dto.getCusType()), customerBaseInfo.getCusType())) { | |
103 | 112 | customerBaseInfo.setName(dto.getName()); |
104 | 113 | customerBaseInfo.setContact(dto.getName()); |
105 | 114 | customerBaseInfoService.updateById(customerBaseInfo); |
... | ... | @@ -117,6 +126,7 @@ public class MemberVehicleBizService { |
117 | 126 | customer.setBaseId(newCustomerBaseInfo.getId()); |
118 | 127 | } |
119 | 128 | customerService.updateById(customer); |
129 | + sendCustomerMq(customer, member.getUserId()); | |
120 | 130 | }); |
121 | 131 | } |
122 | 132 | |
... | ... | @@ -139,4 +149,18 @@ public class MemberVehicleBizService { |
139 | 149 | .eq(MemberVehicle::getId, vo.getId())); |
140 | 150 | } |
141 | 151 | |
152 | + /** | |
153 | + * 发生档案更新mq | |
154 | + * | |
155 | + * @param customer | |
156 | + * @param memberId | |
157 | + */ | |
158 | + private void sendCustomerMq(Customer customer, Long memberId) { | |
159 | + final CustomerInfoDto customerInfoDto = new CustomerInfoDto(); | |
160 | + org.springframework.beans.BeanUtils.copyProperties(customer, customerInfoDto); | |
161 | + customerInfoDto.setConsultantId(customer.getAdviserId()); | |
162 | + customerInfoDto.setMemberId(memberId); | |
163 | + customerChangeProducer.send(customerInfoDto); | |
164 | + } | |
165 | + | |
142 | 166 | } | ... | ... |