From 44f4ad252b3f2a91da162d1842d423bf4c5ee7ea Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Tue, 3 Feb 2026 10:05:02 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=83=A8=E4=BB=B6=E5=88=97=E8=A1=A8=E5=8E=BB=E9=87=8D=E5=92=8C?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E5=AE=8C=E5=96=84=EF=BC=9B2=E3=80=81cad?= =?UTF-8?q?=E6=8B=86=E5=8D=95=E5=B8=A6=E5=8A=A0=E5=B7=A5=E7=BB=84=E7=9A=84?= =?UTF-8?q?orderItem=E9=83=A8=E4=BB=B6id=E7=BC=BA=E5=A4=B1=E8=A1=A5?= =?UTF-8?q?=E5=85=85=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrderComponentServiceImpl.java | 28 +++++++++++++------ .../ordercomponent/OrderComponentMapper.xml | 2 +- .../src/main/resources/message_en.properties | 2 +- .../WebCadOrderImportAsyncFactory.java | 1 + .../factory/WebCadOrderImportFactory.java | 1 + 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentServiceImpl.java index 01b67df36..ec8bfdce4 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentServiceImpl.java @@ -24,8 +24,11 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; @@ -66,11 +69,20 @@ public class OrderComponentServiceImpl implements OrderComponentService { } } - // 结果根据topid - resultDOList.sort(Comparator - .comparing(OrderComponentDO::getTopId)); + // 结果根据id去重和排序 + Map uniqueMap = resultDOList.stream() + .collect(Collectors.toMap( + OrderComponentDO::getId, + Function.identity(), + (a, b) -> a, + LinkedHashMap::new + )); - return BeanUtil.copyToList(resultDOList, OrderComponentRespVO.class); + List uniqueList = new ArrayList<>(uniqueMap.values()); + uniqueList.sort(Comparator + .comparing(OrderComponentDO::getId)); + + return BeanUtil.copyToList(uniqueList, OrderComponentRespVO.class); } @Override @@ -109,7 +121,7 @@ public class OrderComponentServiceImpl implements OrderComponentService { } if(CollUtil.isEmpty(componentIds)) { - // 2、把下级部门id做成集合 + // 2、把下级部件id作为查询条件 List orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX() .eq(OrderComponentDO::getTopId, componentDO.getTopId()) .eq(OrderComponentDO::getOrganId, componentDO.getOrganId()) @@ -122,7 +134,7 @@ public class OrderComponentServiceImpl implements OrderComponentService { return new PageResult<>(); } } else { - // 3、使用入参的部件id集合 + // 3、使用入参的部件id作为条件 componentIds = pageReqVO.getComponentIds(); } @@ -147,7 +159,7 @@ public class OrderComponentServiceImpl implements OrderComponentService { Long cadViewFileId = componentDO.getCadViewFileId(); if(CollUtil.isEmpty(componentIds)) { - // 2、把下级部门id做成集合 + // 2、把下级部件id作为查询条件 List orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX() .eq(OrderComponentDO::getTopId, componentDO.getTopId()) .eq(OrderComponentDO::getOrganId, componentDO.getOrganId()) @@ -160,7 +172,7 @@ public class OrderComponentServiceImpl implements OrderComponentService { return Collections.emptyList(); } } else { - // 3、使用入参的部件id集合 + // 3、使用入参的部件id作为条件 componentIds = pageReqVO.getComponentIds(); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/ordercomponent/OrderComponentMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/ordercomponent/OrderComponentMapper.xml index 06695de6b..1955b4d69 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/ordercomponent/OrderComponentMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/ordercomponent/OrderComponentMapper.xml @@ -22,7 +22,7 @@