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

Reviewed-on: #41
This commit is contained in:
闫阳 2024-02-05 11:24:29 +08:00
commit 20a36755b9

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;