From 863dc8a84f9d56147b0790c34bb1250a777a5d22 Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 22 Apr 2024 13:27:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DistributionOrderServiceImpl.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java index 0cfce95..1df4a57 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java @@ -83,15 +83,13 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } boolean isRepurchase = false; + Map repurchasePlatformPurchaseOrderMap = new HashMap<>(); if (!platformPurchaseOrders.isEmpty()) { for (PlatformPurchaseOrder platformPurchaseOrder: platformPurchaseOrders) { log.info("platformPurchaseOrder[" + platformPurchaseOrder.getPurOrderId() + "]exist, purchaseStatus:" + platformPurchaseOrder.getPurchaseStatus()); if (platformPurchaseOrder.getPurchaseStatus().equals(StatusConst.cancel)) { isRepurchase = true; - platformPurchaseOrder.setPurchaseStatus(PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_PAY); - platformPurchaseOrder.setStatus(StatusConst.normal); - platformPurchaseOrder.setGmtModified(new Date()); - platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder); + repurchasePlatformPurchaseOrderMap.put(platformPurchaseOrder.getPurOrderId(), platformPurchaseOrder); } } } @@ -124,11 +122,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { purchaseOrderItems.addAll(items); OrderResult orderResult = buildOrderResult(purchaseOrderDTO, orderIdAndPurOrderIdMap, skuIdAndPurSkuOrderIdMap); orderResults.add(orderResult); + if (isRepurchase && repurchasePlatformPurchaseOrderMap.containsKey(purOrderId)) { + PlatformPurchaseOrder platformPurchaseOrder = repurchasePlatformPurchaseOrderMap.get(purOrderId); + platformPurchaseOrder.setPurchaseStatus(PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_PAY); + platformPurchaseOrder.setStatus(StatusConst.normal); + platformPurchaseOrder.setGmtModified(new Date()); + platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder); + } } } + data.setOrderResults(orderResults); List currentPurchaseOrders = purchaseOrderMapper.getListByPurOrderId(purOrderIds.iterator().next()); - if (currentPurchaseOrders.isEmpty()) { + if (currentPurchaseOrders.isEmpty() || isRepurchase) { purchaseOrderMapper.insertBatch(purchaseOrders); purchaseOrderItemMapper.insertBatch(purchaseOrderItems); }