mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 12:52:07 +08:00
代码检查部分错误修改
This commit is contained in:
+6
-4
@@ -46,6 +46,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
@@ -223,8 +224,8 @@ public class OrderController {
|
||||
plate, // 板件明细
|
||||
dataModule,// 加工组信息
|
||||
block,// 板材数据
|
||||
orderNo,// 原始板编号
|
||||
orderId,
|
||||
orderNo,// 原始生产单号
|
||||
orderId,// 生成生产单号
|
||||
organId);
|
||||
Long id = orderService.importApiData(listMap);
|
||||
return success(String.valueOf(id));
|
||||
@@ -252,7 +253,7 @@ public class OrderController {
|
||||
HttpServletResponse response) throws Exception {
|
||||
List<OrderPlateImportExcelVO> list = null;
|
||||
OrderXmlVO orderXmlVO = null;
|
||||
Map<String, List<?>> listMap = null;
|
||||
Map<String, Object> listMap = null;
|
||||
|
||||
OrderDO orderDO = null;
|
||||
Map<String, Object> mapOrder = null;
|
||||
@@ -272,7 +273,8 @@ public class OrderController {
|
||||
mapOrder = (Map<String, Object>) mapChange.get("file");
|
||||
orderDO = (OrderDO) mapChange.get("order");
|
||||
orderDO.setId((Long) snowFlakeGenerator.nextId(null));
|
||||
flag = (Boolean) mapChange.get("error");
|
||||
AtomicBoolean error = (AtomicBoolean) mapChange.get("error");
|
||||
flag = error.get();
|
||||
}
|
||||
} else {
|
||||
orderDO = orderService.getOrder(orderId);
|
||||
|
||||
+56
-35
@@ -111,42 +111,63 @@ public class OrderInputProcessor {
|
||||
Collection<GoodsDO> goodsDOS, Collection<PlateGoodDO> plateGoodDOS) {
|
||||
|
||||
|
||||
if (rawGoodsDOS != null)
|
||||
for (int i = 0; i < rawGoodsDOS.size(); i += 1000) {
|
||||
rawGoodsMapper.insertBatch(rawGoodsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
if (orderBodyDOS != null)
|
||||
for (int i = 0; i < orderBodyDOS.size(); i += 1000) {
|
||||
orderBodyMapper.insertBatch(orderBodyDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
if (orderGroupDOS != null)
|
||||
for (int i = 0; i < orderGroupDOS.size(); i += 1000) {
|
||||
orderGroupMapper.insertBatch(orderGroupDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
if (orderPartsDOS != null)
|
||||
for (int i = 0; i < orderPartsDOS.size(); i += 1000) {
|
||||
orderPartsMapper.insertBatch(orderPartsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
if (plateDOS != null)
|
||||
for (int i = 0; i < plateDOS.size(); i += 1000) {
|
||||
plateMapper.insertBatch(plateDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
if (itemDOS != null) {
|
||||
for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
orderItemMapper.insertBatch(itemDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (goodsDOS != null) {
|
||||
for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
goodsMapper.insertBatch(goodsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (plateGoodDOS != null) {
|
||||
for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
plateGoodMapper.insertBatch(plateGoodDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
// if (rawGoodsDOS != null)
|
||||
// for (int i = 0; i < rawGoodsDOS.size(); i += 1000) {
|
||||
// rawGoodsMapper.insertBatch(rawGoodsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// if (orderBodyDOS != null)
|
||||
// for (int i = 0; i < orderBodyDOS.size(); i += 1000) {
|
||||
// orderBodyMapper.insertBatch(orderBodyDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// if (orderGroupDOS != null)
|
||||
// for (int i = 0; i < orderGroupDOS.size(); i += 1000) {
|
||||
// orderGroupMapper.insertBatch(orderGroupDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// if (orderPartsDOS != null)
|
||||
// for (int i = 0; i < orderPartsDOS.size(); i += 1000) {
|
||||
// orderPartsMapper.insertBatch(orderPartsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// if (plateDOS != null)
|
||||
// for (int i = 0; i < plateDOS.size(); i += 1000) {
|
||||
// plateMapper.insertBatch(plateDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// if (itemDOS != null) {
|
||||
// for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
// orderItemMapper.insertBatch(itemDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// }
|
||||
// if (goodsDOS != null) {
|
||||
// for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
// goodsMapper.insertBatch(goodsDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// }
|
||||
// if (plateGoodDOS != null) {
|
||||
// for (int i = 0; i < itemDOS.size(); i += 1000) {
|
||||
// plateGoodMapper.insertBatch(plateGoodDOS.stream().skip(i).limit(1000).collect(Collectors.toList()));
|
||||
// }
|
||||
// }
|
||||
|
||||
insertInBatches(rawGoodsDOS, 1000, (batch, index) -> rawGoodsMapper.insertBatch((Collection<RawGoodsDO>) batch));
|
||||
insertInBatches(orderBodyDOS, 1000, (batch, index) -> orderBodyMapper.insertBatch((Collection<OrderBodyDO>) batch));
|
||||
insertInBatches(orderGroupDOS, 1000, (batch, index) -> orderGroupMapper.insertBatch((Collection<OrderGroupDO>) batch));
|
||||
insertInBatches(orderPartsDOS, 1000, (batch, index) -> orderPartsMapper.insertBatch((Collection<OrderPartsDO>) batch));
|
||||
insertInBatches(plateDOS, 1000, (batch, index) -> plateMapper.insertBatch((Collection<PlateDO>) batch));
|
||||
insertInBatches(itemDOS, 1000, (batch, index) -> orderItemMapper.insertBatch((Collection<OrderItemDO>) batch));
|
||||
insertInBatches(goodsDOS, 1000, (batch, index) -> goodsMapper.insertBatch((Collection<GoodsDO>) batch));
|
||||
insertInBatches(plateGoodDOS, 1000, (batch, index) -> plateGoodMapper.insertBatch((Collection<PlateGoodDO>) batch));
|
||||
}
|
||||
|
||||
private void insertInBatches(Collection<?> entities, int batchSize, BiConsumer<Collection<?>, Integer> insertFunction) {
|
||||
if (entities != null) {
|
||||
int total = entities.size();
|
||||
for (int i = 0; i < total; i += batchSize) {
|
||||
Collection<?> batch = entities.stream()
|
||||
.skip(i)
|
||||
.limit(batchSize)
|
||||
.collect(Collectors.toList());
|
||||
insertFunction.accept(batch, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ public interface OrderService {
|
||||
/**
|
||||
* 文件数据导入
|
||||
*/
|
||||
void importExcelData(OrderDO orderDO, Integer index, Map<String, List<?>> mapOrder);
|
||||
void importExcelData(OrderDO orderDO, Integer index, Map<String, Object> mapOrder);
|
||||
|
||||
/**
|
||||
* 生产导入文件模板下载
|
||||
|
||||
+11
-12
@@ -363,18 +363,17 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long importApiData(Map<String, Object> listMap) {
|
||||
List<OrderDO> order = (List<OrderDO>) listMap.get("orderDO");
|
||||
if (order != null && order.size() > 0) {
|
||||
OrderDO orderDO = order.get(0);
|
||||
validateCustomOrderNoExists(orderDO.getCustomOrderNo());
|
||||
OrderDO order = (OrderDO) listMap.get("orderDO");
|
||||
if (order != null) {
|
||||
validateCustomOrderNoExists(order.getCustomOrderNo());
|
||||
String nickName = SecurityFrameworkUtils.getLoginUser().getNickname();
|
||||
if (orderDO.getSalesman() == null || orderDO.getSalesman().equals("")) {
|
||||
orderDO.setSalesman(nickName);
|
||||
if (order.getSalesman() == null || order.getSalesman().equals("")) {
|
||||
order.setSalesman(nickName);
|
||||
}
|
||||
if (orderDO.getSplitter() == null || orderDO.getSplitter().equals("")) {
|
||||
orderDO.setSplitter(nickName);
|
||||
if (order.getSplitter() == null || order.getSplitter().equals("")) {
|
||||
order.setSplitter(nickName);
|
||||
}
|
||||
orderMapper.insert(orderDO);
|
||||
orderMapper.insert(order);
|
||||
}
|
||||
List<GoodsDO> goodsDO = (List<GoodsDO>) listMap.get(GOODSDO_KEY);
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) listMap.get("rawGoodsDO");
|
||||
@@ -395,14 +394,14 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<OrderModelDO> orderModelDOs = BeanUtils.toBean(plateDetail, OrderModelDO.class);
|
||||
|
||||
if (!orderModelDOs.isEmpty()) {
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.get(0).getId()));
|
||||
orderModelDOs.forEach(orderModelDO -> orderModelDO.setOrderId(order.getId()));
|
||||
orderInputProcessor.batchSaveModel(orderModelDOs);
|
||||
}
|
||||
if (!partsRemark.isEmpty()) {
|
||||
orderInputProcessor.batchSaveOrderPartsModel(partsRemark);
|
||||
}
|
||||
|
||||
return order.get(0).getId();
|
||||
return order.getId();
|
||||
}
|
||||
|
||||
// 生产单插入
|
||||
@@ -421,7 +420,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcelData(OrderDO orderDO, Integer index, Map<String, List<?>> listMap) {
|
||||
public void importExcelData(OrderDO orderDO, Integer index, Map<String, Object> listMap) {
|
||||
insertOrder(orderDO, index);
|
||||
|
||||
if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.NEW_ORDER.getStatus())) {
|
||||
|
||||
+115
-48
@@ -22,6 +22,7 @@ import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
import com.cf.imes.module.executor.enums.ProcessTypeEnum;
|
||||
import com.cf.imes.module.system.api.process.ProcessGroupApi;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessListReqDTO;
|
||||
import com.cf.imes.module.system.api.process.dto.ProcessRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -38,11 +39,14 @@ import com.cf.imes.module.executor.dal.mysql.process.OrderProcessMapper;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
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.ProcessTypeEnum.TYPE_EIGHT;
|
||||
import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_SEVEN;
|
||||
|
||||
/**
|
||||
* 生产单工序 Service 实现类
|
||||
@@ -145,57 +149,58 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
processStepDOS.add(processStepDO);
|
||||
|
||||
// 生产单中是否存在加工组,若存在加工组,需要逐条加工组信息写入到生产单工序步骤表
|
||||
if (processRespDTO.getType() == ProcessTypeEnum.TYPE_SEVEN.getStatus()) {
|
||||
List<OrderGroupDO> orderGroupDOS = orderGroupMapper.getOrderGroupByOrderId(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
if (orderGroupDOS.size() != 0) { // 有加工组
|
||||
for (int i = 0; i < orderGroupDOS.size(); i++) {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(orderGroupDOS.get(i).getName()) // 加工组的名称
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(orderGroupDOS.get(i).getBodyId())
|
||||
.groupId(orderGroupDOS.get(i).getId())
|
||||
.build();// 查模块id,柜体id,加工组id
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
}
|
||||
}
|
||||
} else if (processRespDTO.getType() == ProcessTypeEnum.TYPE_EIGHT.getStatus()) { // 若工序类型为板材
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectGoodsByOrderId(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
if (goodsDOS.size() != 0) { // 有板材
|
||||
for (int i = 0; i < goodsDOS.size(); i++) {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(goodsDOS.get(i).getGoodsName()) // 板块的名称
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(goodsDOS.get(i).getId())
|
||||
.groupId(0L)
|
||||
.build();
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<OrderBodyDO> orderBodyDOS = orderBodyMapper.getOrderBodyByOrderId(createReqVO.getOrderId(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
for (int i = 0; i < orderBodyDOS.size(); i++) {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(processRespDTO.getName())
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(orderBodyDOS.get(i).getName())
|
||||
.bodyId(orderBodyDOS.get(i).getId())
|
||||
.groupId(0L)
|
||||
.build();// 查模块id,柜体id,加工组id
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
}
|
||||
}
|
||||
// if (processRespDTO.getType() == ProcessTypeEnum.TYPE_SEVEN.getStatus()) {
|
||||
// List<OrderGroupDO> orderGroupDOS = orderGroupMapper.getOrderGroupByOrderId(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
|
||||
// if (orderGroupDOS.size() != 0) { // 有加工组
|
||||
// for (int i = 0; i < orderGroupDOS.size(); i++) {
|
||||
// OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
// .name(orderGroupDOS.get(i).getName()) // 加工组的名称
|
||||
// .processStepId(processStepDOId)
|
||||
// .orderProcessId(orderProcessId)
|
||||
// .status(false)
|
||||
// .groupName(processListReqDTO.getName())
|
||||
// .bodyId(orderGroupDOS.get(i).getBodyId())
|
||||
// .groupId(orderGroupDOS.get(i).getId())
|
||||
// .build();// 查模块id,柜体id,加工组id
|
||||
// orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
// }
|
||||
// }
|
||||
// } else if (processRespDTO.getType() == ProcessTypeEnum.TYPE_EIGHT.getStatus()) { // 若工序类型为板材
|
||||
// List<GoodsDO> goodsDOS = goodsMapper.selectGoodsByOrderId(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
|
||||
// if (goodsDOS.size() != 0) { // 有板材
|
||||
// for (int i = 0; i < goodsDOS.size(); i++) {
|
||||
// OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
// .name(goodsDOS.get(i).getGoodsName()) // 板块的名称
|
||||
// .processStepId(processStepDOId)
|
||||
// .orderProcessId(orderProcessId)
|
||||
// .status(false)
|
||||
// .groupName(processListReqDTO.getName())
|
||||
// .bodyId(goodsDOS.get(i).getId())
|
||||
// .groupId(0L)
|
||||
// .build();
|
||||
// orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// List<OrderBodyDO> orderBodyDOS = orderBodyMapper.getOrderBodyByOrderId(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
|
||||
// for (int i = 0; i < orderBodyDOS.size(); i++) {
|
||||
// OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
// .name(processRespDTO.getName())
|
||||
// .processStepId(processStepDOId)
|
||||
// .orderProcessId(orderProcessId)
|
||||
// .status(false)
|
||||
// .groupName(orderBodyDOS.get(i).getName())
|
||||
// .bodyId(orderBodyDOS.get(i).getId())
|
||||
// .groupId(0L)
|
||||
// .build();// 查模块id,柜体id,加工组id
|
||||
// orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
// }
|
||||
// }
|
||||
handleProcessType(processRespDTO, createReqVO, processStepDOId, orderProcessId, processListReqDTO, orderProcessStepItemDOS);
|
||||
});
|
||||
INDEX.set(0);
|
||||
// 修改生产单的状态
|
||||
orderMapper.updateOrderStatus(createReqVO.getOrderId(), OrderStatusEnum.SORTED.getStatus(), SecurityFrameworkUtils.getLoginUser().getOrganId());
|
||||
orderMapper.updateOrderStatus(createReqVO.getOrderId(), OrderStatusEnum.SORTED.getStatus(), OrganContextHolder.getOrganId());
|
||||
// 批量插入
|
||||
orderProcessMapper.insert(orderProcess.setNextStepId(processListReqDTO.getLists().get(0).getId()).setStatus(false));
|
||||
processStepMapper.insertBatch(processStepDOS);
|
||||
@@ -204,6 +209,68 @@ public class OrderProcessServiceImpl implements OrderProcessService {
|
||||
return orderProcess.getId();
|
||||
}
|
||||
|
||||
private void handleProcessType(ProcessRespDTO processRespDTO, OrderProcessSaveReqVO createReqVO, Long processStepDOId, Long orderProcessId, ProcessListReqDTO processListReqDTO, List<OrderProcessStepItemDO> orderProcessStepItemDOS) {
|
||||
if (Objects.equals(processRespDTO.getType(), TYPE_SEVEN.getStatus())) {
|
||||
handleTypeSeven(createReqVO, processStepDOId, orderProcessId, processListReqDTO, orderProcessStepItemDOS);
|
||||
} else if (Objects.equals(processRespDTO.getType(), ProcessTypeEnum.TYPE_EIGHT.getStatus())) {
|
||||
handleTypeEight(createReqVO, processStepDOId, orderProcessId, processListReqDTO, orderProcessStepItemDOS);
|
||||
} else {
|
||||
handleDefaultType(createReqVO, processRespDTO.getName(), processStepDOId, orderProcessId, orderProcessStepItemDOS);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleTypeSeven(OrderProcessSaveReqVO createReqVO, Long processStepDOId, Long orderProcessId, ProcessListReqDTO processListReqDTO, List<OrderProcessStepItemDO> orderProcessStepItemDOS) {
|
||||
List<OrderGroupDO> orderGroupDOS = orderGroupMapper.getOrderGroupByOrderId(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
|
||||
if (!orderGroupDOS.isEmpty()) {
|
||||
orderGroupDOS.forEach(orderGroupDO -> {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(orderGroupDO.getName()) // 加工组的名称
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(orderGroupDO.getBodyId())
|
||||
.groupId(orderGroupDO.getId())
|
||||
.build();
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void handleTypeEight(OrderProcessSaveReqVO createReqVO, Long processStepDOId, Long orderProcessId, ProcessListReqDTO processListReqDTO, List<OrderProcessStepItemDO> orderProcessStepItemDOS) {
|
||||
List<GoodsDO> goodsDOS = goodsMapper.selectGoodsByOrderId(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
|
||||
if (!goodsDOS.isEmpty()) {
|
||||
goodsDOS.forEach(goodsDO -> {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(goodsDO.getGoodsName()) // 板块的名称
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(processListReqDTO.getName())
|
||||
.bodyId(goodsDO.getId())
|
||||
.groupId(0L)
|
||||
.build();
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDefaultType(OrderProcessSaveReqVO createReqVO, String name, Long processStepDOId, Long orderProcessId, List<OrderProcessStepItemDO> orderProcessStepItemDOS) {
|
||||
List<OrderBodyDO> orderBodyDOS = orderBodyMapper.getOrderBodyByOrderId(createReqVO.getOrderId(), OrganContextHolder.getOrganId());
|
||||
orderBodyDOS.forEach(orderBodyDO -> {
|
||||
OrderProcessStepItemDO orderProcessStepItemDO = OrderProcessStepItemDO.builder()
|
||||
.name(name)
|
||||
.processStepId(processStepDOId)
|
||||
.orderProcessId(orderProcessId)
|
||||
.status(false)
|
||||
.groupName(orderBodyDO.getName())
|
||||
.bodyId(orderBodyDO.getId())
|
||||
.groupId(0L)
|
||||
.build();
|
||||
orderProcessStepItemDOS.add(orderProcessStepItemDO);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateOrderProcess(OrderProcessSaveReqVO updateReqVO) {
|
||||
|
||||
+100
-120
@@ -45,16 +45,12 @@ public class ApiTypeRealize {
|
||||
@Resource
|
||||
private SnowflakeIdWorker3rd idWorker;
|
||||
|
||||
// private Integer num = 0;
|
||||
|
||||
// private Integer specialShapedNum = 0;
|
||||
|
||||
// private Integer groupNum = 0;
|
||||
|
||||
private final static Integer X = 0;
|
||||
private final static Integer Y = 1;
|
||||
private final static Integer Z = 2;
|
||||
private static final Integer X = 0;
|
||||
private static final Integer Y = 1;
|
||||
private static final Integer Z = 2;
|
||||
|
||||
private static final String VALUE = "value";
|
||||
/**
|
||||
* @param dataPlates: 板件生产信息
|
||||
* @param dataParts: 配件信息
|
||||
@@ -63,8 +59,6 @@ public class ApiTypeRealize {
|
||||
* @param plates: 板件信息
|
||||
* @param dataModule: 加工组信息
|
||||
* @return Map<Long, List < ?>>
|
||||
* @author Administrator
|
||||
* @date 2024/5/6
|
||||
*/
|
||||
public Map<String, Object> apiPlateDataChange(JSONObject order, JSONObject dataPlates, JSONObject dataParts
|
||||
, JSONObject dataBody, JSONObject dataGoods
|
||||
@@ -73,30 +67,24 @@ public class ApiTypeRealize {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
// 生产单id
|
||||
// Long orderId = (Long) identifierGenerator.nextId(null);
|
||||
|
||||
// 获取组织id 之后删除
|
||||
// Long orgId = 325L;
|
||||
|
||||
// 生产单数据
|
||||
OrderDO orderDO = orderInfoChange(order, orderId, orderNo, organId);
|
||||
List<OrderDO> orderList = new ArrayList<>();
|
||||
orderList.add(orderDO);
|
||||
map.put("orderDO", orderDO);
|
||||
|
||||
// 商品信息数据 信息以全
|
||||
Map<String, Map<Long, ?>> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, dataBlocks, organId);
|
||||
List<GoodsDO> goodsDO = (List<GoodsDO>) goodsInfoChange.get("goodsDOS").values().stream().collect(Collectors.toList());
|
||||
Map<String, Object> goodsInfoChange = rawGoodsInfoChange(dataGoods, orderId, organId);
|
||||
Map<Long, RawGoodsDO> rawGoodsDOS = (Map<Long, RawGoodsDO>) goodsInfoChange.get("rawGoodsDOS");
|
||||
Map<Long, GoodsDO> goodsDOS = (Map<Long, GoodsDO>) goodsInfoChange.get("goodsDOS");
|
||||
List<GoodsDO> goodsDO = new ArrayList<>(goodsDOS.values()); // (List<GoodsDO>)
|
||||
map.put("goodsDO", goodsDO);
|
||||
List<RawGoodsDO> rawGoodsDO = (List<RawGoodsDO>) goodsInfoChange.get("rawGoodsDOS").values().stream().collect(Collectors.toList());
|
||||
List<RawGoodsDO> rawGoodsDO = new ArrayList<>(rawGoodsDOS.values());
|
||||
map.put("rawGoodsDO", rawGoodsDO);
|
||||
|
||||
// 柜体信息 少异形数量、板材数量
|
||||
Map<Long, OrderBodyDO> bodyInfoChange = bodyInfoChange(dataBody, orderId, organId);
|
||||
|
||||
// 加工组 少异形数量、板材数量
|
||||
Map<String, Map<Long, ?>> group =
|
||||
groupInfoChange(dataModule, orderId, bodyInfoChange, organId);
|
||||
Map<String, Map<Long, ?>> group = groupInfoChange(dataModule, orderId, bodyInfoChange, organId);
|
||||
Map<Long, OrderGroupDO> orderGroupDO = (Map<Long, OrderGroupDO>) group.get("orderGroup");
|
||||
Map<Long, List<Long>> groupLists = (Map<Long, List<Long>>) group.get("lists"); // 加工组中包含的板件、配件id
|
||||
// 配件
|
||||
@@ -125,13 +113,6 @@ public class ApiTypeRealize {
|
||||
platesItems = orderPartsChange(orderGroupDO, groupLists, platesItems);// item补充
|
||||
itemsList.addAll(platesItems.values());
|
||||
map.put("groupDO", groupAddUnregularNum(itemsList, orderPlatesDO, orderGroupDO).values().stream().collect(Collectors.toList()));
|
||||
// System.out.println("生产单数据 " + orderDO+ " 商品信息1 " + goodsDO + " 商品信息2 "
|
||||
// + rawGoodsDO + " 板材信息 " + new ArrayList<>(orderPlatesDO.values())
|
||||
// + " 配件信息 " + new ArrayList<>(orderPartsDO.values())
|
||||
// + " 柜体信息 " + new ArrayList<>(bodyInfoChange.values())
|
||||
// + " 加工组信息 " + orderGroupDO
|
||||
// + " 配件Item " + partsItems + " 板材Item " + platesItems);
|
||||
map.put("orderDO", orderList);
|
||||
map.put("itemDO", itemsList);
|
||||
map.put("bodyDO", bodyItemsPlates.values().stream().collect(Collectors.toList()));
|
||||
return map;
|
||||
@@ -225,18 +206,16 @@ public class ApiTypeRealize {
|
||||
Map<Long, OrderGroupDO> orderGroupDOs = new HashMap<>();// 加工组id 和 加工组信息
|
||||
Map<Long, List<Long>> groupLists = new HashMap<>();// 加工组id 和 详细信息
|
||||
|
||||
|
||||
if (dataModule.getJSONArray("value") != null &&
|
||||
!dataModule.getJSONArray("value").isEmpty()) {
|
||||
JSONArray groupsLists = dataModule.getJSONArray("value");
|
||||
for (int i = 0; i < groupsLists.size(); i++) {
|
||||
JSONObject group = groupsLists.getJSONObject(i);
|
||||
JSONArray value = dataModule.getJSONArray("value");
|
||||
if (value != null && !value.isEmpty()) {
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
JSONObject group = value.getJSONObject(i);
|
||||
|
||||
OrderGroupDO bodyInfo = OrderGroupDO.builder()
|
||||
.id((Long) identifierGenerator.nextId(null))
|
||||
.orderId(orderId)
|
||||
.bodyId(bodyInfoChange.get(group.getLong("BoxID")).getId())//group.getLong("BoxID")
|
||||
.groupTypeId(Long.valueOf(group.getLong("ModuleTypeID")))
|
||||
.groupTypeId(group.getLong("ModuleTypeID"))
|
||||
.groupTypeName("无")
|
||||
.name(group.getString("ModuleTypeName"))
|
||||
.width(group.getDouble("Width"))
|
||||
@@ -262,10 +241,6 @@ public class ApiTypeRealize {
|
||||
/**
|
||||
* 生产单信息转换
|
||||
*
|
||||
* @param orderJson:
|
||||
* @return OrderDO
|
||||
* @author Administrator
|
||||
* @date 2024/4/30
|
||||
*/
|
||||
public OrderDO orderInfoChange(JSONObject orderJson, Long orderId, String orderNo, Long organId) {
|
||||
// 获取 Orders 字段对应的数组
|
||||
@@ -291,9 +266,7 @@ public class ApiTypeRealize {
|
||||
.orderDate(orderDate.atStartOfDay())
|
||||
.deliveryDate(deliveryDate.atStartOfDay())
|
||||
.orderType(OrderTypeEnum.MAIN_ORDER.getStatus())
|
||||
// .orderSort(0)
|
||||
.dataType(DataTypeEnum.API_IMPORT.getStatus())
|
||||
// .status(OrderStatusEnum.NEW_ORDER.getStatus())
|
||||
.customOrderNo(order.getString("custom_order_no"))
|
||||
.customer(order.getString("cosignee_name"))
|
||||
.address(order.getString("cosignee_address"))
|
||||
@@ -301,8 +274,6 @@ public class ApiTypeRealize {
|
||||
.dealer(order.getString("store_name"))
|
||||
.dealerPhoneNumber(order.getString("store_phone"))
|
||||
.salesman(order.getString("nick_name"))
|
||||
// .salesman("")
|
||||
// .splitter("")
|
||||
.splitter(order.getString("cd_nick_name"))
|
||||
.remark(orderRemark + order.getString("comments"))
|
||||
.organId(organId)
|
||||
@@ -341,17 +312,18 @@ public class ApiTypeRealize {
|
||||
*
|
||||
* @param dataRawGoods:
|
||||
* @param orderId:
|
||||
* @return Map<String, Map < Integer, ?>> String 标识 , Integer:商品ID标识,RawGoodsDO:商品信息
|
||||
* @author Administrator
|
||||
* @date 2024/4/30
|
||||
* @return Map<String, Map < Long, ?>> String 标识 , Long:商品ID标识,RawGoodsDO:商品信息
|
||||
*/
|
||||
public Map<String, Map<Long, ?>> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, JSONObject dataBlocks, Long organId) {
|
||||
Map<String, Map<Long, ?>> map = new HashMap<>();
|
||||
public Map<String, Object> rawGoodsInfoChange(JSONObject dataRawGoods, Long orderId, Long organId) {
|
||||
|
||||
if (dataRawGoods.getJSONArray("List") == null || dataRawGoods.getJSONArray("List").isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<Long, RawGoodsDO> rawGoodsDOS = new HashMap<>();
|
||||
Map<Long, GoodsDO> goodsDOS = new HashMap<>();
|
||||
|
||||
if (dataRawGoods.getJSONArray("List") != null &&
|
||||
!dataRawGoods.getJSONArray("List").isEmpty()) {
|
||||
JSONArray goodsLists = dataRawGoods.getJSONArray("List");
|
||||
for (int i = 0; i < goodsLists.size(); i++) {
|
||||
JSONObject goods = goodsLists.getJSONObject(i);
|
||||
@@ -365,7 +337,7 @@ public class ApiTypeRealize {
|
||||
.color(goods.getString("Color"))
|
||||
.texture(getTexture( goods.getJSONObject("ExtraProp")))
|
||||
.thickness(goods.getDouble("Thickness"))
|
||||
.price(goods.getDouble("Price"))
|
||||
// .price(goods.getDouble("Price"))
|
||||
.brand(goods.getString("Brand"))
|
||||
.spec(goods.getString("Spec"))
|
||||
.organId(organId)
|
||||
@@ -392,7 +364,7 @@ public class ApiTypeRealize {
|
||||
goodsDOS.put(goods.getLong("GoodsID"), goodsDO);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
map.put("rawGoodsDOS", rawGoodsDOS);
|
||||
map.put("goodsDOS", goodsDOS);
|
||||
@@ -404,14 +376,14 @@ public class ApiTypeRealize {
|
||||
*
|
||||
* @param dataBody:
|
||||
* @return Map<Integer, OrderBodyDO> Integer:柜体ID标识,OrderBodyDO:柜体信息(差数据)
|
||||
* @author Administrator
|
||||
* @date 2024/4/30
|
||||
*/
|
||||
private Map<Long, OrderBodyDO> bodyInfoChange(JSONObject dataBody, Long orderId, Long organId) {
|
||||
|
||||
if (dataBody.getJSONArray("List") == null || dataBody.getJSONArray("List").isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Map<Long, OrderBodyDO> bodyInfos = new HashMap<>();
|
||||
|
||||
if (dataBody.getJSONArray("List") != null &&
|
||||
!dataBody.getJSONArray("List").isEmpty()) {
|
||||
JSONArray bodyLists = dataBody.getJSONArray("List");
|
||||
for (int i = 0; i < bodyLists.size(); i++) {
|
||||
JSONObject body = bodyLists.getJSONObject(i);
|
||||
@@ -434,7 +406,6 @@ public class ApiTypeRealize {
|
||||
bodyInfos.put(body.getLong("BoxID"), bodyInfo);
|
||||
|
||||
}
|
||||
}
|
||||
return bodyInfos;
|
||||
}
|
||||
|
||||
@@ -573,8 +544,7 @@ public class ApiTypeRealize {
|
||||
.name(plate.getString("BoardName"))
|
||||
.plateNo((obtainingTime) + Long.toString(plateNo).substring(2))
|
||||
.type(type)
|
||||
.goodsId(goodsDOMap.get(plate.getLong("GoodsID")) != null
|
||||
? goodsDOMap.get(plate.getLong("GoodsID")).getId() : plate.getLong("GoodsID"))
|
||||
.goodsId(goodsDOMap.get(plate.getLong("GoodsID")) != null ? goodsDOMap.get(plate.getLong("GoodsID")).getId() : plate.getLong("GoodsID"))
|
||||
.splitHeight(BigDecimal.valueOf(plate.getDouble("SpliteHeight")))
|
||||
.splitThickness(BigDecimal.valueOf(plate.getDouble("SpliteThickness")))
|
||||
.splitWidth(BigDecimal.valueOf(plate.getDouble("SpliteWidth")))
|
||||
@@ -582,9 +552,6 @@ public class ApiTypeRealize {
|
||||
.sealRight(BigDecimal.valueOf(plate.getDouble("SealedRight")))
|
||||
.sealUp(BigDecimal.valueOf(plate.getDouble("SealedUp")))
|
||||
.sealDown(BigDecimal.valueOf(plate.getDouble("SealedDown")))
|
||||
// .area(plateDetail.get(plate.getLong("BlockNo")).getSealAcreage())
|
||||
// .texture(plateDetail.get(plate.getLong("BlockNo")).getTexture())
|
||||
// .holeFace(plateDetail.get(plate.getLong("BlockNo")).getTypographicFace()) // 孔面类型
|
||||
.holeArrange(0) // 排孔类型 值无实际含义,默认初始化值
|
||||
.unregularPointCount(0)// 异形孔个数 值无实际含义,默认初始化值
|
||||
.frontHoleCount(plate.getInteger("FrontHoleCount"))
|
||||
@@ -594,8 +561,6 @@ public class ApiTypeRealize {
|
||||
.backModelCount(plate.getInteger("BackModelCount"))
|
||||
.isDoor(plate.getInteger("OpenDoorType") != 0)
|
||||
.openDoorType(plate.getInteger("OpenDoorType"))
|
||||
// .offsetX(plateDetail.get(plate.getLong("BlockNo")).getOffsetX())
|
||||
// .offsetY(plateDetail.get(plate.getLong("BlockNo")).getOffsetY())
|
||||
.isArcAcross(false)
|
||||
.moduleTypeId(0L)
|
||||
.isSculpt(plate.getBoolean("IsModel"))
|
||||
@@ -747,14 +712,16 @@ public class ApiTypeRealize {
|
||||
System.out.println("kkk " + ordersArray.get(i));
|
||||
JSONObject order = ordersArray.getJSONObject(i);
|
||||
// 获取材料信息
|
||||
if (order.getJSONArray("Materials") != null && !order.getJSONArray("Materials").isEmpty()) {
|
||||
for (int j = 0; j < order.getJSONArray("Materials").size(); j++) {
|
||||
JSONObject material = order.getJSONArray("Materials").getJSONObject(j);
|
||||
JSONArray materialJson = order.getJSONArray("Materials");
|
||||
if (materialJson != null && !materialJson.isEmpty()) {
|
||||
for (int j = 0; j < materialJson.size(); j++) {
|
||||
JSONObject material = materialJson.getJSONObject(j);
|
||||
// goodsMap.put()
|
||||
// 板件信息
|
||||
if (material.getJSONArray("Blocks") != null && !material.getJSONArray("Blocks").isEmpty()) {
|
||||
for (int k = 0; k < material.getJSONArray("Blocks").size(); k++) {
|
||||
JSONObject block = material.getJSONArray("Blocks").getJSONObject(k);// 每块板
|
||||
JSONArray blocks = material.getJSONArray("Blocks");
|
||||
if (blocks != null && !blocks.isEmpty()) {
|
||||
for (int k = 0; k < blocks.size(); k++) {
|
||||
JSONObject block = blocks.getJSONObject(k);// 每块板
|
||||
|
||||
PlateDetail plateDetail = PlateDetail.builder()
|
||||
.bodyNo(block.getString("BoxNo"))
|
||||
@@ -791,16 +758,13 @@ public class ApiTypeRealize {
|
||||
.build();
|
||||
|
||||
if (block.getJSONObject("ExtraRemark") != null) {
|
||||
if (block.getJSONObject("ExtraRemark").getJSONObject("extra") != null)
|
||||
plateDetail.setBoardType(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("boardType"))
|
||||
.setThroughHoleCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughHoleCount")))
|
||||
.setThroughModelCount(Double.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("throughModelCount")))
|
||||
.setHas2DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has2DModel")))
|
||||
.setHas3DModel(Boolean.valueOf(block.getJSONObject("ExtraRemark").getJSONObject("extra").getString("has3DModel")))
|
||||
// .setPlateRemark(remarkToMap(block))
|
||||
// .setPlateExtraRemark(block.getJSONObject("ExtraRemark"))
|
||||
// .setSideRemark(edgeRemarkToMap(block.getJSONObject("ExtraRemark").getJSONObject("extra")));
|
||||
// .setPlateRemark(remarkToMap(block))
|
||||
JSONObject extraRemark = block.getJSONObject("ExtraRemark").getJSONObject("extra");
|
||||
if (extraRemark != null)
|
||||
plateDetail.setBoardType(extraRemark.getString("boardType"))
|
||||
.setThroughHoleCount(Double.valueOf(extraRemark.getString("throughHoleCount")))
|
||||
.setThroughModelCount(Double.valueOf(extraRemark.getString("throughModelCount")))
|
||||
.setHas2DModel(Boolean.valueOf(extraRemark.getString("has2DModel")))
|
||||
.setHas3DModel(Boolean.valueOf(extraRemark.getString("has3DModel")))
|
||||
.setPlateExtraRemark(block.getJSONObject("ExtraRemark"))
|
||||
.setSideRemark(remarkToMap(block));
|
||||
}
|
||||
@@ -828,9 +792,10 @@ public class ApiTypeRealize {
|
||||
List<PointDetail> pointDetailList = new ArrayList<>();
|
||||
|
||||
if (type) { // 不含封边
|
||||
if (block.getJSONArray("Points") != null && !block.getJSONArray("Points").isEmpty()) {
|
||||
for (int i = 0; i < block.getJSONArray("Points").size(); i++) {
|
||||
JSONObject point = block.getJSONArray("Points").getJSONObject(i);
|
||||
JSONArray pointsJson = block.getJSONArray("Points");
|
||||
if (pointsJson != null && !pointsJson.isEmpty()) {
|
||||
for (int i = 0; i < pointsJson.size(); i++) {
|
||||
JSONObject point = pointsJson.getJSONObject(i);
|
||||
pointDetailList.add(PointDetail.builder()
|
||||
.pointX(Double.valueOf(point.getString("X")))
|
||||
.pointY(Double.valueOf(point.getString("Y")))
|
||||
@@ -839,9 +804,10 @@ public class ApiTypeRealize {
|
||||
}
|
||||
}
|
||||
} else { // 含封边
|
||||
if (block.getJSONArray("OrgPoints") != null && !block.getJSONArray("OrgPoints").isEmpty()) {
|
||||
for (int i = 0; i < block.getJSONArray("OrgPoints").size(); i++) {
|
||||
JSONObject rawPoint = block.getJSONArray("OrgPoints").getJSONObject(i);
|
||||
JSONArray orgPointsJson = block.getJSONArray("OrgPoints");
|
||||
if (orgPointsJson != null && !orgPointsJson.isEmpty()) {
|
||||
for (int i = 0; i < orgPointsJson.size(); i++) {
|
||||
JSONObject rawPoint = orgPointsJson.getJSONObject(i);
|
||||
pointDetailList.add(PointDetail.builder()
|
||||
.pointX(Double.valueOf(rawPoint.getString("X")))
|
||||
.pointY(Double.valueOf(rawPoint.getString("Y")))
|
||||
@@ -859,22 +825,27 @@ public class ApiTypeRealize {
|
||||
private List<HoleDetail> getHoleDetail(JSONObject block, Boolean type) {
|
||||
List<HoleDetail> holeDetails = new ArrayList<>();
|
||||
if (type) { // 1,正面
|
||||
if (block.getJSONArray("Holes") != null && !block.getJSONArray("Holes").isEmpty()) {
|
||||
for (int i = 0; i < block.getJSONArray("Holes").size(); i++) {
|
||||
JSONObject hole = block.getJSONArray("Holes").getJSONObject(i);
|
||||
JSONArray holes = block.getJSONArray("Holes");
|
||||
if (holes == null || holes.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
for (int i = 0; i < holes.size(); i++) {
|
||||
JSONObject hole = holes.getJSONObject(i);
|
||||
holeDetails.add(HoleDetail.builder()
|
||||
.startX(Double.valueOf(hole.getString("X")))
|
||||
.startY(Double.valueOf(hole.getString("Y")))
|
||||
.faceType(hole.getInteger("Face"))
|
||||
.radius(Double.valueOf(hole.getString("Diameter")) / 2)
|
||||
.radius(Double.parseDouble(hole.getString("Diameter")) / 2)
|
||||
.depth(Double.valueOf(hole.getString("Depth")))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (block.getJSONArray("SideHoles") != null && !block.getJSONArray("SideHoles").isEmpty()) {
|
||||
for (int i = 0; i < block.getJSONArray("SideHoles").size(); i++) {
|
||||
JSONObject hole = block.getJSONArray("SideHoles").getJSONObject(i);
|
||||
JSONArray sideHoles = block.getJSONArray("SideHoles");
|
||||
if (sideHoles == null || sideHoles.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
for (int i = 0; i < sideHoles.size(); i++) {
|
||||
JSONObject hole = sideHoles.getJSONObject(i);
|
||||
String[] startPoints = splitAndTrim(hole.getString("StartPoint"));
|
||||
String[] endPoints = splitAndTrim(hole.getString("EndPoint"));
|
||||
try {
|
||||
@@ -887,7 +858,7 @@ public class ApiTypeRealize {
|
||||
.endZ(Double.valueOf(endPoints[Z]))
|
||||
.faceType(2)
|
||||
.direction(hole.getInteger("Direction"))
|
||||
.radius(Double.valueOf(hole.getString("Diameter")) / 2)
|
||||
.radius(Double.parseDouble(hole.getString("Diameter")) / 2)
|
||||
.depth(Double.valueOf(hole.getString("Depth")))
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
@@ -895,7 +866,7 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return holeDetails;
|
||||
@@ -903,16 +874,21 @@ public class ApiTypeRealize {
|
||||
|
||||
// 造型明细板数据解析 (type 为1,正面;3,侧面)
|
||||
private List<ModelDetail> getModelDetail(JSONObject block) {
|
||||
JSONArray models = block.getJSONArray("Models");
|
||||
|
||||
if (models == null || models.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<ModelDetail> modelDetails = new ArrayList<>();
|
||||
|
||||
if (block.getJSONArray("Models") != null && !block.getJSONArray("Models").isEmpty()) {
|
||||
for (int i = 0; i < block.getJSONArray("Models").size(); i++) {
|
||||
JSONObject model = block.getJSONArray("Models").getJSONObject(i);
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
JSONObject model = models.getJSONObject(i);
|
||||
|
||||
List<PointList> pointLists = new ArrayList<>();
|
||||
if (model.getJSONArray("Points") != null && !model.getJSONArray("Points").isEmpty()) {
|
||||
for (int j = 0; j < model.getJSONArray("Points").size(); j++) {
|
||||
JSONObject point = model.getJSONArray("Points").getJSONObject(j);
|
||||
JSONArray pointsJson = model.getJSONArray("Points");
|
||||
if (pointsJson != null && !pointsJson.isEmpty()) {
|
||||
for (int j = 0; j < pointsJson.size(); j++) {
|
||||
JSONObject point = pointsJson.getJSONObject(j);
|
||||
String[] points = splitAndTrim(point.getString("Pos"));
|
||||
pointLists.add(PointList.builder()
|
||||
.pointX(Double.valueOf(points[X]))
|
||||
@@ -924,9 +900,10 @@ public class ApiTypeRealize {
|
||||
}
|
||||
|
||||
List<OffSetList> offSetLists = new ArrayList<>();
|
||||
if (model.getJSONArray("OffsetList") != null && !model.getJSONArray("OffsetList").isEmpty()) {
|
||||
for (int j = 0; j < model.getJSONArray("OffsetList").size(); j++) {
|
||||
JSONObject offSet = model.getJSONArray("OffsetList").getJSONObject(j);
|
||||
JSONArray offSets = model.getJSONArray("OffsetList");
|
||||
if (offSets != null && !offSets.isEmpty()) {
|
||||
for (int j = 0; j < offSets.size(); j++) {
|
||||
JSONObject offSet = offSets.getJSONObject(j);
|
||||
offSetLists.add(OffSetList.builder()
|
||||
.value(Double.valueOf(offSet.getString("Value")))
|
||||
.name(offSet.getString("Name"))
|
||||
@@ -940,14 +917,13 @@ public class ApiTypeRealize {
|
||||
modelDetails.add(ModelDetail.builder()
|
||||
.depth(Double.valueOf(model.getString("Depth")))
|
||||
.faceType(Integer.valueOf(model.getString("Face")))
|
||||
.knifeName(model.getString("TooINo"))
|
||||
.knifeRadius(Double.valueOf(model.getString("Diameter")) / 2)
|
||||
.knifeName(model.getString("ToolNo"))
|
||||
.knifeRadius(Double.parseDouble(model.getString("Diameter")) / 2)
|
||||
.pointList(pointLists)
|
||||
.offSetList(offSetLists)
|
||||
.originModeling(getOriginModeling(model.getJSONObject("OriginModeling")))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
return modelDetails;
|
||||
}
|
||||
@@ -1031,11 +1007,14 @@ public class ApiTypeRealize {
|
||||
|
||||
// 排钻数据
|
||||
private List<DrillsInfo> getDrillsInfo(JSONObject block) {
|
||||
List<DrillsInfo> drillsInfos = new ArrayList<>();
|
||||
JSONArray drills = block.getJSONArray("drills");
|
||||
|
||||
if (block.getJSONArray("drills") != null && !block.getJSONArray("drills").isEmpty()) {
|
||||
for (int i = 0; i < block.getJSONArray("drills").size(); i++) {
|
||||
JSONObject drill = block.getJSONArray("drills").getJSONObject(i);
|
||||
if (drills == null || drills.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<DrillsInfo> drillsInfos = new ArrayList<>();
|
||||
for (int i = 0; i < drills.size(); i++) {
|
||||
JSONObject drill = drills.getJSONObject(i);
|
||||
drillsInfos.add(DrillsInfo.builder()
|
||||
.name(drill.getString("name"))
|
||||
.type(drill.getString("type"))
|
||||
@@ -1043,7 +1022,6 @@ public class ApiTypeRealize {
|
||||
.count(Double.valueOf(drill.getString("count")))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
return drillsInfos;
|
||||
}
|
||||
|
||||
@@ -1070,14 +1048,16 @@ public class ApiTypeRealize {
|
||||
|
||||
// 将remark转为map
|
||||
public Map<String, String> edgeRemarkToMap(JSONObject edgeRemark) {
|
||||
JSONArray jsonArray = edgeRemark.getJSONArray("edgeRemarks");
|
||||
if (jsonArray == null || jsonArray.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (edgeRemark.getJSONArray("edgeRemarks") != null && !edgeRemark.getJSONArray("edgeRemarks").isEmpty()) {
|
||||
for (int i = 0; i < edgeRemark.getJSONArray("edgeRemarks").size(); i++) {
|
||||
if (edgeRemark.getJSONArray("edgeRemarks").getString(i) != null && !edgeRemark.getJSONArray("edgeRemarks").getString(i).isEmpty()) {
|
||||
map.put(String.valueOf(i), edgeRemark.getJSONArray("edgeRemarks").getString(i));
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
if (jsonArray.getString(i) != null && !jsonArray.getString(i).isEmpty()) {
|
||||
map.put(String.valueOf(i), jsonArray.getString(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
+38
-34
@@ -27,6 +27,8 @@ import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.mysql.cj.util.TimeUtil.DATE_FORMATTER;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ExcelReadUtil { // 文件读取
|
||||
@@ -35,6 +37,9 @@ public class ExcelReadUtil { // 文件读取
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
private static final String ERR = "error";
|
||||
private static final String DEALER_PHONE = "dealerPhoneNumber";
|
||||
private static final String NUMBER_TYPE_ERR = "数量类型错误";
|
||||
// 读excel
|
||||
public Map<String, Object> read(MultipartFile file) throws IOException {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -82,56 +87,55 @@ public class ExcelReadUtil { // 文件读取
|
||||
|
||||
}
|
||||
|
||||
private void setIfInvalid(String key, String errValue, Map<String, Object> orderMap, AtomicBoolean error) {
|
||||
if (orderMap.get(key) == null) {
|
||||
orderMap.put(key, errValue);
|
||||
error.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setPhone(String key, String errValue, Map<String, Object> orderMap, AtomicBoolean error) {
|
||||
if (!ToolUtil.validatePhoneNumber((String) orderMap.get(key))) {
|
||||
orderMap.put(key, orderMap.get(key) + errValue);
|
||||
error.set(false);
|
||||
}
|
||||
}
|
||||
// order 数据转换
|
||||
public Map<String, Object> changeOrderDO(Map<String, Object> orderMap) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
if (MapUtils.isEmpty(orderMap)) {
|
||||
map.put("error", false);
|
||||
map.put(ERR, false);
|
||||
return map;
|
||||
}
|
||||
|
||||
boolean error = true;
|
||||
AtomicBoolean error = new AtomicBoolean(true);
|
||||
|
||||
if (orderMap.get("客户") == null) {
|
||||
orderMap.put("客户", "---< 客户不能为空 >---");
|
||||
error = false;
|
||||
}
|
||||
if (orderMap.get("经销商") == null) {
|
||||
orderMap.put("经销商", "---< 经销商不能为空 >---");
|
||||
error = false;
|
||||
}
|
||||
if (orderMap.get("客户地址") == null) {
|
||||
orderMap.put("客户地址", "---< 客户地址不能为空 >---");
|
||||
error = false;
|
||||
}
|
||||
setIfInvalid("客户", "---< 客户不能为空 >---", orderMap, error);
|
||||
setIfInvalid("经销商", "---< 经销商不能为空 >---", orderMap, error);
|
||||
setIfInvalid("客户地址", "---< 客户地址不能为空 >---", orderMap, error);
|
||||
setIfInvalid("客户地址", "---< 客户地址不能为空 >---", orderMap, error);
|
||||
|
||||
if (orderMap.get("客户电话") == null) {
|
||||
orderMap.put("客户电话", "---< 客户电话不能为空 >---");
|
||||
error = false;
|
||||
error.set(false);
|
||||
} else {
|
||||
if (!ToolUtil.validatePhoneNumber((String) orderMap.get("客户电话"))) {
|
||||
orderMap.put("客户电话", orderMap.get("客户电话") + "---< 客户电话格式错误 >---");
|
||||
error = false;
|
||||
}
|
||||
setPhone("客户电话", "---< 客户电话格式错误 >---", orderMap, error);
|
||||
}
|
||||
if (orderMap.get("经销商电话") != null) {
|
||||
if (!ToolUtil.validatePhoneNumber((String) orderMap.get("经销商电话"))) {
|
||||
orderMap.put("经销商电话", orderMap.get("经销商电话") + "---< 经销商电话格式错误 >---");
|
||||
error = false;
|
||||
}
|
||||
if (orderMap.get(DEALER_PHONE) != null) {
|
||||
setPhone(DEALER_PHONE, "---< 经销商电话格式错误 >---", orderMap, error);
|
||||
}
|
||||
LocalDate deliverDate = null;
|
||||
if (orderMap.get("出货日期") == null) {
|
||||
orderMap.put("出货日期", "---< 出货日期不能为空 >---");
|
||||
error = false;
|
||||
error.set(false);
|
||||
} else {
|
||||
String s = (String) orderMap.get("出货日期");
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
Map<String, Object> mapDate = ToolUtil.changeDate(s, formatter);
|
||||
if (mapDate.get("error") instanceof Integer && (Integer) mapDate.get("error") == -1) {
|
||||
if (mapDate.get(ERR) instanceof Integer && (Integer) mapDate.get(ERR) == -1) {
|
||||
orderMap.put("出货日期", s + "---< 出货日期格式错误 >---");
|
||||
error = false;
|
||||
error.set(false);
|
||||
} else {
|
||||
deliverDate = (LocalDate) mapDate.get("date");
|
||||
if (deliverDate.isBefore(LocalDate.now())) {
|
||||
@@ -140,7 +144,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
}
|
||||
}
|
||||
OrderDO orderDO = new OrderDO();
|
||||
if (error) {
|
||||
if (error.get()) {
|
||||
orderDO = OrderDO.builder()
|
||||
.organId(OrganContextHolder.getOrganId())
|
||||
.dataType(DataTypeEnum.FILE_IMPORT.getStatus())
|
||||
@@ -148,7 +152,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
.customer((String) orderMap.get("客户"))
|
||||
.customOrderNo((String) orderMap.get("自定义单号"))
|
||||
.dealer((String) orderMap.get("经销商"))
|
||||
.dealerPhoneNumber((String) orderMap.get("经销商电话"))
|
||||
.dealerPhoneNumber((String) orderMap.get(DEALER_PHONE))
|
||||
.address((String) orderMap.get("客户地址"))
|
||||
.phoneNumber((String) orderMap.get("客户电话"))
|
||||
.salesman((String) orderMap.get("业务员"))
|
||||
@@ -160,7 +164,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
}
|
||||
map.put("order", orderDO);
|
||||
map.put("file", orderMap);
|
||||
map.put("error", error);
|
||||
map.put(ERR, error);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -329,7 +333,7 @@ public class ExcelReadUtil { // 文件读取
|
||||
}else {
|
||||
if (!convertToDouble(vo.getGoodsNumber())) {
|
||||
flag = false;
|
||||
errList.add("数量类型错误");
|
||||
errList.add(NUMBER_TYPE_ERR);
|
||||
}else {
|
||||
if (!checkNumber(vo.getGoodsNumber())) {
|
||||
flag = false;
|
||||
@@ -348,17 +352,17 @@ public class ExcelReadUtil { // 文件读取
|
||||
// 数量类型判断
|
||||
if (!convertToInteger(vo.getGoodsNumber())) {
|
||||
flag = false;
|
||||
if (errList.contains("数量类型错误")){
|
||||
if (errList.contains(NUMBER_TYPE_ERR)){
|
||||
Iterator<String> iterator = errList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String element = iterator.next();
|
||||
if ("数量类型错误".equals(element)) {
|
||||
if (NUMBER_TYPE_ERR.equals(element)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
errList.add("板材数量类型需为整数");
|
||||
}else {
|
||||
errList.add("数量类型错误");
|
||||
errList.add(NUMBER_TYPE_ERR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -50,13 +50,13 @@ public class ExcelTypeRealize {
|
||||
final String NOT_ASSIGNED = "未命名";
|
||||
|
||||
// 数据转换 + 错误验证
|
||||
public Map<String, List<?>> changeDate(List<OrderPlateImportExcelVO> excelVOS, Long orderId) {
|
||||
public Map<String, Object> changeDate(List<OrderPlateImportExcelVO> excelVOS, Long orderId) {
|
||||
if (excelVOS.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// List<OrderPlateImportExcelVO> excelVOS = (List<OrderPlateImportExcelVO>) list;
|
||||
Map<String, List<?>> map = new HashMap<>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
Long organId = OrganContextHolder.getOrganId();
|
||||
ArrayList<RawGoodsDO> rawGoodsDOS = new ArrayList<>();
|
||||
|
||||
+72
-62
@@ -92,7 +92,6 @@ public class XMLUtil {
|
||||
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(name, StandardCharsets.UTF_8.name()));
|
||||
}
|
||||
|
||||
// 电话格式判断
|
||||
private void setIfInvalid(Supplier<String> getter, Function<String, String> errorMessageFactory, Consumer<String> setter, boolean error) {
|
||||
String phone = getter.get();
|
||||
if (phone != null && !ToolUtil.validatePhoneNumber(phone)) {
|
||||
@@ -738,14 +737,16 @@ public class XMLUtil {
|
||||
notEmptyPositiveNumber(blockXmlVOS::getArea, blockXmlVOS::setArea, "小板总面积", Double.class, flag);
|
||||
isEmptyAddAndInvalid(blockXmlVOS::getUnit, blockXmlVOS::setUnit, "m²", DictTypeConstants.UNIT_AREA, "小板总面积单位", flag);
|
||||
|
||||
if (blockXmlVOS.getBlockXmlVOList() != null && blockXmlVOS.getBlockXmlVOList().size() > 0) {
|
||||
if (blockXmlVOS.getBlockXmlVOList() != null && !blockXmlVOS.getBlockXmlVOList().isEmpty()) {
|
||||
checkBlockList(blockXmlVOS.getBlockXmlVOList(), flag);
|
||||
}
|
||||
}
|
||||
|
||||
// 板块数据格式验证
|
||||
public void checkBlockList(List<BlockXmlVO> blockXmlVOList, AtomicBoolean flag) {
|
||||
if (blockXmlVOList.size() > 0) {
|
||||
if (blockXmlVOList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (BlockXmlVO blockXmlVO : blockXmlVOList) {
|
||||
isEmptyAndAdd(blockXmlVO::getName, blockXmlVO::setName, NOT_ASSIGNED);
|
||||
isEmptyAddAndInvalid(blockXmlVO::getType, blockXmlVO::setType, "背板", DictTypeConstants.PLATE_TYPE, "板块类型", flag);
|
||||
@@ -791,8 +792,7 @@ public class XMLUtil {
|
||||
checkCuttingOutline(blockXmlVO.getCuttingOutlineXmlVO(), flag);
|
||||
}
|
||||
|
||||
if (blockXmlVO.getRawOutlineXmlVO() != null && blockXmlVO.getRawOutlineXmlVO().getPointXmlVOList() != null
|
||||
&& blockXmlVO.getRawOutlineXmlVO().getPointXmlVOList().size() > 0) {
|
||||
if (blockXmlVO.getRawOutlineXmlVO() != null && blockXmlVO.getRawOutlineXmlVO().getPointXmlVOList() != null && !blockXmlVO.getRawOutlineXmlVO().getPointXmlVOList().isEmpty()) {
|
||||
checkRawOutline(blockXmlVO.getRawOutlineXmlVO(), flag);
|
||||
}
|
||||
|
||||
@@ -804,8 +804,7 @@ public class XMLUtil {
|
||||
checkGrooves(blockXmlVO.getGrooveXmlVOS(), flag);
|
||||
}
|
||||
|
||||
if (blockXmlVO.getIsletXmlVOS() != null && blockXmlVO.getIsletXmlVOS().getIsletXmlVOList() != null &&
|
||||
blockXmlVO.getIsletXmlVOS().getIsletXmlVOList().size() > 0) {
|
||||
if (blockXmlVO.getIsletXmlVOS() != null && blockXmlVO.getIsletXmlVOS().getIsletXmlVOList() != null && !blockXmlVO.getIsletXmlVOS().getIsletXmlVOList().isEmpty()) {
|
||||
checkIslets(blockXmlVO.getIsletXmlVOS(), flag);
|
||||
}
|
||||
|
||||
@@ -814,13 +813,12 @@ public class XMLUtil {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCorrelations(CorrelationXmlVOS correlationXmlVOS, AtomicBoolean flag) {
|
||||
notEmptyPositiveNumber(correlationXmlVOS::getCount, correlationXmlVOS::setCount, "关联配件数量", Integer.class, flag);
|
||||
|
||||
if (correlationXmlVOS.getCorrelationXmlVOList() != null && correlationXmlVOS.getCorrelationXmlVOList().size() > 0) {
|
||||
if (correlationXmlVOS.getCorrelationXmlVOList() != null && !correlationXmlVOS.getCorrelationXmlVOList().isEmpty()) {
|
||||
for (CorrelationXmlVO correlationXmlVO : correlationXmlVOS.getCorrelationXmlVOList()) {
|
||||
if (StringUtils.isEmpty(correlationXmlVO.getItemCode())) {
|
||||
isEmptyAndBack(correlationXmlVO::getName, "关联配件名称", correlationXmlVO::setName, flag);
|
||||
@@ -855,8 +853,10 @@ public class XMLUtil {
|
||||
isEmptyAndBack(isletXmlVO::getId, "孤岛ID", isletXmlVO::setId, flag);
|
||||
|
||||
// 造型内孤岛 两个
|
||||
if (isletXmlVO.getPointXmlVOS() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isletXmlVO.getPointXmlVOS() != null) {
|
||||
PointXmlVOS pointXmlVOS = isletXmlVO.getPointXmlVOS();
|
||||
boolean index = isEmptyBackAndPositiveNumberAndBack(pointXmlVOS::getCount, "孤岛点阵数量 "+ pointXmlVOS.getCount(), pointXmlVOS::setCount, Integer.class, flag);
|
||||
|
||||
@@ -876,7 +876,7 @@ public class XMLUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -931,19 +931,19 @@ public class XMLUtil {
|
||||
}
|
||||
|
||||
private void checkGrooves(GrooveXmlVOS grooveXmlVOS, AtomicBoolean flag) {
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCount, grooveXmlVOS::setCount, "造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountFaceA, grooveXmlVOS::setCountFaceA, "正面造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountFaceB, grooveXmlVOS::setCountFaceB, "反面造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountSide, grooveXmlVOS::setCountSide, "侧面造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountSideL, grooveXmlVOS::setCountSideL, "左侧造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountSideR, grooveXmlVOS::setCountSideR, "右侧造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountSideU, grooveXmlVOS::setCountSideU, "上侧造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountSideD, grooveXmlVOS::setCountSideD, "下侧造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountBevelled, grooveXmlVOS::setCountBevelled, "斜面造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountRectangle, grooveXmlVOS::setCountRectangle, "矩形凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCountThrough, grooveXmlVOS::setCountThrough, "挖穿造型/凹槽数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCount2V, grooveXmlVOS::setCount2V, "二维刀路数量", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVOS::getCount3D, grooveXmlVOS::setCount3D, "三维刀路(浮雕)数量", Double.class, flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCount, grooveXmlVOS::setCount, "0", Double.class, "造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountFaceA, grooveXmlVOS::setCountFaceA, "0", Double.class, "正面造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountFaceB, grooveXmlVOS::setCountFaceB, "0", Double.class, "反面造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountSide, grooveXmlVOS::setCountSide, "0", Double.class, "侧面造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountSideL, grooveXmlVOS::setCountSideL, "0", Double.class, "左侧造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountSideR, grooveXmlVOS::setCountSideR, "0", Double.class, "右侧造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountSideU, grooveXmlVOS::setCountSideU, "0", Double.class, "上侧造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountSideD, grooveXmlVOS::setCountSideD, "0", Double.class, "下侧造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountBevelled, grooveXmlVOS::setCountBevelled, "0", Double.class, "斜面造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountRectangle, grooveXmlVOS::setCountRectangle, "0", Double.class, "矩形凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCountThrough, grooveXmlVOS::setCountThrough, "0", Double.class, "挖穿造型/凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCount2V, grooveXmlVOS::setCount2V, "0", Double.class, "矩形凹槽数量", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVOS::getCount3D, grooveXmlVOS::setCount3D, "0", Double.class, "三维刀路(浮雕)数量", flag);
|
||||
|
||||
|
||||
if (grooveXmlVOS.getGrooveXmlVOList() != null && grooveXmlVOS.getGrooveXmlVOList().size() > 0) {
|
||||
@@ -961,11 +961,11 @@ public class XMLUtil {
|
||||
isEmptyBackAndInvalid(grooveXmlVO::getFace, grooveXmlVO::setFace, DictTypeConstants.HOLE_FACE, "槽加工面数据", flag);
|
||||
|
||||
if (grooveXmlVO.getType().trim().equals("矩形槽")) {
|
||||
isEmptyAndBack(grooveXmlVO::getLength, "当槽为矩形时,槽宽度", grooveXmlVO::setLength, flag);
|
||||
|
||||
isEmptyAndBack(grooveXmlVO::getWidth, "当槽为矩形时,槽宽度", grooveXmlVO::setWidth, flag);
|
||||
}
|
||||
notEmptyPositiveNumber(grooveXmlVO::getWidth, grooveXmlVO::setWidth, "槽宽度", Double.class, flag);
|
||||
notEmptyPositiveNumber(grooveXmlVO::getLength, grooveXmlVO::setLength, "槽长度", Double.class, flag);
|
||||
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVO::getWidth, grooveXmlVO::setWidth, "0", Double.class, "槽宽度", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVO::getLength, grooveXmlVO::setLength, "0", Double.class, "槽长度", flag);
|
||||
isEmptyBackAndPositiveNumber(grooveXmlVO::getDepth, "槽深度", grooveXmlVO::setDepth, Double.class, flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVO::getWidthExtend, grooveXmlVO::setWidthExtend, "0", Double.class, "槽宽度延长", flag);
|
||||
isEmptyAddAndPositiveNumber(grooveXmlVO::getLengthExtend, grooveXmlVO::setLengthExtend, "0", Double.class, "槽长度延长", flag);
|
||||
@@ -990,7 +990,7 @@ public class XMLUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (grooveXmlVO.getOffsetLineXmlVOS() != null && grooveXmlVO.getOffsetLineXmlVOS().getOffsetLineXmlVOList() != null && grooveXmlVO.getOffsetLineXmlVOS().getOffsetLineXmlVOList().size() > 0) {
|
||||
if (grooveXmlVO.getOffsetLineXmlVOS() != null && grooveXmlVO.getOffsetLineXmlVOS().getOffsetLineXmlVOList() != null && !grooveXmlVO.getOffsetLineXmlVOS().getOffsetLineXmlVOList().isEmpty()) {
|
||||
for (OffsetLineXmlVO offsetLineXmlVO : grooveXmlVO.getOffsetLineXmlVOS().getOffsetLineXmlVOList()) {
|
||||
checkOffsetLine(offsetLineXmlVO, flag);
|
||||
}
|
||||
@@ -998,7 +998,7 @@ public class XMLUtil {
|
||||
}
|
||||
|
||||
private void checkOffsetLine(OffsetLineXmlVO offsetLineXmlVO, AtomicBoolean flag) {
|
||||
isEmptyBackAndPositiveNumber(offsetLineXmlVO::getOffset, "偏移刀路偏移量", offsetLineXmlVO::setOffset, Double.class, flag);
|
||||
isEmptyBackAndNumber(offsetLineXmlVO::getOffset, offsetLineXmlVO::setOffset, Double.class, "偏移值——正值右偏(外偏)、负值左偏(内偏)", flag);
|
||||
isEmptyBackAndPositiveNumber(offsetLineXmlVO::getDepth, "偏移刀路深度", offsetLineXmlVO::setDepth, Double.class, flag);
|
||||
isEmptyBackAndPositiveNumber(offsetLineXmlVO::getToolDiameter, "偏移刀路所用刀的直径", offsetLineXmlVO::setToolDiameter, Double.class, flag);
|
||||
isEmptyAddAndPositiveNumber(offsetLineXmlVO::getTangentAngle, offsetLineXmlVO::setTangentAngle, "0", Double.class, "角度(二维刀路V型刀提角/清角用)", flag);
|
||||
@@ -1011,7 +1011,7 @@ public class XMLUtil {
|
||||
isEmptyBackAndNumber(rawOutlineXmlVO::getReferenceOffsetY, rawOutlineXmlVO::setReferenceOffsetY, Double.class, "小板坯料(精加工)轮廓参考点Y坐标不可为空 " +rawOutlineXmlVO.getReferenceOffsetY() , flag);
|
||||
|
||||
|
||||
if (rawOutlineXmlVO.getPointXmlVOList() != null && rawOutlineXmlVO.getPointXmlVOList().size() > 0) {
|
||||
if (rawOutlineXmlVO.getPointXmlVOList() != null && !rawOutlineXmlVO.getPointXmlVOList().isEmpty()) {
|
||||
if (index) {
|
||||
if (Integer.parseInt(rawOutlineXmlVO.getCount()) != rawOutlineXmlVO.getPointXmlVOList().size()) {
|
||||
rawOutlineXmlVO.setCount("---< 小板坯料(精加工)点阵数量与实际数量不一致 >---");
|
||||
@@ -1031,7 +1031,7 @@ public class XMLUtil {
|
||||
isEmptyBackAndNumber(cuttingOutlineXmlVO::getReferenceOffsetY, cuttingOutlineXmlVO::setReferenceOffsetY, Double.class, "小板开料轮廓参考点Y坐标" , flag);
|
||||
|
||||
|
||||
if (cuttingOutlineXmlVO.getPointXmlVOList() != null && cuttingOutlineXmlVO.getPointXmlVOList().size() > 0) {
|
||||
if (cuttingOutlineXmlVO.getPointXmlVOList() != null && !cuttingOutlineXmlVO.getPointXmlVOList().isEmpty()) {
|
||||
if (index) {
|
||||
if (Integer.parseInt(cuttingOutlineXmlVO.getCount()) != cuttingOutlineXmlVO.getPointXmlVOList().size()) {
|
||||
cuttingOutlineXmlVO.setCount("---< 小板轮廓点阵数量与实际数量不一致 >---");
|
||||
@@ -1047,7 +1047,11 @@ public class XMLUtil {
|
||||
|
||||
public void checkOutline(OutlineXmlVO outlineXmlVO, AtomicBoolean flag) {
|
||||
boolean index = isEmptyBackAndPositiveNumberAndBack(outlineXmlVO::getCount, "小板成品轮廓点阵列表数量", outlineXmlVO::setCount, Integer.class, flag);
|
||||
if (outlineXmlVO.getPointXmlVOList() != null && outlineXmlVO.getPointXmlVOList().size() > 0) {
|
||||
if (outlineXmlVO.getPointXmlVOList() == null && outlineXmlVO.getPointXmlVOList().isEmpty()) {
|
||||
outlineXmlVO.setCount("---< 小板轮廓点阵列表不可为空 >---");
|
||||
flag.set(false);
|
||||
return;
|
||||
}
|
||||
if (index) {
|
||||
if (Integer.parseInt(outlineXmlVO.getCount()) != outlineXmlVO.getPointXmlVOList().size()) {
|
||||
outlineXmlVO.setCount("---< 小板轮廓点阵数量与实际数量不一致 >---");
|
||||
@@ -1063,22 +1067,23 @@ public class XMLUtil {
|
||||
|
||||
|
||||
checkPoint(pointXmlVO, flag);
|
||||
if (!(StringUtils.isEmpty(pointXmlVO.getItemCode()) && StringUtils.isEmpty(pointXmlVO.getEdgingName()) &&
|
||||
StringUtils.isEmpty(pointXmlVO.getEdgingColor()) && StringUtils.isEmpty(pointXmlVO.getEdgingMaterial()) &&
|
||||
(StringUtils.isEmpty(pointXmlVO.getEdgingThickness()) || pointXmlVO.getEdgingThickness().trim().equals("0")))) {
|
||||
if (StringUtils.isEmpty(pointXmlVO.getEdgingName())) {
|
||||
pointXmlVO.setEdgingName("封边条");
|
||||
}
|
||||
if (StringUtils.isEmpty(pointXmlVO.getItemCode())) {
|
||||
if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) {
|
||||
pointXmlVO.setItemCode("---< 当封边条没有物料编码时,封边条颜色、材质不可为空 >---");
|
||||
flag.set(false);
|
||||
}
|
||||
}
|
||||
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "封边条宽度", flag);
|
||||
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingExtend, pointXmlVO::setEdgingExtend, "0", Double.class, "封边条余量(两头各延长)", flag);
|
||||
|
||||
}
|
||||
checkEdging(pointXmlVO, flag);
|
||||
// if (!(StringUtils.isEmpty(pointXmlVO.getItemCode()) && StringUtils.isEmpty(pointXmlVO.getEdgingName()) &&
|
||||
// StringUtils.isEmpty(pointXmlVO.getEdgingColor()) && StringUtils.isEmpty(pointXmlVO.getEdgingMaterial()) &&
|
||||
// (StringUtils.isEmpty(pointXmlVO.getEdgingThickness()) || pointXmlVO.getEdgingThickness().trim().equals("0")))) {
|
||||
// if (StringUtils.isEmpty(pointXmlVO.getEdgingName())) {
|
||||
// pointXmlVO.setEdgingName("封边条");
|
||||
// }
|
||||
// if (StringUtils.isEmpty(pointXmlVO.getItemCode())) {
|
||||
// if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) {
|
||||
// pointXmlVO.setItemCode("---< 当封边条没有物料编码时,封边条颜色、材质不可为空 >---");
|
||||
// flag.set(false);
|
||||
// }
|
||||
// }
|
||||
// isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "封边条宽度", flag);
|
||||
// isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingExtend, pointXmlVO::setEdgingExtend, "0", Double.class, "封边条余量(两头各延长)", flag);
|
||||
//
|
||||
// }
|
||||
|
||||
isEmptyAddAndPositiveNumber(pointXmlVO::getPreMilling, pointXmlVO::setPreMilling, "0", Double.class, "预铣/精修量", flag);
|
||||
isEmptyAddAndNumber(pointXmlVO::getScale, pointXmlVO::setScale, "0", Double.class, "延展/收缩量", flag);
|
||||
@@ -1087,10 +1092,27 @@ public class XMLUtil {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 板材中封边条的处理
|
||||
public void checkEdging(PointXmlVO pointXmlVO, AtomicBoolean flag) {
|
||||
if (!(StringUtils.isEmpty(pointXmlVO.getItemCode()) && StringUtils.isEmpty(pointXmlVO.getEdgingName()) &&
|
||||
StringUtils.isEmpty(pointXmlVO.getEdgingColor()) && StringUtils.isEmpty(pointXmlVO.getEdgingMaterial()) &&
|
||||
(StringUtils.isEmpty(pointXmlVO.getEdgingThickness()) || pointXmlVO.getEdgingThickness().trim().equals("0")))) {
|
||||
if (StringUtils.isEmpty(pointXmlVO.getEdgingName())) {
|
||||
pointXmlVO.setEdgingName("封边条");
|
||||
}
|
||||
if (StringUtils.isEmpty(pointXmlVO.getItemCode())) {
|
||||
if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) {
|
||||
pointXmlVO.setItemCode("---< 当封边条没有物料编码时,封边条颜色、材质不可为空 >---");
|
||||
flag.set(false);
|
||||
}
|
||||
}
|
||||
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "封边条宽度", flag);
|
||||
isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingExtend, pointXmlVO::setEdgingExtend, "0", Double.class, "封边条余量(两头各延长)", flag);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 数据格式+数据正数判断
|
||||
private Boolean checkNumber(String numberStr, Class<?> targetType) {
|
||||
boolean error = true;
|
||||
@@ -1104,18 +1126,6 @@ public class XMLUtil {
|
||||
return error;
|
||||
}
|
||||
|
||||
// 数据格式+数据正数+数据长度判断
|
||||
private Boolean checkNumber(String numberStr, Class<?> targetType, Integer length, Integer decimalLength) {
|
||||
Boolean flag = checkNumber(numberStr, targetType);
|
||||
if (!flag) {
|
||||
return false;
|
||||
} else {
|
||||
if (!ToolUtil.checkPrecision(numberStr, length, decimalLength)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// point 验证
|
||||
private void checkPoint(PointXmlVO pointXmlVO, AtomicBoolean flag) {
|
||||
|
||||
+5
-5
@@ -81,7 +81,7 @@ public class XmlTypeRealize {
|
||||
// 柜体基点坐标转换
|
||||
public Map<String, BasePosition> roomBasePositionChange(RoomXmlVOS roomXmlVOS) {
|
||||
Map<String, BasePosition> basePositions = new HashMap<>();
|
||||
if (roomXmlVOS != null && roomXmlVOS.getRoomXmlVOList() != null && roomXmlVOS.getRoomXmlVOList().size() > 0) {
|
||||
if (roomXmlVOS != null && roomXmlVOS.getRoomXmlVOList() != null && !roomXmlVOS.getRoomXmlVOList().isEmpty()) {
|
||||
for (RoomXmlVO roomXmlVO : roomXmlVOS.getRoomXmlVOList()) {
|
||||
basePositions.put(roomXmlVO.getCode(), BasePosition.builder()
|
||||
|
||||
@@ -200,8 +200,8 @@ public class XmlTypeRealize {
|
||||
}
|
||||
|
||||
// 板材信息转换
|
||||
public Map<String, List<?>> goodsInfoChange(OrderXmlVO orderXmlVO, Long orderId, Long organId) {
|
||||
Map<String, List<?>> map = new HashMap<>();
|
||||
public Map<String, Object> goodsInfoChange(OrderXmlVO orderXmlVO, Long orderId, Long organId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
List<Object> rawGoodsDOs = new ArrayList<>();
|
||||
List<Object> goodsDOs = new ArrayList<>();
|
||||
@@ -932,7 +932,7 @@ public class XmlTypeRealize {
|
||||
|
||||
private void addIslandDetail(PlateDetail plateDetail, IsletXmlVOS isletXmlVOS) {
|
||||
if (isletXmlVOS != null && ObjectUtils.allNull(isletXmlVOS)) {
|
||||
if (isletXmlVOS.getIsletXmlVOList() != null && isletXmlVOS.getIsletXmlVOList().size() > 0) {
|
||||
if (isletXmlVOS.getIsletXmlVOList() != null && !isletXmlVOS.getIsletXmlVOList().isEmpty()) {
|
||||
for (IsletXmlVO isletXmlVO : isletXmlVOS.getIsletXmlVOList()) {
|
||||
ModelDetail modelDetail = ModelDetail.builder()
|
||||
.id(Integer.valueOf(isletXmlVO.getId()))
|
||||
@@ -1292,7 +1292,7 @@ public class XmlTypeRealize {
|
||||
private ModelDetail createModelDetail(GrooveXmlVO grooveXmlVO, int faceType) {
|
||||
return ModelDetail.builder()
|
||||
.id(Integer.valueOf(grooveXmlVO.getId()))
|
||||
.parentId(Integer.valueOf(grooveXmlVO.getParentId()))
|
||||
// .parentId(Integer.valueOf(grooveXmlVO.getParentId()))
|
||||
.type(grooveXmlVO.getType())
|
||||
.faceType(faceType)
|
||||
.width(Double.parseDouble(grooveXmlVO.getWidth()))
|
||||
|
||||
+5
@@ -27,4 +27,9 @@ public class PostPageReqVO extends PageParam {
|
||||
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "排序", example = "ascend")
|
||||
private String order;
|
||||
|
||||
@Schema(description = "排序字段", example = "id")
|
||||
private String field;
|
||||
}
|
||||
|
||||
+33
-4
@@ -49,11 +49,40 @@ public interface PostMapper extends BaseMapperX<PostDO> {
|
||||
// postDO.setId((long) (i + 1));
|
||||
// }
|
||||
|
||||
return selectPage(reqVO, lambdaQueryWrapperX
|
||||
.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||
lambdaQueryWrapperX.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(PostDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PostDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(PostDO::getSort));
|
||||
.eqIfPresent(PostDO::getStatus, reqVO.getStatus());
|
||||
|
||||
|
||||
if (reqVO.getOrder() == null) {
|
||||
lambdaQueryWrapperX.orderByDesc(PostDO::getSort);
|
||||
} else {
|
||||
if (reqVO.getOrder().equals("ascend")) {
|
||||
switch (reqVO.getField()) {
|
||||
case "name" -> lambdaQueryWrapperX.orderByAsc(PostDO::getName);
|
||||
case "code" -> lambdaQueryWrapperX.orderByAsc(PostDO::getCode);
|
||||
case "sort" -> lambdaQueryWrapperX.orderByAsc(PostDO::getSort);
|
||||
case "status" -> lambdaQueryWrapperX.orderByAsc(PostDO::getStatus);
|
||||
case "create_time" -> lambdaQueryWrapperX.orderByAsc(PostDO::getCreateTime);
|
||||
default -> {
|
||||
// default不排序
|
||||
}
|
||||
}
|
||||
} else if (reqVO.getOrder().equals("descend")) {
|
||||
switch (reqVO.getField()) {
|
||||
case "name" -> lambdaQueryWrapperX.orderByDesc(PostDO::getName);
|
||||
case "code" -> lambdaQueryWrapperX.orderByDesc(PostDO::getCode);
|
||||
case "sort" -> lambdaQueryWrapperX.orderByDesc(PostDO::getSort);
|
||||
case "status" -> lambdaQueryWrapperX.orderByDesc(PostDO::getStatus);
|
||||
case "create_time" -> lambdaQueryWrapperX.orderByDesc(PostDO::getCreateTime);
|
||||
default -> {
|
||||
// default不排序
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return selectPage(reqVO, lambdaQueryWrapperX);
|
||||
}
|
||||
|
||||
default PostDO selectByName(String name) {
|
||||
|
||||
Reference in New Issue
Block a user