From 9e59593d2bc51bc8e0cd5b3a7f4a553dca8ec009 Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 15 Jan 2024 18:57:30 +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 --- .../service/impl/DistributionOrderServiceImpl.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 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 422e7e6..4ef50e8 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 @@ -76,6 +76,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } Set purOrderIds = new HashSet<>(orderIdAndPurOrderIdMap.values()); + + List platformPurchaseOrders = platformPurchaseOrderMapper.getListByPurOrderIds(new ArrayList<>(purOrderIds)); + if (platformPurchaseOrders.isEmpty()) { + storeCreateOrders(shopId, param.getOrders(), purOrderIds); + } + storeCreateOrders(shopId, param.getOrders(), purOrderIds); BatchCreateDistributionOrdersRequestDTO request = buildBatchCreateDistributionOrdersRequestDTO(param); @@ -109,9 +115,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } } data.setOrderResults(orderResults); - - purchaseOrderMapper.insertBatch(purchaseOrders); - purchaseOrderItemMapper.insertBatch(purchaseOrderItems); + PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurOrderId(purOrderIds.iterator().next()); + if (purchaseOrder == null) { + purchaseOrderMapper.insertBatch(purchaseOrders); + purchaseOrderItemMapper.insertBatch(purchaseOrderItems); + } } private PurchaseOrder buildPurchaseOrderByDTO(Long shopId, PurchaseOrderDTO purchaseOrderDTO, String purOrderId) {