From fd4c383fccecda98bbce91030df4f71244736d16 Mon Sep 17 00:00:00 2001 From: yanyang Date: Mon, 5 Feb 2024 10:52:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E4=B8=8A=E7=89=87=E5=9F=BA?= =?UTF-8?q?=E6=9D=BF=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WoPackagingBoxServiceBizImpl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java index 833ffd4..052277b 100644 --- a/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java +++ b/ym-packing/src/main/java/com/cnbm/packing/service/impl/WoPackagingBoxServiceBizImpl.java @@ -28,10 +28,8 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 包装箱表 @@ -143,9 +141,16 @@ public class WoPackagingBoxServiceBizImpl extends CrudServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(entity.getBoxNo()), WoPackagingBoxSubstrate.PACKAGING_BOX_ID, entity.getBoxNo()); - wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT); + //重复上片基板去重 +// wrapper.select("DISTINCT WO_SUBSTRATE_ID").orderByDesc("CREATE_TIME"); +// wrapper.orderByAsc(WoPackagingBoxSubstrate.SLOT); List woPackagingBoxSubstrateList = substrateMapper.selectList(wrapper); - dto.setSubstrateList(woPackagingBoxSubstrateList); + List distinctList = woPackagingBoxSubstrateList.stream().collect( + Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WoPackagingBoxSubstrate::getWoSubstrateId))), ArrayList::new) + ); + List sortedDistinctList = distinctList.stream().sorted(Comparator.comparing(WoPackagingBoxSubstrate::getSlot)).collect(Collectors.toList()); + dto.setSubstrateList(sortedDistinctList); return dto; }