|
@@ -156,38 +156,42 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
}
|
|
|
Page<ContractVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<ContractVo> list = page.getRecords();
|
|
|
- if(CollectionUtils.isNotEmpty(list)){
|
|
|
- List<Long> customerIds = list.stream().map(Contract::getBuyCorporationId).collect(Collectors.toList());
|
|
|
- List<Customer> customerList = customerService.list(Wrappers.<Customer>query().lambda().in(Customer::getId, customerIds));
|
|
|
- Map<Long, List<Customer>> cusMap = customerList.stream().distinct().collect(Collectors.groupingBy(Customer::getId));
|
|
|
-
|
|
|
- List<Long> ids = list.stream().map(ContractVo::getId).collect(Collectors.toList());
|
|
|
- //获取交接单附件
|
|
|
- Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(ids, 1);
|
|
|
-
|
|
|
- //获取包装附件
|
|
|
- Map<Long, List<FileInfoVo>> packageFileMap = ObsFileUtil.getFileMap(ids, 2);
|
|
|
- for (ContractVo p : list) {
|
|
|
- if (MapUtils.isNotEmpty(cusMap)) {//客户
|
|
|
- List<Customer> customers = cusMap.getOrDefault(p.getBuyCorporationId(), null);
|
|
|
- p.setBuyCorporationName(customers == null ? null : customers.get(0).getName());
|
|
|
- //赋值客户标签
|
|
|
- p.setTag(customers == null ? null : customers.get(0).getTag());
|
|
|
- }
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
|
|
|
- //赋值交接单附件
|
|
|
- if (MapUtils.isNotEmpty(fileMap)){
|
|
|
- List<FileInfoVo> fileInfoVos = fileMap.get(p.getId());
|
|
|
- p.setFileInfoVos(fileInfoVos);
|
|
|
- }
|
|
|
+ List<Long> customerIds = list.stream().map(Contract::getBuyCorporationId).collect(Collectors.toList());
|
|
|
+ List<Customer> customerList = customerService.list(Wrappers.<Customer>query().lambda().in(Customer::getId, customerIds));
|
|
|
+ Map<Long, List<Customer>> cusMap = customerList.stream().distinct().collect(Collectors.groupingBy(Customer::getId));
|
|
|
|
|
|
- //赋值包装附件信息
|
|
|
- if (MapUtils.isNotEmpty(packageFileMap)){
|
|
|
- List<FileInfoVo> packageFileInfoVOList= packageFileMap.get(p.getId());
|
|
|
- p.setPackageFileInfoVOList(packageFileInfoVOList);
|
|
|
- }
|
|
|
+ List<Long> ids = list.stream().map(ContractVo::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 获取交接单附件
|
|
|
+ Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(ids, 1);
|
|
|
|
|
|
+ // 获取包装附件
|
|
|
+ Map<Long, List<FileInfoVo>> packageFileMap = ObsFileUtil.getFileMap(ids, 2);
|
|
|
+
|
|
|
+ for (ContractVo p : list) {
|
|
|
+ if (MapUtils.isNotEmpty(cusMap)) {// 客户
|
|
|
+ List<Customer> customers = cusMap.getOrDefault(p.getBuyCorporationId(), null);
|
|
|
+ p.setBuyCorporationName(customers == null ? null : customers.get(0).getName());
|
|
|
+ // 赋值客户标签
|
|
|
+ p.setTag(customers == null ? null : customers.get(0).getTag());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 赋值交接单附件
|
|
|
+ if (MapUtils.isNotEmpty(fileMap)) {
|
|
|
+ List<FileInfoVo> fileInfoVos = fileMap.get(p.getId());
|
|
|
+ p.setFileInfoVos(fileInfoVos);
|
|
|
}
|
|
|
+
|
|
|
+ // 赋值包装附件信息
|
|
|
+ if (MapUtils.isNotEmpty(packageFileMap)) {
|
|
|
+ List<FileInfoVo> packageFileInfoVOList = packageFileMap.get(p.getId());
|
|
|
+ p.setPackageFileInfoVOList(packageFileInfoVOList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return page;
|
|
|
}
|