1、产品明细Service单元测试覆盖率异常修复;2、cad拆单新增支持板件的cadid和cad数据存储、生产单cadviewpath图纸路径存储;

This commit is contained in:
gaoqr
2025-12-17 15:35:52 +08:00
parent 010678724d
commit 89cc926634
14 changed files with 89 additions and 6 deletions
@@ -83,4 +83,10 @@ public class OrderPlatesDetailReqVO {
@ExcelProperty("颜色")
private String color;
@Schema(description = "cad图纸id")
private Integer cadViewId;
@Schema(description = "cad图纸数据")
private String cadData;
}
@@ -89,4 +89,6 @@ public class OrderRespVO {
private Boolean deleted;
@Schema(description = "cad图纸路径")
private String cadViewPath;
}
@@ -241,6 +241,11 @@ public class PlateRespVO extends PageParam {
@Schema(description = "排单状态")
private Long planStatus;
@Schema(description = "cad图纸id")
private Integer cadViewId;
@Schema(description = "cad图纸数据")
private String cadData;
// @Schema(description = "小板详情列表")
@@ -146,4 +146,9 @@ public class OrderDO extends BaseDO {
private Double plannedPlateArea;
private int version;
/**
* cad图纸路径
*/
private String cadViewPath;
}
@@ -211,4 +211,15 @@ public class PlateDO extends BaseDO {
* 排单id
*/
private Long planId;
/**
* cad图纸id
*/
private Integer cadViewId;
/**
* cad图纸数据
*/
private String cadData;
}
@@ -73,6 +73,7 @@ import com.cf.imes.module.executor.util.deviseData.structure.FieldConstants;
import com.cf.imes.module.executor.util.deviseData.structure.PlateDetail;
import com.cf.imes.module.executor.util.elasticsearch.EsUtils;
import com.cf.imes.module.executor.util.fileConversion.admin.api.webcad.ApiDataTypeVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -96,6 +97,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString;
import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId;
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*;
import static com.cf.imes.module.executor.enums.EsIndexEnum.*;
@@ -307,7 +309,15 @@ public class OrderServiceImpl implements OrderService {
IPage<PlateRespVO> plateRespVOPage = orderItemMapper.selectPlatesDetailByOrderId(page, orderId, roomIds, bodyIds, groupIds,
groupName, getUserOrganId(), deleted);
List<PlateRespVO> orderDetail = plateRespVOPage.getRecords();
List<OrderPlatesDetailReqVO> platesDetailReqVOS = BeanUtils.toBean(orderDetail, OrderPlatesDetailReqVO.class);
List<OrderPlatesDetailReqVO> platesDetailReqVOS = new ArrayList<>();
for (PlateRespVO plateRespVO : orderDetail) {
OrderPlatesDetailReqVO orderPlatesDetailReqVO = BeanUtils.toBean(plateRespVO, OrderPlatesDetailReqVO.class);
String cadData = orderPlatesDetailReqVO.getCadData();
if(StringUtils.isNotEmpty(cadData)) {
orderPlatesDetailReqVO.setCadData(unzipString(cadData));
}
platesDetailReqVOS.add(orderPlatesDetailReqVO);
}
return new PageResult(platesDetailReqVOS, plateRespVOPage.getTotal());
}
@@ -6,7 +6,7 @@
<select id="selectPlatesDetailByOrderId" resultType="com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO">
SELECT DISTINCT i.order_id, p.id, p.plate_no, g.material, p.name, p.area, p.seal_left, p.seal_down,
p.seal_right, p.seal_up, p.texture, p.is_special_shaped, p.is_sculpt,p.is_side_sculpt,p.is_2v, p.is_side_2v, p.unregular_point_count, p.front_hole_count,
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness,p.remark,g.color,p.is_row_hole, p.custom_plate_no
p.back_hole_count, p.side_hole_count,p.width,p.height,p.thickness,p.remark,g.color,p.is_row_hole, p.custom_plate_no, p.cad_view_id, p.cad_data
FROM order_item i
RIGHT JOIN `order_plate` p ON i.plate_id = p.id
LEFT JOIN `order_goods` g ON g.id = p.goods_id
@@ -24,6 +24,8 @@ public class WebCadDataBlockReqVO {
private String name;
private Integer type;
private Integer custBlockNo;
@JsonProperty(value = "ID")
private Integer ID;
@Max(value = 99999, message = "板件宽度不能超过99999")
@Min(value = 0, message = "板件宽度最小值为0")
@@ -91,6 +93,9 @@ public class WebCadDataBlockReqVO {
// private Long plateGoodsId;
private String goodsCode;
@JsonProperty(value = "CadData")
private String CadData;
private List<Integer> groupIds = new ArrayList<>();
public void setIsSpecialShape(boolean specialShape) {
@@ -33,4 +33,6 @@ public class WebCadDataReqVO {
@JsonProperty(value = "Blocks")
private List<WebCadDataDoubleRoomTreeReqVO> blocks;
private String cadViewPath;
}
@@ -157,4 +157,9 @@ public class OrderDO extends BaseDO {
* 版本号:乐观锁用
*/
private int version;
/**
* cad图纸路径
*/
private String cadViewPath;
}
@@ -291,4 +291,14 @@ public class PlateDO extends BaseDO {
* 排单id
*/
private Long planId;
/**
* cad图纸id
*/
private Integer cadViewId;
/**
* cad图纸数据
*/
private String cadData;
}
@@ -85,6 +85,7 @@ import java.util.List;
import java.util.Map;
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_ORDER_PLATENUM_CHECK_ERROR;
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR;
@@ -201,6 +202,9 @@ public class WebCadOrderImportAsyncFactory {
private String tempFilePath;
// cad图纸路径
private String cadViewPath;
public WebCadOrderImportAsyncFactory(Long organId,
OrderMapper orderMapper,
SnowFlakeGenerator snowFlakeGenerator,
@@ -268,6 +272,9 @@ public class WebCadOrderImportAsyncFactory {
analyzeOrder(reader.readString());
log.debug("====================【cad拆单解析生产单结束】====================");
break;
case "cadViewPath":
cadViewPath = reader.readString();
break;
case "Materials":
log.debug("====================【cad拆单解析板材开始】====================");
analyzeMaterials(reader);
@@ -843,6 +850,8 @@ public class WebCadOrderImportAsyncFactory {
.deleted(false)
.organId(organId)
.planId(0L)
.cadViewId(block.getID())
.cadData(StringUtils.isNotEmpty(block.getCadData()) ? zipString(block.getCadData()) : null)
.build();
plateDO.setCreator(operatorName);
plateDO.setUpdater(operatorName);
@@ -1837,7 +1846,7 @@ public class WebCadOrderImportAsyncFactory {
private void orderPlateBatchInsertWithinThreshold(List<PlateDO> list, boolean isLast) {
// 达到批量的阈值就做一次插入
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
String sql = "INSERT INTO order_plate (id,organ_id,order_id,name,plate_no,type,goods_id,width,height,thickness,split_width,split_height,split_thickness,seal_left,seal_right,seal_up,seal_down,area,texture,hole_face,hole_arrange,unregular_point_count,front_hole_count,back_hole_count,side_hole_count,front_model_count,back_model_count,is_door,open_door_type,offset_x,offset_y,is_arc_across,module_type_id,is_special_shaped,is_sculpt,is_side_sculpt,is_2v,is_side_2v,is_row_hole,is_optimized,is_cutted,filter_type,remark,is_cancel,deleted,custom_plate_no,create_time,update_time,creator,updater) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
String sql = "INSERT INTO order_plate (id,organ_id,order_id,name,plate_no,type,goods_id,width,height,thickness,split_width,split_height,split_thickness,seal_left,seal_right,seal_up,seal_down,area,texture,hole_face,hole_arrange,unregular_point_count,front_hole_count,back_hole_count,side_hole_count,front_model_count,back_model_count,is_door,open_door_type,offset_x,offset_y,is_arc_across,module_type_id,is_special_shaped,is_sculpt,is_side_sculpt,is_2v,is_side_2v,is_row_hole,is_optimized,is_cutted,filter_type,remark,is_cancel,deleted,custom_plate_no,create_time,update_time,creator,updater, cad_view_id, cad_data) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int index) throws SQLException {
@@ -1892,6 +1901,8 @@ public class WebCadOrderImportAsyncFactory {
ps.setTimestamp(48, Timestamp.valueOf(item.getUpdateTime()));
ps.setString(49, item.getCreator());
ps.setString(50, item.getUpdater());
ps.setInt(51, item.getCadViewId());
ps.setString(52, item.getCadData());
}
@Override
@@ -2201,6 +2212,7 @@ public class WebCadOrderImportAsyncFactory {
.eq(OrderDO::getVersion, version)
.set(OrderDO::getPlateNum, currentPlateNum)
.set(OrderDO::getArea, currentPlateArea)
.set(OrderDO::getCadViewPath, cadViewPath)
.set(OrderDO::getVersion, version + 1));
if (updated == 0) {
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
@@ -75,6 +75,7 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
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_ORDER_PLATENUM_CHECK_ERROR;
import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR;
@@ -265,7 +266,7 @@ public class WebCadOrderImportFactory {
insertOrUpdatePlateNumGoods();
// 更新生产单板件数量
updateOrderPlateNum();
updateOrderPlateNum(webCadDataReqVO.getCadViewPath());
// 所有自定义板编号生成完成后更新配置到生产单
customPlateNoGenerateService.updateCustomPlateNoGenerateConfig(plateNoGenerateConfigVO, orderDO);
@@ -705,6 +706,8 @@ public class WebCadOrderImportFactory {
.deleted(false)
.organId(organId)
.planId(0L)
.cadViewId(block.getID())
.cadData(StringUtils.isNotEmpty(block.getCadData()) ? zipString(block.getCadData()) : null)
.build();
plateDO.setCreator(operatorName);
plateDO.setUpdater(operatorName);
@@ -1694,7 +1697,7 @@ public class WebCadOrderImportFactory {
private void orderPlateBatchInsertWithinThreshold(List<PlateDO> list, boolean isLast) {
// 达到批量的阈值就做一次插入
if (CollUtil.isNotEmpty(list) && (list.size() >= BATCH_THRESHOLD_NUMBER || isLast)) {
String sql = "INSERT INTO order_plate (id,organ_id,order_id,name,plate_no,type,goods_id,width,height,thickness,split_width,split_height,split_thickness,seal_left,seal_right,seal_up,seal_down,area,texture,hole_face,hole_arrange,unregular_point_count,front_hole_count,back_hole_count,side_hole_count,front_model_count,back_model_count,is_door,open_door_type,offset_x,offset_y,is_arc_across,module_type_id,is_special_shaped,is_sculpt,is_side_sculpt,is_2v,is_side_2v,is_row_hole,is_optimized,is_cutted,filter_type,remark,is_cancel,deleted,custom_plate_no,create_time,update_time,creator,updater) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
String sql = "INSERT INTO order_plate (id,organ_id,order_id,name,plate_no,type,goods_id,width,height,thickness,split_width,split_height,split_thickness,seal_left,seal_right,seal_up,seal_down,area,texture,hole_face,hole_arrange,unregular_point_count,front_hole_count,back_hole_count,side_hole_count,front_model_count,back_model_count,is_door,open_door_type,offset_x,offset_y,is_arc_across,module_type_id,is_special_shaped,is_sculpt,is_side_sculpt,is_2v,is_side_2v,is_row_hole,is_optimized,is_cutted,filter_type,remark,is_cancel,deleted,custom_plate_no,create_time,update_time,creator,updater, cad_view_id, cad_data) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
@Override
public void setValues(PreparedStatement ps, int index) throws SQLException {
@@ -1749,6 +1752,8 @@ public class WebCadOrderImportFactory {
ps.setTimestamp(48, Timestamp.valueOf(item.getUpdateTime()));
ps.setString(49, item.getCreator());
ps.setString(50, item.getUpdater());
ps.setInt(51, item.getCadViewId());
ps.setString(52, item.getCadData());
}
@Override
@@ -2008,7 +2013,7 @@ public class WebCadOrderImportFactory {
/**
* 更新生产单的板件总数
*/
private void updateOrderPlateNum() {
private void updateOrderPlateNum(String cadViewPath) {
int version = orderDO.getVersion();
Long orderId = orderDO.getId();
int updated = orderMapper.update(new LambdaUpdateWrapper<OrderDO>()
@@ -2017,6 +2022,7 @@ public class WebCadOrderImportFactory {
.eq(OrderDO::getVersion, version)
.set(OrderDO::getPlateNum, currentPlateNum)
.set(OrderDO::getArea, currentPlateArea)
.set(OrderDO::getCadViewPath, cadViewPath)
.set(OrderDO::getVersion, version + 1));
if (updated == 0) {
throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId);
@@ -1,6 +1,7 @@
package com.cf.imes.module.system.service.funds.products;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
import com.cf.imes.framework.test.core.ut.BaseDbAndRedisUnitTest;
import com.cf.imes.module.system.controller.admin.funds.products.vo.productDetails.ProductDetailsPageReqVO;
import com.cf.imes.module.system.controller.admin.funds.products.vo.productDetails.ProductDetailsSaveReqVO;
@@ -47,6 +48,9 @@ public class ProductsDetailServiceImplTest extends BaseDbAndRedisUnitTest {
@MockitoBean
private ProductsMapper productsMapper;
@MockitoBean
private I18nUtils i18nUtils;
@Test
void testCreateProductDetails() {
// mock下架状态的产品