文件导入bug修改

This commit is contained in:
lym
2025-01-10 14:08:27 +08:00
parent 1414ef5291
commit e059c62d2b
3 changed files with 17 additions and 13 deletions
@@ -2,6 +2,7 @@ package com.cf.imes.module.executor.controller.admin.order;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.pojo.PageParam;
import com.cf.imes.framework.common.pojo.PageResult;
@@ -233,7 +234,10 @@ public class OrderController {
}
log.error(errKey, e);
return error(500 , e.getMessage());
assert e instanceof ServiceException;
ServiceException cause = (ServiceException) e;
return error(cause.getCode(),cause.getMessage());
} finally {
redisLockUtil.unlock(lockKey);
@@ -293,7 +297,7 @@ public class OrderController {
String customOrderNo = mapOrder.get(ProduceExcelConstants.ORDER_CUSTOM_ORDER_NO);
if (index == 0 && customOrderNo != null && !orderService.customOrderNoIsExists(customOrderNo)) {
mapOrder.put(ProduceExcelConstants.ORDER_CUSTOM_ORDER_NO, customOrderNo + "重复");
mapOrder.put(ProduceExcelConstants.ORDER_CUSTOM_ORDER_NO, customOrderNo + "---< 自定义单号重复 >---");
flag = false;
}
@@ -89,11 +89,11 @@ public class ExcelCheckListUtil {
.organId(OrganContextHolder.getOrganId())
.dataType(DataTypeEnum.FILE_IMPORT.getStatus())
.orderDate(LocalDateTime.now())
.customer(ProduceExcelConstants.ORDER_CUSTOMER)
.customer(orderMap.get(ProduceExcelConstants.ORDER_CUSTOMER))
.customOrderNo(orderMap.get(ProduceExcelConstants.ORDER_CUSTOM_ORDER_NO))
.dealer(orderMap.get(ProduceExcelConstants.ORDER_DEALER))
.dealerPhoneNumber(orderMap.get(ProduceExcelConstants.ORDER_DEALER_PHONE_NUMBER))
.address(orderMap.get(ProduceExcelConstants.ORDER_CUSTOMER))
.address(orderMap.get(ProduceExcelConstants.ORDER_ADDRESS))
.phoneNumber(orderMap.get(ProduceExcelConstants.ORDER_PHONE_NUMBER))
.salesman(orderMap.get(ProduceExcelConstants.ORDER_SALESMAN))
.splitter(orderMap.get(ProduceExcelConstants.ORDER_SPLITTER))
@@ -54,7 +54,7 @@ public class ExcelTypeRealize {
final String NOT_ASSIGNED = "未命名";
final String PLATE = "plate";
final String PARTS = "parts";
final String NO_CODE = "no_code_1132589&";
// 数据转换 + 错误验证
public Map<String, Object> changeDate(List<OrderPlateImportExcelVO> excelVOS, Long orderId) {
@@ -81,11 +81,11 @@ public class ExcelTypeRealize {
Map<String, List<OrderPlateImportExcelVO>> goodsIdMap = checkMap.get(PLATE).stream().collect(
Collectors.groupingBy(
excelVO -> excelVO.getGoodsId() != null ? excelVO.getGoodsId() : " ",
excelVO -> excelVO.getGoodsId() != null && !StringUtils.isEmpty(excelVO.getGoodsId())? excelVO.getGoodsId() : NO_CODE,
Collectors.toList()
));
goodsIdMap.forEach((key, value) -> {
if (key.equals(" ")) { // 没有商品编号的 value.get(0).getGoodsId() == null
if (NO_CODE.equals(key)) { // 没有商品编号的 value.get(0).getGoodsId() == null
// 将相同条件的元素归为一个集合
Map<List<Object>, List<OrderPlateImportExcelVO>> goodsMap = value.stream()
.collect(Collectors.groupingBy(
@@ -138,7 +138,7 @@ public class ExcelTypeRealize {
// 配件信息合集,添加生产单id,添加生产单配件设计端商品编码,配件信息写入order_parts
Map<String, List<OrderPlateImportExcelVO>> partsIdMap = checkMap.get(PARTS).stream().collect(
Collectors.groupingBy(
excelVO -> excelVO.getGoodsId() != null ? excelVO.getGoodsId() : "",
excelVO -> excelVO.getGoodsId() != null && !StringUtils.isEmpty(excelVO.getGoodsId())? excelVO.getGoodsId() : " ",
Collectors.toList()
));
partsIdMap.forEach((key, value) -> {
@@ -225,7 +225,7 @@ public class ExcelTypeRealize {
// 房间名称为条件进行分组
Map<String, List<OrderPlateImportExcelVO>> roomCollect = excelVOS.stream().collect(
Collectors.groupingBy(
excelVO -> excelVO.getRoomsName() != null ? excelVO.getRoomsName() : NOT_ASSIGNED,
excelVO -> excelVO.getRoomsName() != null && !StringUtils.isEmpty(excelVO.getRoomsName())? excelVO.getRoomsName() : NOT_ASSIGNED,
Collectors.toList()
));
@@ -234,7 +234,7 @@ public class ExcelTypeRealize {
// 柜体名称为条件进行分组
Map<String, List<OrderPlateImportExcelVO>> bodyCollect = listRoom.stream()
.collect(Collectors.groupingBy(
excelVO -> excelVO.getCabinetsName() != null ? excelVO.getCabinetsName() : NOT_ASSIGNED,
excelVO -> excelVO.getCabinetsName() != null && !StringUtils.isEmpty(excelVO.getCabinetsName())? excelVO.getCabinetsName() : NOT_ASSIGNED,
Collectors.toList()
));
@@ -249,7 +249,7 @@ public class ExcelTypeRealize {
// 加工组类型为条件进行分组
Map<String, List<OrderPlateImportExcelVO>> synthesisCollect = listBody.stream()
.collect(Collectors.groupingBy(
excelVO -> excelVO.getSynthesisTypeName() != null ? excelVO.getSynthesisTypeName() : " ",
excelVO -> excelVO.getSynthesisTypeName() != null && !StringUtils.isEmpty(excelVO.getSynthesisTypeName()) ? excelVO.getSynthesisTypeName() : " ",
Collectors.toList()
));
@@ -258,7 +258,7 @@ public class ExcelTypeRealize {
// 加工组名称为条件进行分组
Map<String, List<OrderPlateImportExcelVO>> combinationNameCollect = listSynthesis.stream()
.collect(Collectors.groupingBy(
excelVO -> excelVO.getCombinationName() != null ? excelVO.getCombinationName() : " ",
excelVO -> excelVO.getCombinationName() != null && !StringUtils.isEmpty(excelVO.getCombinationName())? excelVO.getCombinationName() : " ",
Collectors.toList()
));
combinationNameCollect.forEach((combinationName, listCombinationName) -> {