Commit efe55351ea9c024421c8ae231bac1bee3aee1399
1 parent
3b8c7908
feat(*): 新增查询某个档案的全部跟进记录
- 新增查询某个档案的全部跟进记录
Showing
2 changed files
with
98 additions
and
0 deletions
fw-shirasawa-server/src/main/java/cn/fw/shirasawa/server/controller/app/FollowQueryController.java
... | ... | @@ -159,6 +159,33 @@ public class FollowQueryController { |
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
162 | + * 查询客户的跟进历史记录 | |
163 | + * | |
164 | + * @param customerId 客户档案用户id | |
165 | + * @param bizType 业态类型 | |
166 | + * @return | |
167 | + */ | |
168 | + @GetMapping("/customer/history/record") | |
169 | + @IgnoreAuth | |
170 | + @ControllerMethod("查询客户的跟进历史记录") | |
171 | + public Message<List<FollowRecordHistoryVO>> customerRecord(@NotNull(message = "档案id不能为空") final Long customerId, @NotNull(message = "业态类型不能为空") final Integer bizType) { | |
172 | + return success(followBizService.queryHistoryByCustomer(customerId, bizType)); | |
173 | + } | |
174 | + | |
175 | + /** | |
176 | + * 查询车辆的跟进历史记录 | |
177 | + * | |
178 | + * @param vin 客户vin | |
179 | + * @return | |
180 | + */ | |
181 | + @GetMapping("/vin/history/record") | |
182 | + @IgnoreAuth | |
183 | + @ControllerMethod("查询车辆的跟进历史记录") | |
184 | + public Message<List<FollowRecordHistoryVO>> vinRecord(@CurrentUser LoginAuthBean currentUser, @NotBlank(message = "vin不能为空") final String vin) { | |
185 | + return success(followBizService.queryHistoryByVin(vin, currentUser.getGroupId())); | |
186 | + } | |
187 | + | |
188 | + /** | |
162 | 189 | * 查询跟进记录对应线索的跟进记录 |
163 | 190 | * |
164 | 191 | * @param id 跟进待办id | ... | ... |
fw-shirasawa-service/src/main/java/cn/fw/shirasawa/service/bus/follow/FollowBizService.java
... | ... | @@ -758,6 +758,46 @@ public class FollowBizService { |
758 | 758 | } |
759 | 759 | |
760 | 760 | /** |
761 | + * 查询客户的跟进历史记录 | |
762 | + * | |
763 | + * @param customerId 客户档案用户id | |
764 | + * @param bizType 业态类型 | |
765 | + */ | |
766 | + public List<FollowRecordHistoryVO> queryHistoryByCustomer(Long customerId, Integer bizType) { | |
767 | + List<FollowRecord> followRecordList = followRecordService.list(Wrappers.<FollowRecord>lambdaQuery() | |
768 | + .eq(FollowRecord::getCustomerId, customerId) | |
769 | + .eq(FollowRecord::getBizType, bizType) | |
770 | + .eq(FollowRecord::getFollowStatus, FollowStatusEnum.CLOSED) | |
771 | + .eq(FollowRecord::getYn, Boolean.TRUE) | |
772 | + .eq(FollowRecord::getAddTodo, Boolean.TRUE) | |
773 | + ); | |
774 | + if (CollectionUtils.isEmpty(followRecordList)) { | |
775 | + return new ArrayList<>(); | |
776 | + } | |
777 | + return transfromData(followRecordList); | |
778 | + } | |
779 | + | |
780 | + /** | |
781 | + * 查询车辆的跟进历史记录 | |
782 | + * | |
783 | + * @param vin vin | |
784 | + * @param groupId 集团id | |
785 | + */ | |
786 | + public List<FollowRecordHistoryVO> queryHistoryByVin(String vin, Long groupId) { | |
787 | + List<FollowRecord> followRecordList = followRecordService.list(Wrappers.<FollowRecord>lambdaQuery() | |
788 | + .eq(FollowRecord::getVin, vin) | |
789 | + .eq(FollowRecord::getGroupId, groupId) | |
790 | + .eq(FollowRecord::getFollowStatus, FollowStatusEnum.CLOSED) | |
791 | + .eq(FollowRecord::getYn, Boolean.TRUE) | |
792 | + .eq(FollowRecord::getAddTodo, Boolean.TRUE) | |
793 | + ); | |
794 | + if (CollectionUtils.isEmpty(followRecordList)) { | |
795 | + return new ArrayList<>(); | |
796 | + } | |
797 | + return transfromData(followRecordList); | |
798 | + } | |
799 | + | |
800 | + /** | |
761 | 801 | * 查询跟进池详情 |
762 | 802 | * |
763 | 803 | * @param taskId |
... | ... | @@ -1224,4 +1264,35 @@ public class FollowBizService { |
1224 | 1264 | historyVOList.sort(Comparator.comparing(ClueHistoryVO::getDeadline)); |
1225 | 1265 | return historyVOList; |
1226 | 1266 | } |
1267 | + | |
1268 | + private List<FollowRecordHistoryVO> transfromData(List<FollowRecord> followRecordList) { | |
1269 | + List<Long> recordIds = followRecordList.stream().map(FollowRecord::getId).collect(Collectors.toList()); | |
1270 | + Map<Long, FollowRecord> map = followRecordList.stream().collect(Collectors.toMap(FollowRecord::getId, r -> r)); | |
1271 | + List<FollowRecordLog> attachments = followRecordLogService.getListByRecordIds(recordIds); | |
1272 | + if (CollectionUtils.isEmpty(attachments)) { | |
1273 | + return new ArrayList<>(); | |
1274 | + } | |
1275 | + List<FollowRecordHistoryVO> list = new ArrayList<>(); | |
1276 | + for (FollowRecordLog attachment : attachments) { | |
1277 | + FollowRecord followRecord = map.get(attachment.getRecordId()); | |
1278 | + if (Objects.isNull(followRecord)) { | |
1279 | + continue; | |
1280 | + } | |
1281 | + FollowRecordHistoryVO vo = new FollowRecordHistoryVO(); | |
1282 | + vo.setAttachments(attachment.getAttachments()); | |
1283 | + vo.setId(attachment.getId()); | |
1284 | + vo.setCustomerName(followRecord.getCustomerName()); | |
1285 | + vo.setRecordId(attachment.getRecordId()); | |
1286 | + vo.setTaskId(attachment.getTaskId()); | |
1287 | + vo.setAttType(attachment.getAttType()); | |
1288 | + vo.setFeedbackType(attachment.getFeedbackType()); | |
1289 | + vo.setFollowType(followRecord.getType()); | |
1290 | + vo.setUploadTime(attachment.getUploadTime()); | |
1291 | + vo.setDescribes(attachment.getDescribes()); | |
1292 | + vo.setUserName(followRecord.getUserName()); | |
1293 | + list.add(vo); | |
1294 | + } | |
1295 | + | |
1296 | + return list; | |
1297 | + } | |
1227 | 1298 | } | ... | ... |