bug 1060修改

This commit is contained in:
lym
2025-02-10 16:50:49 +08:00
parent 03e406fec4
commit 25f19f2275
3 changed files with 685 additions and 356 deletions
@@ -427,6 +427,11 @@ public class OrderServiceImpl implements OrderService {
if (order.getSplitter() == null || order.getSplitter().equals("")) {
order.setSplitter(nickName);
}
if (order.getStatus() == 0) {
orderMapper.insert(order);
return order.getId();
}
}
List<GoodsDO> goodsDO = new ArrayList<>(apiDataTypeVo.getMapGoodsDO().values());
List<RawGoodsDO> rawGoodsDO = new ArrayList<>(apiDataTypeVo.getMapRawGoodsDO().values());
@@ -89,7 +89,7 @@ public class ApiTypeRealize {
ConcurrentHashMap<String, CompletableFuture<ApiDataTypeVo>> results = new ConcurrentHashMap<>();
// 添加各个API调用到映射中,并指定结果字段名
results.put("order", CompletableFuture.supplyAsync(() -> orderInfoChange(token, orderId, orderNo, organId)));
// results.put("order", CompletableFuture.supplyAsync(() -> orderInfoChange(token, orderId, orderNo, organId)));
results.put("good", CompletableFuture.supplyAsync(() -> goodsInfoChange(token, orderId, orderNo, organId)));
results.put("body", CompletableFuture.supplyAsync(() -> bodyInfoChange(token, orderId, orderNo, organId)));
results.put("group", CompletableFuture.supplyAsync(() -> groupInfoChange(token, orderId, orderNo, organId)));
@@ -98,9 +98,10 @@ public class ApiTypeRealize {
results.put("plate", CompletableFuture.supplyAsync(() -> platesInfoChange(token, orderId, orderNo, organId)));
// 等待所有异步任务完成
CompletableFuture.allOf(results.values().toArray(new CompletableFuture[7])).join();
CompletableFuture.allOf(results.values().toArray(new CompletableFuture[6])).join();
ApiDataTypeVo order = results.get("order").get();
// ApiDataTypeVo order = results.get("order").get();
ApiDataTypeVo order = orderInfoChange(token, orderId, orderNo, organId);
ApiDataTypeVo goodsData = results.get("good").get();
ApiDataTypeVo bodyData = results.get("body").get();
ApiDataTypeVo groupData = results.get("group").get();
@@ -108,6 +109,10 @@ public class ApiTypeRealize {
ApiDataTypeVo plateDetailData = results.get("plateDetail").get();
ApiDataTypeVo platesData = results.get("plate").get();
// 判断是不是空单
if (order.getOrderDO().getStatus() == 0) {
return order;
}
// 判断生产数据是否可以为空
if (!platesData.getMapPlatesInfos().isEmpty() && plateDetailData.getMapPlateDetails().isEmpty() ) {
@@ -123,7 +128,10 @@ public class ApiTypeRealize {
plateDetailData.getMapPlateDetails());
Map<String, List<OrderItemDO>> mapItemList = new HashMap<>();
mergeMaps(mapItemList, partsData.getMapItemByGroup());
if (partsData.getMapItemByGroup() != null && partsData.getMapItemByGroup().size() > 0) {
mergeMaps(mapItemList, partsData.getMapItemByGroup());
}
// mergeMaps(mapItemList, partsData.getMapItemByGroup());
mergeMaps(mapItemList, platesData.getMapItemByGroup());
@@ -179,7 +187,7 @@ public class ApiTypeRealize {
// item中配件更换id
mapItem.forEach(itemDO -> {
if (itemDO.getPartsId() != null) {
if (itemDO.getPartsId() != null && partsData.getMapPartsInfos() != null) {
String goodsId = String.valueOf(itemDO.getPartsId());
OrderPartsDO newPartsDO = partsData.getMapPartsInfos().get(goodsId);
if (newPartsDO != null) {
@@ -203,18 +211,20 @@ public class ApiTypeRealize {
Map<String, PlateDetail> mapPlateDetails,
Map<String, PlateDO> mapPlatesInfos,
Map<String, PlateDetail> mapPlateDetailsRemarks) {
// 这里需要修改
// 第一步判断是否存在需要进行数据添加的小板
if (mapPlatesInfos == null || mapPlatesInfos.isEmpty()) {
log.error("小板信息:{}" , PLATE_DATA_ERROR);
throw exception(PLATE_DATA_ERROR);
// throw exception(PLATE_DATA_ERROR);
}
if (mapPlateDetails == null || mapPlateDetails.isEmpty()) {
log.error("小板信息:{}" , PLATE_PRODUCE_DATA_ERROR);
throw exception(PLATE_PRODUCE_DATA_ERROR);
// throw exception(PLATE_PRODUCE_DATA_ERROR);
}
if (mapGoodsDO == null || mapGoodsDO.isEmpty()) {
log.error("板材信息:{}" , GOODS_DATA_ERROR);
throw exception(GOODS_DATA_ERROR);
// throw exception(GOODS_DATA_ERROR);
}
mapPlatesInfos.forEach((k, v) -> {
// 判断是否有造型数据可以进行整合
@@ -414,14 +424,19 @@ public class ApiTypeRealize {
JSONArray bodyLists = bodyMessage.getJSONArray(ProduceApiConstants.LIST);
if (bodyLists == null || bodyLists.isEmpty()) {
log.error("{}房间柜体信息获取失败",orderNo);
throw exception(ORDER_BODY_NOT_EXISTS);
}
// if (bodyLists == null || bodyLists.isEmpty()) {
// log.error("{}房间柜体信息获取失败",orderNo);
// throw exception(ORDER_BODY_NOT_EXISTS);
//
// }
Map<String, OrderBodyDO> bodyInfos = new HashMap<>();
if (bodyLists == null || bodyLists.isEmpty()) {
return new ApiDataTypeVo().setMapOrderBodyDO(bodyInfos);
}
for (int i = 0; i < bodyLists.size(); i++) {
JSONObject body = bodyLists.getJSONObject(i);
OrderBodyDO bodyInfo = OrderBodyDO.builder()
@@ -504,16 +519,24 @@ public class ApiTypeRealize {
jsonParts.put(ProduceApiConstants.PAGE_COUNT_KEY, PARTS_PAGE_MAX);
jsonParts.put(ProduceApiConstants.ORDER_NO_KEY, "N" + orderNo);
if (apiDataAchieve.getApiPartsMessage(token, orderNo, jsonParts) == null) {
return new ApiDataTypeVo();
}
Integer pageCount = apiDataAchieve.getApiPartsMessage(token, orderNo, jsonParts).getJSONObject(ProduceApiConstants.VALUE).getInteger(ProduceApiConstants.PAGE_COUNT); // 获取页码总数
// 根据总页码总数进行多线程循环
Map<String, OrderPartsDO> partsInfos = new HashMap<>();
Map<String, List<OrderItemDO>> partsItem = new HashMap<>();
Map<String, OrderPartsRemark> remarks = new HashMap<>();
if (apiDataAchieve.getApiPartsMessage(token, orderNo, jsonParts) == null) {
return new ApiDataTypeVo().setMapPartsInfos(partsInfos).setMapItemByGroup(partsItem).setMapPartRemarks(remarks);
}
// if (apiDataAchieve.getApiPartsMessage(token, orderNo, jsonParts) == null) {
// return new ApiDataTypeVo();
// }
Integer pageCount = apiDataAchieve.getApiPartsMessage(token, orderNo, jsonParts).getJSONObject(ProduceApiConstants.VALUE).getInteger(ProduceApiConstants.PAGE_COUNT); // 获取页码总数
// 根据总页码总数进行多线程循环
// Map<String, OrderPartsDO> partsInfos = new HashMap<>();
// Map<String, List<OrderItemDO>> partsItem = new HashMap<>();
// Map<String, OrderPartsRemark> remarks = new HashMap<>();
List<CompletableFuture<Map<String, Object>>> futures = new ArrayList<>();
for (int i = 1; i <= pageCount; i++) {
@@ -1478,7 +1501,7 @@ public class ApiTypeRealize {
if (map == null || map.isEmpty()) {
log.error("明细信息:{}" , CHANGE_DETAILS_ITEM_ERROR);
throw exception(CHANGE_DETAILS_ITEM_ERROR);
// throw exception(CHANGE_DETAILS_ITEM_ERROR);
}
// 处理第一个 Map