Compare commits

..

No commits in common. "46f51e656ec8d5c270026375c5943eab5d7ad510" and "095bdc1e23a6fc0f0c1ba2263b6a87e699be02ba" 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;