From c64ac0d12ea948ada73a8ae4e0f5493a909c9ca2 Mon Sep 17 00:00:00 2001 From: ljl Date: Sun, 17 Sep 2023 12:06:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DistributionOrderServiceImpl.java | 10 ++++++++-- .../ms/api/service/impl/OutstorageServiceImpl.java | 13 +++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java index 4e020a70..d004a381 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/DistributionOrderServiceImpl.java @@ -434,6 +434,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { private void dsPurchaseOrderOutStorageAndUpdateRemark(ShopBO shopBO, PurchaseOrderDTO purchaseOrderInfo, OpOrder opOrder, PurchaseOrder purchaseOrder) { if (checkPurchaseOrderStatusCanOutStorage(purchaseOrderInfo, opOrder)) { outstorageService.dsPurchaseAutoOutStorage(shopBO, opOrder, purchaseOrder); + } else { + log.info("checkPurchaseOrderStatusCanOutStorageFail"); } if (checkNeedBuildPurchaseOrderRemark(purchaseOrderInfo, purchaseOrder)) { buildAndUpdateNewPurchaseOrderRemark(shopBO, opOrder); @@ -570,15 +572,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { String appChineseName = AppConst.appChineseName; Pattern p = Pattern.compile("【(" + appChineseName + "|0.0):[^】]*】"); Matcher m = p.matcher(oldRemark); - boolean hasMatch = false; StringBuffer newRemarkBuffer = new StringBuffer(oldRemark.length()); while (m.find()) { hasMatch = true; -// m.appendReplacement(newRemarkBuffer, purchaseOrderRemark); + m.appendReplacement(newRemarkBuffer, purchaseOrderRemark); } m.appendTail(newRemarkBuffer); String newRemark = newRemarkBuffer.toString(); + +// String newRemark = oldRemark.replaceAll("【(" + appChineseName + "|0.0):[^】]*】", purchaseOrderRemark); + if (!hasMatch) { newRemark = oldRemark + purchaseOrderRemark; } @@ -738,6 +742,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } private boolean checkPurchaseOrderStatusCanOutStorage(PurchaseOrderDTO purchaseOrderInfo, OpOrder opOrder) { + log.info("checkPurchaseOrderStatusCanOutStorage:purchaseOrderInfo" + purchaseOrderInfo); + log.info("checkPurchaseOrderStatusCanOutStorage:orderStatus" + opOrder); if (!purchaseOrderInfo.getPurchaseOrderStatus().equals(PurchaseOrderConst.PURCHASE_ORDER_STATUS_HAS_SEND)) { return false; } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OutstorageServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OutstorageServiceImpl.java index 66fc9aaa..d81da610 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OutstorageServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OutstorageServiceImpl.java @@ -256,23 +256,28 @@ public class OutstorageServiceImpl implements OutstorageService { @Override public void dsPurchaseAutoOutStorage(ShopBO shopBO, OpOrder opOrder, PurchaseOrder purchaseOrder) { + log.info("dsPurchaseAutoOutStorage_begin_" + opOrder.getOrderId()); DsPurchaseSetting dsPurchaseSetting = dsPurchaseSettingService.getShopSetting(opOrder.getShopId()); if (purchaseOrder.getItems() == null) { List items = purchaseOrderItemService.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrder.getPurchaseOrderId()); purchaseOrder.setItems(items); } log.info("getOrderStatus: " + opOrder.getOrderStatus()); -// try { + try { if (opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS)) { + log.info("dsPurchaseAutoOutStorage: dsOrderOutStorage" + opOrder.getOrderId()); dsOrderOutStorage(shopBO, opOrder, purchaseOrder, dsPurchaseSetting); } else if (opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_BUYER_CONFIRM_GOODS) || opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_PART_DELIVERY)) { + log.info("dsPurchaseAutoOutStorage: dsOrderOutStorageOrUpdateOutStorageLogistics" + opOrder.getOrderId()); dsOrderOutStorageOrUpdateOutStorageLogistics(shopBO, opOrder, purchaseOrder, dsPurchaseSetting); } else { + log.error("dsPurchaseAutoOutStorageNotNeed_" + opOrder.getOrderId()); throw new RuntimeException("订单状态未达到发货条件"); } -// } catch (RuntimeException e) { -// opOrderOutstorageHistoryService.addOrderOutstorageHistory(shopBO.getShopId(), opOrder.getOrderId(), );; -// } + } catch (RuntimeException e) { + log.error("dsPurchaseAutoOutStorageError_" + opOrder.getOrderId(), e); + opOrderOutstorageHistoryService.addOrderOutstorageHistory(shopBO.getShopId(), Collections.singletonList(opOrder.getOrderId()), 0, purchaseOrder.getPurchaseOrderWaybillCode(), LogisticsConst.outstorageSourceDsAuto, 0, ResultDTO.fail(e.getMessage()));; + } } private void dsOrderOutStorage(ShopBO shopBO, OpOrder opOrder, PurchaseOrder purchaseOrder, DsPurchaseSetting dsPurchaseSetting) {