1、订单详情部件列表去重和排序完善;2、cad拆单带加工组的orderItem部件id缺失补充;

This commit is contained in:
gaoqr
2026-02-03 10:05:02 +08:00
parent 5dddcc1606
commit 44f4ad252b
5 changed files with 24 additions and 10 deletions
@@ -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<Long, OrderComponentDO> uniqueMap = resultDOList.stream()
.collect(Collectors.toMap(
OrderComponentDO::getId,
Function.identity(),
(a, b) -> a,
LinkedHashMap::new
));
return BeanUtil.copyToList(resultDOList, OrderComponentRespVO.class);
List<OrderComponentDO> 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<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
.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<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
.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();
}
@@ -22,7 +22,7 @@
<select id="getTopComponentListIn"
resultType="com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO">
select distinct p.id, p.name, p.level, p.top_id
select distinct p.id, p.name
from order_component p
join order_component c
on p.id = c.top_id
@@ -19,7 +19,7 @@ veneer.defect.save.id.not.null=veneer id cannot be empty
veneer.classification.name.save.name.not.null=classification name cannot be empty
veneer.classification.name.save.name.length.max=classification name length cannot exceed 64 characters
order.detail.component.list.query.orderId.not.null=order id cannot be empty
order.detail.component.list.query.orderId.not.null=The order id cannot be empty
order.detail.component.list.query.roomIds.max=The list of query order numbers cannot exceed 100
order.detail.component.list.query.bodyIds.max=The cabinet query range cannot exceed 200
order.detail.component.list.query.componentIds.max=The range of component queries cannot exceed 200
@@ -973,6 +973,7 @@ public class WebCadOrderImportAsyncFactory {
.partsId(0L)
.num(1.0)
.organId(organId)
.compId(componentId)
.build();
orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
@@ -1323,6 +1323,7 @@ public class WebCadOrderImportFactory {
.partsId(0L)
.num(1.0)
.organId(organId)
.compId(componentId)
.build();
orderItemDOS.add(orderItemDO);
orderItemBatchInsertWithinThreshold(orderItemDOS, false);