From 09265a4ca097cc7cdc4c773afc4f7b62b961a255 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Wed, 13 Sep 2023 17:13:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=BB=99=E6=AF=8F?= =?UTF-8?q?=E4=B8=AA=E5=BA=97=E9=93=BA=E4=B8=80=E4=B8=AA=E6=90=AC=E5=AE=B6?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E9=87=8F=E7=9A=84=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ePublishBufferRandShopIdAndPriorityBO.java | 9 + .../task/MovePublishBufferTaskService.java | 158 ++++++++++++++---- 2 files changed, 131 insertions(+), 36 deletions(-) create mode 100644 ms-biz/src/main/java/com/ms/api/bo/MovePublishBufferRandShopIdAndPriorityBO.java diff --git a/ms-biz/src/main/java/com/ms/api/bo/MovePublishBufferRandShopIdAndPriorityBO.java b/ms-biz/src/main/java/com/ms/api/bo/MovePublishBufferRandShopIdAndPriorityBO.java new file mode 100644 index 00000000..2b9ed764 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/bo/MovePublishBufferRandShopIdAndPriorityBO.java @@ -0,0 +1,9 @@ +package com.ms.api.bo; + +import lombok.Data; + +@Data +public class MovePublishBufferRandShopIdAndPriorityBO { + private Long shopId; + private Integer prioirty; +} diff --git a/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java b/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java index be72770d..25f3941e 100644 --- a/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java @@ -1,6 +1,6 @@ package com.ms.api.task; -import com.ms.api.common.E; +import com.ms.api.bo.MovePublishBufferRandShopIdAndPriorityBO; import com.ms.api.common.StrObjMap; import com.ms.api.common.TaskBaseService; import com.ms.api.consts.RedisKeyConst; @@ -20,9 +20,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.DefaultTransactionDefinition; import javax.annotation.Resource; import java.util.*; @@ -252,38 +249,127 @@ public class MovePublishBufferTaskService extends TaskBaseService { } private Map allocProductPublishQuota(int leftCount, Map> priorityShopsMap, Map shopLimitQuotaArray) { - // TODO 根据一定算法给每个店铺一个搬家的数量 -// $needSkipShopIdMap = $this->getNeedSkipShopIdMap($shopLimitQuotaArray); -// $selectedShopMap = array(); -// do { -// if (empty($priorityShopsMap)) { -// break; -// } -// -// $priorityArr = $this->randPriority(); -// list ($shopId, $priority) = $this->getMovePublishBufferRandShopIdByPriorityArr($priorityArr, $priorityShopsMap, $needSkipShopIdMap); -// if (empty($shopId)) { -// break; -// } -// -// $shopLimitQuotaArray[$shopId]--; -// if ($shopLimitQuotaArray[$shopId] <= 0) { -// $needSkipShopIdMap[$shopId] = true; -// } -// -// $selectedShopMap[$shopId] = isset($selectedShopMap[$shopId]) ? $selectedShopMap[$shopId] + 1 : 1; -// $leftCount--; -// if ($leftCount <= 0) { -// break; -// } -// $priorityShopsMap[$priority][$shopId]--; -// if (empty($priorityShopsMap[$priority][$shopId])) { -// unset($priorityShopsMap[$priority][$shopId]); -// } -// } while (true); -// -// return $selectedShopMap; - return shopLimitQuotaArray; + // 根据一定算法给每个店铺一个搬家的数量 + Map needSkipShopIdMap = getNeedSkipShopIdMap(shopLimitQuotaArray); + Map selectedShopMap = new HashMap<>(); + do { + if (priorityShopsMap == null || priorityShopsMap.isEmpty()) { + break; + } + int[] priorityArr = randPriority(); + MovePublishBufferRandShopIdAndPriorityBO movePublishBufferRandShopIdAndPriorityBO = getMovePublishBufferRandShopIdByPriorityArr(priorityArr, priorityShopsMap, needSkipShopIdMap); + Long shopId = movePublishBufferRandShopIdAndPriorityBO.getShopId(); + Integer priority = movePublishBufferRandShopIdAndPriorityBO.getPrioirty(); + if (shopId == null) { + break; + } + + if (shopLimitQuotaArray.containsKey(shopId)) { + shopLimitQuotaArray.put(shopId, shopLimitQuotaArray.get(shopId) - 1); + } else { + shopLimitQuotaArray.put(shopId, -1); + } + if (shopLimitQuotaArray.get(shopId) <= 0) { + needSkipShopIdMap.put(shopId, true); + } + + if (selectedShopMap.containsKey(shopId)) { + selectedShopMap.put(shopId, selectedShopMap.get(shopId) + 1); + } else { + selectedShopMap.put(shopId, 1); + } + + leftCount--; + if (leftCount <= 0) { + break; + } + + if (priorityShopsMap.containsKey(priority) && priorityShopsMap.get(priority).containsKey(shopId)) { + int val = priorityShopsMap.get(priority).get(shopId) - 1; + if (val == 0) { + priorityShopsMap.get(priority).remove(shopId); + } else { + priorityShopsMap.get(priority).put(shopId, val); + } + if (priorityShopsMap.get(priority).isEmpty()) { + priorityShopsMap.remove(priority); + } + } + + } while (true); + + return selectedShopMap; + } + + private int[] randPriority() { + int pc = (new Random()).nextInt(100) + 1; + int[] pl; + if (pc >= 1 && pc <= 35) { + pl = new int[] {98, 99, 100, 101, 110}; + } else if (pc >= 36 && pc <= 50) { + pl = new int[] {99, 100, 101, 103, 110}; + } else if (pc >= 51 && pc <= 65) { + pl = new int[] {100, 103, 105, 110}; + } else if (pc >= 66 && pc <= 75) { + pl = new int[] {101, 103, 105, 110}; + } else if (pc >= 76 && pc <= 85) { + pl = new int[] {103, 105, 110}; + } else if (pc >= 86 && pc <= 95) { + pl = new int[] {105, 110}; + } else { + pl = new int[] {110}; + } + return pl; + } + + private MovePublishBufferRandShopIdAndPriorityBO getMovePublishBufferRandShopIdByPriorityArr(int[] priorityArr, Map> priorityShopsMap, Map needSkipShopIdMap) { + Set shopIds = new HashSet<>(); + int minPriority = Arrays.stream(priorityArr).min().getAsInt(); + Map> shopIdPriorityMap = new HashMap<>(); + + for (Integer currPriority : priorityShopsMap.keySet()) { + Map shopIdAndCountMap = priorityShopsMap.get(currPriority); + Set priorityShopIds = new HashSet<>(); + for (Long shopId : shopIdAndCountMap.keySet()) { + if (needSkipShopIdMap.containsKey(shopId)) { + continue; + } + priorityShopIds.add(shopId); + if (!shopIdPriorityMap.containsKey(shopId)) { + shopIdPriorityMap.put(shopId, new ArrayList()); + } + List priorityList = shopIdPriorityMap.get(shopId); + if (!priorityList.contains(currPriority)) { + priorityList.add(currPriority); + } + } + shopIds.addAll(priorityShopIds); + if (currPriority >= minPriority && !shopIds.isEmpty()) { + break; + } + + } + MovePublishBufferRandShopIdAndPriorityBO ret = new MovePublishBufferRandShopIdAndPriorityBO(); + if (!shopIds.isEmpty()) { + ArrayList shopIdList = new ArrayList<>(shopIds); + Long shopId = shopIdList.get(new Random().nextInt(shopIdList.size())); + Integer prioirty = shopIdPriorityMap.get(shopId).get(0); + ret.setShopId(shopId); + ret.setPrioirty(prioirty); + } + return ret; + } + + private Map getNeedSkipShopIdMap(Map shopLimitQuotaArray) { + Map needSkipShopIdMap = new HashMap<>(); + for (Map.Entry entry : shopLimitQuotaArray.entrySet()) { + Integer count = entry.getValue(); + Long shopId = entry.getKey(); + if (count <= 0) { + needSkipShopIdMap.put(shopId, true); + } + } + return needSkipShopIdMap; } // Buffer移到Queue中 From f628adce2ff17ad8ebcb4f4f688cffe068692d6b Mon Sep 17 00:00:00 2001 From: ljl Date: Wed, 13 Sep 2023 17:25:37 +0800 Subject: [PATCH 2/3] yh --- ...seOrderItemsAndSourceItemsResponseDTO.java | 2 +- .../com/ms/api/consts/AfterSaleConst.java | 3 +- .../impl/DistributionOrderServiceImpl.java | 6 ++-- .../OpOrderChildLogisticsServiceImpl.java | 6 +++- .../service/impl/OutstorageServiceImpl.java | 30 ++++++++++++++++--- .../task/DsMessageConsumeMsgTaskService.java | 4 +-- .../task/DsMessageMoveBufferTaskService.java | 4 +-- 7 files changed, 42 insertions(+), 13 deletions(-) diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/GetPurchaseOrderItemsAndSourceItemsResponseDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/GetPurchaseOrderItemsAndSourceItemsResponseDTO.java index aff7ad0e..680bdf62 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/GetPurchaseOrderItemsAndSourceItemsResponseDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/GetPurchaseOrderItemsAndSourceItemsResponseDTO.java @@ -142,7 +142,7 @@ public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonRespon private String tradeTypeDesc; private String tradeTypeCode; private String waybill; - private Integer logisticsId; + private Long logisticsId; private String logisticsName; private String alibabaLogisticsIds; private String toFullNameMd5; diff --git a/ms-biz/src/main/java/com/ms/api/consts/AfterSaleConst.java b/ms-biz/src/main/java/com/ms/api/consts/AfterSaleConst.java index 3d29c08d..fd886020 100644 --- a/ms-biz/src/main/java/com/ms/api/consts/AfterSaleConst.java +++ b/ms-biz/src/main/java/com/ms/api/consts/AfterSaleConst.java @@ -1,5 +1,6 @@ package com.ms.api.consts; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -90,6 +91,6 @@ public class AfterSaleConst { public static final String WARNING_SOURCE_DISTRIBUTION = "distribution"; public static List getAfterSaleCloseOrCancelStatusList() { - return Arrays.asList(AFTERSALE_STATUS_CLOSE, AFTERSALE_STATUS_REFUSE_AFTER_SALE_APPLY); + return new ArrayList<>(Arrays.asList(AFTERSALE_STATUS_CLOSE, AFTERSALE_STATUS_REFUSE_AFTER_SALE_APPLY)); } } 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 a645c26e..faacdbcd 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 @@ -430,10 +430,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { for (PlatformOrderDTO platformOrder: platformOrders) { OpOrder opOrder = orderIdAndOrderMap.get(platformOrder.getPlatformOrderId()); if (purchaseSetting.getIsAutoFillRemark() >= 1) { - platformOrder.setSourceOrderSellerMemo(buildSourceOrderRemarkAndMemo(shop, purchaseSetting.getAutoFillRemarkTpl(), opOrder)); + String autoFillRemarkTpl = buildRemarkTplHtml(purchaseSetting.getAutoFillRemarkTpl()); + platformOrder.setSourceOrderSellerMemo(buildSourceOrderRemarkAndMemo(shop, autoFillRemarkTpl, opOrder)); } if (purchaseSetting.getIsAutoFillOrderMemo() >= 1) { - platformOrder.setSourceOrderSellerMemo(buildSourceOrderRemarkAndMemo(shop, purchaseSetting.getAutoFillOrderMemoTpl(), opOrder)); + String autoFillOrderMemoTpl = buildRemarkTplHtml(purchaseSetting.getAutoFillOrderMemoTpl()); + platformOrder.setSourceOrderSellerMemo(buildSourceOrderRemarkAndMemo(shop, autoFillOrderMemoTpl, opOrder)); } } } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildLogisticsServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildLogisticsServiceImpl.java index ca842466..8aa34d88 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildLogisticsServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildLogisticsServiceImpl.java @@ -84,7 +84,11 @@ public class OpOrderChildLogisticsServiceImpl implements OpOrderChildLogisticsSe public List getListByOrderId(String orderId) { List list = new ArrayList<>(); list.add(orderId); - return getOrderIdAndChildLogisticsListMap(list).get(orderId); + if (getOrderIdAndChildLogisticsListMap(list).containsKey(orderId)) { + return getOrderIdAndChildLogisticsListMap(list).get(orderId); + } else { + return new ArrayList<>(); + } } @Override 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 60f5609f..ace427f0 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 @@ -2,6 +2,7 @@ package com.ms.api.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.doudian.open.api.order_logisticsAddMultiPack.OrderLogisticsAddMultiPackRequest; @@ -28,6 +29,7 @@ import com.ms.dal.entity.*; import com.ms.dal.mapper.OpOrderChildAfterSaleMapper; import com.ms.dal.mapper.OpOrderMapper; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -39,6 +41,7 @@ import java.util.stream.Stream; * @author elf */ @Service +@Slf4j @AllArgsConstructor public class OutstorageServiceImpl implements OutstorageService { private OpOrderMapper opOrderMapper; @@ -100,6 +103,7 @@ public class OutstorageServiceImpl implements OutstorageService { try { checkCanOutStorage(Collections.singletonList(orderId), packageList); } catch (RuntimeException e) { + log.error("checkCanOutStorage", e); return ResultDTO.fail(e.getMessage()); } @@ -128,6 +132,7 @@ public class OutstorageServiceImpl implements OutstorageService { request.setParam(param); OrderLogisticsAddMultiPackResponse response = request.execute(); + log.error("OrderLogisticsAddMultiPackResponse: " + response); if (!response.isSuccess()) { throw new RuntimeException(response.getSubMsg()); } @@ -147,7 +152,7 @@ public class OutstorageServiceImpl implements OutstorageService { } List invalidStatusOrderIds = orderList.stream() - .filter(e -> (OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS.equals(e.getOrderStatus()) || OrderConst.ORDER_STATUS_PART_DELIVERY.equals(e.getOrderStatus()))) + .filter(e -> (!OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS.equals(e.getOrderStatus()) && !OrderConst.ORDER_STATUS_PART_DELIVERY.equals(e.getOrderStatus()))) .map(OpOrder::getOrderId).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(invalidStatusOrderIds)) { throw new RuntimeException(String.format("订单:%s 当前状态不能进行发货操作", invalidStatusOrderIds)); @@ -233,6 +238,11 @@ public class OutstorageServiceImpl implements OutstorageService { @Override public void dsPurchaseAutoOutStorage(ShopBO shopBO, OpOrder opOrder, PurchaseOrder purchaseOrder) { DsPurchaseSetting dsPurchaseSetting = dsPurchaseSettingService.getShopSetting(opOrder.getShopId()); + if (purchaseOrder.getItems() == null) { + List items = purchaseOrderItemService.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrder.getPurchaseOrderId()); + purchaseOrder.setItems(items); + } + log.info("getOrderStatus: " + opOrder.getOrderStatus()); if (opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS)) { 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)) { @@ -243,6 +253,7 @@ public class OutstorageServiceImpl implements OutstorageService { } private void dsOrderOutStorage(ShopBO shopBO, OpOrder opOrder, PurchaseOrder purchaseOrder, DsPurchaseSetting dsPurchaseSetting) { + log.info("dsOrderOutStorage begin"); Long nearExpShipTime; try { nearExpShipTime = checkDsPurchaseAutoOutStorage(opOrder, purchaseOrder, dsPurchaseSetting); @@ -257,7 +268,9 @@ public class OutstorageServiceImpl implements OutstorageService { List purchaseOrders = new ArrayList<>(); purchaseOrders.add(purchaseOrder); OrderPackageInfoDTO orderPackageInfoDTO = packOrderDeliveryInfos(opOrder, purchaseOrders, isShipAfterLogisticsAccept, false, false); + log.info("dsOrderOutStorage[orderPackageInfoDTO]: " + orderPackageInfoDTO); ResultDTO result = orderMultiPackageOutstorage(shopBO, opOrder, orderPackageInfoDTO.getPackageList(), LogisticsConst.outstorageSourceDsAuto); + log.info("dsOrderOutStorage[result]: " + result); if (result.isSuccess()) { opOrderDsService.updateOpOrderDsOrderStatus(opOrder); } @@ -290,6 +303,7 @@ public class OutstorageServiceImpl implements OutstorageService { List purchaseOrders = new ArrayList<>(); purchaseOrders.add(purchaseOrder); OrderPackageInfoDTO orderPackageInfoDTO = packOrderDeliveryInfos(opOrder, purchaseOrders, false, false, true); + log.info("dsOrderOutStorageOrUpdateOutStorageLogistics[orderPackageInfoDTO]: " + orderPackageInfoDTO); if (orderPackageInfoDTO.getPackageList() == null || orderPackageInfoDTO.getPackageList().isEmpty()) { throw new RuntimeException("没有需要出库的包裹"); } @@ -340,6 +354,7 @@ public class OutstorageServiceImpl implements OutstorageService { errorMessages.add(e.getMessage()); } ResultDTO result = orderMultiPackageOutstorage(shopBO, opOrder, new ArrayList<>(newPackages.values()), LogisticsConst.outstorageSourceDsAuto); + log.info("dsOrderOutStorageOrUpdateOutStorageLogistics[result]: " + result); if (result.isSuccess()) { opOrderDsService.updateOpOrderDsOrderStatus(opOrder); } else { @@ -353,6 +368,7 @@ public class OutstorageServiceImpl implements OutstorageService { hasProcessOutstorage = true; try { doUpdateLogistics(shopBO, opOrder, opPackage.getDdPackId(), orderPackageInfoDTO.getDeliveryInfo(), LogisticsConst.outstorageSourceDsLogisticsChangeUpdate); + log.info("dsOrderOutStorageOrUpdateOutStorageLogistics[doUpdateLogistics]: "); } catch (RuntimeException e) { errorMessages.add("包裹:" + opPackage.getDdPackId() + ",失败原因:" + e.getMessage()); } @@ -561,6 +577,7 @@ public class OutstorageServiceImpl implements OutstorageService { String logisticsName = PurchaseTool.getDdLogisticsNameByDsLogisticsName(purchaseOrder.getPurchaseOrderLogisticsName()); OpLogisticsPlatformBO logisticsPlatformBO = logisticsNameAndLogisticsInfoMap.get(logisticsName); + log.info("logisticsPlatformBO: " + logisticsPlatformBO); if(logisticsPlatformBO == null) { continue; } @@ -578,9 +595,11 @@ public class OutstorageServiceImpl implements OutstorageService { for (PurchaseOrderItem item: purchaseOrder.getItems()) { if (skuIds.contains(item.getSkuId())) { List childOrderInfoList = skuIdAndChildOrderInfoMap.get(item.getSkuId()); + System.out.println("childOrderInfoList: " + childOrderInfoList); for (OpOrderChild child: childOrderInfoList) { JSONObject opOrderChildAfterSale = child.getAfterSaleInfo(); - if (opOrderChildAfterSale != null && opOrderChildAfterSale.get("after_sale_type").equals(AfterSaleConst.AFTERSALE_TYPE_REFUND_ONLY_BEFORE_SALE) && !AfterSaleConst.getAfterSaleCloseOrCancelStatusList().equals(opOrderChildAfterSale.get("after_sale_status"))) { + System.out.println("opOrderChildAfterSale: " + opOrderChildAfterSale); + if (opOrderChildAfterSale != null && !ObjectUtil.isEmpty(opOrderChildAfterSale) && opOrderChildAfterSale.get("after_sale_type").equals(AfterSaleConst.AFTERSALE_TYPE_REFUND_ONLY_BEFORE_SALE) && !AfterSaleConst.getAfterSaleCloseOrCancelStatusList().equals(opOrderChildAfterSale.get("after_sale_status"))) { hasAfterSaleChildOrder = true; } packageList = buildChildOrderPackageList(packageList, child, childOrderIdAndLogisticsMap.get(child.getChildOrderId()), deliveryInfo, isIgnoreOrderStatus, isUpdateDelivery); @@ -600,14 +619,14 @@ public class OutstorageServiceImpl implements OutstorageService { private List buildChildOrderPackageList(List packageList, OpOrderChild orderChild, List childOrderLogisticsList, DeliverInfoDTO deliverInfoDTO, boolean isIgnoreOrderStatus, boolean isUpdateDelivery) { if (!isIgnoreOrderStatus) { - if (!isUpdateDelivery && orderChild.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS)) { + if (!isUpdateDelivery && !orderChild.getOrderStatus().equals(OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS)) { return packageList; } Set tmpOrderStatusSet = new HashSet<>(); tmpOrderStatusSet.add(OrderConst.ORDER_STATUS_WAIT_BUYER_CONFIRM_GOODS); tmpOrderStatusSet.add(OrderConst.ORDER_STATUS_FINISH); - if (isUpdateDelivery && tmpOrderStatusSet.contains(orderChild.getOrderStatus())) { + if (isUpdateDelivery && !tmpOrderStatusSet.contains(orderChild.getOrderStatus())) { return packageList; } } @@ -633,6 +652,9 @@ public class OutstorageServiceImpl implements OutstorageService { } int shippedNum = 0; + if (childOrderLogisticsList == null) { + childOrderLogisticsList = new ArrayList<>(); + } for (OpOrderChildLogistics childLogistics: childOrderLogisticsList) { shippedNum += childLogistics.getShippedNum().intValue(); } diff --git a/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java b/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java index bbb0cdf2..d8cdc886 100644 --- a/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java @@ -44,8 +44,8 @@ public class DsMessageConsumeMsgTaskService extends TaskBaseService { @Resource(name = "dsMessageConsumeMsgTaskPool") protected Executor taskPool; -// @Async("dsMessageConsumeMsgTaskPool") -// @Scheduled(fixedRate = 10000) + @Async("dsMessageConsumeMsgTaskPool") + @Scheduled(fixedRate = 10000) @Override public void runTask() { super.runTask(); diff --git a/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java b/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java index 9fa2e353..0f628447 100644 --- a/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java @@ -32,8 +32,8 @@ public class DsMessageMoveBufferTaskService extends TaskBaseService { @Resource(name = "dsMessageMoveBufferTaskPool") protected Executor taskPool; -// @Async("dsMessageMoveBufferTaskPool") -// @Scheduled(fixedRate = 10000) + @Async("dsMessageMoveBufferTaskPool") + @Scheduled(fixedRate = 10000) @Override public void runTask() { super.runTask(); From e27baed4cbf25e898b3ee4b29e69d5bfa1f1cb77 Mon Sep 17 00:00:00 2001 From: ljl Date: Wed, 13 Sep 2023 17:31:38 +0800 Subject: [PATCH 3/3] yh --- .../com/ms/api/service/impl/PurchaseOrderServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java index 7589f5ec..6d0c69c6 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java @@ -343,7 +343,9 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService { continue; } OpOrderOutstorageHistory orderOutstorageResult = orderIdAndOpOrderOutstrorageHistoryMap.get(order.getString("orderId")); - order.put("outstorageFailReason", orderOutstorageResult.getStatus().equals(StatusConst.fail) ? orderOutstorageResult.getReason() : ""); + if (orderOutstorageResult != null) { + order.put("outstorageFailReason", orderOutstorageResult.getStatus().equals(StatusConst.fail) ? orderOutstorageResult.getReason() : ""); + } } }