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) {