From 1fa0154147a57fb661e41f29fed3a4fbc8141363 Mon Sep 17 00:00:00 2001 From: ljl Date: Thu, 14 Mar 2024 17:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DistributionOrderServiceImpl.java | 14 ++++++++++---- .../com/ms/dal/mapper/PurchaseOrderMapper.java | 2 ++ .../main/resources/mapper/PurchaseOrderMapper.xml | 6 ++++++ 3 files changed, 18 insertions(+), 4 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 4ef50e8..c215e18 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 @@ -115,8 +115,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } } data.setOrderResults(orderResults); - PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurOrderId(purOrderIds.iterator().next()); - if (purchaseOrder == null) { + List currentPurchaseOrders = purchaseOrderMapper.getListByPurOrderId(purOrderIds.iterator().next()); + if (currentPurchaseOrders.isEmpty()) { purchaseOrderMapper.insertBatch(purchaseOrders); purchaseOrderItemMapper.insertBatch(purchaseOrderItems); } @@ -488,11 +488,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { throw new RuntimeException("采购单不存在"); } - PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurOrderId(purOrderId); + List purchaseOrders = purchaseOrderMapper.getListByPurOrderId(purOrderId); + List sourceOrderIds = new ArrayList<>(); + for (PurchaseOrder purchaseOrder: purchaseOrders) { + sourceOrderIds.add(purchaseOrder.getPurchaseOrderSn()); + } + if (sourceOrderIds.isEmpty()) { + throw new RuntimeException("采购单号不存在"); + } List paymentResults = new ArrayList<>(); for (BatchPayParam.Param p: param.getParams()) { - List sourceOrderIds = Collections.singletonList(purchaseOrder.getPurchaseOrderSn()); GetPurchaseOrderPayUrlResponseDTO response1 = dsApiService.getPurchaseOrderPayUrl(p.getShopId(), sourceOrderIds, "PC"); GetPurchaseOrderPayUrlResponseDTO response2 = dsApiService.getPurchaseOrderPayUrl(p.getShopId(), sourceOrderIds, "WIRELESS"); if (!response1.isSuccess()) { diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java index 8df0b42..b4e708c 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java @@ -32,4 +32,6 @@ public interface PurchaseOrderMapper { PurchaseOrder getByPurchaseOrderSn(@Param("purchaseOrderSn") String purchaseOrderSn); PurchaseOrder getByPurOrderId(@Param("purOrderId") String purOrderId); + + List getListByPurOrderId(@Param("purOrderId") String purOrderId); } diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml index 9ffe860..a7d8876 100644 --- a/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml @@ -56,6 +56,12 @@ from purchase_order where pur_order_id = #{purOrderId,jdbcType=VARCHAR} + delete from purchase_order