mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、新增cad同步异步拆单接入部件;2、新增订单详情部件列表、cad视图列表、部件板件分页、部件cad板件列表接口;
This commit is contained in:
-4
@@ -1,6 +1,5 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -26,7 +25,4 @@ public class OrderModuleDetailRespVO {
|
||||
|
||||
@Schema(description = "组件列表")
|
||||
private List<OrderPlatesDetailRespVO> component;
|
||||
|
||||
@Schema(description = "部件列表")
|
||||
private List<OrderComponentRespVO> section;
|
||||
}
|
||||
|
||||
+34
-6
@@ -1,15 +1,24 @@
|
||||
package com.cf.imes.module.executor.controller.admin.ordercomponent;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.OrderViewPlatePageRespVO;
|
||||
import com.cf.imes.module.executor.service.ordercomponent.OrderComponentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
@@ -21,13 +30,32 @@ import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
@Tag(name = "管理后台 - 生产单部件管理")
|
||||
@RestController
|
||||
@RequestMapping("/executor/order/component")
|
||||
@Validated
|
||||
public class OrderComponentController {
|
||||
@Resource
|
||||
private OrderComponentService orderComponentService;
|
||||
|
||||
@GetMapping("/tree/{componentId}")
|
||||
@Operation(summary = "生产单详情部件树查询")
|
||||
public CommonResult<Object> getTree(@PathVariable Long componentId) {
|
||||
return success(orderComponentService.getOrderDetailComponentTree(componentId));
|
||||
@PostMapping("/detail/list")
|
||||
@Operation(summary = "查询订单详情部件列表")
|
||||
public CommonResult<List<OrderComponentRespVO>> getOrderComponentList(@Valid @RequestBody OrderDetailComponentListReqVO reqVO) {
|
||||
return success(orderComponentService.getOrderComponentList(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/view/list")
|
||||
@Operation(summary = "查询订单详情cad视图部件列表")
|
||||
public CommonResult<List<OrderComponentRespVO>> getOrderViewComponentList(@Valid @RequestBody OrderDetailComponentListReqVO reqVO) {
|
||||
return success(orderComponentService.getComponentListOnTopId(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/view/plate/page")
|
||||
@Operation(summary = "获取部件下的板件视图分页列表数据")
|
||||
public CommonResult<PageResult<OrderViewPlatePageRespVO>> getComponentViewPlatesPage(@Valid @RequestBody OrderDetailComponentPageReqVO pageReqVO) {
|
||||
return success(orderComponentService.getViewComponentPage(pageReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/view/plate/cadinfo")
|
||||
@Operation(summary = "获取部件下的所有板件视图列表数据")
|
||||
public CommonResult<List<OrderViewPlatePageRespVO>> getComponentViewPlates(@Valid @RequestBody OrderDetailComponentPageReqVO pageReqVO) {
|
||||
return success(orderComponentService.getViewComponentPlatesCadInfo(pageReqVO));
|
||||
}
|
||||
}
|
||||
|
||||
+10
-12
@@ -1,24 +1,22 @@
|
||||
package com.cf.imes.module.executor.controller.admin.ordercomponent.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单部件列表 order component Response VO")
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class OrderComponentRespVO {
|
||||
@Schema(description = "父ID")
|
||||
private Long pid;
|
||||
|
||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230414026120")
|
||||
private Long orderId;
|
||||
@Schema(description = "部件Id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "房间Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long roomId;
|
||||
@Schema(description = "部件名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "柜体Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long bodyId;
|
||||
|
||||
@Schema(description = "部件Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "部件名", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String componentName;
|
||||
@Schema(description = "cad图纸数据文件id")
|
||||
private Long cadViewFileId;
|
||||
}
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.cf.imes.module.executor.controller.admin.ordercomponent.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
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/2/2 11:34
|
||||
*/
|
||||
@Schema(description = "管理后台 - 订单详情部件列表查询 Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderDetailComponentListReqVO {
|
||||
@Schema(description = "订单编号", example = "1")
|
||||
@NotNull(message = "{order.detail.component.list.query.orderId.not.null}")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "房间编号", example = "[1,2]")
|
||||
@Size(max = 200, message = "{order.detail.component.list.query.roomIds.max}")
|
||||
private Set<Long> roomIds;
|
||||
|
||||
@Schema(description = "柜体编号", example = "[1,2]")
|
||||
@Size(max = 200, message = "{order.detail.component.list.query.bodyIds.max}")
|
||||
private Set<Long> bodyIds;
|
||||
|
||||
@Schema(description = "部件编号", example = "[1,2]")
|
||||
@Size(max = 200, message = "{order.detail.component.list.query.componentIds.max}")
|
||||
private Set<Long> componentIds;
|
||||
|
||||
@Schema(description = "部件编号", example = "1")
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "部件名称", example = "部件")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "是否删除", example = "false")
|
||||
private boolean deleted;
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.cf.imes.module.executor.controller.admin.ordercomponent.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
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/2/2 11:34
|
||||
*/
|
||||
@Schema(description = "管理后台 - 订单详情部件视图分页查询 Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrderDetailComponentPageReqVO extends PageParam {
|
||||
@Schema(description = "订单编号", example = "1")
|
||||
@NotNull(message = "{order.detail.component.list.query.orderId.not.null}")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "部件编号", example = "[1,2]")
|
||||
@Size(max = 200, message = "{order.detail.component.list.query.componentIds.max}")
|
||||
private Set<Long> componentIds;
|
||||
|
||||
@Schema(description = "部件编号", example = "1")
|
||||
@NotNull(message = "{order.detail.component.plate.page.query.componentId.not.null}")
|
||||
private Long componentId;
|
||||
|
||||
@Schema(description = "是否删除", example = "false")
|
||||
private boolean deleted;
|
||||
}
|
||||
+15
@@ -59,6 +59,16 @@ public class OrderComponentDO extends BaseDO {
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 顶级id
|
||||
*/
|
||||
private Long topId;
|
||||
|
||||
/**
|
||||
* 层级,顶级为0
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* 部件名称
|
||||
*/
|
||||
@@ -93,4 +103,9 @@ public class OrderComponentDO extends BaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 加工状态
|
||||
*/
|
||||
private Integer processStatus;
|
||||
}
|
||||
|
||||
+1
-1
@@ -202,6 +202,6 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
||||
@Param("bodyId") Long bodyId,
|
||||
@Param("groupId") Long groupId,
|
||||
@Param("organId") Long organId,
|
||||
@Param("componentId") Long componentId,
|
||||
@Param("componentIds") Set<Long> componentIds,
|
||||
@Param("cadView") boolean cadView);
|
||||
}
|
||||
+11
-2
@@ -1,11 +1,13 @@
|
||||
package com.cf.imes.module.executor.dal.mysql.ordercomponent;
|
||||
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 部件 Mapper
|
||||
@@ -19,8 +21,15 @@ public interface OrderComponentMapper extends BaseMapperX<OrderComponentDO> {
|
||||
/**
|
||||
* 订单详情部件列表查询
|
||||
*
|
||||
* @param orderId 生产单id
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderComponentDO> getOrderDetailComponentList(@Param("orderId") Long orderId);
|
||||
Set<Long> getOrderDetailComponentIds(@Param("reqVO") OrderDetailComponentListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 查询id列表中每个节点上同一棵树的所有父级
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<OrderComponentDO> getTopComponentListIn(@Param("ids") List<Long> ids);
|
||||
}
|
||||
+1
-2
@@ -17,8 +17,7 @@ import java.util.Arrays;
|
||||
public enum OrderCadViewPlateRangeEnum implements IntArrayValuable {
|
||||
BODY(0),
|
||||
GROUP(1),
|
||||
GROUP_WITH_BODY(2),
|
||||
COMPONENT(3);
|
||||
GROUP_WITH_BODY(2);
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderCadViewPlateRangeEnum::getRange).toArray();
|
||||
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.cf.imes.module.executor.enums.ordercomponent;
|
||||
|
||||
import com.cf.imes.framework.common.core.IntArrayValuable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 部件加工状态枚举
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2026/1/29 11:03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum OrderComponentProcessStatusEnum implements IntArrayValuable {
|
||||
NOT_PROCESS(0),
|
||||
UNPROCESSED(1),
|
||||
PROCESSED(2);
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderComponentProcessStatusEnum::getStatus).toArray();
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
private final Integer status;
|
||||
}
|
||||
-1
@@ -302,7 +302,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
orderModuleDetailRespVO.setParts(orderItemDOS);
|
||||
orderModuleDetailRespVO.setGoods(orderGoodsRespVOS);
|
||||
orderModuleDetailRespVO.setComponent(orderComponentRespVOS);
|
||||
orderModuleDetailRespVO.setSection(orderComponentService.getOrderComponentList(orderId));
|
||||
return orderModuleDetailRespVO;
|
||||
}
|
||||
|
||||
|
||||
+23
-5
@@ -1,7 +1,10 @@
|
||||
package com.cf.imes.module.executor.service.ordercomponent;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentTreeRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.OrderViewPlatePageRespVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,15 +18,30 @@ public interface OrderComponentService {
|
||||
/**
|
||||
* 查询订单部件列表
|
||||
*
|
||||
* @param orderId 生产单id
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderComponentRespVO> getOrderComponentList(Long orderId);
|
||||
List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 查询部件树
|
||||
* 获取节点的顶级节点下所有节点
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderComponentTreeRespVO> getOrderDetailComponentTree(Long componentId);
|
||||
List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获取部件下板件视图分页列表
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
PageResult<OrderViewPlatePageRespVO> getViewComponentPage(OrderDetailComponentPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获取部件和下级所有的板件视图列表
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<OrderViewPlatePageRespVO> getViewComponentPlatesCadInfo(OrderDetailComponentPageReqVO reqVO);
|
||||
}
|
||||
+128
-95
@@ -1,12 +1,21 @@
|
||||
package com.cf.imes.module.executor.service.ordercomponent;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.cf.imes.framework.common.exception.ServiceException;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderComponentTreeRespVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentListReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.ordercomponent.vo.OrderDetailComponentPageReqVO;
|
||||
import com.cf.imes.module.executor.controller.admin.plate.vo.OrderViewPlatePageRespVO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||
import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderBodyViewPlatesPageDO;
|
||||
import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper;
|
||||
import com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -14,13 +23,12 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO.PARENT_ID_ROOT;
|
||||
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
|
||||
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NOT_EXIST;
|
||||
|
||||
/**
|
||||
@@ -35,118 +43,143 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
||||
@Resource
|
||||
private OrderComponentMapper orderComponentMapper;
|
||||
|
||||
@Resource
|
||||
private OrderItemMapper orderItemMapper;
|
||||
|
||||
@Override
|
||||
public List<OrderComponentRespVO> getOrderComponentList(Long orderId) {
|
||||
public List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO) {
|
||||
List<OrderComponentRespVO> resultList = new ArrayList<>();
|
||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.getOrderDetailComponentList(orderId);
|
||||
if (CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
for (OrderComponentDO componentDO : orderComponentDOS) {
|
||||
OrderComponentRespVO orderComponentRespVO = new OrderComponentRespVO();
|
||||
orderComponentRespVO.setOrderId(orderId);
|
||||
orderComponentRespVO.setRoomId(componentDO.getRoomId());
|
||||
orderComponentRespVO.setBodyId(componentDO.getBodyId());
|
||||
orderComponentRespVO.setComponentId(componentDO.getId());
|
||||
orderComponentRespVO.setComponentName(componentDO.getName());
|
||||
resultList.add(orderComponentRespVO);
|
||||
// 查询所有满足条件的部件id
|
||||
Set<Long> orderDetailComponentIds = orderComponentMapper.getOrderDetailComponentIds(reqVO);
|
||||
if (CollUtil.isEmpty(orderDetailComponentIds)) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
// 拆分每500条查询一次
|
||||
List<OrderComponentDO> resultDOList = new ArrayList<>();
|
||||
List<List<Long>> partitions = CollUtil.split(orderDetailComponentIds, 500);
|
||||
for (List<Long> partIds : partitions) {
|
||||
// 根据部件id查询顶级节点
|
||||
List<OrderComponentDO> topComponentList = orderComponentMapper.getTopComponentListIn(partIds);
|
||||
if (CollUtil.isNotEmpty(topComponentList)) {
|
||||
resultDOList.addAll(topComponentList);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
|
||||
// 结果根据topid
|
||||
resultDOList.sort(Comparator
|
||||
.comparing(OrderComponentDO::getTopId));
|
||||
|
||||
return BeanUtil.copyToList(resultDOList, OrderComponentRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderComponentTreeRespVO> getOrderDetailComponentTree(Long componentId) {
|
||||
// 1. 查询本身和所有非顶级节点
|
||||
public List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO) {
|
||||
Long componentId = reqVO.getComponentId();
|
||||
Long orderId = reqVO.getOrderId();
|
||||
|
||||
// 1、查询部件
|
||||
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
||||
if (ObjectUtil.isNull(componentDO)) {
|
||||
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||
}
|
||||
|
||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(
|
||||
new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.and(wr ->
|
||||
wr.or(wrapper -> wrapper.ne(OrderComponentDO::getPid, PARENT_ID_ROOT))
|
||||
.or(wrapper -> wrapper.eq(OrderComponentDO::getId, componentId)))
|
||||
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName));
|
||||
// 2、根据部件的topid查询树上所有节点
|
||||
List<OrderComponentDO> topComponentList = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||
.eq(OrderComponentDO::getOrganId, componentDO.getOrganId())
|
||||
.eq(OrderComponentDO::getOrderId, orderId)
|
||||
.eqIfPresent(OrderComponentDO::getDeleted, reqVO.isDeleted())
|
||||
.likeIfPresent(OrderComponentDO::getName, reqVO.getName())
|
||||
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName, OrderComponentDO::getCadViewFileId));
|
||||
|
||||
// 2. 如果 DB 本身就没数据,直接返回 componentId 本身
|
||||
if (orderComponentDOS.isEmpty()) {
|
||||
return Collections.singletonList(buildSelfNode(componentDO));
|
||||
return BeanUtil.copyToList(topComponentList, OrderComponentRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderViewPlatePageRespVO> getViewComponentPage(OrderDetailComponentPageReqVO pageReqVO) {
|
||||
Set<Long> componentIds = pageReqVO.getComponentIds();
|
||||
Long componentId = pageReqVO.getComponentId();
|
||||
Long orderId = pageReqVO.getOrderId();
|
||||
|
||||
// 1、查询顶级
|
||||
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
||||
if (ObjectUtil.isNull(componentDO)) {
|
||||
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||
}
|
||||
|
||||
// 3. DO -> Tree VO
|
||||
Map<Long, OrderComponentTreeRespVO> nodeMap = new HashMap<>(orderComponentDOS.size());
|
||||
for (OrderComponentDO doObj : orderComponentDOS) {
|
||||
OrderComponentTreeRespVO vo = new OrderComponentTreeRespVO();
|
||||
vo.setId(doObj.getId());
|
||||
vo.setPid(doObj.getPid());
|
||||
vo.setName(doObj.getName());
|
||||
vo.setChildren(new ArrayList<>());
|
||||
nodeMap.put(vo.getId(), vo);
|
||||
}
|
||||
|
||||
// 4. 建立父子关系
|
||||
for (OrderComponentTreeRespVO node : nodeMap.values()) {
|
||||
OrderComponentTreeRespVO parent = nodeMap.get(node.getPid());
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
if(CollUtil.isEmpty(componentIds)) {
|
||||
// 2、把下级部门id做成集合
|
||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||
.eq(OrderComponentDO::getOrganId, componentDO.getOrganId())
|
||||
.eq(OrderComponentDO::getOrderId, orderId)
|
||||
.eqIfPresent(OrderComponentDO::getDeleted, pageReqVO.isDeleted())
|
||||
.select(OrderComponentDO::getId));
|
||||
if(CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
componentIds = orderComponentDOS.stream().map(OrderComponentDO::getId).collect(Collectors.toSet());
|
||||
} else {
|
||||
return new PageResult<>();
|
||||
}
|
||||
} else {
|
||||
// 3、使用入参的部件id集合
|
||||
componentIds = pageReqVO.getComponentIds();
|
||||
}
|
||||
|
||||
// 5. 尝试找到 componentId 对应的节点
|
||||
OrderComponentTreeRespVO root = nodeMap.get(componentId);
|
||||
|
||||
// 6. 找不到节点:只返回 componentId 自身
|
||||
if (root == null) {
|
||||
return Collections.singletonList(buildSelfNode(componentDO));
|
||||
}
|
||||
|
||||
// 7. 找到节点但没有下级:只返回自己
|
||||
if (root.getChildren().isEmpty()) {
|
||||
return Collections.singletonList(buildSelfNode(componentDO));
|
||||
}
|
||||
|
||||
// 8. 正常情况:返回 componentId + 子树
|
||||
pruneTree(root, new HashSet<>());
|
||||
return Collections.singletonList(root);
|
||||
// 分页查询板件
|
||||
PageDTO<OrderComponentRespVO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
||||
null, null, getUserOrganId(), componentIds, false);
|
||||
return new PageResult<>(BeanUtil.copyToList(pageRes.getRecords(), OrderViewPlatePageRespVO.class), pageRes.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理可能存在的重复子节点
|
||||
*
|
||||
* @param node 顶级节点
|
||||
* @param path 记录已经访问过的节点
|
||||
*/
|
||||
private void pruneTree(OrderComponentTreeRespVO node, Set<Long> path) {
|
||||
// 防止 pid 循环
|
||||
if (!path.add(node.getId())) {
|
||||
node.getChildren().clear();
|
||||
return;
|
||||
@Override
|
||||
public List<OrderViewPlatePageRespVO> getViewComponentPlatesCadInfo(OrderDetailComponentPageReqVO pageReqVO) {
|
||||
Set<Long> componentIds = pageReqVO.getComponentIds();
|
||||
Long componentId = pageReqVO.getComponentId();
|
||||
Long orderId = pageReqVO.getOrderId();
|
||||
|
||||
// 1、查询顶级
|
||||
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
||||
if (ObjectUtil.isNull(componentDO)) {
|
||||
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||
}
|
||||
Long cadViewFileId = componentDO.getCadViewFileId();
|
||||
|
||||
if(CollUtil.isEmpty(componentIds)) {
|
||||
// 2、把下级部门id做成集合
|
||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||
.eq(OrderComponentDO::getOrganId, componentDO.getOrganId())
|
||||
.eq(OrderComponentDO::getOrderId, orderId)
|
||||
.eqIfPresent(OrderComponentDO::getDeleted, pageReqVO.isDeleted())
|
||||
.select(OrderComponentDO::getId));
|
||||
if(CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||
componentIds = orderComponentDOS.stream().map(OrderComponentDO::getId).collect(Collectors.toSet());
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
} else {
|
||||
// 3、使用入参的部件id集合
|
||||
componentIds = pageReqVO.getComponentIds();
|
||||
}
|
||||
|
||||
List<OrderComponentTreeRespVO> children = node.getChildren();
|
||||
if (children == null || children.isEmpty()) {
|
||||
return;
|
||||
// 查询所有板件的视图所需信息
|
||||
PageDTO<OrderViewPlatePageRespVO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
|
||||
IPage<OrderBodyViewPlatesPageDO> viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
||||
null, null, getUserOrganId(), componentIds, true);
|
||||
List<OrderBodyViewPlatesPageDO> records = viewPlatesPage.getRecords();
|
||||
|
||||
List<OrderViewPlatePageRespVO> resultList = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
resultList = records.stream().map(item -> {
|
||||
OrderViewPlatePageRespVO vo = new OrderViewPlatePageRespVO();
|
||||
BeanUtil.copyProperties(item, vo);
|
||||
|
||||
vo.setCadViewFileId(cadViewFileId);
|
||||
return vo;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
for (OrderComponentTreeRespVO child : children) {
|
||||
pruneTree(child, path);
|
||||
}
|
||||
|
||||
path.remove(node.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建部件自身的顶级树节点
|
||||
*
|
||||
* @param componentDO
|
||||
* @return
|
||||
*/
|
||||
private OrderComponentTreeRespVO buildSelfNode(OrderComponentDO componentDO) {
|
||||
OrderComponentTreeRespVO vo = new OrderComponentTreeRespVO();
|
||||
vo.setId(componentDO.getId());
|
||||
vo.setPid(PARENT_ID_ROOT);
|
||||
vo.setName(componentDO.getName());
|
||||
vo.setChildren(Collections.emptyList());
|
||||
return vo;
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
+3
-6
@@ -811,9 +811,9 @@ public class PlateServiceImpl implements PlateService {
|
||||
|
||||
@Override
|
||||
public PageResult<OrderViewPlatePageRespVO> getViewPlatesPage(OrderCadViewPlatePageReqVO pageReqVO) {
|
||||
PageDTO<PlateRespVO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
PageDTO<OrderViewPlatePageRespVO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, pageReqVO.getOrderId(), pageReqVO.getRoomId(),
|
||||
pageReqVO.getBodyId(), pageReqVO.getGroupId(), getUserOrganId(), pageReqVO.getComponentId(), false);
|
||||
pageReqVO.getBodyId(), pageReqVO.getGroupId(), getUserOrganId(), null, false);
|
||||
return new PageResult<>(BeanUtil.copyToList(pageRes.getRecords(), OrderViewPlatePageRespVO.class), pageRes.getTotal());
|
||||
}
|
||||
|
||||
@@ -850,10 +850,7 @@ public class PlateServiceImpl implements PlateService {
|
||||
Integer range = reqVO.getRange();
|
||||
if (OrderCadViewPlateRangeEnum.BODY.getRange().equals(range)) {
|
||||
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(),
|
||||
orderItemDO.getBodyId(), null, orderItemDO.getOrganId(), null,true);
|
||||
} else if (OrderCadViewPlateRangeEnum.COMPONENT.getRange().equals(range)) {
|
||||
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), null,
|
||||
null, null, orderItemDO.getOrganId(), orderItemDO.getCompId(), true);
|
||||
orderItemDO.getBodyId(), null, orderItemDO.getOrganId(), null, true);
|
||||
} else {
|
||||
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(),
|
||||
orderItemDO.getBodyId(), orderItemDO.getGroupId(), orderItemDO.getOrganId(), null, true);
|
||||
|
||||
+5
-2
@@ -552,8 +552,11 @@
|
||||
<if test="groupId != null">
|
||||
AND i.group_id = #{groupId}
|
||||
</if>
|
||||
<if test="componentId != null">
|
||||
AND i.comp_id = #{componentId}
|
||||
<if test="componentIds != null and componentIds.size() > 0">
|
||||
AND i.comp_id in
|
||||
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
||||
#{componentId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
+46
-1
@@ -1,14 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper">
|
||||
<select id="getOrderDetailComponentIds" resultType="java.lang.Long">
|
||||
select comp_id from order_item i
|
||||
where
|
||||
i.order_id = #{reqVO.orderId}
|
||||
<if test="reqVO.roomIds != null and reqVO.roomIds.size() > 0">
|
||||
AND i.room_id IN
|
||||
<foreach item="roomIdItem" collection="reqVO.roomIds" open="(" separator="," close=")">
|
||||
#{roomIdItem}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="reqVO.bodyIds != null and reqVO.bodyIds.size() > 0">
|
||||
AND i.body_id IN
|
||||
<foreach item="bodyIdItem" collection="reqVO.bodyIds" open="(" separator="," close=")">
|
||||
#{bodyIdItem}
|
||||
</foreach>
|
||||
</if>
|
||||
and i.comp_id is not null
|
||||
</select>
|
||||
|
||||
<select id="getTopComponentListIn"
|
||||
resultType="com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO">
|
||||
select distinct p.id, p.name, p.level, p.top_id
|
||||
from order_component p
|
||||
join order_component c
|
||||
on p.id = c.top_id
|
||||
where c.id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getOrderDetailComponentList" resultType="com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO">
|
||||
select
|
||||
ob.room_id,
|
||||
oc.body_id,
|
||||
oc.order_id
|
||||
oc.id,
|
||||
oc.name
|
||||
from order_component oc
|
||||
left join order_body ob on oc.body_id = ob.id
|
||||
where oc.order_id = #{orderId}
|
||||
where oc.order_id in
|
||||
<foreach collection="orderIds"
|
||||
item="orderId"
|
||||
open="("
|
||||
separator=","
|
||||
close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
<if test="name !=null and name != ''">
|
||||
and oc.name = #{name}
|
||||
</if>
|
||||
<if test="processStatus != null">
|
||||
and oc.process_status = #{processStatus}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
+9
@@ -19,6 +19,15 @@ veneer.defect.save.id.not.null=贴皮ID不能为空
|
||||
veneer.classification.name.save.name.not.null=分类名称不能为空
|
||||
veneer.classification.name.save.name.length.max=分类名称长度不能超过64
|
||||
|
||||
order.detail.component.list.query.orderId.not.null=订单编号不能为空
|
||||
order.detail.component.list.query.roomIds.max=房间查询范围不能超过200个
|
||||
order.detail.component.list.query.bodyIds.max=柜体查询范围不能超过200个
|
||||
order.detail.component.list.query.componentIds.max=部件查询范围不能超过200个
|
||||
order.detail.component.plate.page.query.componentId.not.null=部件编号不能为空
|
||||
|
||||
order.cadview.plate.cadinfo.range.not.null=板件查询范围不能为空
|
||||
order.cadview.plate.cadinfo.plateno.not.null=板件编号不能为空
|
||||
order.cadview.plate.page.orderid.not.null=订单编号不能为空
|
||||
|
||||
order.component.assemble.req.orderIds.max=查询订单编号列表不能超过100个
|
||||
order.component.assemble.req.name.max=名称长度不能超过 64 个字符
|
||||
+10
-1
@@ -19,6 +19,15 @@ veneer.defect.save.id.not.null=貼皮ID不能為空
|
||||
veneer.classification.name.save.name.not.null=分類名稱不能為空
|
||||
veneer.classification.name.save.name.length.max=分類名稱不能超過64個字元
|
||||
|
||||
order.detail.component.list.query.orderId.not.null=訂單編號不能為空
|
||||
order.detail.component.list.query.roomIds.max=房間查詢範圍不能超過200個
|
||||
order.detail.component.list.query.bodyIds.max=櫃體查詢範圍不能超過200個
|
||||
order.detail.component.list.query.componentIds.max=部件查詢範圍不能超過200個
|
||||
order.detail.component.plate.page.query.componentId.not.null=部件編號不能為空
|
||||
|
||||
order.cadview.plate.cadinfo.range.invalid=板件查詢範圍不能為空
|
||||
order.cadview.plate.cadinfo.plateno.not.null=板件編號不能為空
|
||||
order.cadview.plate.page.orderid.not.null=訂單編號不能為空
|
||||
order.cadview.plate.page.orderid.not.null=訂單編號不能為空
|
||||
|
||||
order.component.assemble.req.orderIds.max=查詢訂單編號清單不能超過100個
|
||||
order.component.assemble.req.name.max=名稱長度不能超過64個字元
|
||||
+10
-1
@@ -19,6 +19,15 @@ 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.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
|
||||
order.detail.component.plate.page.query.componentId.not.null=The component id cannot be empty
|
||||
|
||||
order.cadview.plate.cadinfo.range.invalid=range cannot be empty
|
||||
order.cadview.plate.cadinfo.plateno.not.null=plate no cannot be empty
|
||||
order.cadview.plate.page.orderid.not.null=order id cannot be empty
|
||||
order.cadview.plate.page.orderid.not.null=order id cannot be empty
|
||||
|
||||
order.component.assemble.req.orderIds.max=The list of query order numbers cannot exceed 100
|
||||
order.component.assemble.req.name.max=name length cannot exceed 64 characters
|
||||
Reference in New Issue
Block a user