From 29692860d0a134a2e00aeddd99ab84766fcf6bdf Mon Sep 17 00:00:00 2001 From: ljl Date: Thu, 7 Sep 2023 13:56:00 +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 --- .../impl/DistributionOrderServiceImpl.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 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 45df5934..01386f47 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 @@ -171,7 +171,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { throw new RuntimeException(dsResponse.getReason()); } - for (DsSuccessRetDTO successRet: dsResponse.getSuccessList()) { + List successList = dsResponse.getSuccessList(); + if (successList == null) { + successList = new ArrayList<>(); + } + + for (DsSuccessRetDTO successRet: successList) { List relatePurchaseOrderInfos = successRet.getRelatePurchaseOrderInfos(); boolean isUseManualConsignee = useManualConsigneeOrderIds.contains(successRet.getPlatformOrderId()); @@ -365,7 +370,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { continue; } PurchaseOrderDsEncrypt log = new PurchaseOrderDsEncrypt(); - log.setShopId(); +// log.setShopId(); log.setOrderId(errorItem.getPlatformOrderId()); log.setIsEncryptOrder(errorItem.getIsEncryptOrder()); log.setIsSupportEncryptOrder(errorItem.getIsSupportEncryptOrder()); @@ -632,7 +637,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { StringBuffer newShopNoteBuffer = new StringBuffer(oldSellerWords.length()); while (m.find()) { hasMatch = true; - m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark); +// m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark); } m.appendTail(newShopNoteBuffer); newSellerWords = newShopNoteBuffer.toString(); @@ -674,7 +679,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { StringBuffer newShopNoteBuffer = new StringBuffer(oldShopNote.length()); while (m.find()) { hasMatch = true; - m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark); +// m.appendReplacement(newShopNoteBuffer, purchaseOrderRemark); } m.appendTail(newShopNoteBuffer); newShopNote = newShopNoteBuffer.toString(); @@ -693,6 +698,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } public String buildPurchaseOrderRemark(Long shopId, String appendRemarkTpl, List purchaseOrders) { + if (purchaseOrders.isEmpty()) { + return ""; + } appendRemarkTpl = buildRemarkTplHtml(appendRemarkTpl); Shop shop = shopService.getDetailById(shopId); List purchaseOrderRemarks = new ArrayList<>(); @@ -1383,8 +1391,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { PurchaseOrder purchaseOrder = purchaseOrders.iterator().next(); // TODO 加事务 - purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); - purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); + purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel); + purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel); opOrderExtService.updateFieldByOrderId(shopId, orderId, "filter_purchase_status", PurchaseOrderConst.FILTER_PURCHASE_STATUS_WAIT_PURCHASE); if (opOrderDs != null) { opOrderDsService.updateDsStatusByOrderId(shopId, orderId, DsOrderConst.DS_PURCHASE_STATUS_WAIT_PURCHASE, null); @@ -1418,7 +1426,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { for (PurchaseOrder purchaseOrder: purchaseOrders) { int cancelPurchaseOrderItemCount = 0; for (PurchaseOrderItem item: purchaseOrder.getItems()) { - if (Objects.equals(item.getStatus(), StatusConst.normal)) { + if (Objects.equals(item.getStatus(), StatusConst.cancel)) { cancelPurchaseOrderItemCount ++; } if (!skuIds.contains(item.getSkuId())) { @@ -1447,11 +1455,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { if (needCancelPurchaseOrderItemIds.isEmpty()) { throw new RuntimeException("该商品没有关联外部订单"); } + // TODO 加事务 if (!needCancelPurchaseOrderIds.isEmpty()) { - purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); + purchaseOrderService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel); } - purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.normal); + purchaseOrderItemService.updateStatusByOrderId(shopId, orderId, StatusConst.cancel); updateOpOrderFilterPurchaseStatus(orderId, null); for (PurchaseOrderCancelLog log: logs) { purchaseOrderCancelLogService.insertSelective(log);