Browse Source

Merge pull request 'yanyang' (#41) from yanyang into master

Reviewed-on: #41
master
闫阳 7 months ago
parent
commit
20a36755b9
1 changed files with 11 additions and 5 deletions
  1. +11
    -5
      ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java

+ 11
- 5
ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java View File

@@ -142,13 +142,19 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl<WoPackagingBox
QueryWrapper<WoPackagingBoxSubstrate> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo());
//重复上片基板去重
// wrapper.select("DISTINCT WO_SUBSTRATE_ID").orderByDesc("CREATE_TIME");
// wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT);
List<WoPackagingBoxSubstrate> woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper);
List<WoPackagingBoxSubstrate> distinctList = woPackagingBoxSubstrateList.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WoPackagingBoxSubstrate::getWoSubstrateId))), ArrayList::new)
);
List<WoPackagingBoxSubstrate> distinctList = new ArrayList<>();
Map<String, List<WoPackagingBoxSubstrate>> map = woPackagingBoxSubstrateList.stream().sorted(Comparator.comparing(WoPackagingBoxSubstrate::getCreateTime).reversed())
.collect(Collectors.groupingBy(WoPackagingBoxSubstrate::getWoSubstrateId));
for (Map.Entry<String, List<WoPackagingBoxSubstrate>> entry : map.entrySet()) {
//取list首并放入到新list中
distinctList.add(entry.getValue().get(0));
}
// List<WoPackagingBoxSubstrate> distinctList = woPackagingBoxSubstrateList.stream().collect(
// Collectors.collectingAndThen(
// Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WoPackagingBoxSubstrate::getWoSubstrateId))), ArrayList::new)
// );
List<WoPackagingBoxSubstrate> sortedDistinctList = distinctList.stream().sorted(Comparator.comparing(WoPackagingBoxSubstrate::getSlot)).collect(Collectors.toList());
dto.setSubstrateList(sortedDistinctList);
return dto;


Loading…
Cancel
Save