Commit eeaeaee348e7782bda7fec0e9043617c058182c1
Merge remote-tracking branch 'origin/test'
Showing
10 changed files
with
72 additions
and
5 deletions
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/ACTodoListVO.java
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/follow/FollowTodoListVO.java
fw-valhalla-service/src/main/java/cn/fw/valhalla/component/FlowConsumer.java
... | ... | @@ -3,22 +3,28 @@ package cn.fw.valhalla.component; |
3 | 3 | import cn.fw.flow.enums.ApproveResultEnum; |
4 | 4 | import cn.fw.flow.result.ApproveCheckMessageDto; |
5 | 5 | import cn.fw.valhalla.domain.db.ApproveRecord; |
6 | +import cn.fw.valhalla.domain.db.follow.FollowRecord; | |
6 | 7 | import cn.fw.valhalla.domain.db.follow.FollowTask; |
7 | 8 | import cn.fw.valhalla.domain.enums.ApproveStateEnum; |
8 | 9 | import cn.fw.valhalla.domain.enums.FollowTypeEnum; |
9 | 10 | import cn.fw.valhalla.domain.enums.TaskStateEnum; |
10 | 11 | import cn.fw.valhalla.service.bus.cust.CustomerBizService; |
11 | 12 | import cn.fw.valhalla.service.bus.cust.CustomerChangeBizService; |
13 | +import cn.fw.valhalla.service.bus.follow.FollowBizService; | |
12 | 14 | import cn.fw.valhalla.service.data.ApproveRecordService; |
15 | +import cn.fw.valhalla.service.data.FollowRecordService; | |
13 | 16 | import cn.fw.valhalla.service.data.FollowTaskService; |
14 | 17 | import com.alibaba.fastjson.JSONObject; |
18 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
15 | 19 | import lombok.extern.slf4j.Slf4j; |
16 | 20 | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
17 | 21 | import org.apache.rocketmq.spring.core.RocketMQListener; |
18 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
19 | 23 | import org.springframework.stereotype.Service; |
20 | 24 | import org.springframework.transaction.annotation.Transactional; |
25 | +import org.springframework.util.CollectionUtils; | |
21 | 26 | |
27 | +import java.util.List; | |
22 | 28 | import java.util.Objects; |
23 | 29 | |
24 | 30 | /** |
... | ... | @@ -36,17 +42,23 @@ public class FlowConsumer implements RocketMQListener<ApproveCheckMessageDto> { |
36 | 42 | private final CustomerBizService customerBizService; |
37 | 43 | private final ApproveRecordService approveRecordService; |
38 | 44 | private final FollowTaskService followTaskService; |
45 | + private final FollowRecordService followRecordService; | |
46 | + private final FollowBizService followBizService; | |
39 | 47 | |
40 | 48 | |
41 | 49 | @Autowired |
42 | 50 | public FlowConsumer(final CustomerChangeBizService customerChangeBizService, |
43 | 51 | final CustomerBizService customerBizService, |
44 | 52 | final ApproveRecordService approveRecordService, |
45 | - final FollowTaskService followTaskService) { | |
53 | + final FollowTaskService followTaskService, | |
54 | + final FollowRecordService followRecordService, | |
55 | + final FollowBizService followBizService) { | |
46 | 56 | this.customerChangeBizService = customerChangeBizService; |
47 | 57 | this.customerBizService = customerBizService; |
48 | 58 | this.approveRecordService = approveRecordService; |
49 | 59 | this.followTaskService = followTaskService; |
60 | + this.followRecordService = followRecordService; | |
61 | + this.followBizService = followBizService; | |
50 | 62 | } |
51 | 63 | |
52 | 64 | @Override |
... | ... | @@ -94,5 +106,16 @@ public class FlowConsumer implements RocketMQListener<ApproveCheckMessageDto> { |
94 | 106 | return; |
95 | 107 | } |
96 | 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 | 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 | 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 | 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
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 | 117 | } |
118 | 118 | |
119 | 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 | 131 | public void uploadAtt(FollowAttachmentDTO dto, Long userId) { |
121 | 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 | 58 | vo.setDeadline(followRecord.getDeadline()); |
59 | 59 | CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); |
60 | 60 | vo.setName(customerDetailDto.getName()); |
61 | + vo.setPlateNo(customerDetailDto.getPlateNo()); | |
61 | 62 | vo.setCarImage(customerDetailDto.getCarImage()); |
62 | 63 | vo.setBuyDate(customerDetailDto.getBuyDate()); |
63 | 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 | 63 | CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); |
64 | 64 | vo.setName(customerDetailDto.getName()); |
65 | 65 | vo.setCarImage(customerDetailDto.getCarImage()); |
66 | + vo.setPlateNo(customerDetailDto.getPlateNo()); | |
66 | 67 | Optional<InsuranceDTO> insuranceDTO = queryInsuInfo(followRecord.getCustomerId()); |
67 | 68 | insuranceDTO.ifPresent(ins -> { |
68 | 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 | 71 | CustomerDetailDto customerDetailDto = queryCustomerInfo(followRecord.getCustomerId()); |
72 | 72 | vo.setName(customerDetailDto.getName()); |
73 | 73 | vo.setCarImage(customerDetailDto.getCarImage()); |
74 | + vo.setPlateNo(customerDetailDto.getPlateNo()); | |
74 | 75 | vo.setLastMileage(customerDetailDto.getCurrentMileage()); |
75 | 76 | |
76 | 77 | OriginalData originalData = originalDataService.getOne(Wrappers.<OriginalData>lambdaQuery() | ... | ... |