From a51a588961fe640c719dd71500e608630b204759 Mon Sep 17 00:00:00 2001 From: ljl Date: Fri, 19 Apr 2024 17:35:02 +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 | 18 +++++++++++++++--- 1 file changed, 15 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 c215e18..7256592 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 @@ -82,9 +82,20 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { storeCreateOrders(shopId, param.getOrders(), purOrderIds); } - storeCreateOrders(shopId, param.getOrders(), purOrderIds); + boolean isRepurchase = false; + 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); + platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder); + } + } + } - BatchCreateDistributionOrdersRequestDTO request = buildBatchCreateDistributionOrdersRequestDTO(param); + BatchCreateDistributionOrdersRequestDTO request = buildBatchCreateDistributionOrdersRequestDTO(param, isRepurchase); BatchCreateDistributionOrdersResponseDTO response = dsApiService.batchCreateDistributionOrders(param.getShopId(), request); // String res = "{\"result\":\"success\",\"successCount\":1,\"failCount\":0,\"successList\":[{\"result\":\"success\",\"data\":{\"success\":true,\"totalSuccessAmount\":598,\"orderId\":\"3641170788609141341\",\"postFee\":0,\"mutilOrders\":null},\"createAlibabaOrderLogId\":1496,\"platformOrderIds\":[\"6923971910449173607\"],\"isEncryptOrder\":\"true\",\"isSupportEncryptOrder\":1,\"isUseManualConsignee\":0,\"flow\":\"fenxiao\",\"includeSplitJxhy\":false,\"sourceOrderIds\":[\"3641170788609141341\"],\"payRet\":null,\"platformOrderId\":\"6923971910449173607\",\"relatePurchaseOrderInfos\":[{\"platformOrderId\":\"6923971910449173607\",\"purchasePlatform\":\"1688DS\",\"purchaseOrderSn\":\"3641170788609141341\",\"purchaseOrderBuyer\":\"douhuotest\",\"purchaseOrderSeller\":\"\\u798f\\u5dde\\u67cf\\u4e3a\\u5546\\u8d38\\u6709\\u9650\\u516c\\u53f8\",\"purchaseOrderPayment\":\"5.98\",\"purchaseOrderFullname\":\"\\u6de1*\",\"purchaseOrderMobile\":\"1********80\",\"purchaseOrderFullAddress\":\"\\u6d59\\u6c5f\\u7701 \\u676d\\u5dde\\u5e02 \\u4f59\\u676d\\u533a \\u4ed3\\u524d\\u8857\\u9053 \\u4f59\\u676d*\\u8def****\",\"purchaseOrderStartTime\":\"2023-11-22 11:03:37\",\"platformPushStatus\":\"wait\",\"purchaseOrderLogisticsName\":\"\",\"purchaseOrderWaybillCode\":\"\",\"purchaseOrderStatus\":\"wait_pay\",\"purchaseOrderFlow\":\"fenxiao\",\"alibabaOrderStatus\":\"waitbuyerpay\",\"isUseManualConsignee\":0,\"isDsEncryptOrder\":0,\"isSupportEncryptOrder\":0,\"logisticsIsAccept\":false,\"items\":[{\"skuId\":\"3386515436145410\",\"wareId\":\"3651940874226638524\",\"purchaseNum\":\"2\",\"purchasePrice\":\"2.99\",\"sourceItemId\":\"712130508984\",\"subItemId\":\"3641170788609141341\"}],\"mergePurchasePlatformOrderIds\":null,\"purchaseOrderUpdateTime\":\"2023-11-22 11:03:37\",\"purchaseOrderPayTime\":null}]}],\"errorList\":null,\"lockSourceItems\":[{\"createPurchaseOrderLockSkuId\":\"2224\",\"createPurchaseOrderLockId\":\"20001680\",\"sourceItemId\":\"712130508984\",\"sourceSkuId\":\"4987755988437\",\"createPurchaseOrderLogId\":\"1553\",\"sourceOrderId\":\"3641170788609141341\",\"sourceNum\":null,\"reqId\":null,\"status\":\"lock\",\"gmtCreate\":\"2023-11-22 11:03:36\",\"gmtModified\":\"2023-11-22 11:03:37\",\"platformOrderId\":\"6923971910449173607\",\"platformItemId\":\"3651940874226638524\",\"platformSkuId\":\"3386515436145410\"}]}"; @@ -449,7 +460,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return item; } - private BatchCreateDistributionOrdersRequestDTO buildBatchCreateDistributionOrdersRequestDTO(BatchCreateParam param) { + private BatchCreateDistributionOrdersRequestDTO buildBatchCreateDistributionOrdersRequestDTO(BatchCreateParam param, boolean isRepurchase) { Map productIdAndOutProductIdMap = new HashMap<>(); Map skuIdAndOutSkuIdMap = new HashMap<>(); for (CreateOrder order: param.getOrders()) { @@ -467,6 +478,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { PlatformOrderDTO platformOrder = buildPlatformOrderDTO(param.getShopId(), order, productIdAndSourceProductInfoMap, skuIdAndOutSkuIdMap); platformOrders.add(platformOrder); } + request.setRepurchase(isRepurchase); request.setPlatformOrders(platformOrders); request.setPlatform(CommonConst.PLATFORM); request.setActionSource(DsOrderConst.ACTION_SOURCE_BATCH_PURCHASE);