From e4324a49422986db5a9d8754cf0b4922c50d88ac Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 5 Sep 2023 18:27:31 +0800 Subject: [PATCH] yh --- .../dto/dsapi/request/ConsigneeInfoDTO.java | 2 +- .../dto/dsapi/request/PlatformOrderDTO.java | 2 +- .../dsapi/request/PlatformOrderItemDTO.java | 2 +- .../dto/dsapi/response/DsSuccessRetDTO.java | 3 +- .../dsorder/PurchaseOrderItemRequestDTO.java | 2 +- .../dto/dsorder/PurchaseOrderRequestDTO.java | 2 +- .../java/com/ms/api/service/DsApiService.java | 2 +- .../ms/api/service/OpOrderChildService.java | 4 +- .../api/service/PurchaseOrderItemService.java | 2 +- .../impl/DistributionOrderServiceImpl.java | 72 ++++++++++++------- .../ms/api/service/impl/DsApiServiceImpl.java | 13 +++- .../service/impl/OpOrderChildServiceImpl.java | 8 ++- .../service/impl/OrderPrintServiceImpl.java | 5 +- .../impl/PurchaseAccountServiceImpl.java | 8 ++- .../impl/PurchaseOrderItemServiceImpl.java | 6 +- .../BatchCreateDistributionOrdersService.java | 1 + .../dal/mapper/PurchaseOrderItemMapper.java | 2 + .../mapper/PurchaseAccountMapper.xml | 2 +- .../mapper/PurchaseOrderItemMapper.xml | 9 +++ .../resources/mapper/PurchaseOrderMapper.xml | 2 +- .../mapper/PurchaseSettingMapper.xml | 2 +- 21 files changed, 104 insertions(+), 47 deletions(-) diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/ConsigneeInfoDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/ConsigneeInfoDTO.java index 199bd548..8bc3ff60 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/ConsigneeInfoDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/ConsigneeInfoDTO.java @@ -21,5 +21,5 @@ public class ConsigneeInfoDTO { private String fullAddress; private Boolean hasHide = true; private List hasDecryptFields; - private Boolean isManualInput; + private Boolean isManualInput = false; } diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderDTO.java index 0f7dbb66..0494f93a 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderDTO.java @@ -8,7 +8,7 @@ import java.util.List; public class PlatformOrderDTO { private String userId; private String platformOrderId; - private Long shopId; + private String shopId; private ConsigneeInfoDTO consigneeInfo; private String buyerRemark; private EncryptOutOrderInfoDTO encryptOutOrderInfo; diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderItemDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderItemDTO.java index b0f8114c..6b990c9d 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderItemDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/PlatformOrderItemDTO.java @@ -14,5 +14,5 @@ public class PlatformOrderItemDTO { private Boolean isJxhyOffer; private String instanceCode; private String platformSkuSubName; - private String platformSkuId; + private Long platformSkuId; } diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java index df7cc407..2dad5d57 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java @@ -4,6 +4,7 @@ import com.ms.api.dto.dsorder.PurchaseOrderRequestDTO; import lombok.Data; import java.util.HashMap; +import java.util.List; @Data public class DsSuccessRetDTO {private String platformOrderId; @@ -17,5 +18,5 @@ public class DsSuccessRetDTO {private String platformOrderId; private String flow; private Boolean includeSplitJxhy; private HashMap dsPayRet; - private HashMap relatePurchaseOrderInfos; + private List relatePurchaseOrderInfos; } diff --git a/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderItemRequestDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderItemRequestDTO.java index 2974a1c1..efcfb725 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderItemRequestDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderItemRequestDTO.java @@ -5,7 +5,7 @@ import lombok.Data; @Data public class PurchaseOrderItemRequestDTO { private Long skuId; - private Integer wareId; + private Long wareId; private Integer purchaseNum; private Double purchasePrice; private String purchaseUrl; diff --git a/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderRequestDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderRequestDTO.java index 8735f171..3e90b2d6 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderRequestDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderRequestDTO.java @@ -31,7 +31,7 @@ public class PurchaseOrderRequestDTO { private String checkStatus; private Integer logisticsIsAccept; private String purchaseOrderSendTime; - private Boolean isFirstPurchase; + private Boolean isFirstPurchase = false; private String purchaseAlipayMerchantNo; public List getSkuIds() { diff --git a/ms-biz/src/main/java/com/ms/api/service/DsApiService.java b/ms-biz/src/main/java/com/ms/api/service/DsApiService.java index 9a9e3132..5f3586ed 100644 --- a/ms-biz/src/main/java/com/ms/api/service/DsApiService.java +++ b/ms-biz/src/main/java/com/ms/api/service/DsApiService.java @@ -10,7 +10,7 @@ import java.util.List; public interface DsApiService { GetPlatformShopPurchaseSettingResponseDTO getPlatformShopPurchaseSetting(String userId, String platform); - BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(BatchCreateDistributionOrdersRequestDTO request); + BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request); CommonResponseDTO saveDsManualSelectedSku(SavePlatformManualSelectedSkuRequestDTO request); GetPurchaseOrderItemsAndSourceItemsResponseDTO getPurchaseOrderItemsAndSourceItems(GetPurchaseOrderItemsAndSourceItemsRequestDTO request); BatchAddDsPurchaseConfirmLogResponseDTO batchAddPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request); diff --git a/ms-biz/src/main/java/com/ms/api/service/OpOrderChildService.java b/ms-biz/src/main/java/com/ms/api/service/OpOrderChildService.java index c6077a96..5a680cc0 100644 --- a/ms-biz/src/main/java/com/ms/api/service/OpOrderChildService.java +++ b/ms-biz/src/main/java/com/ms/api/service/OpOrderChildService.java @@ -27,7 +27,7 @@ public interface OpOrderChildService { HashMap> getOrderIdAndSkuIdAndSkuSubNameMap(List orderIds, List skuIds); - List getHistorySkuIdsByOrderId(String orderId); + List getHistorySkuIdsByOrderId(String orderId); List getListByOrderId(String orderId); @@ -36,4 +36,6 @@ public interface OpOrderChildService { Map> getOrderIdAndChildrenMapByOrderIds(List orderIds); List getChildrenByOrderId(String orderId); + + List getSkuIdsByOrderId(String orderId); } diff --git a/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderItemService.java b/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderItemService.java index a69d7fd3..f8304f7f 100644 --- a/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderItemService.java +++ b/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderItemService.java @@ -23,7 +23,7 @@ public interface PurchaseOrderItemService { int updateByPrimaryKey(PurchaseOrderItem record); - List getSkuIdsByOrderId(String orderId); + List getSkuIdsByOrderId(String orderId); List getRelatedPurchaseOrderItems(Long shopId, String orderId); 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 096ac064..af957871 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 @@ -105,6 +105,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { orderIdAndOpOrderMap.put(opOrder.getOrderId(), opOrder); } + System.out.println("orderIdAndOpOrderMap" + orderIdAndOpOrderMap); + Stream shopIdsStream = orderIdAndOpOrderMap.values().stream().map(OpOrder::getShopId); Set shopIds = shopIdsStream.collect(Collectors.toSet()); if (shopIds.size() != 1 || !shopIds.contains(shopId)) { @@ -135,15 +137,16 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { throw new RuntimeException("购买的商品不属于同一个卖家,请检查后重新提交!"); } - if (!shopPurchaseSettings.containsKey(platformOrderDto.getShopId())) { + if (!shopPurchaseSettings.containsKey(Long.valueOf(platformOrderDto.getShopId()))) { GetPlatformShopPurchaseSettingResponseDTO resp = dsApiService.getPlatformShopPurchaseSetting(String.valueOf(platformOrderDto.getShopId()), "dd"); - shopPurchaseSettings.put(platformOrderDto.getShopId(), resp.getPurchaseSetting()); + shopPurchaseSettings.put(Long.valueOf(platformOrderDto.getShopId()), resp.getPurchaseSetting()); } checkConsigneeInfo(platformOrderDto.getConsigneeInfo()); + System.out.println("getConsigneeInfo" + platformOrderDto.getConsigneeInfo()); if (platformOrderDto.getConsigneeInfo().getIsManualInput()) { useManualConsigneeOrderIds.add(platformOrderDto.getPlatformOrderId()); - } else if (checkNeedDecryptConsigneeInfo(platformOrderDto, shopPurchaseSettings.get(platformOrderDto.getShopId()), sourceSellerIds.iterator().next())) { + } else if (checkNeedDecryptConsigneeInfo(platformOrderDto, shopPurchaseSettings.get(Long.valueOf(platformOrderDto.getShopId())), sourceSellerIds.iterator().next())) { throw new RuntimeException("不支持解密"); } @@ -159,17 +162,23 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { rebuildPlatformOrderItems(platformOrders); request.setPlatformOrders(platformOrders); - BatchCreateDistributionOrdersResponseDTO dsResponse = dsApiService.batchCreateDistributionOrders(request); + BatchCreateDistributionOrdersResponseDTO dsResponse = dsApiService.batchCreateDistributionOrders(shopId, request); + if (!dsResponse.isSuccess()) { + throw new RuntimeException(dsResponse.getReason()); + } for (DsSuccessRetDTO successRet: dsResponse.getSuccessList()) { - HashMap relatePurchaseOrderInfos = successRet.getRelatePurchaseOrderInfos(); + List relatePurchaseOrderInfos = successRet.getRelatePurchaseOrderInfos(); boolean isUseManualConsignee = useManualConsigneeOrderIds.contains(successRet.getPlatformOrderId()); - for (Map.Entry entry: relatePurchaseOrderInfos.entrySet()) { + for (PurchaseOrderRequestDTO purchaseOrder: relatePurchaseOrderInfos) { if (isUseManualConsignee) { - entry.getValue().setIsUseManualConsignee(true); + purchaseOrder.setIsUseManualConsignee(true); } - dsRelatePurchaseOrder(entry.getValue(), orderIdAndOpOrderMap.get(successRet.getPlatformOrderId())); + + System.out.println("getPlatformOrderId" + successRet.getPlatformOrderId()); + + dsRelatePurchaseOrder(purchaseOrder, orderIdAndOpOrderMap.get(successRet.getPlatformOrderId())); } } @@ -280,8 +289,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { if (PurchaseOrderConst.DS_ENCRYPT_ORDER_TYPE_ALL_SELLER.equals(shopPurchaseSetting.getEncryptDsOrderType())) { isSettingEncryptDsOrder = true; } - Stream sellerIdMd5sStream = shopPurchaseSetting.getAllowDsEncryptOrderSourceSellers().values().stream().map(SellerInfoDTO::getSellerIdMd5); - List sellerIdMd5sList = sellerIdMd5sStream.collect(Collectors.toList()); + Map allowDsEncryptOrderSourceSellers = shopPurchaseSetting.getAllowDsEncryptOrderSourceSellers(); + List sellerIdMd5sList = new ArrayList<>(); + if (allowDsEncryptOrderSourceSellers != null) { + sellerIdMd5sList = allowDsEncryptOrderSourceSellers.values().stream().map(SellerInfoDTO::getSellerIdMd5).collect(Collectors.toList()); + } if (sellerIdMd5sList.contains(sourceSellerId)) { isSettingEncryptDsOrder = true; } @@ -309,15 +321,15 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { private void checkConsigneeInfo(ConsigneeInfoDTO consigneeInfo) { if ( - StringUtils.isNotBlank(consigneeInfo.getFullname()) || - StringUtils.isNotBlank(consigneeInfo.getMobile()) || - StringUtils.isNotBlank(consigneeInfo.getProvince()) || - StringUtils.isNotBlank(consigneeInfo.getCity()) || - StringUtils.isNotBlank(consigneeInfo.getCounty()) || - StringUtils.isNotBlank(consigneeInfo.getAddress()) || - StringUtils.isNotBlank(consigneeInfo.getFullAddress()) + StringUtils.isBlank(consigneeInfo.getFullname()) || + StringUtils.isBlank(consigneeInfo.getMobile()) || + StringUtils.isBlank(consigneeInfo.getProvince()) || + StringUtils.isBlank(consigneeInfo.getCity()) || + StringUtils.isBlank(consigneeInfo.getCounty()) || + StringUtils.isBlank(consigneeInfo.getAddress()) || + StringUtils.isBlank(consigneeInfo.getFullAddress()) ) { - throw new RuntimeException("采购单参数异常"); + throw new RuntimeException("采购单收件人异常"); } } @@ -328,11 +340,13 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { List skuIds = new ArrayList<>(); for (PlatformOrderDTO platformOrder: platformOrders) { for (PlatformOrderItemDTO item: platformOrder.getItems()) { - skuIds.add(item.getSourceSkuId()); + skuIds.add(item.getPlatformSkuId()); } } HashMap> orderIdAndSkuIdAndSkuSubNameMap = opOrderChildService.getOrderIdAndSkuIdAndSkuSubNameMap(orderIds, skuIds); + System.out.println("orderIdAndSkuIdAndSkuSubNameMap" + orderIdAndSkuIdAndSkuSubNameMap); + System.out.println("platformOrders" + platformOrders); for (PlatformOrderDTO platformOrder: platformOrders) { for (PlatformOrderItemDTO item: platformOrder.getItems()) { item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(item.getSourceSkuId())); @@ -353,7 +367,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { savePurchaseOrderInfo(purchaseOrderInfo, opOrder, skuIdAndOpOrderChildMap); } - dsPurchaseOrderOutStorageAndUpdateRemark(purchaseOrderInfo, opOrder, purchaseOrder); + // dsPurchaseOrderOutStorageAndUpdateRemark(purchaseOrderInfo, opOrder, purchaseOrder); } private void dsPurchaseOrderOutStorageAndUpdateRemark(PurchaseOrderRequestDTO purchaseOrderInfo, OpOrder opOrder, PurchaseOrder purchaseOrder) { @@ -649,6 +663,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { if (fields.contains(PurchaseOrderConst.PROFIT_RATIO_FIELD)) { needProfitRatio = true; } + System.out.println("purchaseOrders" + purchaseOrders); PurchaseOrder firstPurchaseOrder = purchaseOrders.iterator().next(); String profitText = ""; @@ -856,9 +871,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { if (opOrderExt == null) { opOrderExt = opOrderExtService.getByOrderId(orderId); } - List historySkuIds = opOrderChildService.getHistorySkuIdsByOrderId(orderId); - List purchaseSkuIds = purchaseOrderItemService.getSkuIdsByOrderId(orderId); - List noPurchaseSkuIds = historySkuIds.stream().filter(i -> !purchaseSkuIds.contains(i)).collect(Collectors.toList()); + List historySkuIds = opOrderChildService.getSkuIdsByOrderId(orderId); + List purchaseSkuIds = purchaseOrderItemService.getSkuIdsByOrderId(orderId); + List noPurchaseSkuIds = historySkuIds.stream().filter(i -> !purchaseSkuIds.contains(i)).collect(Collectors.toList()); Integer filterPurchaseStatus = null; if (purchaseSkuIds.isEmpty()) { @@ -1070,11 +1085,16 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { HashMap purchasePriceMap = buildPurchaseOrderItemsPurchasePrice(skuIdAndOpOrderChildMap, needRebuildSkuIds, (double) 0, purchaseNumMap); PurchaseOrder purchaseOrder = buildPurchaseOrderByDto(purchaseOrderRequestDto, oldPurchaseOrder, opOrder); - purchaseOrderService.updateByPrimaryKeySelective(purchaseOrder); + if (purchaseOrder.getPurchaseOrderId() != null && purchaseOrder.getPurchaseOrderId() > 0) { + purchaseOrderService.updateByPrimaryKeySelective(purchaseOrder); + } else { + purchaseOrderService.insertSelective(purchaseOrder); + } // TODO purchase_order_ds_encrypt Map skuIdAndItemMap = purchaseOrderRequestDto.getSkuIdAndItemMap(); + System.out.println("needRebuildSkuIds" + needRebuildSkuIds); for (Long skuId: needRebuildSkuIds) { OpOrderChild opOrderChild = skuIdAndOpOrderChildMap.get(skuId); PurchaseOrderItem oldPurchaseOrderitem = oldPurchaseOrderItemMap.get(skuId); @@ -1142,10 +1162,10 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { Date purchaseOrderSendTime = null; Date purchaseOrderStartTime = null; if (StringUtils.isNotBlank(purchaseOrderRequestDto.getPurchaseOrderStartTime())) { - purchaseOrderStartTime = DateUtils.parseDate(purchaseOrderRequestDto.getPurchaseOrderStartTime(), new String[]{"yyyy-MM-dd HH:ii:ss"}); + purchaseOrderStartTime = DateUtils.parseDate(purchaseOrderRequestDto.getPurchaseOrderStartTime(), new String[]{"yyyy-MM-dd HH:mm:ss"}); } if (StringUtils.isNotBlank(purchaseOrderRequestDto.getPurchaseOrderSendTime())) { - purchaseOrderSendTime = DateUtils.parseDate(purchaseOrderRequestDto.getPurchaseOrderSendTime(), new String[]{"yyyy-MM-dd HH:ii:ss"}); + purchaseOrderSendTime = DateUtils.parseDate(purchaseOrderRequestDto.getPurchaseOrderSendTime(), new String[]{"yyyy-MM-dd HH:mm:ss"}); } String purchaseStatus = purchaseOrderRequestDto.getPurchaseOrderStatus(); diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/DsApiServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/DsApiServiceImpl.java index 612ba6c3..2787e711 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/DsApiServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/DsApiServiceImpl.java @@ -29,8 +29,17 @@ public class DsApiServiceImpl implements DsApiService { } @Override - public BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(BatchCreateDistributionOrdersRequestDTO request) { - String resp = execute("/order/batchCreateDistributionOrders", objectToMap(request)); + public BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request) { + request.setPlatform("dd"); + request.setOperateInfo(createOperateInfo(shopId)); + for (PlatformOrderDTO platformOrder: request.getPlatformOrders()) { + platformOrder.setShopId(SecurityTool.encodeByAES(String.valueOf(shopId))); + for (PlatformOrderItemDTO item: platformOrder.getItems()) { + item.setPlatformItemId(SecurityTool.encodeByAES(item.getPlatformItemId())); + } + } +// String resp = execute("/order/batchCreateDistributionOrders", objectToMap(request)); + String resp = "{\"result\":\"success\",\"successCount\":1,\"failCount\":0,\"successList\":[{\"result\":\"success\",\"data\":{\"success\":true,\"totalSuccessAmount\":6500,\"orderId\":\"3507894290302847640\",\"postFee\":1500,\"mutilOrders\":null},\"createAlibabaOrderLogId\":960,\"platformOrderIds\":[\"6921501275308365608\"],\"isEncryptOrder\":1,\"isSupportEncryptOrder\":1,\"isUseManualConsignee\":0,\"flow\":\"fenxiao\",\"includeSplitJxhy\":false,\"sourceOrderIds\":[\"3507894290302847640\"],\"payRet\":{\"3507894290302847640\":{\"result\":\"fail\",\"code\":\"NO_SIGN_UP_ERROR\",\"reason\":\"\\u672a\\u7b7e\\u7ea6\\u6216\\u672a\\u7ed1\\u5b9a\"}},\"platformOrderId\":\"6921501275308365608\",\"relatePurchaseOrderInfos\":[{\"platformOrderId\":\"6921501275308365608\",\"purchasePlatform\":\"1688DS\",\"purchaseOrderSn\":\"3507894290302847640\",\"purchaseOrderBuyer\":\"goufx_ms\",\"purchaseOrderSeller\":\"\\u798f\\u5dde\\u67cf\\u4e3a\\u5546\\u8d38\\u6709\\u9650\\u516c\\u53f8\",\"purchaseOrderPayment\":\"65\",\"purchaseOrderFullname\":\"\\u53f6*\",\"purchaseOrderMobile\":\"1********51\",\"purchaseOrderFullAddress\":\"\\u7518\\u8083\\u7701 \\u5609\\u5cea\\u5173\\u5e02 \\u94a2\\u57ce\\u8857\\u9053 \\u8fce\\u5bbe*\\u8def****-*\\u53f7****\",\"purchaseOrderStartTime\":\"2023-09-05 16:57:29\",\"platformPushStatus\":\"wait\",\"purchaseOrderLogisticsName\":\"\",\"purchaseOrderWaybillCode\":\"\",\"purchaseOrderStatus\":\"wait_pay\",\"purchaseOrderFlow\":\"fenxiao\",\"alibabaOrderStatus\":\"waitbuyerpay\",\"isUseManualConsignee\":0,\"isDsEncryptOrder\":\"1\",\"isSupportEncryptOrder\":\"1\",\"logisticsIsAccept\":false,\"items\":[{\"skuId\":\"1759603409502271\",\"wareId\":\"3603667784447454901\",\"purchaseNum\":\"1\",\"purchasePrice\":\"50\",\"sourceItemId\":\"714710164290\"}],\"mergePurchasePlatformOrderIds\":null}]}],\"errorList\":null,\"lockSourceItems\":[{\"createPurchaseOrderLockSkuId\":\"1432\",\"createPurchaseOrderLockId\":\"20000973\",\"sourceItemId\":\"714710164290\",\"sourceSkuId\":\"5255522619991\",\"createPurchaseOrderLogId\":\"1017\",\"sourceOrderId\":\"3507894290302847640\",\"sourceNum\":null,\"reqId\":null,\"status\":\"lock\",\"gmtCreate\":\"2023-09-05 16:57:28\",\"gmtModified\":\"2023-09-05 16:57:29\",\"platformOrderId\":\"6921501275308365608\",\"platformItemId\":\"3603667784447454901\",\"platformSkuId\":\"1759603409502271\"}]}"; return JSON.parseObject(resp, BatchCreateDistributionOrdersResponseDTO.class); } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildServiceImpl.java index 7ae75b29..b4e623fc 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderChildServiceImpl.java @@ -82,7 +82,7 @@ public class OpOrderChildServiceImpl implements OpOrderChildService{ return map; } - public List getHistorySkuIdsByOrderId(String orderId) { + public List getHistorySkuIdsByOrderId(String orderId) { // TODO return new ArrayList<>(); } @@ -132,6 +132,12 @@ public class OpOrderChildServiceImpl implements OpOrderChildService{ } return orderIdAndChildrenMap; } + + @Override + public List getSkuIdsByOrderId(String orderId) { + List children = opOrderChildMapper.getListByOrderId(orderId); + return children.stream().map(OpOrderChild::getSkuId).collect(Collectors.toList()); + } } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OrderPrintServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OrderPrintServiceImpl.java index 9acb803a..58725dc5 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OrderPrintServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OrderPrintServiceImpl.java @@ -281,13 +281,16 @@ public class OrderPrintServiceImpl implements OrderPrintService { dsProductIds.add(purchaseOrderItem.getWareId()); } } + System.out.println("purchaseOrderItems" + purchaseOrderItems); + System.out.println("dsProductIds" + dsProductIds); + System.out.println("productIdAndPurchasePlatformsMap" + productIdAndPurchasePlatformsMap); if (dsProductIds.isEmpty()) { return true; } else { boolean isDsProductAllPurchaseOtherPlatform = true; for (String loopDsProductId : dsProductIds) { Set loopPurchasePlatformsMap = productIdAndPurchasePlatformsMap.get(loopDsProductId); - if (loopPurchasePlatformsMap.isEmpty() || loopPurchasePlatformsMap.contains(sourcePlatform)) { + if (loopPurchasePlatformsMap == null || loopPurchasePlatformsMap.isEmpty() || loopPurchasePlatformsMap.contains(sourcePlatform)) { isDsProductAllPurchaseOtherPlatform = false; break; } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseAccountServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseAccountServiceImpl.java index 092448ed..452b0242 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseAccountServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseAccountServiceImpl.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.Objects; /** @@ -56,17 +57,18 @@ public class PurchaseAccountServiceImpl implements PurchaseAccountService{ @Override public PurchaseAccount savePurchaseAccount(Long shopId, String platform, String purchaseOrderBuyer) { PurchaseAccount purchaseAccount = getByPurchaseOrderBuyer(shopId, platform, purchaseOrderBuyer); - if (purchaseAccount == null) { + System.out.println(purchaseAccount); + if (Objects.isNull(purchaseAccount)) { purchaseAccount = new PurchaseAccount(); purchaseAccount.setShopId(shopId); purchaseAccount.setPlatform(platform); purchaseAccount.setPurchaseOrderBuyer(purchaseOrderBuyer); purchaseAccount.setGmtCreate(new Date()); purchaseAccount.setGmtModified(new Date()); - purchaseAccountMapper.updateByPrimaryKey(purchaseAccount); + purchaseAccountMapper.insertSelective(purchaseAccount); } else { purchaseAccount.setGmtModified(new Date()); - purchaseAccountMapper.insert(purchaseAccount); + purchaseAccountMapper.updateByPrimaryKeySelective(purchaseAccount); } return purchaseAccount; } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderItemServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderItemServiceImpl.java index 7216998e..d1b587e2 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderItemServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderItemServiceImpl.java @@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; /** @@ -50,8 +51,9 @@ public class PurchaseOrderItemServiceImpl implements PurchaseOrderItemService{ } @Override - public List getSkuIdsByOrderId(String orderId) { - return null; + public List getSkuIdsByOrderId(String orderId) { + List items = purchaseOrderItemMapper.getSkuIdsByOrderId(orderId);; + return items.stream().map(PurchaseOrderItem::getSkuId).collect(Collectors.toList()); } @Override diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/BatchCreateDistributionOrdersService.java b/ms-biz/src/main/java/com/ms/api/spi/order/BatchCreateDistributionOrdersService.java index 3205f84d..8a88e754 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/BatchCreateDistributionOrdersService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/BatchCreateDistributionOrdersService.java @@ -37,6 +37,7 @@ public class BatchCreateDistributionOrdersService extends SPIBaseService impleme data.put("errorList", response.getErrorList()); return R.ok(Ret.success(data)); } catch (Exception e) { + e.printStackTrace(); log.error("batchCreateDistributionOrders fail:" + e.getMessage()); return R.ok(Ret.fail(e.getMessage())); } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderItemMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderItemMapper.java index 0e15254c..1d3fa2c0 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderItemMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderItemMapper.java @@ -37,4 +37,6 @@ public interface PurchaseOrderItemMapper { int updateStatusByIds(@Param("status") String status, @Param("ids") List ids); int updateStatusByOrderId(@Param("shopId") Long shopId, @Param("orderId") String orderId, @Param("status") String status); + + List getSkuIdsByOrderId(@Param("orderId") String orderId); } diff --git a/ms-dal/src/main/resources/mapper/PurchaseAccountMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseAccountMapper.xml index 4bca07b1..ac621339 100644 --- a/ms-dal/src/main/resources/mapper/PurchaseAccountMapper.xml +++ b/ms-dal/src/main/resources/mapper/PurchaseAccountMapper.xml @@ -91,7 +91,7 @@ + +