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;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -26,7 +25,4 @@ public class OrderModuleDetailRespVO {
|
|||||||
|
|
||||||
@Schema(description = "组件列表")
|
@Schema(description = "组件列表")
|
||||||
private List<OrderPlatesDetailRespVO> component;
|
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;
|
package com.cf.imes.module.executor.controller.admin.ordercomponent;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
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 com.cf.imes.module.executor.service.ordercomponent.OrderComponentService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
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 = "管理后台 - 生产单部件管理")
|
@Tag(name = "管理后台 - 生产单部件管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/executor/order/component")
|
@RequestMapping("/executor/order/component")
|
||||||
|
@Validated
|
||||||
public class OrderComponentController {
|
public class OrderComponentController {
|
||||||
@Resource
|
@Resource
|
||||||
private OrderComponentService orderComponentService;
|
private OrderComponentService orderComponentService;
|
||||||
|
|
||||||
@GetMapping("/tree/{componentId}")
|
@PostMapping("/detail/list")
|
||||||
@Operation(summary = "生产单详情部件树查询")
|
@Operation(summary = "查询订单详情部件列表")
|
||||||
public CommonResult<Object> getTree(@PathVariable Long componentId) {
|
public CommonResult<List<OrderComponentRespVO>> getOrderComponentList(@Valid @RequestBody OrderDetailComponentListReqVO reqVO) {
|
||||||
return success(orderComponentService.getOrderDetailComponentTree(componentId));
|
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;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 生产单部件列表 order component Response VO")
|
@Schema(description = "管理后台 - 生产单部件列表 order component Response VO")
|
||||||
@Data
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class OrderComponentRespVO {
|
public class OrderComponentRespVO {
|
||||||
|
@Schema(description = "父ID")
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
@Schema(description = "生产单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230414026120")
|
@Schema(description = "部件Id")
|
||||||
private Long orderId;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "房间Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "部件名")
|
||||||
private Long roomId;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "柜体Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "cad图纸数据文件id")
|
||||||
private Long bodyId;
|
private Long cadViewFileId;
|
||||||
|
|
||||||
@Schema(description = "部件Id", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private Long componentId;
|
|
||||||
|
|
||||||
@Schema(description = "部件名", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private String componentName;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+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;
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顶级id
|
||||||
|
*/
|
||||||
|
private Long topId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级,顶级为0
|
||||||
|
*/
|
||||||
|
private int level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部件名称
|
* 部件名称
|
||||||
*/
|
*/
|
||||||
@@ -93,4 +103,9 @@ public class OrderComponentDO extends BaseDO {
|
|||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加工状态
|
||||||
|
*/
|
||||||
|
private Integer processStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -202,6 +202,6 @@ public interface OrderItemMapper extends BaseMapperX<OrderItemDO> {
|
|||||||
@Param("bodyId") Long bodyId,
|
@Param("bodyId") Long bodyId,
|
||||||
@Param("groupId") Long groupId,
|
@Param("groupId") Long groupId,
|
||||||
@Param("organId") Long organId,
|
@Param("organId") Long organId,
|
||||||
@Param("componentId") Long componentId,
|
@Param("componentIds") Set<Long> componentIds,
|
||||||
@Param("cadView") boolean cadView);
|
@Param("cadView") boolean cadView);
|
||||||
}
|
}
|
||||||
+11
-2
@@ -1,11 +1,13 @@
|
|||||||
package com.cf.imes.module.executor.dal.mysql.ordercomponent;
|
package com.cf.imes.module.executor.dal.mysql.ordercomponent;
|
||||||
|
|
||||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
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 com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部件 Mapper
|
* 部件 Mapper
|
||||||
@@ -19,8 +21,15 @@ public interface OrderComponentMapper extends BaseMapperX<OrderComponentDO> {
|
|||||||
/**
|
/**
|
||||||
* 订单详情部件列表查询
|
* 订单详情部件列表查询
|
||||||
*
|
*
|
||||||
* @param orderId 生产单id
|
* @param reqVO
|
||||||
* @return
|
* @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 {
|
public enum OrderCadViewPlateRangeEnum implements IntArrayValuable {
|
||||||
BODY(0),
|
BODY(0),
|
||||||
GROUP(1),
|
GROUP(1),
|
||||||
GROUP_WITH_BODY(2),
|
GROUP_WITH_BODY(2);
|
||||||
COMPONENT(3);
|
|
||||||
|
|
||||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderCadViewPlateRangeEnum::getRange).toArray();
|
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.setParts(orderItemDOS);
|
||||||
orderModuleDetailRespVO.setGoods(orderGoodsRespVOS);
|
orderModuleDetailRespVO.setGoods(orderGoodsRespVOS);
|
||||||
orderModuleDetailRespVO.setComponent(orderComponentRespVOS);
|
orderModuleDetailRespVO.setComponent(orderComponentRespVOS);
|
||||||
orderModuleDetailRespVO.setSection(orderComponentService.getOrderComponentList(orderId));
|
|
||||||
return orderModuleDetailRespVO;
|
return orderModuleDetailRespVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+23
-5
@@ -1,7 +1,10 @@
|
|||||||
package com.cf.imes.module.executor.service.ordercomponent;
|
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.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;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -15,15 +18,30 @@ public interface OrderComponentService {
|
|||||||
/**
|
/**
|
||||||
* 查询订单部件列表
|
* 查询订单部件列表
|
||||||
*
|
*
|
||||||
* @param orderId 生产单id
|
* @param reqVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderComponentRespVO> getOrderComponentList(Long orderId);
|
List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部件树
|
* 获取节点的顶级节点下所有节点
|
||||||
*
|
*
|
||||||
|
* @param reqVO
|
||||||
* @return
|
* @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;
|
package com.cf.imes.module.executor.service.ordercomponent;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.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.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.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.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 com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -14,13 +23,12 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
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;
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_COMPONENT_NOT_EXIST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,118 +43,143 @@ public class OrderComponentServiceImpl implements OrderComponentService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderComponentMapper orderComponentMapper;
|
private OrderComponentMapper orderComponentMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderItemMapper orderItemMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderComponentRespVO> getOrderComponentList(Long orderId) {
|
public List<OrderComponentRespVO> getOrderComponentList(OrderDetailComponentListReqVO reqVO) {
|
||||||
List<OrderComponentRespVO> resultList = new ArrayList<>();
|
List<OrderComponentRespVO> resultList = new ArrayList<>();
|
||||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.getOrderDetailComponentList(orderId);
|
// 查询所有满足条件的部件id
|
||||||
if (CollUtil.isNotEmpty(orderComponentDOS)) {
|
Set<Long> orderDetailComponentIds = orderComponentMapper.getOrderDetailComponentIds(reqVO);
|
||||||
for (OrderComponentDO componentDO : orderComponentDOS) {
|
if (CollUtil.isEmpty(orderDetailComponentIds)) {
|
||||||
OrderComponentRespVO orderComponentRespVO = new OrderComponentRespVO();
|
return resultList;
|
||||||
orderComponentRespVO.setOrderId(orderId);
|
}
|
||||||
orderComponentRespVO.setRoomId(componentDO.getRoomId());
|
|
||||||
orderComponentRespVO.setBodyId(componentDO.getBodyId());
|
// 拆分每500条查询一次
|
||||||
orderComponentRespVO.setComponentId(componentDO.getId());
|
List<OrderComponentDO> resultDOList = new ArrayList<>();
|
||||||
orderComponentRespVO.setComponentName(componentDO.getName());
|
List<List<Long>> partitions = CollUtil.split(orderDetailComponentIds, 500);
|
||||||
resultList.add(orderComponentRespVO);
|
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
|
@Override
|
||||||
public List<OrderComponentTreeRespVO> getOrderDetailComponentTree(Long componentId) {
|
public List<OrderComponentRespVO> getComponentListOnTopId(OrderDetailComponentListReqVO reqVO) {
|
||||||
// 1. 查询本身和所有非顶级节点
|
Long componentId = reqVO.getComponentId();
|
||||||
|
Long orderId = reqVO.getOrderId();
|
||||||
|
|
||||||
|
// 1、查询部件
|
||||||
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
||||||
if (ObjectUtil.isNull(componentDO)) {
|
if (ObjectUtil.isNull(componentDO)) {
|
||||||
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(
|
// 2、根据部件的topid查询树上所有节点
|
||||||
new LambdaQueryWrapperX<OrderComponentDO>()
|
List<OrderComponentDO> topComponentList = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||||
.and(wr ->
|
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||||
wr.or(wrapper -> wrapper.ne(OrderComponentDO::getPid, PARENT_ID_ROOT))
|
.eq(OrderComponentDO::getOrganId, componentDO.getOrganId())
|
||||||
.or(wrapper -> wrapper.eq(OrderComponentDO::getId, componentId)))
|
.eq(OrderComponentDO::getOrderId, orderId)
|
||||||
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName));
|
.eqIfPresent(OrderComponentDO::getDeleted, reqVO.isDeleted())
|
||||||
|
.likeIfPresent(OrderComponentDO::getName, reqVO.getName())
|
||||||
|
.select(OrderComponentDO::getId, OrderComponentDO::getPid, OrderComponentDO::getName, OrderComponentDO::getCadViewFileId));
|
||||||
|
|
||||||
// 2. 如果 DB 本身就没数据,直接返回 componentId 本身
|
return BeanUtil.copyToList(topComponentList, OrderComponentRespVO.class);
|
||||||
if (orderComponentDOS.isEmpty()) {
|
}
|
||||||
return Collections.singletonList(buildSelfNode(componentDO));
|
|
||||||
|
@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
|
if(CollUtil.isEmpty(componentIds)) {
|
||||||
Map<Long, OrderComponentTreeRespVO> nodeMap = new HashMap<>(orderComponentDOS.size());
|
// 2、把下级部门id做成集合
|
||||||
for (OrderComponentDO doObj : orderComponentDOS) {
|
List<OrderComponentDO> orderComponentDOS = orderComponentMapper.selectList(new LambdaQueryWrapperX<OrderComponentDO>()
|
||||||
OrderComponentTreeRespVO vo = new OrderComponentTreeRespVO();
|
.eq(OrderComponentDO::getTopId, componentDO.getTopId())
|
||||||
vo.setId(doObj.getId());
|
.eq(OrderComponentDO::getOrganId, componentDO.getOrganId())
|
||||||
vo.setPid(doObj.getPid());
|
.eq(OrderComponentDO::getOrderId, orderId)
|
||||||
vo.setName(doObj.getName());
|
.eqIfPresent(OrderComponentDO::getDeleted, pageReqVO.isDeleted())
|
||||||
vo.setChildren(new ArrayList<>());
|
.select(OrderComponentDO::getId));
|
||||||
nodeMap.put(vo.getId(), vo);
|
if(CollUtil.isNotEmpty(orderComponentDOS)) {
|
||||||
}
|
componentIds = orderComponentDOS.stream().map(OrderComponentDO::getId).collect(Collectors.toSet());
|
||||||
|
} else {
|
||||||
// 4. 建立父子关系
|
return new PageResult<>();
|
||||||
for (OrderComponentTreeRespVO node : nodeMap.values()) {
|
|
||||||
OrderComponentTreeRespVO parent = nodeMap.get(node.getPid());
|
|
||||||
if (parent != null) {
|
|
||||||
parent.getChildren().add(node);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 3、使用入参的部件id集合
|
||||||
|
componentIds = pageReqVO.getComponentIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 尝试找到 componentId 对应的节点
|
// 分页查询板件
|
||||||
OrderComponentTreeRespVO root = nodeMap.get(componentId);
|
PageDTO<OrderComponentRespVO> page = new PageDTO<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||||
|
IPage<OrderBodyViewPlatesPageDO> pageRes = orderItemMapper.selectBodyViewPlatesPage(page, orderId, null,
|
||||||
// 6. 找不到节点:只返回 componentId 自身
|
null, null, getUserOrganId(), componentIds, false);
|
||||||
if (root == null) {
|
return new PageResult<>(BeanUtil.copyToList(pageRes.getRecords(), OrderViewPlatePageRespVO.class), pageRes.getTotal());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 清理可能存在的重复子节点
|
public List<OrderViewPlatePageRespVO> getViewComponentPlatesCadInfo(OrderDetailComponentPageReqVO pageReqVO) {
|
||||||
*
|
Set<Long> componentIds = pageReqVO.getComponentIds();
|
||||||
* @param node 顶级节点
|
Long componentId = pageReqVO.getComponentId();
|
||||||
* @param path 记录已经访问过的节点
|
Long orderId = pageReqVO.getOrderId();
|
||||||
*/
|
|
||||||
private void pruneTree(OrderComponentTreeRespVO node, Set<Long> path) {
|
// 1、查询顶级
|
||||||
// 防止 pid 循环
|
OrderComponentDO componentDO = orderComponentMapper.selectById(componentId);
|
||||||
if (!path.add(node.getId())) {
|
if (ObjectUtil.isNull(componentDO)) {
|
||||||
node.getChildren().clear();
|
throw new ServiceException(ORDER_COMPONENT_NOT_EXIST);
|
||||||
return;
|
}
|
||||||
|
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()) {
|
PageDTO<OrderViewPlatePageRespVO> page = new PageDTO<>(1, PageParam.PAGE_SIZE_NONE);
|
||||||
return;
|
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();
|
||||||
}
|
}
|
||||||
|
return resultList;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-6
@@ -811,9 +811,9 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<OrderViewPlatePageRespVO> getViewPlatesPage(OrderCadViewPlatePageReqVO pageReqVO) {
|
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(),
|
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());
|
return new PageResult<>(BeanUtil.copyToList(pageRes.getRecords(), OrderViewPlatePageRespVO.class), pageRes.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,10 +850,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
Integer range = reqVO.getRange();
|
Integer range = reqVO.getRange();
|
||||||
if (OrderCadViewPlateRangeEnum.BODY.getRange().equals(range)) {
|
if (OrderCadViewPlateRangeEnum.BODY.getRange().equals(range)) {
|
||||||
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(),
|
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(),
|
||||||
orderItemDO.getBodyId(), null, orderItemDO.getOrganId(), null,true);
|
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);
|
|
||||||
} else {
|
} else {
|
||||||
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(),
|
viewPlatesPage = orderItemMapper.selectBodyViewPlatesPage(page, orderItemDO.getOrderId(), orderItemDO.getRoomId(),
|
||||||
orderItemDO.getBodyId(), orderItemDO.getGroupId(), orderItemDO.getOrganId(), null, true);
|
orderItemDO.getBodyId(), orderItemDO.getGroupId(), orderItemDO.getOrganId(), null, true);
|
||||||
|
|||||||
+5
-2
@@ -552,8 +552,11 @@
|
|||||||
<if test="groupId != null">
|
<if test="groupId != null">
|
||||||
AND i.group_id = #{groupId}
|
AND i.group_id = #{groupId}
|
||||||
</if>
|
</if>
|
||||||
<if test="componentId != null">
|
<if test="componentIds != null and componentIds.size() > 0">
|
||||||
AND i.comp_id = #{componentId}
|
AND i.comp_id in
|
||||||
|
<foreach item="componentId" collection="componentIds" open="(" separator="," close=")">
|
||||||
|
#{componentId}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
+46
-1
@@ -1,14 +1,59 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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" >
|
<!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">
|
<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 id="getOrderDetailComponentList" resultType="com.cf.imes.module.executor.dal.dataobject.ordecomponent.OrderComponentDO">
|
||||||
select
|
select
|
||||||
ob.room_id,
|
ob.room_id,
|
||||||
oc.body_id,
|
oc.body_id,
|
||||||
|
oc.order_id
|
||||||
oc.id,
|
oc.id,
|
||||||
oc.name
|
oc.name
|
||||||
from order_component oc
|
from order_component oc
|
||||||
left join order_body ob on oc.body_id = ob.id
|
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>
|
</select>
|
||||||
</mapper>
|
</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.not.null=分类名称不能为空
|
||||||
veneer.classification.name.save.name.length.max=分类名称长度不能超过64
|
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.range.not.null=板件查询范围不能为空
|
||||||
order.cadview.plate.cadinfo.plateno.not.null=板件编号不能为空
|
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=貼皮ID不能為空
|
|||||||
veneer.classification.name.save.name.not.null=分類名稱不能為空
|
veneer.classification.name.save.name.not.null=分類名稱不能為空
|
||||||
veneer.classification.name.save.name.length.max=分類名稱不能超過64個字元
|
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.range.invalid=板件查詢範圍不能為空
|
||||||
order.cadview.plate.cadinfo.plateno.not.null=板件編號不能為空
|
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.not.null=classification name cannot be empty
|
||||||
veneer.classification.name.save.name.length.max=classification name length cannot exceed 64 characters
|
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.range.invalid=range cannot be empty
|
||||||
order.cadview.plate.cadinfo.plateno.not.null=plate no 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
|
||||||
+3
@@ -95,6 +95,9 @@ public class WebCadDataBlockReqVO {
|
|||||||
|
|
||||||
private List<Integer> groupIds = new ArrayList<>();
|
private List<Integer> groupIds = new ArrayList<>();
|
||||||
|
|
||||||
|
// 组件id
|
||||||
|
private Integer componentId;
|
||||||
|
|
||||||
public void setIsSpecialShape(boolean specialShape) {
|
public void setIsSpecialShape(boolean specialShape) {
|
||||||
isSpecialShape = specialShape;
|
isSpecialShape = specialShape;
|
||||||
}
|
}
|
||||||
|
|||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
package com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.Max;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/29 15:18
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Schema(description = "管理后台 - webcad部件分组 - RequestVO")
|
||||||
|
@Data
|
||||||
|
public class WebCadDataComponentGroupReqVO {
|
||||||
|
/**
|
||||||
|
* 组ID
|
||||||
|
*/
|
||||||
|
@JsonProperty("groupID")
|
||||||
|
private Integer groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部件名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
private BoxSizeDTO boxSize = new BoxSizeDTO();
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
private List<WebCadDataComponentGroupReqVO> children = new ArrayList<>();
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public static class BoxSizeDTO {
|
||||||
|
@Max(value = 99999, message = "部件宽度不能超过99999")
|
||||||
|
@Min(value = 0, message = "部件宽度最小值为0")
|
||||||
|
private Double width;
|
||||||
|
|
||||||
|
@Max(value = 99999, message = "部件高度不能超过99999")
|
||||||
|
@Min(value = 0, message = "部件高度最小值为0")
|
||||||
|
private Double height;
|
||||||
|
|
||||||
|
@Max(value = 99999, message = "部件深度不能超过99999")
|
||||||
|
@Min(value = 0, message = "部件深度最小值为0")
|
||||||
|
private Double depth;
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
@@ -31,6 +31,10 @@ public class WebCadDataReqVO {
|
|||||||
@Valid
|
@Valid
|
||||||
private List<WebCadDataProcessGroupReqVO> ProcessGroup;
|
private List<WebCadDataProcessGroupReqVO> ProcessGroup;
|
||||||
|
|
||||||
|
@JsonProperty(value = "ComponentGroupTree")
|
||||||
|
@Valid
|
||||||
|
private List<WebCadDataComponentGroupReqVO> ComponentGroup;
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
private List<WebCadDataDoubleRoomTreeReqVO> douleRoomTree;
|
private List<WebCadDataDoubleRoomTreeReqVO> douleRoomTree;
|
||||||
|
|
||||||
|
|||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
package com.cf.imes.module.plan.dal.dataobject.ordecomponent;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮表 order_component_{N} DO
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/27 14:00
|
||||||
|
*/
|
||||||
|
@TableName(value = "order_component", autoResultMap = true)
|
||||||
|
@KeySequence("order_component_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class OrderComponentDO extends BaseDO {
|
||||||
|
public static final Long PARENT_ID_ROOT = 0L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织id
|
||||||
|
*/
|
||||||
|
private Long organId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 柜体id
|
||||||
|
*/
|
||||||
|
private Long bodyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间id
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Long roomId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父id
|
||||||
|
*/
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顶级id
|
||||||
|
*/
|
||||||
|
private Long topId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级,顶级为0
|
||||||
|
*/
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部件名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块宽度
|
||||||
|
*/
|
||||||
|
private Double width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块高度
|
||||||
|
*/
|
||||||
|
private Double height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块深度
|
||||||
|
*/
|
||||||
|
private Double depth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格
|
||||||
|
*/
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cad图纸文件id
|
||||||
|
*/
|
||||||
|
private Long cadViewFileId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加工状态
|
||||||
|
*/
|
||||||
|
private Integer processStatus;
|
||||||
|
}
|
||||||
+5
-16
@@ -24,22 +24,6 @@ import lombok.ToString;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class OrderItemDO {
|
public class OrderItemDO {
|
||||||
|
|
||||||
public OrderItemDO(OrderItemDO item) {
|
|
||||||
this.id = item.getId();
|
|
||||||
this.orderId = item.getOrderId();
|
|
||||||
this.type = item.getType();
|
|
||||||
this.roomId = item.getRoomId();
|
|
||||||
this.bodyId = item.getBodyId();
|
|
||||||
this.planId = item.getPlanId();
|
|
||||||
this.plateId = item.getPlateId();
|
|
||||||
this.packageId = item.getPackageId();
|
|
||||||
this.groupId = item.getGroupId();
|
|
||||||
this.partsId = item.getPartsId();
|
|
||||||
this.num = item.getNum();
|
|
||||||
this.organId = item.getOrganId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 明细编号
|
* 明细编号
|
||||||
*/
|
*/
|
||||||
@@ -90,4 +74,9 @@ public class OrderItemDO {
|
|||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Long organId;
|
private Long organId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部件id
|
||||||
|
*/
|
||||||
|
private Long compId;
|
||||||
|
|
||||||
}
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cf.imes.module.plan.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;
|
||||||
|
}
|
||||||
+258
-23
@@ -27,12 +27,14 @@ import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
|||||||
import com.cf.imes.module.infra.api.file.FileApi;
|
import com.cf.imes.module.infra.api.file.FileApi;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockRemarkVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockRemarkVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockReqVO;
|
||||||
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataComponentGroupReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataDoubleRoomTreeReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataDoubleRoomTreeReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataGroupInfoReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataGroupInfoReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataMaterialReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataMaterialReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataPartsReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataPartsReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataProcessGroupReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataProcessGroupReqVO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.plan.dal.dataobject.goods.GoodsDO;
|
||||||
|
import com.cf.imes.module.plan.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.plan.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.orderBody.OrderBodyDO;
|
import com.cf.imes.module.plan.dal.dataobject.orderBody.OrderBodyDO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.orderGroup.OrderGroupDO;
|
import com.cf.imes.module.plan.dal.dataobject.orderGroup.OrderGroupDO;
|
||||||
@@ -57,6 +59,7 @@ import com.cf.imes.module.plan.dal.mysql.orderImport.OrderImportTaskMapper;
|
|||||||
import com.cf.imes.module.plan.dal.mysql.plate.PlateMapper;
|
import com.cf.imes.module.plan.dal.mysql.plate.PlateMapper;
|
||||||
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
||||||
import com.cf.imes.module.plan.enums.ErrorCodeConstants;
|
import com.cf.imes.module.plan.enums.ErrorCodeConstants;
|
||||||
|
import com.cf.imes.module.plan.enums.ordercomponent.OrderComponentProcessStatusEnum;
|
||||||
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
||||||
import com.cf.imes.module.plan.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
import com.cf.imes.module.plan.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
||||||
import com.cf.imes.module.plan.service.order.OrderInputProcessor;
|
import com.cf.imes.module.plan.service.order.OrderInputProcessor;
|
||||||
@@ -86,7 +89,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.zipString;
|
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
|
||||||
@@ -175,15 +177,18 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
// 加工组缓存
|
// 加工组缓存
|
||||||
private Map<Integer, WebCadDataGroupInfoReqVO> processGroupMap = new HashMap<>();
|
private Map<Integer, WebCadDataGroupInfoReqVO> processGroupMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 部件缓存:{cad groupId:imes部件id}
|
||||||
|
private Map<Integer, Long> componentGroupMap = new HashMap<>();
|
||||||
|
|
||||||
private List<PlateDO> plateDOS = new ArrayList<>();
|
private List<PlateDO> plateDOS = new ArrayList<>();
|
||||||
private List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
private List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||||
private List<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
private List<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
||||||
private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
private List<RawGoodsDO> rawGoodsDOS = new ArrayList<>();
|
private List<RawGoodsDO> rawGoodsDOS = new ArrayList<>();
|
||||||
private List<GoodsDO> goodsDOS = new ArrayList<>();
|
private List<GoodsDO> goodsDOS = new ArrayList<>();
|
||||||
|
private List<OrderComponentDO> orderComponentDOS = new ArrayList<>();
|
||||||
private List<SystemConfigSealEdgeRespDTO> sealEdgeConfigList;
|
private List<SystemConfigSealEdgeRespDTO> sealEdgeConfigList;
|
||||||
|
|
||||||
|
|
||||||
private static final String PART_CATEGORY_ONE = "封边条";
|
private static final String PART_CATEGORY_ONE = "封边条";
|
||||||
private static final String PART_CATEGORY_TWO = "五金";
|
private static final String PART_CATEGORY_TWO = "五金";
|
||||||
private static final String PART_CATEGORY_THREE = "组件";
|
private static final String PART_CATEGORY_THREE = "组件";
|
||||||
@@ -300,6 +305,9 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
case "CadViewFileId":
|
case "CadViewFileId":
|
||||||
cadViewFileId = reader.readLong();
|
cadViewFileId = reader.readLong();
|
||||||
break;
|
break;
|
||||||
|
case "ComponentGroupTree":
|
||||||
|
analyzeCadComponentList(reader);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// 跳过未知字段
|
// 跳过未知字段
|
||||||
reader.readObject();
|
reader.readObject();
|
||||||
@@ -511,9 +519,9 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.texture(materialReqVO.getTexture())
|
.texture(materialReqVO.getTexture())
|
||||||
.color(materialReqVO.getColor())
|
.color(materialReqVO.getColor())
|
||||||
.colorBlack(EMPTY_STRING)
|
.colorBlack(EMPTY_STRING)
|
||||||
.width(BigDecimal.valueOf(getZeroDouble(materialReqVO.getWidth())))
|
.width(getBigDecimalOrNull(getZeroDouble(materialReqVO.getWidth())))
|
||||||
.height(BigDecimal.valueOf(getZeroDouble(materialReqVO.getHeight())))
|
.height(getBigDecimalOrNull(getZeroDouble(materialReqVO.getHeight())))
|
||||||
.thickness(BigDecimal.valueOf(materialReqVO.getThickness()))
|
.thickness(getBigDecimalOrNull(materialReqVO.getThickness()))
|
||||||
.spec(getEmpty(materialReqVO.getSpec()))
|
.spec(getEmpty(materialReqVO.getSpec()))
|
||||||
.brand(getEmpty(materialReqVO.getBrand()))
|
.brand(getEmpty(materialReqVO.getBrand()))
|
||||||
.remark(EMPTY_STRING)
|
.remark(EMPTY_STRING)
|
||||||
@@ -808,6 +816,16 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
||||||
goodsDO.setArea(goodsDO.getArea() + area);
|
goodsDO.setArea(goodsDO.getArea() + area);
|
||||||
|
|
||||||
|
// 获取缓存的部件id
|
||||||
|
Integer cadGroupId = block.getComponentId();
|
||||||
|
Long plateComponentId = null;
|
||||||
|
if (ObjectUtil.isNotNull(cadGroupId)) {
|
||||||
|
Long componentId = componentGroupMap.get(cadGroupId);
|
||||||
|
if (ObjectUtil.isNotNull(componentId)) {
|
||||||
|
plateComponentId = componentId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 创建order_plate
|
// 创建order_plate
|
||||||
PlateDO plateDO = PlateDO.builder()
|
PlateDO plateDO = PlateDO.builder()
|
||||||
.id(plateId)
|
.id(plateId)
|
||||||
@@ -816,13 +834,13 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.plateNo(obtainingTime + Long.toString(plateNo).substring(2))
|
.plateNo(obtainingTime + Long.toString(plateNo).substring(2))
|
||||||
.type(block.getType())
|
.type(block.getType())
|
||||||
.goodsId(goodsDO.getId())
|
.goodsId(goodsDO.getId())
|
||||||
.width(BigDecimal.valueOf(block.getWidth()))
|
.width(getBigDecimalOrNull(block.getWidth()))
|
||||||
.height(BigDecimal.valueOf(block.getHeight()))
|
.height(getBigDecimalOrNull(block.getHeight()))
|
||||||
.thickness(BigDecimal.valueOf(block.getThickness()))
|
.thickness(getBigDecimalOrNull(block.getThickness()))
|
||||||
.splitHeight(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(splitHeight) ? splitHeight : String.valueOf(block.getKaiLiaoHeight()))))
|
.splitHeight(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(splitHeight) ? splitHeight : String.valueOf(block.getKaiLiaoHeight()))))
|
||||||
.splitThickness(BigDecimal.valueOf(NumberUtil.parseDouble(block.getSpliteThickness())))
|
.splitThickness(BigDecimal.valueOf(NumberUtil.parseDouble(block.getSpliteThickness())))
|
||||||
.splitWidth(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(spliteWidth) ? spliteWidth : String.valueOf(block.getKaiLiaoWidth()))))
|
.splitWidth(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(spliteWidth) ? spliteWidth : String.valueOf(block.getKaiLiaoWidth()))))
|
||||||
.area(BigDecimal.valueOf(area))
|
.area(getBigDecimalOrNull(area))
|
||||||
.texture(block.getTexture())
|
.texture(block.getTexture())
|
||||||
.holeFace(block.getHoleFace())
|
.holeFace(block.getHoleFace())
|
||||||
.isDoor(block.getIsDoor())
|
.isDoor(block.getIsDoor())
|
||||||
@@ -841,18 +859,18 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.sideHoleCount(block.getSideHoleCount())
|
.sideHoleCount(block.getSideHoleCount())
|
||||||
.frontModelCount(block.getFrontModelCount())
|
.frontModelCount(block.getFrontModelCount())
|
||||||
.backModelCount(block.getBackModelCount())
|
.backModelCount(block.getBackModelCount())
|
||||||
.offsetX(BigDecimal.valueOf(block.getOffsetX()))
|
.offsetX(getBigDecimalOrNull(block.getOffsetX()))
|
||||||
.offsetY(BigDecimal.valueOf(block.getOffsetY()))
|
.offsetY(getBigDecimalOrNull(block.getOffsetY()))
|
||||||
.isArcAcross(getDefaultFalse(block.getIsArcBase()))
|
.isArcAcross(getDefaultFalse(block.getIsArcBase()))
|
||||||
.moduleTypeId(0L)
|
.moduleTypeId(0L)
|
||||||
.isOptimized(false)
|
.isOptimized(false)
|
||||||
.isCutted(0)
|
.isCutted(0)
|
||||||
.isCancel(false)
|
.isCancel(false)
|
||||||
.filterType(EMPTY_STRING)
|
.filterType(EMPTY_STRING)
|
||||||
.sealLeft(BigDecimal.valueOf(block.getSealLeft()))
|
.sealLeft(getBigDecimalOrNull(block.getSealLeft()))
|
||||||
.sealRight(BigDecimal.valueOf(block.getSealRight()))
|
.sealRight(getBigDecimalOrNull(block.getSealRight()))
|
||||||
.sealUp(BigDecimal.valueOf(block.getSealUp()))
|
.sealUp(getBigDecimalOrNull(block.getSealUp()))
|
||||||
.sealDown(BigDecimal.valueOf(block.getSealDown()))
|
.sealDown(getBigDecimalOrNull(block.getSealDown()))
|
||||||
.remark(remark.toString())
|
.remark(remark.toString())
|
||||||
.deleted(false)
|
.deleted(false)
|
||||||
.organId(organId)
|
.organId(organId)
|
||||||
@@ -888,7 +906,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
orderModelsBatchInsertWithinThreshold(false);
|
orderModelsBatchInsertWithinThreshold(false);
|
||||||
|
|
||||||
// 遍历加工组信息,生成对应的加工组和item
|
// 遍历加工组信息,生成对应的加工组和item
|
||||||
analyzeBlockProcessGroup(orderBodyDO, block, plateId);
|
analyzeBlockProcessGroup(orderBodyDO, block, plateId, plateComponentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -898,7 +916,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
* @param block
|
* @param block
|
||||||
* @param plateId
|
* @param plateId
|
||||||
*/
|
*/
|
||||||
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId) {
|
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId, Long componentId) {
|
||||||
Long bodyId = orderBodyDO.getId();
|
Long bodyId = orderBodyDO.getId();
|
||||||
Long roomId = orderBodyDO.getRoomId();
|
Long roomId = orderBodyDO.getRoomId();
|
||||||
|
|
||||||
@@ -973,6 +991,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.partsId(0L)
|
.partsId(0L)
|
||||||
.num(1.0)
|
.num(1.0)
|
||||||
.organId(organId)
|
.organId(organId)
|
||||||
|
.compId(componentId)
|
||||||
.build();
|
.build();
|
||||||
orderItemDOS.add(orderItemDO);
|
orderItemDOS.add(orderItemDO);
|
||||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||||
@@ -993,10 +1012,10 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
.texture(block.getTexture())
|
.texture(block.getTexture())
|
||||||
.typographicFace(block.getHoleArrange())
|
.typographicFace(block.getHoleArrange())
|
||||||
.openDoorType(block.getOpenDoorType())
|
.openDoorType(block.getOpenDoorType())
|
||||||
.splitLength(BigDecimal.valueOf(block.getKaiLiaoHeight()))
|
.splitLength(getBigDecimalOrNull(block.getKaiLiaoHeight()))
|
||||||
.splitWidth(BigDecimal.valueOf(block.getKaiLiaoWidth()))
|
.splitWidth(getBigDecimalOrNull(block.getKaiLiaoWidth()))
|
||||||
.offsetX(BigDecimal.valueOf(block.getOffsetX()))
|
.offsetX(getBigDecimalOrNull(block.getOffsetX()))
|
||||||
.offsetY(BigDecimal.valueOf(block.getOffsetY()))
|
.offsetY(getBigDecimalOrNull(block.getOffsetY()))
|
||||||
.pointDetail(getPointDetail(pointInfo.getPointDetail()))
|
.pointDetail(getPointDetail(pointInfo.getPointDetail()))
|
||||||
.rawPointDetail(getRawPointDetail(pointInfo.getOrgPointDetail()))
|
.rawPointDetail(getRawPointDetail(pointInfo.getOrgPointDetail()))
|
||||||
.holeDetail(getHoleDetail(pointInfo.getHoleDetail()))
|
.holeDetail(getHoleDetail(pointInfo.getHoleDetail()))
|
||||||
@@ -1278,7 +1297,9 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
*/
|
*/
|
||||||
private List<ModelDetail> getSideDetail(List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSideModelDetailList, List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSide2DModelDetail) {
|
private List<ModelDetail> getSideDetail(List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSideModelDetailList, List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSide2DModelDetail) {
|
||||||
// 合并侧面2v刀路列表
|
// 合并侧面2v刀路列表
|
||||||
cadSideModelDetailList.addAll(cadSide2DModelDetail);
|
if (CollUtil.isNotEmpty(cadSide2DModelDetail)) {
|
||||||
|
cadSideModelDetailList.addAll(cadSide2DModelDetail);
|
||||||
|
}
|
||||||
if (CollUtil.isNotEmpty(cadSideModelDetailList)) {
|
if (CollUtil.isNotEmpty(cadSideModelDetailList)) {
|
||||||
List<ModelDetail> modelDetails = new ArrayList<>();
|
List<ModelDetail> modelDetails = new ArrayList<>();
|
||||||
// 侧面造型和侧面2v刀路合并,序号从头计算不使用cad的
|
// 侧面造型和侧面2v刀路合并,序号从头计算不使用cad的
|
||||||
@@ -1709,6 +1730,110 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理cad部件数据
|
||||||
|
*/
|
||||||
|
private void analyzeCadComponentList(JSONReader reader) {
|
||||||
|
log.debug("====================【cad拆单解析部件开始】====================");
|
||||||
|
processComponentList(reader);
|
||||||
|
log.debug("====================【cad拆单解析部件结束】====================");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析部件列表
|
||||||
|
*
|
||||||
|
* @param reader
|
||||||
|
*/
|
||||||
|
private void processComponentList(JSONReader reader) {
|
||||||
|
reader.startArray();
|
||||||
|
while (reader.hasNext()) {
|
||||||
|
processComponent(reader, null, null, 0);
|
||||||
|
}
|
||||||
|
reader.endArray();
|
||||||
|
orderComponentBatchInsertWithinThreshold(orderComponentDOS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析单个部件
|
||||||
|
*
|
||||||
|
* @param reader
|
||||||
|
*/
|
||||||
|
private void processComponent(JSONReader reader, Long parentId, Long topId, int level) {
|
||||||
|
if (parentId == null) {
|
||||||
|
parentId = OrderComponentDO.PARENT_ID_ROOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer cadGroupId = null;
|
||||||
|
String name = null;
|
||||||
|
WebCadDataComponentGroupReqVO.BoxSizeDTO boxSize = null;
|
||||||
|
|
||||||
|
reader.startObject();
|
||||||
|
List<JSONReader> childrenReaders = new ArrayList<>();
|
||||||
|
|
||||||
|
while (reader.hasNext()) {
|
||||||
|
String key = reader.readString();
|
||||||
|
switch (key) {
|
||||||
|
case "groupID":
|
||||||
|
cadGroupId = reader.readInteger();
|
||||||
|
break;
|
||||||
|
case "name":
|
||||||
|
name = reader.readString();
|
||||||
|
break;
|
||||||
|
case "boxSize":
|
||||||
|
boxSize = reader.readObject(WebCadDataComponentGroupReqVO.BoxSizeDTO.class);
|
||||||
|
break;
|
||||||
|
case "children":
|
||||||
|
// 当前节点生成 OrderComponentDO
|
||||||
|
Long componentId = (Long) snowFlakeGenerator.nextId(null);
|
||||||
|
if (topId == null) {
|
||||||
|
topId = componentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderComponentDO componentDO = OrderComponentDO.builder()
|
||||||
|
.id(componentId)
|
||||||
|
.organId(organId)
|
||||||
|
.orderId(orderId)
|
||||||
|
.pid(parentId)
|
||||||
|
.topId(topId)
|
||||||
|
.name(name)
|
||||||
|
.width(boxSize != null ? boxSize.getWidth() : null)
|
||||||
|
.height(boxSize != null ? boxSize.getHeight() : null)
|
||||||
|
.depth(boxSize != null ? boxSize.getDepth() : null)
|
||||||
|
.cadViewFileId(cadViewFileId)
|
||||||
|
.processStatus(OrderComponentProcessStatusEnum.UNPROCESSED.getStatus())
|
||||||
|
.level(level)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
componentDO.setCreateTime(now);
|
||||||
|
componentDO.setUpdateTime(now);
|
||||||
|
componentDO.setCreator(operatorName);
|
||||||
|
componentDO.setUpdater(operatorName);
|
||||||
|
componentDO.setDeleted(false);
|
||||||
|
|
||||||
|
// 缓存组件id
|
||||||
|
componentGroupMap.put(cadGroupId, componentId);
|
||||||
|
|
||||||
|
// 逐条加入批量入库
|
||||||
|
orderComponentDOS.add(componentDO);
|
||||||
|
orderComponentBatchInsertWithinThreshold(orderComponentDOS, false);
|
||||||
|
|
||||||
|
reader.startArray();
|
||||||
|
while (reader.hasNext()) {
|
||||||
|
// 递归子节点
|
||||||
|
processComponent(reader, componentId, topId, level); // 子节点在递归中生成组件DO
|
||||||
|
}
|
||||||
|
reader.endArray();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 其他字段直接跳过
|
||||||
|
reader.readObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reader.endObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从规格中获取属性,例:material、color
|
* 从规格中获取属性,例:material、color
|
||||||
*
|
*
|
||||||
@@ -1811,6 +1936,20 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
return ObjectUtil.defaultIfNull(value, false);
|
return ObjectUtil.defaultIfNull(value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* value不可转返回null
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private BigDecimal getBigDecimalOrNull(Double value) {
|
||||||
|
try {
|
||||||
|
return BigDecimal.valueOf(value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配件类型转换
|
* 配件类型转换
|
||||||
*
|
*
|
||||||
@@ -1932,7 +2071,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
// 达到批量的阈值就做一次插入
|
// 达到批量的阈值就做一次插入
|
||||||
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||||
|
|
||||||
String sql = "INSERT INTO order_item (id,order_id,type,room_id,body_id,package_id,group_id,plate_id,parts_id,num,organ_id) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
|
String sql = "INSERT INTO order_item (id,order_id,type,room_id,body_id,package_id,group_id,plate_id,parts_id,num,organ_id,comp_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||||
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||||
@Override
|
@Override
|
||||||
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
||||||
@@ -1952,6 +2091,11 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
ps.setLong(9, item.getPartsId());
|
ps.setLong(9, item.getPartsId());
|
||||||
ps.setDouble(10, item.getNum());
|
ps.setDouble(10, item.getNum());
|
||||||
ps.setLong(11, item.getOrganId());
|
ps.setLong(11, item.getOrganId());
|
||||||
|
if (item.getCompId() != null) {
|
||||||
|
ps.setLong(12, item.getCompId());
|
||||||
|
} else {
|
||||||
|
ps.setNull(12, Types.BIGINT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2027,6 +2171,95 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
orderPartsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
orderPartsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void orderComponentBatchInsertWithinThreshold(List<OrderComponentDO> list, boolean isLast) {
|
||||||
|
// 达到批量的阈值就做一次插入
|
||||||
|
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||||
|
|
||||||
|
String sql = """
|
||||||
|
INSERT INTO order_component (
|
||||||
|
id,
|
||||||
|
order_id,
|
||||||
|
organ_id,
|
||||||
|
pid,
|
||||||
|
top_id,
|
||||||
|
name,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
depth,
|
||||||
|
spec,
|
||||||
|
cad_view_file_id,
|
||||||
|
process_status,
|
||||||
|
remark,
|
||||||
|
creator,
|
||||||
|
create_time,
|
||||||
|
updater,
|
||||||
|
update_time,
|
||||||
|
deleted,
|
||||||
|
level
|
||||||
|
) VALUES (
|
||||||
|
?,?,?,?,?,?,
|
||||||
|
?,?,?,?,
|
||||||
|
?,?,?,?,
|
||||||
|
?,?,?,
|
||||||
|
?,?
|
||||||
|
)
|
||||||
|
""";
|
||||||
|
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||||
|
@Override
|
||||||
|
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
||||||
|
OrderComponentDO item = list.get(index);
|
||||||
|
ps.setLong(1, item.getId());
|
||||||
|
ps.setLong(2, item.getOrderId());
|
||||||
|
ps.setLong(3, item.getOrganId());
|
||||||
|
ps.setLong(4, item.getPid());
|
||||||
|
ps.setLong(5, item.getTopId());
|
||||||
|
ps.setString(6, item.getName());
|
||||||
|
if (item.getWidth() != null) {
|
||||||
|
ps.setDouble(7, item.getWidth());
|
||||||
|
} else {
|
||||||
|
ps.setNull(7, Types.DOUBLE);
|
||||||
|
}
|
||||||
|
if (item.getHeight() != null) {
|
||||||
|
ps.setDouble(8, item.getHeight());
|
||||||
|
} else {
|
||||||
|
ps.setNull(8, Types.DOUBLE);
|
||||||
|
}
|
||||||
|
if (item.getDepth() != null) {
|
||||||
|
ps.setDouble(9, item.getDepth());
|
||||||
|
} else {
|
||||||
|
ps.setNull(9, Types.DOUBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.setString(10, item.getSpec());
|
||||||
|
ps.setLong(11, item.getCadViewFileId());
|
||||||
|
ps.setInt(12, item.getProcessStatus());
|
||||||
|
ps.setString(13, item.getRemark());
|
||||||
|
ps.setString(14, item.getCreator());
|
||||||
|
ps.setTimestamp(15, Timestamp.valueOf(item.getCreateTime()));
|
||||||
|
ps.setString(16, item.getUpdater());
|
||||||
|
ps.setTimestamp(17, Timestamp.valueOf(item.getUpdateTime()));
|
||||||
|
ps.setBoolean(18, item.getDeleted());
|
||||||
|
ps.setInt(19, item.getLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatchSize() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (!isLast) {
|
||||||
|
// 存储完成清理 list
|
||||||
|
clearComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearComponent() {
|
||||||
|
orderComponentDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每达到阈值就批量插入一次生产单造型数据和压缩数据
|
* 每达到阈值就批量插入一次生产单造型数据和压缩数据
|
||||||
*
|
*
|
||||||
@@ -2175,6 +2408,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
processGroupMap = null;
|
processGroupMap = null;
|
||||||
existRoomIdMap = null;
|
existRoomIdMap = null;
|
||||||
orderPartMap = null;
|
orderPartMap = null;
|
||||||
|
componentGroupMap = null;
|
||||||
|
|
||||||
plateDOS = null;
|
plateDOS = null;
|
||||||
orderItemDOS = null;
|
orderItemDOS = null;
|
||||||
@@ -2182,6 +2416,7 @@ public class WebCadOrderImportAsyncFactory {
|
|||||||
orderModelDOS = null;
|
orderModelDOS = null;
|
||||||
rawGoodsDOS = null;
|
rawGoodsDOS = null;
|
||||||
goodsDOS = null;
|
goodsDOS = null;
|
||||||
|
orderComponentDOS = null;
|
||||||
sealEdgeConfigList = null;
|
sealEdgeConfigList = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+232
-31
@@ -22,6 +22,7 @@ import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
|||||||
import com.cf.imes.module.executor.enums.OrderItemTypeEnum;
|
import com.cf.imes.module.executor.enums.OrderItemTypeEnum;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockRemarkVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockRemarkVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataBlockReqVO;
|
||||||
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataComponentGroupReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataDoubleRoomTreeReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataDoubleRoomTreeReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataGroupInfoReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataGroupInfoReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataMaterialReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataMaterialReqVO;
|
||||||
@@ -29,6 +30,7 @@ import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadData
|
|||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataProcessGroupReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataProcessGroupReqVO;
|
||||||
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataReqVO;
|
import com.cf.imes.module.plan.controller.admin.orderimport.webcad.vo.WebCadDataReqVO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.goods.GoodsDO;
|
import com.cf.imes.module.plan.dal.dataobject.goods.GoodsDO;
|
||||||
|
import com.cf.imes.module.plan.dal.dataobject.ordecomponent.OrderComponentDO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.order.OrderDO;
|
import com.cf.imes.module.plan.dal.dataobject.order.OrderDO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.orderBody.OrderBodyDO;
|
import com.cf.imes.module.plan.dal.dataobject.orderBody.OrderBodyDO;
|
||||||
import com.cf.imes.module.plan.dal.dataobject.orderGroup.OrderGroupDO;
|
import com.cf.imes.module.plan.dal.dataobject.orderGroup.OrderGroupDO;
|
||||||
@@ -51,6 +53,7 @@ import com.cf.imes.module.plan.dal.mysql.orderBody.OrderBodyMapper;
|
|||||||
import com.cf.imes.module.plan.dal.mysql.plate.PlateMapper;
|
import com.cf.imes.module.plan.dal.mysql.plate.PlateMapper;
|
||||||
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
import com.cf.imes.module.plan.dal.mysql.rawgoods.RawGoodsMapper;
|
||||||
import com.cf.imes.module.plan.enums.ErrorCodeConstants;
|
import com.cf.imes.module.plan.enums.ErrorCodeConstants;
|
||||||
|
import com.cf.imes.module.plan.enums.ordercomponent.OrderComponentProcessStatusEnum;
|
||||||
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
import com.cf.imes.module.plan.service.customplateno.CustomPlateNoGenerateService;
|
||||||
import com.cf.imes.module.plan.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
import com.cf.imes.module.plan.service.customplateno.vo.CustomPlateNoGenerateConfigVO;
|
||||||
import com.cf.imes.module.plan.service.order.OrderInputProcessor;
|
import com.cf.imes.module.plan.service.order.OrderInputProcessor;
|
||||||
@@ -75,7 +78,6 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.util.json.JsonUtils.zipString;
|
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR;
|
||||||
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR;
|
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR;
|
||||||
@@ -160,15 +162,18 @@ public class WebCadOrderImportFactory {
|
|||||||
// 加工组缓存
|
// 加工组缓存
|
||||||
private Map<Integer, WebCadDataGroupInfoReqVO> processGroupMap = new HashMap<>();
|
private Map<Integer, WebCadDataGroupInfoReqVO> processGroupMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 部件缓存:{cad groupId:imes部件id}
|
||||||
|
private Map<Integer, Long> componentGroupMap = new HashMap<>();
|
||||||
|
|
||||||
private List<PlateDO> plateDOS = new ArrayList<>();
|
private List<PlateDO> plateDOS = new ArrayList<>();
|
||||||
private List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
private List<OrderItemDO> orderItemDOS = new ArrayList<>();
|
||||||
private List<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
private List<OrderPartsDO> orderPartsDOS = new ArrayList<>();
|
||||||
private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
private List<OrderModelDO> orderModelDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
private List<RawGoodsDO> rawGoodsDOS = new ArrayList<>();
|
private List<RawGoodsDO> rawGoodsDOS = new ArrayList<>();
|
||||||
private List<GoodsDO> goodsDOS = new ArrayList<>();
|
private List<GoodsDO> goodsDOS = new ArrayList<>();
|
||||||
|
private List<OrderComponentDO> orderComponentDOS = new ArrayList<>();
|
||||||
private List<SystemConfigSealEdgeRespDTO> sealEdgeConfigList;
|
private List<SystemConfigSealEdgeRespDTO> sealEdgeConfigList;
|
||||||
|
|
||||||
|
|
||||||
private static final String PART_CATEGORY_ONE = "封边条";
|
private static final String PART_CATEGORY_ONE = "封边条";
|
||||||
private static final String PART_CATEGORY_TWO = "五金";
|
private static final String PART_CATEGORY_TWO = "五金";
|
||||||
private static final String PART_CATEGORY_THREE = "组件";
|
private static final String PART_CATEGORY_THREE = "组件";
|
||||||
@@ -229,6 +234,8 @@ public class WebCadOrderImportFactory {
|
|||||||
|
|
||||||
public void analyzeTempData(WebCadDataReqVO webCadDataReqVO) {
|
public void analyzeTempData(WebCadDataReqVO webCadDataReqVO) {
|
||||||
try {
|
try {
|
||||||
|
cadViewFileId = webCadDataReqVO.getCadViewFileId();
|
||||||
|
|
||||||
log.debug("====================【cad拆单校验板件数量开始】====================");
|
log.debug("====================【cad拆单校验板件数量开始】====================");
|
||||||
// 校验板件数量
|
// 校验板件数量
|
||||||
analyzePlateNum();
|
analyzePlateNum();
|
||||||
@@ -249,6 +256,11 @@ public class WebCadOrderImportFactory {
|
|||||||
analyzeRoomBody(webCadDataReqVO.getDouleRoomTree());
|
analyzeRoomBody(webCadDataReqVO.getDouleRoomTree());
|
||||||
log.debug("====================【cad拆单解析成倍柜体结束】====================");
|
log.debug("====================【cad拆单解析成倍柜体结束】====================");
|
||||||
|
|
||||||
|
// 缓存部件信息
|
||||||
|
log.debug("====================【cad拆单解析部件开始】====================");
|
||||||
|
analyzeComponentGroup(webCadDataReqVO.getComponentGroup());
|
||||||
|
log.debug("====================【cad拆单解析部件结束】====================");
|
||||||
|
|
||||||
log.debug("====================【cad拆单解析板件开始】====================");
|
log.debug("====================【cad拆单解析板件开始】====================");
|
||||||
// 解析板件列表
|
// 解析板件列表
|
||||||
analyzeBlockList(webCadDataReqVO.getBlocks());
|
analyzeBlockList(webCadDataReqVO.getBlocks());
|
||||||
@@ -263,7 +275,6 @@ public class WebCadOrderImportFactory {
|
|||||||
log.debug("====================【cad拆单全局保存开始】====================");
|
log.debug("====================【cad拆单全局保存开始】====================");
|
||||||
|
|
||||||
// 保存数据柜体、加工组
|
// 保存数据柜体、加工组
|
||||||
cadViewFileId = webCadDataReqVO.getCadViewFileId();
|
|
||||||
saveData();
|
saveData();
|
||||||
log.debug("====================【cad拆单全局保存结束】====================");
|
log.debug("====================【cad拆单全局保存结束】====================");
|
||||||
|
|
||||||
@@ -355,7 +366,7 @@ public class WebCadOrderImportFactory {
|
|||||||
.eq(DELETED_FIELD, false));
|
.eq(DELETED_FIELD, false));
|
||||||
if (CollUtil.isNotEmpty(orderPlateSumResult)) {
|
if (CollUtil.isNotEmpty(orderPlateSumResult)) {
|
||||||
Map<String, Object> resultMap = orderPlateSumResult.get(0);
|
Map<String, Object> resultMap = orderPlateSumResult.get(0);
|
||||||
if(ObjectUtil.isNotNull(resultMap)) {
|
if (ObjectUtil.isNotNull(resultMap)) {
|
||||||
currentPlateArea = (BigDecimal) resultMap.get("area");
|
currentPlateArea = (BigDecimal) resultMap.get("area");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -432,9 +443,9 @@ public class WebCadOrderImportFactory {
|
|||||||
.texture(materialReqVO.getTexture())
|
.texture(materialReqVO.getTexture())
|
||||||
.color(materialReqVO.getColor())
|
.color(materialReqVO.getColor())
|
||||||
.colorBlack(EMPTY_STRING)
|
.colorBlack(EMPTY_STRING)
|
||||||
.width(BigDecimal.valueOf(getZeroDouble(materialReqVO.getWidth())))
|
.width(getBigDecimalOrNull(getZeroDouble(materialReqVO.getWidth())))
|
||||||
.height(BigDecimal.valueOf(getZeroDouble(materialReqVO.getHeight())))
|
.height(getBigDecimalOrNull(getZeroDouble(materialReqVO.getHeight())))
|
||||||
.thickness(BigDecimal.valueOf(materialReqVO.getThickness()))
|
.thickness(getBigDecimalOrNull(materialReqVO.getThickness()))
|
||||||
.spec(getEmpty(materialReqVO.getSpec()))
|
.spec(getEmpty(materialReqVO.getSpec()))
|
||||||
.brand(getEmpty(materialReqVO.getBrand()))
|
.brand(getEmpty(materialReqVO.getBrand()))
|
||||||
.remark(EMPTY_STRING)
|
.remark(EMPTY_STRING)
|
||||||
@@ -508,6 +519,73 @@ public class WebCadOrderImportFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析部件信息
|
||||||
|
*
|
||||||
|
* @param componentGroupReqVOS
|
||||||
|
*/
|
||||||
|
private void analyzeComponentGroup(List<WebCadDataComponentGroupReqVO> componentGroupReqVOS) {
|
||||||
|
if (CollUtil.isEmpty(componentGroupReqVOS)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (WebCadDataComponentGroupReqVO componentGroupReqVO : componentGroupReqVOS) {
|
||||||
|
createAndCacheComponent(componentGroupReqVO, null, null, 0);
|
||||||
|
}
|
||||||
|
// 部件入库
|
||||||
|
orderComponentBatchInsertWithinThreshold(orderComponentDOS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建部件并缓存
|
||||||
|
*
|
||||||
|
* @param componentGroupReqVO cad部件数据
|
||||||
|
* @param parentId 父级部件id
|
||||||
|
* @param topId 顶级部件id
|
||||||
|
* @param level 层级从0开始计算
|
||||||
|
*/
|
||||||
|
private void createAndCacheComponent(WebCadDataComponentGroupReqVO componentGroupReqVO, Long parentId, Long topId, int level) {
|
||||||
|
if (ObjectUtil.isNull(parentId)) {
|
||||||
|
parentId = OrderComponentDO.PARENT_ID_ROOT;
|
||||||
|
}
|
||||||
|
Integer cadGroupId = componentGroupReqVO.getGroupId();
|
||||||
|
Long componentId = (Long) snowFlakeGenerator.nextId(null);
|
||||||
|
// 顶级节点创建过一次后后续继续使用
|
||||||
|
if (ObjectUtil.isNull(topId)) {
|
||||||
|
topId = componentId;
|
||||||
|
}
|
||||||
|
OrderComponentDO componentDO = OrderComponentDO.builder()
|
||||||
|
.id(componentId)
|
||||||
|
.organId(organId)
|
||||||
|
.orderId(orderId)
|
||||||
|
.pid(parentId)
|
||||||
|
.topId(topId)
|
||||||
|
.name(componentGroupReqVO.getName())
|
||||||
|
.width(componentGroupReqVO.getBoxSize().getWidth())
|
||||||
|
.height(componentGroupReqVO.getBoxSize().getHeight())
|
||||||
|
.depth(componentGroupReqVO.getBoxSize().getDepth())
|
||||||
|
.cadViewFileId(cadViewFileId)
|
||||||
|
.processStatus(OrderComponentProcessStatusEnum.UNPROCESSED.getStatus())
|
||||||
|
.level(level)
|
||||||
|
.build();
|
||||||
|
componentDO.setCreateTime(now);
|
||||||
|
componentDO.setUpdateTime(now);
|
||||||
|
componentDO.setCreator(operatorName);
|
||||||
|
componentDO.setUpdater(operatorName);
|
||||||
|
componentDO.setDeleted(false);
|
||||||
|
|
||||||
|
// 缓存部件
|
||||||
|
componentGroupMap.put(cadGroupId, componentId);
|
||||||
|
// 部件入库
|
||||||
|
orderComponentDOS.add(componentDO);
|
||||||
|
orderComponentBatchInsertWithinThreshold(orderComponentDOS, false);
|
||||||
|
// 继续处理下级
|
||||||
|
if (!componentGroupReqVO.getChildren().isEmpty()) {
|
||||||
|
for (WebCadDataComponentGroupReqVO children : componentGroupReqVO.getChildren()) {
|
||||||
|
createAndCacheComponent(children, componentId, topId, ++level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析生产单信息板材列表
|
* 解析生产单信息板材列表
|
||||||
*
|
*
|
||||||
@@ -662,6 +740,16 @@ public class WebCadOrderImportFactory {
|
|||||||
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
goodsDO.setPlateNum(goodsDO.getPlateNum() + 1);
|
||||||
goodsDO.setArea(goodsDO.getArea() + area);
|
goodsDO.setArea(goodsDO.getArea() + area);
|
||||||
|
|
||||||
|
// 获取缓存的部件id
|
||||||
|
Integer cadGroupId = block.getComponentId();
|
||||||
|
Long plateComponentId = null;
|
||||||
|
if (ObjectUtil.isNotNull(cadGroupId)) {
|
||||||
|
Long componentId = componentGroupMap.get(cadGroupId);
|
||||||
|
if (ObjectUtil.isNotNull(componentId)) {
|
||||||
|
plateComponentId = componentId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String splitHeight = block.getSpliteHeight();
|
String splitHeight = block.getSpliteHeight();
|
||||||
String spliteWidth = block.getSpliteWidth();
|
String spliteWidth = block.getSpliteWidth();
|
||||||
@@ -673,13 +761,13 @@ public class WebCadOrderImportFactory {
|
|||||||
.plateNo(obtainingTime + Long.toString(plateNo).substring(2))
|
.plateNo(obtainingTime + Long.toString(plateNo).substring(2))
|
||||||
.type(block.getType())
|
.type(block.getType())
|
||||||
.goodsId(goodsDO.getId())
|
.goodsId(goodsDO.getId())
|
||||||
.width(BigDecimal.valueOf(block.getWidth()))
|
.width(getBigDecimalOrNull(block.getWidth()))
|
||||||
.height(BigDecimal.valueOf(block.getHeight()))
|
.height(getBigDecimalOrNull(block.getHeight()))
|
||||||
.thickness(BigDecimal.valueOf(block.getThickness()))
|
.thickness(getBigDecimalOrNull(block.getThickness()))
|
||||||
.splitHeight(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(splitHeight) ? splitHeight : String.valueOf(block.getKaiLiaoHeight()))))
|
.splitHeight(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(splitHeight) ? splitHeight : String.valueOf(block.getKaiLiaoHeight()))))
|
||||||
.splitThickness(BigDecimal.valueOf(NumberUtil.parseDouble(block.getSpliteThickness())))
|
.splitThickness(BigDecimal.valueOf(NumberUtil.parseDouble(block.getSpliteThickness())))
|
||||||
.splitWidth(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(spliteWidth) ? spliteWidth : String.valueOf(block.getKaiLiaoWidth()))))
|
.splitWidth(BigDecimal.valueOf(NumberUtil.parseDouble(StringUtils.isNotEmpty(spliteWidth) ? spliteWidth : String.valueOf(block.getKaiLiaoWidth()))))
|
||||||
.area(BigDecimal.valueOf(area))
|
.area(getBigDecimalOrNull(area))
|
||||||
.texture(block.getTexture())
|
.texture(block.getTexture())
|
||||||
.holeFace(block.getHoleFace())
|
.holeFace(block.getHoleFace())
|
||||||
.isDoor(block.getIsDoor())
|
.isDoor(block.getIsDoor())
|
||||||
@@ -698,18 +786,18 @@ public class WebCadOrderImportFactory {
|
|||||||
.sideHoleCount(block.getSideHoleCount())
|
.sideHoleCount(block.getSideHoleCount())
|
||||||
.frontModelCount(block.getFrontModelCount())
|
.frontModelCount(block.getFrontModelCount())
|
||||||
.backModelCount(block.getBackModelCount())
|
.backModelCount(block.getBackModelCount())
|
||||||
.offsetX(BigDecimal.valueOf(block.getOffsetX()))
|
.offsetX(getBigDecimalOrNull(block.getOffsetX()))
|
||||||
.offsetY(BigDecimal.valueOf(block.getOffsetY()))
|
.offsetY(getBigDecimalOrNull(block.getOffsetY()))
|
||||||
.isArcAcross(getDefaultFalse(block.getIsArcBase()))
|
.isArcAcross(getDefaultFalse(block.getIsArcBase()))
|
||||||
.moduleTypeId(0L)
|
.moduleTypeId(0L)
|
||||||
.isOptimized(false)
|
.isOptimized(false)
|
||||||
.isCutted(0)
|
.isCutted(0)
|
||||||
.isCancel(false)
|
.isCancel(false)
|
||||||
.filterType(EMPTY_STRING)
|
.filterType(EMPTY_STRING)
|
||||||
.sealLeft(BigDecimal.valueOf(block.getSealLeft()))
|
.sealLeft(getBigDecimalOrNull(block.getSealLeft()))
|
||||||
.sealRight(BigDecimal.valueOf(block.getSealRight()))
|
.sealRight(getBigDecimalOrNull(block.getSealRight()))
|
||||||
.sealUp(BigDecimal.valueOf(block.getSealUp()))
|
.sealUp(getBigDecimalOrNull(block.getSealUp()))
|
||||||
.sealDown(BigDecimal.valueOf(block.getSealDown()))
|
.sealDown(getBigDecimalOrNull(block.getSealDown()))
|
||||||
.remark(remark.toString())
|
.remark(remark.toString())
|
||||||
.deleted(false)
|
.deleted(false)
|
||||||
.organId(organId)
|
.organId(organId)
|
||||||
@@ -745,7 +833,7 @@ public class WebCadOrderImportFactory {
|
|||||||
orderModelsBatchInsertWithinThreshold(false);
|
orderModelsBatchInsertWithinThreshold(false);
|
||||||
|
|
||||||
// 遍历加工组信息,生成对应的加工组和item
|
// 遍历加工组信息,生成对应的加工组和item
|
||||||
analyzeBlockProcessGroup(orderBodyDO, block, plateId);
|
analyzeBlockProcessGroup(orderBodyDO, block, plateId, plateComponentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -762,10 +850,10 @@ public class WebCadOrderImportFactory {
|
|||||||
.texture(block.getTexture())
|
.texture(block.getTexture())
|
||||||
.typographicFace(block.getHoleArrange())
|
.typographicFace(block.getHoleArrange())
|
||||||
.openDoorType(block.getOpenDoorType())
|
.openDoorType(block.getOpenDoorType())
|
||||||
.splitLength(BigDecimal.valueOf(block.getKaiLiaoHeight()))
|
.splitLength(getBigDecimalOrNull(block.getKaiLiaoHeight()))
|
||||||
.splitWidth(BigDecimal.valueOf(block.getKaiLiaoWidth()))
|
.splitWidth(getBigDecimalOrNull(block.getKaiLiaoWidth()))
|
||||||
.offsetX(BigDecimal.valueOf(block.getOffsetX()))
|
.offsetX(getBigDecimalOrNull(block.getOffsetX()))
|
||||||
.offsetY(BigDecimal.valueOf(block.getOffsetY()))
|
.offsetY(getBigDecimalOrNull(block.getOffsetY()))
|
||||||
.pointDetail(getPointDetail(pointInfo.getPointDetail()))
|
.pointDetail(getPointDetail(pointInfo.getPointDetail()))
|
||||||
.rawPointDetail(getRawPointDetail(pointInfo.getOrgPointDetail()))
|
.rawPointDetail(getRawPointDetail(pointInfo.getOrgPointDetail()))
|
||||||
.holeDetail(getHoleDetail(pointInfo.getHoleDetail()))
|
.holeDetail(getHoleDetail(pointInfo.getHoleDetail()))
|
||||||
@@ -1047,7 +1135,9 @@ public class WebCadOrderImportFactory {
|
|||||||
*/
|
*/
|
||||||
private List<ModelDetail> getSideDetail(List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSideModelDetailList, List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSide2DModelDetail) {
|
private List<ModelDetail> getSideDetail(List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSideModelDetailList, List<WebCadDataBlockReqVO.PointInfoDTO.SideModelDetailDTO> cadSide2DModelDetail) {
|
||||||
// 合并侧面2v刀路列表
|
// 合并侧面2v刀路列表
|
||||||
cadSideModelDetailList.addAll(cadSide2DModelDetail);
|
if (CollUtil.isNotEmpty(cadSide2DModelDetail)) {
|
||||||
|
cadSideModelDetailList.addAll(cadSide2DModelDetail);
|
||||||
|
}
|
||||||
if (CollUtil.isNotEmpty(cadSideModelDetailList)) {
|
if (CollUtil.isNotEmpty(cadSideModelDetailList)) {
|
||||||
List<ModelDetail> modelDetails = new ArrayList<>();
|
List<ModelDetail> modelDetails = new ArrayList<>();
|
||||||
// 侧面造型和侧面2v刀路合并,序号从头计算不使用cad的
|
// 侧面造型和侧面2v刀路合并,序号从头计算不使用cad的
|
||||||
@@ -1176,7 +1266,7 @@ public class WebCadOrderImportFactory {
|
|||||||
* @param block
|
* @param block
|
||||||
* @param plateId
|
* @param plateId
|
||||||
*/
|
*/
|
||||||
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId) {
|
private void analyzeBlockProcessGroup(OrderBodyDO orderBodyDO, WebCadDataBlockReqVO block, Long plateId, Long componentId) {
|
||||||
Long bodyId = orderBodyDO.getId();
|
Long bodyId = orderBodyDO.getId();
|
||||||
Long roomId = orderBodyDO.getRoomId();
|
Long roomId = orderBodyDO.getRoomId();
|
||||||
|
|
||||||
@@ -1251,6 +1341,7 @@ public class WebCadOrderImportFactory {
|
|||||||
.partsId(0L)
|
.partsId(0L)
|
||||||
.num(1.0)
|
.num(1.0)
|
||||||
.organId(organId)
|
.organId(organId)
|
||||||
|
.compId(componentId)
|
||||||
.build();
|
.build();
|
||||||
orderItemDOS.add(orderItemDO);
|
orderItemDOS.add(orderItemDO);
|
||||||
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
orderItemBatchInsertWithinThreshold(orderItemDOS, false);
|
||||||
@@ -1663,6 +1754,20 @@ public class WebCadOrderImportFactory {
|
|||||||
return ObjectUtil.defaultIfNull(value, false);
|
return ObjectUtil.defaultIfNull(value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* value不可转返回null
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private BigDecimal getBigDecimalOrNull(Double value) {
|
||||||
|
try {
|
||||||
|
return BigDecimal.valueOf(value);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配件类型转换
|
* 配件类型转换
|
||||||
*
|
*
|
||||||
@@ -1776,15 +1881,15 @@ public class WebCadOrderImportFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearPlate(){
|
private void clearPlate() {
|
||||||
plateDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
plateDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void orderItemBatchInsertWithinThreshold(List<OrderItemDO> list, boolean isLast) {
|
private void orderItemBatchInsertWithinThreshold(List<OrderItemDO> list, boolean isLast) {
|
||||||
// 达到批量的阈值就做一次插入
|
// 达到批量的阈值就做一次插入
|
||||||
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||||
|
|
||||||
String sql = "INSERT INTO order_item (id,order_id,type,room_id,body_id,package_id,group_id,plate_id,parts_id,num,organ_id) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
|
String sql = "INSERT INTO order_item (id,order_id,type,room_id,body_id,package_id,group_id,plate_id,parts_id,num,organ_id,comp_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||||
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||||
@Override
|
@Override
|
||||||
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
||||||
@@ -1804,6 +1909,11 @@ public class WebCadOrderImportFactory {
|
|||||||
ps.setLong(9, item.getPartsId());
|
ps.setLong(9, item.getPartsId());
|
||||||
ps.setDouble(10, item.getNum());
|
ps.setDouble(10, item.getNum());
|
||||||
ps.setLong(11, item.getOrganId());
|
ps.setLong(11, item.getOrganId());
|
||||||
|
if (item.getCompId() != null) {
|
||||||
|
ps.setLong(12, item.getCompId());
|
||||||
|
} else {
|
||||||
|
ps.setNull(12, Types.BIGINT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1820,8 +1930,8 @@ public class WebCadOrderImportFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearItem(){
|
private void clearItem() {
|
||||||
orderItemDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
orderItemDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void orderPartBatchInsertWithinThreshold(List<OrderPartsDO> list, boolean isLast) {
|
private void orderPartBatchInsertWithinThreshold(List<OrderPartsDO> list, boolean isLast) {
|
||||||
@@ -1875,8 +1985,97 @@ public class WebCadOrderImportFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearPart(){
|
private void clearPart() {
|
||||||
orderPartsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
orderPartsDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void orderComponentBatchInsertWithinThreshold(List<OrderComponentDO> list, boolean isLast) {
|
||||||
|
// 达到批量的阈值就做一次插入
|
||||||
|
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
|
||||||
|
|
||||||
|
String sql = """
|
||||||
|
INSERT INTO order_component (
|
||||||
|
id,
|
||||||
|
order_id,
|
||||||
|
organ_id,
|
||||||
|
pid,
|
||||||
|
top_id,
|
||||||
|
name,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
depth,
|
||||||
|
spec,
|
||||||
|
cad_view_file_id,
|
||||||
|
process_status,
|
||||||
|
remark,
|
||||||
|
creator,
|
||||||
|
create_time,
|
||||||
|
updater,
|
||||||
|
update_time,
|
||||||
|
deleted,
|
||||||
|
level
|
||||||
|
) VALUES (
|
||||||
|
?,?,?,?,?,?,
|
||||||
|
?,?,?,?,
|
||||||
|
?,?,?,?,
|
||||||
|
?,?,?,
|
||||||
|
?,?
|
||||||
|
)
|
||||||
|
""";
|
||||||
|
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
|
||||||
|
@Override
|
||||||
|
public void setValues(PreparedStatement ps, int index) throws SQLException {
|
||||||
|
OrderComponentDO item = list.get(index);
|
||||||
|
ps.setLong(1, item.getId());
|
||||||
|
ps.setLong(2, item.getOrderId());
|
||||||
|
ps.setLong(3, item.getOrganId());
|
||||||
|
ps.setLong(4, item.getPid());
|
||||||
|
ps.setLong(5, item.getTopId());
|
||||||
|
ps.setString(6, item.getName());
|
||||||
|
if (item.getWidth() != null) {
|
||||||
|
ps.setDouble(7, item.getWidth());
|
||||||
|
} else {
|
||||||
|
ps.setNull(7, Types.DOUBLE);
|
||||||
|
}
|
||||||
|
if (item.getHeight() != null) {
|
||||||
|
ps.setDouble(8, item.getHeight());
|
||||||
|
} else {
|
||||||
|
ps.setNull(8, Types.DOUBLE);
|
||||||
|
}
|
||||||
|
if (item.getDepth() != null) {
|
||||||
|
ps.setDouble(9, item.getDepth());
|
||||||
|
} else {
|
||||||
|
ps.setNull(9, Types.DOUBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.setString(10, item.getSpec());
|
||||||
|
ps.setLong(11, item.getCadViewFileId());
|
||||||
|
ps.setInt(12, item.getProcessStatus());
|
||||||
|
ps.setString(13, item.getRemark());
|
||||||
|
ps.setString(14, item.getCreator());
|
||||||
|
ps.setTimestamp(15, Timestamp.valueOf(item.getCreateTime()));
|
||||||
|
ps.setString(16, item.getUpdater());
|
||||||
|
ps.setTimestamp(17, Timestamp.valueOf(item.getUpdateTime()));
|
||||||
|
ps.setBoolean(18, item.getDeleted());
|
||||||
|
ps.setInt(19, item.getLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatchSize() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (!isLast) {
|
||||||
|
// 存储完成清理 list
|
||||||
|
clearComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearComponent() {
|
||||||
|
orderComponentDOS = ListUtils.newArrayListWithExpectedSize(BATCH_THRESHOLD_NUMBER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2080,6 +2279,7 @@ public class WebCadOrderImportFactory {
|
|||||||
processGroupMap = null;
|
processGroupMap = null;
|
||||||
existRoomIdMap = null;
|
existRoomIdMap = null;
|
||||||
orderPartMap = null;
|
orderPartMap = null;
|
||||||
|
componentGroupMap = null;
|
||||||
|
|
||||||
plateDOS = null;
|
plateDOS = null;
|
||||||
orderItemDOS = null;
|
orderItemDOS = null;
|
||||||
@@ -2087,6 +2287,7 @@ public class WebCadOrderImportFactory {
|
|||||||
orderModelDOS = null;
|
orderModelDOS = null;
|
||||||
rawGoodsDOS = null;
|
rawGoodsDOS = null;
|
||||||
goodsDOS = null;
|
goodsDOS = null;
|
||||||
|
orderComponentDOS = null;
|
||||||
sealEdgeConfigList = null;
|
sealEdgeConfigList = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user