Commit eeaeaee348e7782bda7fec0e9043617c058182c1

Authored by 张志伟
2 parents 42179ee3 d3202190

Merge remote-tracking branch 'origin/test'

fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/ACTodoListVO.java
@@ -19,10 +19,6 @@ public class ACTodoListVO extends FollowTodoListVO { @@ -19,10 +19,6 @@ public class ACTodoListVO extends FollowTodoListVO {
19 * 保险公司名称 19 * 保险公司名称
20 */ 20 */
21 private String insComName; 21 private String insComName;
22 - /**  
23 - * 车牌号  
24 - */  
25 - private String plateNo;  
26 22
27 public Integer getType() { 23 public Integer getType() {
28 return FollowTypeEnum.AC.getValue(); 24 return FollowTypeEnum.AC.getValue();
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowTodoListVO.java
@@ -22,6 +22,10 @@ public class FollowTodoListVO { @@ -22,6 +22,10 @@ public class FollowTodoListVO {
22 */ 22 */
23 private Long taskId; 23 private Long taskId;
24 /** 24 /**
  25 + * 车牌号
  26 + */
  27 + private String plateNo;
  28 + /**
25 * 档案id 29 * 档案id
26 */ 30 */
27 private Long customerId; 31 private Long customerId;
fw-valhalla-service/src/main/java/cn/fw/valhalla/component/FlowConsumer.java
@@ -3,22 +3,28 @@ package cn.fw.valhalla.component; @@ -3,22 +3,28 @@ package cn.fw.valhalla.component;
3 import cn.fw.flow.enums.ApproveResultEnum; 3 import cn.fw.flow.enums.ApproveResultEnum;
4 import cn.fw.flow.result.ApproveCheckMessageDto; 4 import cn.fw.flow.result.ApproveCheckMessageDto;
5 import cn.fw.valhalla.domain.db.ApproveRecord; 5 import cn.fw.valhalla.domain.db.ApproveRecord;
  6 +import cn.fw.valhalla.domain.db.follow.FollowRecord;
6 import cn.fw.valhalla.domain.db.follow.FollowTask; 7 import cn.fw.valhalla.domain.db.follow.FollowTask;
7 import cn.fw.valhalla.domain.enums.ApproveStateEnum; 8 import cn.fw.valhalla.domain.enums.ApproveStateEnum;
8 import cn.fw.valhalla.domain.enums.FollowTypeEnum; 9 import cn.fw.valhalla.domain.enums.FollowTypeEnum;
9 import cn.fw.valhalla.domain.enums.TaskStateEnum; 10 import cn.fw.valhalla.domain.enums.TaskStateEnum;
10 import cn.fw.valhalla.service.bus.cust.CustomerBizService; 11 import cn.fw.valhalla.service.bus.cust.CustomerBizService;
11 import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService; 12 import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService;
  13 +import cn.fw.valhalla.service.bus.follow.FollowBizService;
12 import cn.fw.valhalla.service.data.ApproveRecordService; 14 import cn.fw.valhalla.service.data.ApproveRecordService;
  15 +import cn.fw.valhalla.service.data.FollowRecordService;
13 import cn.fw.valhalla.service.data.FollowTaskService; 16 import cn.fw.valhalla.service.data.FollowTaskService;
14 import com.alibaba.fastjson.JSONObject; 17 import com.alibaba.fastjson.JSONObject;
  18 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
15 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
16 import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; 20 import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
17 import org.apache.rocketmq.spring.core.RocketMQListener; 21 import org.apache.rocketmq.spring.core.RocketMQListener;
18 import org.springframework.beans.factory.annotation.Autowired; 22 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
20 import org.springframework.transaction.annotation.Transactional; 24 import org.springframework.transaction.annotation.Transactional;
  25 +import org.springframework.util.CollectionUtils;
21 26
  27 +import java.util.List;
22 import java.util.Objects; 28 import java.util.Objects;
23 29
24 /** 30 /**
@@ -36,17 +42,23 @@ public class FlowConsumer implements RocketMQListener<ApproveCheckMessageDto> { @@ -36,17 +42,23 @@ public class FlowConsumer implements RocketMQListener<ApproveCheckMessageDto> {
36 private final CustomerBizService customerBizService; 42 private final CustomerBizService customerBizService;
37 private final ApproveRecordService approveRecordService; 43 private final ApproveRecordService approveRecordService;
38 private final FollowTaskService followTaskService; 44 private final FollowTaskService followTaskService;
  45 + private final FollowRecordService followRecordService;
  46 + private final FollowBizService followBizService;
39 47
40 48
41 @Autowired 49 @Autowired
42 public FlowConsumer(final CustomerChangeBizService customerChangeBizService, 50 public FlowConsumer(final CustomerChangeBizService customerChangeBizService,
43 final CustomerBizService customerBizService, 51 final CustomerBizService customerBizService,
44 final ApproveRecordService approveRecordService, 52 final ApproveRecordService approveRecordService,
45 - final FollowTaskService followTaskService) { 53 + final FollowTaskService followTaskService,
  54 + final FollowRecordService followRecordService,
  55 + final FollowBizService followBizService) {
46 this.customerChangeBizService = customerChangeBizService; 56 this.customerChangeBizService = customerChangeBizService;
47 this.customerBizService = customerBizService; 57 this.customerBizService = customerBizService;
48 this.approveRecordService = approveRecordService; 58 this.approveRecordService = approveRecordService;
49 this.followTaskService = followTaskService; 59 this.followTaskService = followTaskService;
  60 + this.followRecordService = followRecordService;
  61 + this.followBizService = followBizService;
50 } 62 }
51 63
52 @Override 64 @Override
@@ -94,5 +106,16 @@ public class FlowConsumer implements RocketMQListener<ApproveCheckMessageDto> { @@ -94,5 +106,16 @@ public class FlowConsumer implements RocketMQListener<ApproveCheckMessageDto> {
94 return; 106 return;
95 } 107 }
96 customerChangeBizService.changeFollowUser(task); 108 customerChangeBizService.changeFollowUser(task);
  109 + List<FollowRecord> list = followRecordService.list(Wrappers.<FollowRecord>lambdaQuery()
  110 + .eq(FollowRecord::getTaskId, taskId)
  111 + .eq(FollowRecord::getOutTime, Boolean.FALSE)
  112 + .isNotNull(FollowRecord::getFollowTime)
  113 + .eq(FollowRecord::getAddTodo, Boolean.TRUE)
  114 + );
  115 + if (!CollectionUtils.isEmpty(list)) {
  116 + for (FollowRecord record : list) {
  117 + followBizService.completeRecord2(record);
  118 + }
  119 + }
97 } 120 }
98 } 121 }
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java
@@ -165,6 +165,18 @@ public class FollowBizService { @@ -165,6 +165,18 @@ public class FollowBizService {
165 } 165 }
166 166
167 /** 167 /**
  168 + * 完成跟进
  169 + *
  170 + * @param record
  171 + */
  172 + @Transactional(rollbackFor = Exception.class)
  173 + public void completeRecord2(FollowRecord record) {
  174 + FollowStrategy strategy = followMap.get(record.getType());
  175 + Assert.notNull(strategy, "strategy cannot be null");
  176 + strategy.completeRecord2(record);
  177 + }
  178 +
  179 + /**
168 * 查询待办详情 180 * 查询待办详情
169 * 181 *
170 * @param id 182 * @param id
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/AbstractFollowStrategy.java
@@ -173,6 +173,18 @@ public abstract class AbstractFollowStrategy implements FollowStrategy { @@ -173,6 +173,18 @@ public abstract class AbstractFollowStrategy implements FollowStrategy {
173 todoRpcService.complete(dto); 173 todoRpcService.complete(dto);
174 } 174 }
175 175
  176 + @Override
  177 + @Transactional(rollbackFor = Exception.class)
  178 + public void completeRecord2(FollowRecord record) {
  179 + BV.isTrue(Boolean.FALSE.equals(record.getOutTime()), () -> "无法完成已逾期的待办任务");
  180 + final Date followTime = DateUtil.localDateTime2Date(LocalDateTime.now());
  181 + record.setFollowTime(followTime);
  182 + followRecordService.updateById(record);
  183 + this.addTaskRecord(record, false);
  184 + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), followTime);
  185 + todoRpcService.complete(dto);
  186 + }
  187 +
176 /** 188 /**
177 * 生成跟进记录 189 * 生成跟进记录
178 * 190 *
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/FollowStrategy.java
@@ -63,6 +63,12 @@ public interface FollowStrategy { @@ -63,6 +63,12 @@ public interface FollowStrategy {
63 void completeRecord(Long id, LoginAuthBean currentUser); 63 void completeRecord(Long id, LoginAuthBean currentUser);
64 64
65 /** 65 /**
  66 + * 完成跟进
  67 + * @param record
  68 + */
  69 + void completeRecord2(FollowRecord record);
  70 +
  71 + /**
66 * 上传跟进附件 72 * 上传跟进附件
67 * 73 *
68 * @param dto 74 * @param dto
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/ACFollowStrategy.java
@@ -117,6 +117,17 @@ public class ACFollowStrategy extends AbstractFollowStrategy { @@ -117,6 +117,17 @@ public class ACFollowStrategy extends AbstractFollowStrategy {
117 } 117 }
118 118
119 @Override 119 @Override
  120 + public void completeRecord2(FollowRecord record) {
  121 + final Date followTime = DateUtil.localDateTime2Date(LocalDateTime.now());
  122 + record.setFollowTime(followTime);
  123 + if (Boolean.FALSE.equals(record.getOutTime())) {
  124 + followRecordService.updateById(record);
  125 + }
  126 + BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), followTime);
  127 + todoRpcService.complete(dto);
  128 + }
  129 +
  130 + @Override
120 public void uploadAtt(FollowAttachmentDTO dto, Long userId) { 131 public void uploadAtt(FollowAttachmentDTO dto, Long userId) {
121 super.uploadAtt(dto, userId); 132 super.uploadAtt(dto, userId);
122 } 133 }
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/FMFollowStrategy.java
@@ -58,6 +58,7 @@ public class FMFollowStrategy extends AbstractFollowStrategy { @@ -58,6 +58,7 @@ public class FMFollowStrategy extends AbstractFollowStrategy {
58 vo.setDeadline(followRecord.getDeadline()); 58 vo.setDeadline(followRecord.getDeadline());
59 CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); 59 CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId());
60 vo.setName(customerDetailDto.getName()); 60 vo.setName(customerDetailDto.getName());
  61 + vo.setPlateNo(customerDetailDto.getPlateNo());
61 vo.setCarImage(customerDetailDto.getCarImage()); 62 vo.setCarImage(customerDetailDto.getCarImage());
62 vo.setBuyDate(customerDetailDto.getBuyDate()); 63 vo.setBuyDate(customerDetailDto.getBuyDate());
63 Optional<FollowTask> followTask = Optional.ofNullable(followTaskService.getById(followRecord.getTaskId())); 64 Optional<FollowTask> followTask = Optional.ofNullable(followTaskService.getById(followRecord.getTaskId()));
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/IRFollowStrategy.java
@@ -63,6 +63,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy { @@ -63,6 +63,7 @@ public class IRFollowStrategy extends AbstractFollowStrategy {
63 CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); 63 CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId());
64 vo.setName(customerDetailDto.getName()); 64 vo.setName(customerDetailDto.getName());
65 vo.setCarImage(customerDetailDto.getCarImage()); 65 vo.setCarImage(customerDetailDto.getCarImage());
  66 + vo.setPlateNo(customerDetailDto.getPlateNo());
66 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(followRecord.getCustomerId()); 67 Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(followRecord.getCustomerId());
67 insuranceDTO.ifPresent(ins -> { 68 insuranceDTO.ifPresent(ins -> {
68 vo.setInsComName(ins.getInsurerName()); 69 vo.setInsComName(ins.getInsurerName());
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/strategy/impl/RMFollowStrategy.java
@@ -71,6 +71,7 @@ public class RMFollowStrategy extends AbstractFollowStrategy { @@ -71,6 +71,7 @@ public class RMFollowStrategy extends AbstractFollowStrategy {
71 CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); 71 CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId());
72 vo.setName(customerDetailDto.getName()); 72 vo.setName(customerDetailDto.getName());
73 vo.setCarImage(customerDetailDto.getCarImage()); 73 vo.setCarImage(customerDetailDto.getCarImage());
  74 + vo.setPlateNo(customerDetailDto.getPlateNo());
74 vo.setLastMileage(customerDetailDto.getCurrentMileage()); 75 vo.setLastMileage(customerDetailDto.getCurrentMileage());
75 76
76 OriginalData originalData = originalDataService.getOne(Wrappers.<OriginalData>lambdaQuery() 77 OriginalData originalData = originalDataService.getOne(Wrappers.<OriginalData>lambdaQuery()