Commit 33a55d43bf4f0a2c1d919664ecd68716023bdbd3

Authored by 张志伟
1 parent 53f17218

feature(*): bug修复

- bug修复
fw-valhalla-service/src/main/java/cn/fw/valhalla/component/consumer/FollowFlowConsumer.kt
1 1 package cn.fw.valhalla.component.consumer;
2 2  
3 3 import cn.fw.shirasawa.sdk.mq.FollowApproveDTO
4   -import cn.fw.valhalla.domain.enums.FollowTypeEnum
  4 +import cn.fw.valhalla.domain.enums.FollowTypeEnum.PL
  5 +import cn.fw.valhalla.domain.enums.FollowTypeEnum.ofValue
  6 +import cn.fw.valhalla.domain.enums.PublicPoolTypeEnum
5 7 import cn.fw.valhalla.service.bus.cust.CustomerBizService
6 8 import cn.fw.valhalla.service.data.ClueTaskService
  9 +import cn.fw.valhalla.service.data.PubCluePoolService
7 10 import com.alibaba.fastjson.JSONObject
8 11 import org.apache.rocketmq.spring.annotation.RocketMQMessageListener
9 12 import org.apache.rocketmq.spring.core.RocketMQListener
... ... @@ -24,7 +27,8 @@ import org.springframework.stereotype.Component
24 27 )
25 28 class FollowFlowConsumer(
26 29 private val customerBizService: CustomerBizService,
27   - private val clueTaskService: ClueTaskService
  30 + private val clueTaskService: ClueTaskService,
  31 + private val pubCluePoolService: PubCluePoolService
28 32 ) : RocketMQListener<FollowApproveDTO> {
29 33  
30 34 private val log: Logger = LoggerFactory.getLogger(this.javaClass)
... ... @@ -32,8 +36,18 @@ class FollowFlowConsumer(
32 36 override fun onMessage(dto: FollowApproveDTO?) {
33 37 log.info("跟进审批通过MQ消息回调:{}", JSONObject.toJSONString(dto));
34 38 dto?.let { data ->
35   - clueTaskService.queryOngoingTaskByClueId(data.detailId.toLong(), FollowTypeEnum.ofValue(data.type))?.apply {
36   - customerBizService.abandon(this)
  39 + clueTaskService.queryOngoingTaskByClueId(data.detailId.toLong(), ofValue(data.type))?.apply {
  40 + when (this.type) {
  41 + PL -> {
  42 + pubCluePoolService.getById(this.clueId)?.let {
  43 + customerBizService.abandon(it.vin, it.groupId, PublicPoolTypeEnum.AD)
  44 + }
  45 + }
  46 +
  47 + else -> {
  48 + customerBizService.abandon(this)
  49 + }
  50 + }
37 51 }
38 52 }
39 53 }
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/cust/CustomerBizService.java
... ... @@ -474,7 +474,8 @@ public class CustomerBizService extends AbstractCustomerService {
474 474 public void abandon(final Long customerId, final String reason) {
475 475 CustomerDetailDto detailDto = queryById(customerId);
476 476 BV.notNull(detailDto, () -> "档案不存在");
477   - if (publicPoolService.queryByPlate(detailDto.getPlateNo(), detailDto.getGroupId()).isPresent()) {
  477 + PublicPool publicData = publicPoolService.queryByVin(detailDto.getFrameNo(), detailDto.getGroupId());
  478 + if (Objects.nonNull(publicData)) {
478 479 return;
479 480 }
480 481 PublicPool publicPool = createPublicPool(detailDto, PublicPoolTypeEnum.AD, reason);
... ... @@ -521,7 +522,24 @@ public class CustomerBizService extends AbstractCustomerService {
521 522 if (FollowTypeEnum.RM.equals(task.getType())) {
522 523 type = PublicPoolTypeEnum.RM;
523 524 }
524   - if (publicPoolService.queryByPlate(detailDto.getPlateNo(), detailDto.getGroupId()).isPresent()) {
  525 + abandon(detailDto.getFrameNo(), detailDto.getGroupId(), type);
  526 + }
  527 +
  528 + /**
  529 + * 审批通过客户档案处理
  530 + *
  531 + * @param vin
  532 + * @param groupId
  533 + * @param type
  534 + */
  535 + @Transactional(rollbackFor = Exception.class)
  536 + public void abandon(String vin, final Long groupId, PublicPoolTypeEnum type) {
  537 + CustomerDetailDto detailDto = queryByFrameNo(vin, groupId);
  538 + if (Objects.isNull(detailDto)) {
  539 + return;
  540 + }
  541 + PublicPool publicData = publicPoolService.queryByVin(detailDto.getFrameNo(), detailDto.getGroupId());
  542 + if (Objects.nonNull(publicData)) {
525 543 return;
526 544 }
527 545 PublicPool publicPool = createPublicPool(detailDto, type, "系统判定");
... ... @@ -532,15 +550,14 @@ public class CustomerBizService extends AbstractCustomerService {
532 550 if (!updated) {
533 551 return;
534 552 }
535   -
536 553 AffiliationRecord entity = createEntity(detailDto);
537 554 entity.setReason(DefeatReasonEnum.GU.getName());
538 555 affiliationRecordService.save(entity);
539 556 publicPoolService.save(publicPool);
540   - stammkundePoolService.reject(detailDto.getId(), task.getGroupId(), DefeatReasonEnum.GU);
  557 + stammkundePoolService.reject(detailDto.getId(), groupId, DefeatReasonEnum.GU);
541 558 publicCluePoolService.removeClue(detailDto.getId(), detailDto.getAdviserId());
542 559  
543   - PublicPoolEvent poolEvent = new PublicPoolEvent(detailDto.getFrameNo(), task.getGroupId());
  560 + PublicPoolEvent poolEvent = new PublicPoolEvent(detailDto.getFrameNo(), groupId);
544 561 eventPublisher.publishEvent(poolEvent);
545 562 }
546 563  
... ... @@ -578,7 +595,8 @@ public class CustomerBizService extends AbstractCustomerService {
578 595 entity.setOriginShopId(task.getFollowShop());
579 596 }
580 597 affiliationRecordService.save(entity);
581   - if (publicPoolService.queryByPlate(detailDto.getPlateNo(), detailDto.getGroupId()).isPresent()) {
  598 + PublicPool publicData = publicPoolService.queryByVin(detailDto.getFrameNo(), detailDto.getGroupId());
  599 + if (Objects.nonNull(publicData)) {
582 600 return;
583 601 }
584 602 PublicPool publicPool = createPublicPool(detailDto, type, "跟进超期");
... ... @@ -609,7 +627,8 @@ public class CustomerBizService extends AbstractCustomerService {
609 627 AffiliationRecord entity = createEntity(detailDto);
610 628 entity.setReason("跟进超期");
611 629 affiliationRecordService.save(entity);
612   - if (publicPoolService.queryByPlate(detailDto.getPlateNo(), detailDto.getGroupId()).isPresent()) {
  630 + PublicPool publicData = publicPoolService.queryByVin(detailDto.getFrameNo(), detailDto.getGroupId());
  631 + if (Objects.nonNull(publicData)) {
613 632 return;
614 633 }
615 634 PublicPool publicPool = createPublicPool(detailDto, PublicPoolTypeEnum.PD, PublicPoolTypeEnum.PD.getName());
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/pub/PubDistributeBizService.java
... ... @@ -380,6 +380,7 @@ public class PubDistributeBizService {
380 380 customerService.afterDistributePubClue(vinArr, staffId, shopId, groupId);
381 381 pubCluePoolService.saveBatch(clueList);
382 382 stammkundePoolService.saveBatch(stammkundePoolList);
  383 + publicPoolService.removeBatchByVin(vinArr, groupId);
383 384 return true;
384 385 }
385 386  
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/PublicPoolService.java
... ... @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
7 7 import org.springframework.transaction.annotation.Transactional;
8 8  
9 9 import java.util.List;
10   -import java.util.Optional;
11 10  
12 11 /**
13 12 * @author : kurisu
... ... @@ -19,11 +18,11 @@ public interface PublicPoolService extends IService&lt;PublicPool&gt; {
19 18 /**
20 19 * 根据车牌号查询
21 20 *
22   - * @param plateNo
  21 + * @param vin
23 22 * @param groupId
24 23 * @return
25 24 */
26   - Optional<PublicPool> queryByPlate(String plateNo, Long groupId);
  25 + PublicPool queryByVin(String vin, Long groupId);
27 26  
28 27 /**
29 28 * 移除公共池
... ... @@ -33,6 +32,7 @@ public interface PublicPoolService extends IService&lt;PublicPool&gt; {
33 32 */
34 33 @Transactional(rollbackFor = Exception.class)
35 34 void removeByCustomerId(Long customerId, Long groupId);
  35 +
36 36 /**
37 37 * 移除公共池
38 38 *
... ... @@ -41,6 +41,7 @@ public interface PublicPoolService extends IService&lt;PublicPool&gt; {
41 41 */
42 42 @Transactional(rollbackFor = Exception.class)
43 43 void removeByVin(String vin, Long groupId);
  44 +
44 45 /**
45 46 * 移除公共池
46 47 *
... ... @@ -49,6 +50,7 @@ public interface PublicPoolService extends IService&lt;PublicPool&gt; {
49 50 */
50 51 @Transactional(rollbackFor = Exception.class)
51 52 void removeBatchByVin(List<String> vinList, Long groupId);
  53 +
52 54 /**
53 55 * 查询公共池
54 56 *
... ... @@ -67,6 +69,7 @@ public interface PublicPoolService extends IService&lt;PublicPool&gt; {
67 69  
68 70 /**
69 71 * 根据门店id查询对应车架号
  72 + *
70 73 * @param shopIds
71 74 * @return
72 75 */
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/PublicPoolServiceImpl.java
... ... @@ -26,14 +26,14 @@ import java.util.Optional;
26 26 @Slf4j
27 27 @Service
28 28 public class PublicPoolServiceImpl extends ServiceImpl<PublicPoolMapper, PublicPool> implements PublicPoolService {
  29 +
29 30 @Override
30   - public Optional<PublicPool> queryByPlate(String plateNo, Long groupId) {
31   - PublicPool pool = getOne(Wrappers.<PublicPool>lambdaQuery()
  31 + public PublicPool queryByVin(final String vin, final Long groupId) {
  32 + return getOne(Wrappers.<PublicPool>lambdaQuery()
32 33 .eq(PublicPool::getGroupId, groupId)
33   - .eq(PublicPool::getPlateNo, plateNo)
  34 + .eq(PublicPool::getFrameNo, vin)
34 35 .last("limit 1")
35 36 );
36   - return Optional.ofNullable(pool);
37 37 }
38 38  
39 39 @Transactional(rollbackFor = Exception.class)
... ...