Compare commits

..

No commits in common. "20a36755b98e7a42883e607171ae474ce65fc966" and "f9af03b030232875caad48447d1ab2b07234e552" have entirely different histories.

View File

@ -142,19 +142,13 @@ 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 = 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> 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;