Commit 2d5d7cc737046169a8416ce73aa61c287de5dc32
1 parent
dbd3caa4
对接新待办
Showing
4 changed files
with
56 additions
and
26 deletions
fw-valhalla-rpc/src/main/java/cn/fw/valhalla/rpc/backlog/dto/BackLogItemDTO.java
... | ... | @@ -5,6 +5,7 @@ import lombok.EqualsAndHashCode; |
5 | 5 | import lombok.ToString; |
6 | 6 | |
7 | 7 | import java.util.Date; |
8 | +import java.util.Map; | |
8 | 9 | import java.util.Objects; |
9 | 10 | |
10 | 11 | /** |
... | ... | @@ -43,6 +44,7 @@ public class BackLogItemDTO { |
43 | 44 | private Date dataTime; |
44 | 45 | private Date expireTime; |
45 | 46 | private Long shopId; |
47 | + private Map<String, String> dynamicMap; | |
46 | 48 | |
47 | 49 | public BackLogItemDTO(Long userId, String itemCode, String dataId, Date dataTime, Long shopId) { |
48 | 50 | this.userId = userId; | ... | ... |
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/FollowController.java
... | ... | @@ -15,9 +15,7 @@ import cn.fw.valhalla.domain.vo.follow.CustomerClueHistoryVO; |
15 | 15 | import cn.fw.valhalla.domain.vo.follow.FollowDetailVO; |
16 | 16 | import cn.fw.valhalla.domain.vo.follow.FollowRecordVO; |
17 | 17 | import cn.fw.valhalla.domain.vo.follow.FollowTodoListVO; |
18 | -import cn.fw.valhalla.rpc.sms.SmsRpcService; | |
19 | 18 | import cn.fw.valhalla.service.bus.follow.FollowBizService; |
20 | -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
21 | 19 | import lombok.extern.slf4j.Slf4j; |
22 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
23 | 21 | import org.springframework.validation.annotation.Validated; |
... | ... | @@ -29,10 +27,7 @@ import java.util.List; |
29 | 27 | import java.util.Objects; |
30 | 28 | |
31 | 29 | import static cn.fw.common.businessvalidator.Validator.BV; |
32 | -import static cn.fw.common.web.util.ExceptionHandler.handleException; | |
33 | -import static cn.fw.common.web.util.ResultBuilder.failureWithMessage; | |
34 | 30 | import static cn.fw.common.web.util.ResultBuilder.success; |
35 | -import static cn.fw.valhalla.common.constant.MessageStr.QUERY_FAILURE; | |
36 | 31 | |
37 | 32 | /** |
38 | 33 | * @author : kurisu |
... | ... | @@ -56,6 +51,7 @@ public class FollowController { |
56 | 51 | |
57 | 52 | @GetMapping("/todo/list") |
58 | 53 | @ControllerMethod("分页查询跟进待办列表") |
54 | + @Deprecated | |
59 | 55 | public Message<AppPage<FollowTodoListVO>> todoList(@CurrentUser LoginAuthBean currentUser, final FollowQueryVO queryVO) { |
60 | 56 | BV.notNull(queryVO.getType(), "跟进类型不正确"); |
61 | 57 | AppPage<FollowTodoListVO> page = followBizService.todoList(queryVO, currentUser); |
... | ... | @@ -64,11 +60,8 @@ public class FollowController { |
64 | 60 | |
65 | 61 | @GetMapping("/todo/detail") |
66 | 62 | @ControllerMethod("查询跟进待办详情") |
67 | - public Message<FollowDetailVO> todoDetail(@NotNull(message = "跟进记录id不能为空") final Long id, | |
68 | - @NotNull(message = "跟进类型不能为空") final Integer type) { | |
69 | - FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type); | |
70 | - BV.notNull(typeEnum, "跟进类型不正确"); | |
71 | - FollowDetailVO detailVO = followBizService.todoDetail(id, typeEnum); | |
63 | + public Message<FollowDetailVO> todoDetail(@NotNull(message = "跟进记录id不能为空") final Long id) { | |
64 | + FollowDetailVO detailVO = followBizService.todoDetail(id); | |
72 | 65 | return success(detailVO); |
73 | 66 | } |
74 | 67 | |
... | ... | @@ -83,8 +76,8 @@ public class FollowController { |
83 | 76 | @GetMapping("/todo/record") |
84 | 77 | @IgnoreAuth |
85 | 78 | @ControllerMethod("查询跟进历史记录") |
86 | - public Message<List<FollowRecordVO>> todoRecord(@NotNull(message = "跟进任务id不能为空") final Long taskId, final Integer type) { | |
87 | - return success(followBizService.todoRecord(taskId, type)); | |
79 | + public Message<List<FollowRecordVO>> todoRecord(@NotNull(message = "跟进任务id不能为空") final Long taskId) { | |
80 | + return success(followBizService.todoRecord(taskId)); | |
88 | 81 | } |
89 | 82 | |
90 | 83 | @GetMapping("/sms/template") | ... | ... |
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/FollowRecordTask.java
1 | 1 | package cn.fw.valhalla.controller.task; |
2 | 2 | |
3 | 3 | import cn.fw.valhalla.common.utils.DateUtil; |
4 | +import cn.fw.valhalla.common.utils.StringUtils; | |
4 | 5 | import cn.fw.valhalla.domain.db.follow.FollowRecord; |
5 | 6 | import cn.fw.valhalla.domain.db.follow.FollowTask; |
6 | 7 | import cn.fw.valhalla.domain.enums.FollowTypeEnum; |
7 | 8 | import cn.fw.valhalla.domain.enums.TaskStateEnum; |
9 | +import cn.fw.valhalla.domain.vo.follow.*; | |
8 | 10 | import cn.fw.valhalla.rpc.backlog.TodoRpcService; |
9 | 11 | import cn.fw.valhalla.rpc.backlog.dto.BackLogItemDTO; |
10 | 12 | import cn.fw.valhalla.service.bus.follow.FollowBizService; |
... | ... | @@ -21,10 +23,7 @@ import org.springframework.transaction.annotation.Transactional; |
21 | 23 | import org.springframework.util.CollectionUtils; |
22 | 24 | |
23 | 25 | import java.time.LocalDateTime; |
24 | -import java.util.ArrayList; | |
25 | -import java.util.Collection; | |
26 | -import java.util.List; | |
27 | -import java.util.Objects; | |
26 | +import java.util.*; | |
28 | 27 | |
29 | 28 | /** |
30 | 29 | * @author : kurisu |
... | ... | @@ -154,6 +153,7 @@ public class FollowRecordTask { |
154 | 153 | if (Objects.nonNull(task) && TaskStateEnum.ONGOING.equals(task.getState())) { |
155 | 154 | BackLogItemDTO dto = new BackLogItemDTO(record.getUserId(), getItemCode(record.getType()), String.valueOf(record.getId()), record.getPlanTime(), record.getShopId()); |
156 | 155 | dto.setExpireTime(record.getDeadline()); |
156 | + dto.setDynamicMap(create(record)); | |
157 | 157 | todoRpcService.push(dto); |
158 | 158 | idList.add(record.getId()); |
159 | 159 | } else { |
... | ... | @@ -166,6 +166,32 @@ public class FollowRecordTask { |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | + private Map<String, String> create(FollowRecord record) { | |
170 | + FollowDetailVO vo = followBizService.todoDetail(record.getId(), record.getType()); | |
171 | + Map<String, String> dynamicMap = new HashMap<>(); | |
172 | + dynamicMap.put("type", record.getType().getValue().toString()); | |
173 | + dynamicMap.put("taskId", record.getTaskId().toString()); | |
174 | + dynamicMap.put("id", record.getId().toString()); | |
175 | + if (Objects.nonNull(vo)) { | |
176 | + dynamicMap.put("state", "1"); | |
177 | + dynamicMap.put("plateNo", StringUtils.isValid(vo.getPlateNo()) ? vo.getPlateNo() : ""); | |
178 | + dynamicMap.put("name", StringUtils.isValid(vo.getName()) ? vo.getPlateNo() : ""); | |
179 | + if (vo instanceof FMDetailVO) { | |
180 | + dynamicMap.put("buyDate", DateUtil.getFullDateString(((FMDetailVO) vo).getBuyDate())); | |
181 | + dynamicMap.put("expirTime", DateUtil.getFullDateString(((FMDetailVO) vo).getFMExpiration())); | |
182 | + } else if (vo instanceof RMDetailVO) { | |
183 | + dynamicMap.put("currentMileage", Optional.ofNullable(((RMDetailVO) vo).getLastMileage()).map(String::valueOf).orElse("")); | |
184 | + dynamicMap.put("arrivalTime", DateUtil.getFullDateString(((RMDetailVO) vo).getDeliveryTime())); | |
185 | + } else if (vo instanceof IRDetailVO) { | |
186 | + dynamicMap.put("expirTime", DateUtil.getFullDateString(((IRDetailVO) vo).getTclInsExpiration())); | |
187 | + dynamicMap.put("insComName", StringUtils.isValid(((IRDetailVO) vo).getTclInsComName()) ? vo.getPlateNo() : ""); | |
188 | + } else if (vo instanceof ACDetailVO) { | |
189 | + dynamicMap.put("insComName", StringUtils.isValid(((ACDetailVO) vo).getInsComName()) ? vo.getPlateNo() : ""); | |
190 | + } | |
191 | + } | |
192 | + return dynamicMap; | |
193 | + } | |
194 | + | |
169 | 195 | private String getItemCode(FollowTypeEnum type) { |
170 | 196 | switch (type) { |
171 | 197 | case AC: | ... | ... |
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/FollowBizService.java
... | ... | @@ -118,6 +118,7 @@ public class FollowBizService { |
118 | 118 | * @param currentUser |
119 | 119 | * @return |
120 | 120 | */ |
121 | + @Deprecated | |
121 | 122 | public AppPage<FollowTodoListVO> todoList(FollowQueryVO queryVO, LoginAuthBean currentUser) { |
122 | 123 | Integer pageSize = queryVO.getPageSize(); |
123 | 124 | Integer current = queryVO.getCurrent(); |
... | ... | @@ -156,7 +157,20 @@ public class FollowBizService { |
156 | 157 | * 查询待办详情 |
157 | 158 | * |
158 | 159 | * @param id |
159 | - * @param type | |
160 | + * @return | |
161 | + */ | |
162 | + public FollowDetailVO todoDetail(Long id) { | |
163 | + FollowTask followTask = followTaskService.getById(id); | |
164 | + BV.notNull(followTask, () -> "跟进不能为空"); | |
165 | + FollowStrategy strategy = followMap.get(followTask.getType()); | |
166 | + Assert.notNull(strategy, "strategy cannot be null"); | |
167 | + return strategy.getDetail(id); | |
168 | + } | |
169 | + | |
170 | + /** | |
171 | + * 查询待办详情 | |
172 | + * | |
173 | + * @param id | |
160 | 174 | * @return |
161 | 175 | */ |
162 | 176 | public FollowDetailVO todoDetail(Long id, FollowTypeEnum type) { |
... | ... | @@ -169,17 +183,12 @@ public class FollowBizService { |
169 | 183 | * 查询跟进历史 |
170 | 184 | * |
171 | 185 | * @param taskId |
172 | - * @param type | |
173 | 186 | * @return |
174 | 187 | */ |
175 | - public List<FollowRecordVO> todoRecord(Long taskId, Integer type) { | |
176 | - FollowTypeEnum typeEnum = FollowTypeEnum.ofValue(type); | |
177 | - if (Objects.isNull(typeEnum)) { | |
178 | - FollowTask task = followTaskService.getById(taskId); | |
179 | - BV.notNull(task, () -> "跟进任务不存在"); | |
180 | - typeEnum = task.getType(); | |
181 | - } | |
182 | - FollowStrategy strategy = followMap.get(typeEnum); | |
188 | + public List<FollowRecordVO> todoRecord(Long taskId) { | |
189 | + FollowTask task = followTaskService.getById(taskId); | |
190 | + BV.notNull(task, () -> "跟进任务不存在"); | |
191 | + FollowStrategy strategy = followMap.get(task.getType()); | |
183 | 192 | BV.notNull(strategy, () -> "跟进类型不正确"); |
184 | 193 | return strategy.getRecordList(taskId); |
185 | 194 | } | ... | ... |