mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
webcad拆单对图纸id为空的校验优化
This commit is contained in:
+25
-2
@@ -134,7 +134,13 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
@Override
|
||||
public List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO) {
|
||||
Set<Long> componentIds = reqVO.getComponentIds();
|
||||
if(CollUtil.isEmpty(componentIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 校验订单
|
||||
Long orderId = reqVO.getOrderId();
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
AssertUtils.notEmpty(orderDO,ORDER_NOT_EXISTS);
|
||||
|
||||
// 1、查询部件
|
||||
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
||||
@@ -172,7 +178,13 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
@Override
|
||||
public PageResult<OrderViewPlatePageRespVO> getViewComponentPage(OrderDetailComponentPageReqVO pageReqVO) {
|
||||
Set<Long> componentIds = pageReqVO.getComponentIds();
|
||||
if (CollUtil.isEmpty(componentIds)) {
|
||||
return new PageResult<>(Collections.emptyList(), 0L);
|
||||
}
|
||||
// 校验订单
|
||||
Long orderId = pageReqVO.getOrderId();
|
||||
OrderDO orderDO = orderMapper.selectById(orderId);
|
||||
AssertUtils.notEmpty(orderDO,ORDER_NOT_EXISTS);
|
||||
|
||||
// 1、查询顶级
|
||||
List<OrderComponentDO> componentDOS = orderComponentMapper.selectByIds(componentIds);
|
||||
@@ -248,15 +260,26 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 整理出id和cadViewFileId的对应关系
|
||||
Map<Long, Long> cadViewFileIdMap = orderComponentDOS.stream()
|
||||
.collect(Collectors.toMap(OrderComponentDO::getId, OrderComponentDO::getCadViewFileId));
|
||||
|
||||
// 查询所有板件的视图所需信息
|
||||
PageDTO<OrderBodyViewPlatesPageDO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
|
||||
IPage<OrderBodyViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
||||
null, componentIds, true);
|
||||
List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords();
|
||||
long total = viewPlatesPage.getTotal();
|
||||
|
||||
List<OrderViewPlatePageRespVO> resultList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
resultList = BeanUtil.copyToList(records, OrderViewPlatePageRespVO.class);
|
||||
if(total > 0) {
|
||||
resultList = records.stream().map(item -> {
|
||||
OrderViewPlatePageRespVO vo = new OrderViewPlatePageRespVO();
|
||||
BeanUtil.copyProperties(item, vo);
|
||||
|
||||
vo.setCadViewFileId(cadViewFileIdMap.get(item.getCompId()));
|
||||
return vo;
|
||||
}).toList();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user