From 3692a20d589aaadf629bc9021efa17aa5793831b Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Thu, 9 Apr 2026 10:38:53 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=89=93=E5=8C=85=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=92=8C=E5=8C=85=E8=A3=B9=E6=98=8E=E7=BB=86=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=88=90=E5=80=8D=E6=95=B0=E9=87=8F=E5=92=8C=E6=88=90=E5=80=8D?= =?UTF-8?q?=E5=BA=8F=E5=8F=B7=EF=BC=9B2=E3=80=81=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=9F=BA=E4=BA=8E?= =?UTF-8?q?=E7=9F=AD=E7=BC=96=E5=8F=B7=E8=8E=B7=E5=8F=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B8=8B=E6=9D=BF=E4=BB=B6=E5=92=8C=E9=85=8D=E4=BB=B6=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E6=8E=A5=E5=8F=A3=EF=BC=9B3=E3=80=81=E5=88=86?= =?UTF-8?q?=E5=A0=86=E6=89=93=E5=8C=85=E5=85=B3=E8=81=94=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=80=BB=E8=BE=91=EF=BC=9A=E9=83=A8=E4=BB=B6?= =?UTF-8?q?=E5=92=8C=E5=8A=A0=E5=B7=A5=E7=BB=84=E7=94=B1=E4=BA=A4=E9=9B=86?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=B9=B6=E9=9B=86=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-local.yaml | 1 + .../manage/pack/vo/OrderPartsRespVO.java | 6 + .../manage/pack/vo/PlateDetailsRespVO.java | 6 + .../query/vo/pack/PackageDetailsRespVO.java | 6 + .../vo/OrderDetailComponentPageReqVO.java | 4 + .../admin/plate/PlateController.java | 8 +- .../vo/OrderWechatMiniProgramDetailReqVO.java | 33 ++++++ .../dal/mysql/orderItem/OrderItemMapper.java | 8 +- .../service/manage/pack/PackServiceImpl.java | 18 +-- .../ordercomponent/OrderComponentService.java | 8 ++ .../OrderComponentServiceImpl.java | 106 +++++++++++++++++- .../service/orderitem/OrderItemService.java | 6 +- .../orderitem/OrderItemServiceImpl.java | 16 +-- .../executor/service/plate/PlateService.java | 9 ++ .../service/plate/PlateServiceImpl.java | 27 +++++ .../src/main/resources/application-local.yaml | 1 + .../mapper/orderItem/OrderItemMapper.xml | 53 ++++++--- .../mapper/orderParts/OrderPartsMapper.xml | 32 ++++-- .../resources/mapper/plate/PlateMapper.xml | 19 +++- 19 files changed, 309 insertions(+), 58 deletions(-) create mode 100644 cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OrderWechatMiniProgramDetailReqVO.java diff --git a/cf-gateway/src/main/resources/application-local.yaml b/cf-gateway/src/main/resources/application-local.yaml index 7986e4bff..85a4bac42 100644 --- a/cf-gateway/src/main/resources/application-local.yaml +++ b/cf-gateway/src/main/resources/application-local.yaml @@ -24,6 +24,7 @@ chenfeng: ignore-token-urls: - /admin-api/executor/plate/wechat/miniprogram/cadview/info/* - /admin-api/executor/plate/wechat/miniprogram/cadview/order/info/* + - /admin-api/executor/plate/wechat/miniprogram/cadview/order/details/* accessLogEnable: false access-log-ignore-urls: - /report/template diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/OrderPartsRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/OrderPartsRespVO.java index 58a472c34..7f095258b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/OrderPartsRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/OrderPartsRespVO.java @@ -111,4 +111,10 @@ public class OrderPartsRespVO { @Schema(description = "打包数量") private BigDecimal packNum; + + @Schema(description = "成倍数量") + private Integer multiNum; + + @Schema(description = "成倍序号") + private Integer multiSort; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/PlateDetailsRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/PlateDetailsRespVO.java index fa374ac86..37d89fbb3 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/PlateDetailsRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/pack/vo/PlateDetailsRespVO.java @@ -165,4 +165,10 @@ public class PlateDetailsRespVO { @Schema(description = "分堆状态,true:已分堆") private Boolean heapSplitStatus; + + @Schema(description = "成倍数量") + private Integer multiNum; + + @Schema(description = "成倍序号") + private Integer multiSort; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/query/vo/pack/PackageDetailsRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/query/vo/pack/PackageDetailsRespVO.java index 38a3fb444..355653cbd 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/query/vo/pack/PackageDetailsRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/manage/query/vo/pack/PackageDetailsRespVO.java @@ -179,4 +179,10 @@ public class PackageDetailsRespVO { @Schema(description = "下封边厚度") private BigDecimal sealDown; + + @Schema(description = "成倍数量") + private Integer multiNum; + + @Schema(description = "成倍序号") + private Integer multiSort; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/ordercomponent/vo/OrderDetailComponentPageReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/ordercomponent/vo/OrderDetailComponentPageReqVO.java index f686b636e..373c6026d 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/ordercomponent/vo/OrderDetailComponentPageReqVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/ordercomponent/vo/OrderDetailComponentPageReqVO.java @@ -35,4 +35,8 @@ public class OrderDetailComponentPageReqVO extends PageParam { @Schema(description = "是否删除", example = "false") private boolean deleted; + + @Schema(description = "柜体编号", example = "[1,2]") + @Size(max = 200, message = "{order.detail.component.list.query.bodyIds.max}") + private Set bodyIds; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java index cb65d28f7..2579b37a9 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/PlateController.java @@ -175,10 +175,10 @@ public class PlateController { return success(plateService.getOrderInfoByPlateNo(plateNo)); } - @PostMapping("/wechat/miniprogram/cadview/order/info/{plateNo:[A-Fa-f0-9]{6}[A-Za-z0-9]{11}}") - @Operation(summary = "微信小程序根据板编号获取单板所属订单信息") + @PostMapping("/wechat/miniprogram/cadview/order/details/{plateNo:[A-Fa-f0-9]{6}[A-Za-z0-9]{11}}") + @Operation(summary = "微信小程序根据板编号获取订单详情") @Parameter(name = "plateNo", description = "板编号", required = true) - public CommonResult getOrderDetailsByPlateNo(@PathVariable String plateNo) { - return success(plateService.getOrderInfoByPlateNo(plateNo)); + public CommonResult getOrderDetailsByPlateNo(@PathVariable String plateNo, @Valid @RequestBody OrderWechatMiniProgramDetailReqVO reqVO) { + return success(plateService.getOrderDetailsByPlateNo(plateNo, reqVO)); } } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OrderWechatMiniProgramDetailReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OrderWechatMiniProgramDetailReqVO.java new file mode 100644 index 000000000..8011cc613 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OrderWechatMiniProgramDetailReqVO.java @@ -0,0 +1,33 @@ +package com.cf.imes.module.executor.controller.admin.plate.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.util.Set; + +/** + * + * + * @author Gqr + * @since 2026/4/8 18:11 + */ +@Schema(description = "管理后台 - 微信小程序 - 订单详情视图查询 Request VO") +@Data +@ToString(callSuper = true) +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class OrderWechatMiniProgramDetailReqVO { + @Schema(description = "部件编号", example = "[1,2]") + @Size(max = 200, message = "{order.detail.component.list.query.componentIds.max}") + private Set componentIds; + + @Schema(description = "柜体编号", example = "[1,2]") + @Size(max = 200, message = "{order.detail.component.list.query.bodyIds.max}") + private Set bodyIds; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java index 0590c42f7..eb8ad7a18 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/orderItem/OrderItemMapper.java @@ -263,18 +263,18 @@ public interface OrderItemMapper extends BaseMapperX { * * @param componentIds * @param orderIds - * @param groupId + * @param groupIds * @return */ - List selectComponentCorrelationPlateIds(@Param("orderIds") List orderIds, @Param("componentIds") List componentIds, @Param("groupId") Long groupId); + List selectComponentCorrelationPlateIds(@Param("orderIds") List orderIds, @Param("componentIds") List componentIds, @Param("groupIds") List groupIds); /** * 查询部件关联的部件ID列表 * * @param componentIds * @param orderIds - * @param groupId + * @param groupIds * @return */ - List selectComponentCorrelationPartsIds(@Param("orderIds") List orderIds, @Param("componentIds") List componentIds, @Param("groupId") Long groupId); + List selectComponentCorrelationPartsIds(@Param("orderIds") List orderIds, @Param("componentIds") List componentIds, @Param("groupIds") List groupIds); } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java index aed0eadb8..288ac29c4 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java @@ -1008,29 +1008,31 @@ public class PackServiceImpl implements PackService { // 没有归属部件返回自己本身 List self = List.of(id); - OrderItemDO itemDO; + List itemDOS; if (com.cf.imes.module.executor.enums.OrderItemTypeEnum.PLATE_ITEM.getStatus().equals(itemType)) { // 板件 PlateDO plate = plateService.getPlateByNo(id, ArrayUtil.toArray(orderIds, Long.class)); AssertUtils.notEmpty(plate, PLATE_NOT_EXISTS); // 查询关联部件id - itemDO = orderItemService.getPlateItemCompId(plate.getId()); + itemDOS = orderItemService.getPlateItemCompId(plate.getId()); } else { // 配件 OrderPartsDO part = orderPartsService.getPart(id); AssertUtils.notEmpty(part, ORDER_PARTS_NOT_EXISTS); // 查询关联部件id - itemDO = orderItemService.getPartItemCompId(id); + itemDOS = orderItemService.getPartItemCompId(id); } - if (ObjectUtil.isNull(itemDO)) { + if (ObjectUtil.isEmpty(itemDOS)) { // 没查到返回自己本身 return self; } List componentIdList; - Long compId = itemDO.getCompId(); - Long groupId = reqVO.isRelateGroup() ? itemDO.getGroupId() : null; + Long compId = itemDOS.get(0).getCompId(); + // 需要关联加工组时,记录所有groupId不为空和0的记录 + List groupIds = reqVO.isRelateGroup() ? + itemDOS.stream().filter(Objects::nonNull).map(OrderItemDO::getGroupId).filter(f -> ObjectUtil.isNotNull(f) && f != 0).distinct().toList() : null; if (PackScanComponentCorrelationTypeEnum.SELF.getType().equals(type)) { // 本身不查部件树 componentIdList = null; @@ -1043,12 +1045,12 @@ public class PackServiceImpl implements PackService { } // 没有归属部件且没有归属加工组返回自己本身 - if (CollUtil.isEmpty(componentIdList) && ObjectUtil.isNull(groupId)) { + if (CollUtil.isEmpty(componentIdList) && CollUtil.isEmpty(groupIds)) { return self; } // 是否勾选了加工组 - List componentIdsCorrelationItemIds = orderItemService.getComponentIdsCorrelationItemIds(orderIds, componentIdList, groupId); + List componentIdsCorrelationItemIds = orderItemService.getComponentIdsCorrelationItemIds(orderIds, componentIdList, groupIds); if (CollUtil.isEmpty(componentIdsCorrelationItemIds)) { return self; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentService.java index 7c3b409ea..70e5ee8bd 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/ordercomponent/OrderComponentService.java @@ -103,4 +103,12 @@ public interface OrderComponentService { * @return */ List getChildComponentIdsOnMyParent(Long id); + + /** + * 查询订单下板件+配件详情 + * + * @param pageReqVO 房间id列表+部件id列表 + * @return + */ + OrdersViewCadViewInfoRespVO getOrderViewCadInfo(OrderDetailComponentPageReqVO pageReqVO); } \ No newline at end of file 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 5a810fc9d..3164c1095 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 @@ -2,6 +2,7 @@ package com.cf.imes.module.executor.service.ordercomponent; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -50,6 +51,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Deque; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; @@ -58,6 +60,7 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; +import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_BODY_NOT_EXISTS; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_DELETE_PLATE_IN_PLAN; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NOT_EXIST; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NO_NEED_TO_RESTORE; @@ -353,7 +356,7 @@ public class OrderComponentServiceImpl implements OrderComponentService { List partRecords = viewPartsPage.getRecords(); List partResult = new ArrayList<>(); - if (CollUtil.isNotEmpty(plateRecords)) { + if (CollUtil.isNotEmpty(partRecords)) { partResult = partRecords.stream().map(item -> { OrderViewPartPageRespVO vo = new OrderViewPartPageRespVO(); BeanUtil.copyProperties(item, vo); @@ -700,6 +703,10 @@ public class OrderComponentServiceImpl implements OrderComponentService { List result = new ArrayList<>(); OrderComponentDO componentDO = orderComponentMapper.selectById(id); if (ObjectUtil.isNotNull(componentDO)) { + OrderComponentDO parentComponentDO = orderComponentMapper.selectById(componentDO.getPid()); + if (ObjectUtil.isNull(parentComponentDO)) { + return result; + } // 查询顶级下所有部件 List componentListOnTop = orderComponentMapper.selectList(new LambdaQueryWrapperX() .eq(OrderComponentDO::getTopId, componentDO.getTopId()) @@ -707,8 +714,103 @@ public class OrderComponentServiceImpl implements OrderComponentService { .select(OrderComponentDO::getId, OrderComponentDO::getPid) ); - return getChildrenIds(componentDO, componentListOnTop).stream().toList(); + return getChildrenIds(parentComponentDO, componentListOnTop).stream().toList(); } return result; } + + @Override + public OrdersViewCadViewInfoRespVO getOrderViewCadInfo(OrderDetailComponentPageReqVO pageReqVO) { + OrdersViewCadViewInfoRespVO ordersViewCadViewInfoRespVO = new OrdersViewCadViewInfoRespVO(); + Long orderId = pageReqVO.getOrderId(); + + boolean useBodyKey = true; + // cad图纸id对应map + Map cadViewFileIdMap = new HashMap<>(); + Set bodyIds = pageReqVO.getBodyIds(); + if(CollUtil.isNotEmpty(bodyIds)) { + List orderBodyDOList = orderBodyMapper.selectByIds(bodyIds); + if (CollUtil.isEmpty(orderBodyDOList)) { + throw new ServiceException(ORDER_BODY_NOT_EXISTS); + } + + // 整理出body_id和cad图纸id的关系 + cadViewFileIdMap = orderBodyDOList.stream() + .filter(item -> item.getCadViewFileId() != null) + .collect(Collectors.toMap(OrderBodyDO::getId, OrderBodyDO::getCadViewFileId)); + } + + + Set componentIds = pageReqVO.getComponentIds(); + // 要查询的部件id列表 + Set queryComponentIds = new HashSet<>(); + if(CollUtil.isNotEmpty(componentIds)) { + // 1、查询顶级 + List componentDOS = orderComponentMapper.selectByIds(componentIds); + if (CollUtil.isEmpty(componentDOS) || componentDOS.size() != componentIds.size()) { + throw new ServiceException(ORDER_COMPONENT_NOT_EXIST); + } + List topIds = componentDOS.stream() + .map(OrderComponentDO::getTopId) + .toList(); + + // 2、把下级部件id作为查询条件 + List orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX() + .in(OrderComponentDO::getTopId, topIds) + .eq(OrderComponentDO::getOrderId, orderId) + .eqIfPresent(OrderComponentDO::getDeleted, pageReqVO.isDeleted()) + .select(OrderComponentDO::getId, OrderComponentDO::getCadViewFileId, OrderComponentDO::getPid)); + if (CollUtil.isNotEmpty(orderComponentDOS)) { + for (OrderComponentDO co : componentDOS) { + queryComponentIds.addAll(getChildrenIds(co, orderComponentDOS)); + } + } else { + return ordersViewCadViewInfoRespVO; + } + // 有柜体图纸对应关系就不用部件的了 + if (MapUtil.isEmpty(cadViewFileIdMap)) { + useBodyKey = false; + // 整理出id和cadViewFileId的对应关系 + cadViewFileIdMap = orderComponentDOS.stream() + .filter(item -> item.getCadViewFileId() != null) + .collect(Collectors.toMap(OrderComponentDO::getId, OrderComponentDO::getCadViewFileId)); + } + } + + // 查询所有板件的视图所需信息 + PageDTO page1 = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE); + IPage viewPlatesPage = orderItemMapper.selectOrdersViewPlatesPage(page1, List.of(orderId), bodyIds, + null, queryComponentIds, true); + List plateRecords = viewPlatesPage.getRecords(); + + List plateResult = new ArrayList<>(); + if (CollUtil.isNotEmpty(plateRecords)) { + for (OrdersViewPlatesPageDO plateRecord : plateRecords) { + OrderViewPlatePageRespVO vo = new OrderViewPlatePageRespVO(); + BeanUtil.copyProperties(plateRecord, vo); + vo.setCadViewFileId(cadViewFileIdMap.get(useBodyKey ? plateRecord.getBodyId() : plateRecord.getCompId())); + plateResult.add(vo); + } + } + + // 查询所有配件的视图所需信息 + PageDTO page2 = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE); + IPage viewPartsPage = orderItemMapper.selectOrdersViewPartsPage(page2, List.of(orderId), bodyIds, + null, queryComponentIds, null, true); + List partRecords = viewPartsPage.getRecords(); + + List partResult = new ArrayList<>(); + if (CollUtil.isNotEmpty(partRecords)) { + for (OrdersViewPartsPageDO partRecord : partRecords) { + OrderViewPartPageRespVO vo = new OrderViewPartPageRespVO(); + BeanUtil.copyProperties(partRecord, vo); + vo.setCadViewFileId(cadViewFileIdMap.get(useBodyKey ? partRecord.getBodyId() : partRecord.getCompId())); + partResult.add(vo); + } + } + + ordersViewCadViewInfoRespVO.setPlates(plateResult); + ordersViewCadViewInfoRespVO.setParts(partResult); + return ordersViewCadViewInfoRespVO; + } } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemService.java index 7e6c705b2..d297ca6a2 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemService.java @@ -18,7 +18,7 @@ public interface OrderItemService { * @param plateId * @return */ - OrderItemDO getPlateItemCompId(Long plateId); + List getPlateItemCompId(Long plateId); /** * 查询配件订单明细关联的部件id @@ -26,7 +26,7 @@ public interface OrderItemService { * @param partId * @return */ - OrderItemDO getPartItemCompId(Long partId); + List getPartItemCompId(Long partId); /** * @@ -34,5 +34,5 @@ public interface OrderItemService { * @param orderIds * @return */ - List getComponentIdsCorrelationItemIds(List orderIds, List componentIds, Long groupId); + List getComponentIdsCorrelationItemIds(List orderIds, List componentIds, List groupIds); } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemServiceImpl.java index 6df9a760f..dc11a702b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderitem/OrderItemServiceImpl.java @@ -22,36 +22,36 @@ public class OrderItemServiceImpl implements OrderItemService { private OrderItemMapper orderItemMapper; @Override - public OrderItemDO getPlateItemCompId(Long id) { + public List getPlateItemCompId(Long id) { List plateItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper() .eq(OrderItemDO::getPlateId, id) .select(OrderItemDO::getCompId, OrderItemDO::getGroupId)); if (CollUtil.isNotEmpty(plateItemDOS)) { - return plateItemDOS.get(0); + return plateItemDOS; } return null; } @Override - public OrderItemDO getPartItemCompId(Long partId) { + public List getPartItemCompId(Long partId) { List partItemDOS = orderItemMapper.selectList(new LambdaQueryWrapper() .eq(OrderItemDO::getPartsId, partId) .select(OrderItemDO::getCompId, OrderItemDO::getGroupId)); if (CollUtil.isNotEmpty(partItemDOS)) { - return partItemDOS.get(0); + return partItemDOS; } return null; } @Override - public List getComponentIdsCorrelationItemIds(List orderIds, List componentIds, Long groupId) { + public List getComponentIdsCorrelationItemIds(List orderIds, List componentIds, List groupIds) { List resultList = new ArrayList<>(); - if (CollUtil.isEmpty(componentIds)) { + if (CollUtil.isEmpty(componentIds) && CollUtil.isEmpty(groupIds)) { return resultList; } // 查询关联的板件和配件id - resultList.addAll(orderItemMapper.selectComponentCorrelationPlateIds(orderIds, componentIds, groupId)); - resultList.addAll(orderItemMapper.selectComponentCorrelationPartsIds(orderIds, componentIds, groupId)); + resultList.addAll(orderItemMapper.selectComponentCorrelationPlateIds(orderIds, componentIds, groupIds)); + resultList.addAll(orderItemMapper.selectComponentCorrelationPartsIds(orderIds, componentIds, groupIds)); return resultList; } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java index 63ff252c7..aafd649ed 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateService.java @@ -162,4 +162,13 @@ public interface PlateService { * @return */ OrderWechatMiniProgramCadInfoRespVO getOrderInfoByPlateNo(String plateNo); + + /** + * 根据板编号获取订单详情 + * + * @param plateNo + * @param reqVO + * @return + */ + OrdersViewCadViewInfoRespVO getOrderDetailsByPlateNo(String plateNo, OrderWechatMiniProgramDetailReqVO reqVO); } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java index 9d9aa2008..b4b23e8ef 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java @@ -23,11 +23,13 @@ import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX; import com.cf.imes.framework.mybatis.core.query.QueryWrapperX; +import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsSaveReqVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderCadViewPlatePageReqVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderRespVO; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrdersViewCadViewInfoRespVO; +import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentPageReqVO; import com.cf.imes.module.executor.controller.admin.plan.vo.OrderGoodsResp; import com.cf.imes.module.executor.controller.admin.plan.vo.PlateResList; import com.cf.imes.module.executor.controller.admin.plate.vo.*; @@ -1081,4 +1083,29 @@ public class PlateServiceImpl implements PlateService { result.setOrderComponentList(orderComponentService.getOrderComponentListOnOrders(List.of(orderId), organIdLong)); return result; } + + @Override + public OrdersViewCadViewInfoRespVO getOrderDetailsByPlateNo(String plateNo, OrderWechatMiniProgramDetailReqVO reqVO) { + // 1、解析组织id,查询板件信息 + Integer organId = Integer.parseInt(plateNo.substring(0, 6), 16); + Long organIdLong = organId.longValue(); + organApi.validOrgan(organId.longValue()).checkError(); + + OrganContextHolder.setIgnore(false); + OrganContextHolder.setOrganId(organIdLong); + + PlateDO plateDO = plateMapper.selectOne(new LambdaQueryWrapper() + .eq(PlateDO::getOrganId, organIdLong) + .eq(PlateDO::getPlateNo, plateNo.substring(6))); + + if (ObjectUtil.isNull(plateDO)) { + throw new ServiceException(PLATE_NOT_EXISTS); + } + + OrderDetailComponentPageReqVO detailReqVO = new OrderDetailComponentPageReqVO(); + detailReqVO.setOrderId(plateDO.getOrderId()); + detailReqVO.setComponentIds(reqVO.getComponentIds()); + detailReqVO.setBodyIds(reqVO.getBodyIds()); + return orderComponentService.getOrderViewCadInfo(detailReqVO); + } } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml index aa9e4df38..d21d1d70b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/application-local.yaml @@ -188,6 +188,7 @@ chenfeng: - /rpc-api/** - /admin-api/executor/plate/wechat/miniprogram/cadview/info/* - /admin-api/executor/plate/wechat/miniprogram/cadview/order/info/* + - /admin-api/executor/plate/wechat/miniprogram/cadview/order/details/* ignore-tables: env: # 多环境的配置项 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml index 526532a82..3d09ccf04 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml @@ -703,20 +703,30 @@ AND op.order_id = oi.order_id AND op.deleted = 0 WHERE oi.plate_id != 0 - - and oi.comp_id in - - #{componentId} - - AND oi.order_id IN #{orderId} - - AND oi.group_id = #{groupId} + + AND ( + + oi.comp_id IN + + #{componentId} + + + + OR + + + oi.group_id IN + + #{groupId} + + + ) @@ -724,20 +734,31 @@ SELECT oi.parts_id FROM order_item oi WHERE oi.parts_id != 0 - - AND oi.comp_id IN - - #{componentId} - - AND oi.order_id IN #{orderId} - - AND oi.group_id = #{groupId} + + AND ( + + oi.comp_id IN + + #{componentId} + + + + + OR + + + oi.group_id IN + + #{groupId} + + + ) AND EXISTS ( SELECT 1 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderParts/OrderPartsMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderParts/OrderPartsMapper.xml index 2e986a501..1e2f41606 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderParts/OrderPartsMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderParts/OrderPartsMapper.xml @@ -289,6 +289,9 @@ + + + + + @@ -847,6 +848,8 @@ t.body_name AS bodyName, t.room_id AS roomId, t.body_id AS bodyId, + t.multi_num AS multiNum, + t.multi_sort AS multiSort, op.id AS plateId, op.plate_no AS plateNo, op.custom_plate_no AS customPlateNo, @@ -889,7 +892,9 @@ GROUP_CONCAT(og.name SEPARATOR ',') AS group_names,-- 聚合加工组 MIN(oc.name) AS component_names, MIN(ob.room_name) AS room_name, - MIN(ob.name) AS body_name + MIN(ob.name) AS body_name, + MIN(ob.multi_num) AS multi_num, + MIN(ob.sort) AS multi_sort FROM order_item oi LEFT JOIN order_group og ON oi.organ_id = og.organ_id @@ -926,6 +931,8 @@ t.body_name AS bodyName, t.room_id AS roomId, t.body_id AS bodyId, + t.multi_num AS multiNum, + t.multi_sort AS multiSort, op.id AS plateId, op.plate_no AS plateNo, op.custom_plate_no AS customPlateNo, @@ -969,7 +976,9 @@ GROUP_CONCAT(og.name SEPARATOR ',') AS group_names,-- 聚合加工组 MIN(oc.name) AS component_names, MIN(ob.room_name) AS room_name, - MIN(ob.name) AS body_name + MIN(ob.name) AS body_name, + MIN(ob.multi_num) AS multi_num, + MIN(ob.sort) AS multi_sort FROM order_item oi LEFT JOIN order_group og ON oi.organ_id = og.organ_id @@ -1221,6 +1230,8 @@ + + \ No newline at end of file