From 6b5dfa9e74b177ae1c40bd44a8ef053ca81c23d4 Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 4 Sep 2023 20:42:25 +0800 Subject: [PATCH 1/4] yh --- .../java/com/ms/api/service/DistributionOrderService.java | 2 +- .../ms/api/service/impl/DistributionOrderServiceImpl.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java b/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java index 533de1ae..d388969f 100644 --- a/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java +++ b/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java @@ -14,7 +14,7 @@ import com.ms.api.dto.dsorder.OrderItemDTO; public interface DistributionOrderService { BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request); GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List orderItems); - CommonResponseDTO batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request); + void batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request); void cancelPurchaseOrder(Long shopId, String orderId, List skuIds, String source, boolean isForce); void closeSourceOrderAndCancelRelatePurchaseOrder(Long shopId, String orderId, String purchaseOrderSn); String getDsPurchaseOrderPayUrl(Long shopId, GetDsPurchaseOrderPayUrlRequestDTO request); 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 02bb3338..2cbf2550 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 @@ -1283,8 +1283,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } @Override - public CommonResponseDTO batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request) { - return dsApiService.batchAddPurchaseConfirmLog(request); + public void batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request) { + CommonResponseDTO response = dsApiService.batchAddPurchaseConfirmLog(request); + if (!response.isSuccess()) { + throw new RuntimeException(response.getReason()); + } } @Override From 1f79b5c364ba7ea2a78ccec16d5767053333f931 Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 4 Sep 2023 21:24:29 +0800 Subject: [PATCH 2/4] yh --- .../impl/DistributionOrderServiceImpl.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 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 e36e843d..74a94ba3 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 @@ -88,7 +88,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { @Autowired private OpLogisticsPlatformService opLogisticsPlatformService; - @Override public BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request) { List platformOrders = request.getPlatformOrders(); @@ -124,11 +123,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { platformOrderDto.setEncryptOutOrderInfo(encryptOutOrderInfoDto); } - List allDecryptFields = Arrays.asList("post_receiver", "post_tel", "detail"); Set useManualConsigneeOrderIds = new HashSet<>(); - HashMap> tradeKeyAndDecryptFieldsMap = new HashMap<>(); HashMap sourceItemIdAndSourceSellerIdMap = getSourceItemIdAndSourceSellerIdMap(request.getAllItems()); - HashMap rebuildPlatformOrdersByChoicesItem = new HashMap<>(); HashMap shopPurchaseSettings = new HashMap<>(); for (PlatformOrderDTO platformOrderDto : platformOrders) { Set sourceSellerIds = getSourceSellerIdsFromPlatformOrder(platformOrderDto, sourceItemIdAndSourceSellerIdMap); @@ -148,7 +144,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { if (platformOrderDto.getConsigneeInfo().getIsManualInput()) { useManualConsigneeOrderIds.add(platformOrderDto.getPlatformOrderId()); } else if (checkNeedDecryptConsigneeInfo(platformOrderDto, shopPurchaseSettings.get(platformOrderDto.getShopId()), sourceSellerIds.iterator().next())) { - tradeKeyAndDecryptFieldsMap.put(platformOrderDto.getPlatformOrderId(), allDecryptFields); + throw new RuntimeException("不支持解密"); } for (PlatformOrderItemDTO item: platformOrderDto.getItems()) { @@ -333,7 +329,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } } - private List rebuildPlatformOrderItems(List platformOrders) { + private void rebuildPlatformOrderItems(List platformOrders) { Stream orderIdsStream = platformOrders.stream().map(PlatformOrderDTO::getPlatformOrderId); List orderIds = orderIdsStream.collect(Collectors.toList()); @@ -350,7 +346,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(Long.valueOf(item.getSourceSkuId()))); } } - return platformOrders; } private void dsRelatePurchaseOrder(PurchaseOrderRequestDTO purchaseOrderInfo, OpOrder opOrder) { @@ -472,8 +467,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { deliveryInfo.setWaybillCode(waybillCode); } for (PurchaseOrderItem item: purchaseOrder.getItems()) { - if (skuIds.contains(item.getSkuId().intValue())) { - List childOrderInfoList = skuIdAndChildOrderInfoMap.get(item.getSkuId().intValue()); + if (skuIds.contains(item.getSkuId())) { + List childOrderInfoList = skuIdAndChildOrderInfoMap.get(item.getSkuId()); 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"))) { @@ -667,9 +662,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { String profitText = ""; String profitRatioText = ""; if (needProfit || needProfitRatio) { - HashMap resuslt = getOrderProfitAndRatioByOrderId(firstPurchaseOrder.getOrderId()); - profitText = "(总利润 ¥" + resuslt.get("orderProfitSum") + ")"; - profitRatioText = "(利润率" + resuslt.get("orderTotalProfitRate") + "%)"; + HashMap result = getOrderProfitAndRatioByOrderId(firstPurchaseOrder.getOrderId()); + profitText = "(总利润 ¥" + result.get("orderProfitSum") + ")"; + profitRatioText = "(利润率" + result.get("orderTotalProfitRate") + "%)"; } for (PurchaseOrder purchaseOrder: purchaseOrders) { From 717ccde9d3f45a38797be4ff2bb836ea94b965ba Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Tue, 5 Sep 2023 00:37:03 +0800 Subject: [PATCH 3/4] yh --- .../dsapi/request/PlatformOrderItemDTO.java | 2 +- .../ms/api/service/OpOrderChildService.java | 4 +- .../impl/DistributionOrderServiceImpl.java | 45 +++++++------------ .../service/impl/OpOrderChildServiceImpl.java | 4 +- .../com/ms/dal/mapper/OpOrderChildMapper.java | 2 +- 5 files changed, 23 insertions(+), 34 deletions(-) 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 53fb514b..2be3cc49 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 @@ -6,7 +6,7 @@ import lombok.Data; public class PlatformOrderItemDTO { private String sourceItemId; private String specId; - private Integer sourceSkuId; + private Long sourceSkuId; private String platformItemId; private String platformOrderId; private Integer itemTotal; 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 696844d9..c6077a96 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 @@ -23,9 +23,9 @@ public interface OpOrderChildService { int updateByPrimaryKey(OpOrderChild record); - List getListByOrderIdsAndSkuIds(List orderIds, List skuIds); + List getListByOrderIdsAndSkuIds(List orderIds, List skuIds); - HashMap> getOrderIdAndSkuIdAndSkuSubNameMap(List orderIds, List skuIds); + HashMap> getOrderIdAndSkuIdAndSkuSubNameMap(List orderIds, List skuIds); List getHistorySkuIdsByOrderId(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 74a94ba3..a5f9a32a 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 @@ -61,9 +61,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { @Autowired private OpOrderAmountDetailService opOrderAmountDetailService; - @Autowired - private OpOrderRedpackInfoService opOrderRedpackInfoService; - @Autowired private PurchaseSettingService purchaseSettingService; @@ -321,19 +318,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } } - private void checkItems(List items) { - for (PlatformOrderItemDTO item: items) { - if (item.getSourceSkuId() == 0 || item.getItemTotal() == 0) { - throw new RuntimeException("items参数错误"); - } - } - } - private void rebuildPlatformOrderItems(List platformOrders) { Stream orderIdsStream = platformOrders.stream().map(PlatformOrderDTO::getPlatformOrderId); List orderIds = orderIdsStream.collect(Collectors.toList()); - List skuIds = new ArrayList<>(); + List skuIds = new ArrayList<>(); for (PlatformOrderDTO platformOrder: platformOrders) { for (PlatformOrderItemDTO item: platformOrder.getItems()) { skuIds.add(item.getSourceSkuId()); @@ -343,7 +332,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { HashMap> orderIdAndSkuIdAndSkuSubNameMap = opOrderChildService.getOrderIdAndSkuIdAndSkuSubNameMap(orderIds, skuIds); for (PlatformOrderDTO platformOrder: platformOrders) { for (PlatformOrderItemDTO item: platformOrder.getItems()) { - item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(Long.valueOf(item.getSourceSkuId()))); + item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(item.getSourceSkuId())); } } } @@ -482,7 +471,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { boolean hasMultiPackageOutstorage = opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_PART_DELIVERY); OrderPackageInfoDTO orderPackageInfoDTO = new OrderPackageInfoDTO(); - orderPackageInfoDTO.setDeliveryInfo(deliveryInfo);; + orderPackageInfoDTO.setDeliveryInfo(deliveryInfo); orderPackageInfoDTO.setPackageList(packageList); orderPackageInfoDTO.setHasAfterSaleChildOrder(hasAfterSaleChildOrder); orderPackageInfoDTO.setHasMultiPackageOutstorage(hasMultiPackageOutstorage); @@ -601,7 +590,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return newSellerWords; } newSellerWords = newSellerWords.replaceAll(appChineseName, "0.0"); - if (newSellerWords.equals(oldSellerWords) && shopRemarkFlag.equals(opOrder.getSellerRemarkStars())) { + if (newSellerWords.equals(oldSellerWords) && String.valueOf(shopRemarkFlag).equals(opOrder.getSellerRemarkStars())) { return newSellerWords; } opOrderExtService.updateOpOrderShopNote(shopId, orderId, newSellerWords); @@ -808,9 +797,10 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { BigDecimal purchaseOrderPayment = new BigDecimal(purchaseOrderRequestDto.getPurchaseOrderPayment()); dbPurchaseOrder.setPurchaseOrderPayment(purchaseOrderPayment); } + comparePurchaseOrderAndAddUpdateLog(purchaseOrderRequestDto, opOrder.getShopId(), PurchaseOrderConst.ACTION_RSYNC); + checkPurchaseOrderLogisticsChangeAndAddTag(purchaseOrderRequestDto, dbPurchaseOrder); OpOrderExt orderExt = opOrderExtService.getByOrderId(dbPurchaseOrder.getOrderId()); - if ("normal".equals(dbPurchaseOrder.getStatus()) && orderExt != null && orderExt.getFilterPurchaseStatus() != null) { updateOpOrderFilterPurchaseStatus(opOrder.getOrderId(), orderExt); } @@ -914,7 +904,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { List purchaseOrderItems = purchaseOrderItemService.getRelatedPurchaseOrderItems(opOrderDs.getShopId(), orderId); List purchaseWareIds; - List dsPurchaseSkuIds = new ArrayList<>(); + List dsPurchaseSkuIds = new ArrayList<>(); List purchaseDsProductIds = new ArrayList<>(); if (!purchaseOrderItems.isEmpty()) { Stream wareIdsStream = purchaseOrderItems.stream().map(PurchaseOrderItem::getWareId); @@ -923,7 +913,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { if (purchaseOrderItem.getPurchasePlatform().equals(purchasePlatform)) { purchaseDsProductIds.add(purchaseOrderItem.getWareId()); dsProductIds.add(purchaseOrderItem.getWareId()); - dsPurchaseSkuIds.add(purchaseOrderItem.getSkuId()); + dsPurchaseSkuIds.add(String.valueOf(purchaseOrderItem.getSkuId())); } } } else { @@ -933,7 +923,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { List noPurchaseDsProductIds = dsProductIds.stream().filter(i -> !purchaseWareIds.contains(i)).collect(Collectors.toList()); List notPurchaseDsSkuIds = dsProductIds.stream().filter(i -> !dsPurchaseSkuIds.contains(i)).collect(Collectors.toList()); List notDsAndDsPurchaseSkuIds = skuIdList.stream().filter(i -> !dsOrderSkuIds.contains(i)).collect(Collectors.toList()); - notDsAndDsPurchaseSkuIds = notDsAndDsPurchaseSkuIds.stream().filter(i -> !dsPurchaseSkuIds.contains(i)).collect(Collectors.toList()); + notDsAndDsPurchaseSkuIds = notDsAndDsPurchaseSkuIds.stream().filter(i -> !dsPurchaseSkuIds.contains(String.valueOf(i))).collect(Collectors.toList()); if (orderPrintService.checkAndDeleteOpOrderDs(purchasePlatform, orderId, productToDsItemList, purchaseOrderItems)) { return; @@ -1015,11 +1005,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { opOrderDsService.updateByPrimaryKeySelective(opOrderDs); } - - private void addPurchaseOrderRefundOrderTipMsg(Long shopId, String orderId, String purchaseOrderStatus, Long purchaseOrderId) { - - } - private void savePurchaseOrderInfo(PurchaseOrderRequestDTO purchaseOrderRequestDto, OpOrder opOrder, HashMap skuIdAndOpOrderChildMap) { purchaseAccountService.savePurchaseAccount(opOrder.getShopId(), purchaseOrderRequestDto.getPurchasePlatform(), purchaseOrderRequestDto.getPurchaseOrderBuyer()); PurchaseOrder dbPurchaseOrder = purchaseOrderService.getByPlatformAndPurchaseOrderSn(purchaseOrderRequestDto.getPurchasePlatform(), purchaseOrderRequestDto.getPurchaseOrderSn()); @@ -1145,10 +1130,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return log; } - public void savePurchaseOrderSetting(Long shopId) { - - } - private PurchaseOrder buildPurchaseOrderByDto(PurchaseOrderRequestDTO purchaseOrderRequestDto, PurchaseOrder oldPurchaseOrder, OpOrder opOrder) { PurchaseOrder purchaseOrder = oldPurchaseOrder; if (purchaseOrder == null) { @@ -1240,6 +1221,14 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return isReapt; } + private void getOrderPurchaseItemsOldPackageInfo(PurchaseOrder purchaseOrder) { + List purchaseOrderItems = purchaseOrderItemService.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrder.getPurchaseOrderId()); + List skuIds = purchaseOrderItems.stream().map(PurchaseOrderItem::getSkuId).collect(Collectors.toList()); + List orderIds = new ArrayList<>(); + orderIds.add(purchaseOrder.getOrderId()); + opOrderChildService.getListByOrderIdsAndSkuIds(orderIds, skuIds); + } + @Override public GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List orderItems) { Stream orderIdsStream = orderItems.stream().map(OrderItemDTO::getOrderId); 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 c814d603..7ae75b29 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 @@ -63,11 +63,11 @@ public class OpOrderChildServiceImpl implements OpOrderChildService{ } @Override - public List getListByOrderIdsAndSkuIds(List orderIds, List skuIds) { + public List getListByOrderIdsAndSkuIds(List orderIds, List skuIds) { return opOrderChildMapper.getListByOrderIdsAndSkuIds(orderIds, skuIds); } @Override - public HashMap> getOrderIdAndSkuIdAndSkuSubNameMap(List orderIds, List skuIds) { + public HashMap> getOrderIdAndSkuIdAndSkuSubNameMap(List orderIds, List skuIds) { List children = getListByOrderIdsAndSkuIds(orderIds, skuIds); HashMap> map = new HashMap<>(); for (OpOrderChild child: children) { diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderChildMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderChildMapper.java index 82ce8690..9c4d19c7 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderChildMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderChildMapper.java @@ -27,7 +27,7 @@ public interface OpOrderChildMapper { int updateByPrimaryKey(OpOrderChild record); - List getListByOrderIdsAndSkuIds(@Param("orderIds") List orderIds, @Param("skuIds") List skuIds); + List getListByOrderIdsAndSkuIds(@Param("orderIds") List orderIds, @Param("skuIds") List skuIds); List getListByOrderId(@Param("orderId") String orderId); From 1469e9f0111d33fc6b9f78edd03ffc24151c089c Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 5 Sep 2023 15:51:09 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BatchAddPurchaseConfirmLogRequestDTO.java | 29 +++-------------- .../dto/dsapi/request/PlatformOrderDTO.java | 1 + .../dsapi/request/PlatformOrderItemDTO.java | 1 + ...vePlatformManualSelectedSkuRequestDTO.java | 2 +- ...tchAddDsPurchaseConfirmLogResponseDTO.java | 10 ++++++ ...seOrderItemsAndSourceItemsResponseDTO.java | 5 ++- .../api/service/DistributionOrderService.java | 3 +- .../java/com/ms/api/service/DsApiService.java | 2 +- .../service/OpPackageOrderChildService.java | 5 +++ .../ms/api/service/OpPackageOrderService.java | 6 ++++ .../com/ms/api/service/OpPackageService.java | 5 +++ .../impl/DistributionOrderServiceImpl.java | 11 +++++-- .../ms/api/service/impl/DsApiServiceImpl.java | 12 +++++-- .../impl/OpPackageOrderChildServiceImpl.java | 6 ++++ .../impl/OpPackageOrderServiceImpl.java | 13 ++++++++ .../service/impl/OpPackageServiceImpl.java | 6 ++++ .../impl/PurchaseOrderServiceImpl.java | 6 ++-- .../BatchAddDsPurchaseConfirmLogService.java | 18 ++++++++--- .../BatchCreateDistributionOrdersService.java | 22 ++++++++++--- .../spi/order/CancelPurchaseOrderService.java | 15 ++++++--- .../spi/order/ClosePurchaseOrderService.java | 13 +++++--- .../GetDsPurchaseOrderPayUrlService.java | 17 ++++++---- .../spi/order/GetSourceSkuInfosService.java | 31 +++++++++++-------- .../order/SaveDsManualSelectedSkuService.java | 31 +++++++++++++------ .../com/ms/dal/entity/ProductToDsItem.java | 2 +- .../com/ms/dal/mapper/OpPackageMapper.java | 3 ++ .../dal/mapper/OpPackageOrderChildMapper.java | 3 ++ .../ms/dal/mapper/OpPackageOrderMapper.java | 3 ++ .../main/resources/mapper/OpPackageMapper.xml | 18 ++++++++++- .../mapper/OpPackageOrderChildMapper.xml | 18 ++++++++++- .../resources/mapper/OpPackageOrderMapper.xml | 17 ++++++++++ .../java/com/ms/web/OrderTestController.java | 7 +++++ 32 files changed, 256 insertions(+), 85 deletions(-) create mode 100644 ms-api/src/main/java/com/ms/api/dto/dsapi/response/BatchAddDsPurchaseConfirmLogResponseDTO.java diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/BatchAddPurchaseConfirmLogRequestDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/BatchAddPurchaseConfirmLogRequestDTO.java index 351c8992..e93b0618 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/BatchAddPurchaseConfirmLogRequestDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/BatchAddPurchaseConfirmLogRequestDTO.java @@ -8,30 +8,9 @@ import java.util.List; @Data public class BatchAddPurchaseConfirmLogRequestDTO { + private String userId; private String purchaseSource; - private String purchasePlatform; - - @Data - public static class PlatformOrder implements Serializable { - private String platformOrderId; - private String userId; - private List items; - } - - @Data - public static class PlatformOrderItem implements Serializable { - private String platformOrderId; - private String platformItemId; - private String platformSkuId; - private Integer itemTotal; - private String platformSkuSubName; - private String sourceItemId; - private String sourceSkuId; - private Integer sourceNum; - private String sourceSkuPurchaseQuantity; - private String sourceSkuSubName; - private Integer isSkuSubNameEqual; - private Integer isItemTotalEqual; - private String dsRefundStatus; - } + private String platform; + private OperateInfoDTO operateInfo; + private List platformOrders; } 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 65d694e5..0f7dbb66 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 @@ -6,6 +6,7 @@ import java.util.List; @Data public class PlatformOrderDTO { + private String userId; private String platformOrderId; private Long shopId; private ConsigneeInfoDTO consigneeInfo; 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 2be3cc49..b0f8114c 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,4 +14,5 @@ public class PlatformOrderItemDTO { private Boolean isJxhyOffer; private String instanceCode; private String platformSkuSubName; + private String platformSkuId; } diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/SavePlatformManualSelectedSkuRequestDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/SavePlatformManualSelectedSkuRequestDTO.java index c8cf3729..c966a9c6 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/request/SavePlatformManualSelectedSkuRequestDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/request/SavePlatformManualSelectedSkuRequestDTO.java @@ -4,7 +4,7 @@ import lombok.Data; @Data public class SavePlatformManualSelectedSkuRequestDTO { - private String shopId; + private String userId; private String platform; private String platformItemId; private String platformSkuId; diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/BatchAddDsPurchaseConfirmLogResponseDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/BatchAddDsPurchaseConfirmLogResponseDTO.java new file mode 100644 index 00000000..b3fa2544 --- /dev/null +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/BatchAddDsPurchaseConfirmLogResponseDTO.java @@ -0,0 +1,10 @@ +package com.ms.api.dto.dsapi.response; + +import lombok.Data; + +import java.util.HashMap; + +@Data +public class BatchAddDsPurchaseConfirmLogResponseDTO extends CommonResponseDTO { + HashMap platformOrderIdAndPurchaseConfirmLogIdMap; +} 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 4b1d6264..aff7ad0e 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 @@ -10,7 +10,7 @@ import java.util.Map; public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonResponseDTO { private Map sourceItemIdAndProductInfoMap; private Map sourceItemIdAndProductApiRetMap; - private Map platformItemIdAndSourceItemSkuRelationMap; + private Map>> platformItemIdAndSourceItemSkuRelationMap; private Map> platformOrderIdAndPurchaseOrderItemsMap; private Map> platformOrderIdAndPurchaseOrdersMap; private Map platformItemIdAndSourceItemInfoMap; @@ -32,6 +32,8 @@ public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonRespon private String resourceOwner; private List skus; private EncryptLogisticsOrderSupportChannel encryptLogisticsOrderSupportChannel; + private Map platformSkuIdAndSourceSkuInfoMap; + private Map platformSkuIdAndSourceSkuIdMap; } @Data @@ -61,6 +63,7 @@ public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonRespon private String gmtCreate; private String gmtModified; private Long platformItemId; + private Long sourceItemId; } @Data diff --git a/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java b/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java index d388969f..ff1d5281 100644 --- a/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java +++ b/ms-biz/src/main/java/com/ms/api/service/DistributionOrderService.java @@ -1,5 +1,6 @@ package com.ms.api.service; +import java.util.HashMap; import java.util.List; import com.ms.api.dto.dsapi.request.BatchAddPurchaseConfirmLogRequestDTO; @@ -14,7 +15,7 @@ import com.ms.api.dto.dsorder.OrderItemDTO; public interface DistributionOrderService { BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request); GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List orderItems); - void batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request); + HashMap batchAddDsPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request); void cancelPurchaseOrder(Long shopId, String orderId, List skuIds, String source, boolean isForce); void closeSourceOrderAndCancelRelatePurchaseOrder(Long shopId, String orderId, String purchaseOrderSn); String getDsPurchaseOrderPayUrl(Long shopId, GetDsPurchaseOrderPayUrlRequestDTO request); 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 242f3623..9a9e3132 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 @@ -13,7 +13,7 @@ public interface DsApiService { BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(BatchCreateDistributionOrdersRequestDTO request); CommonResponseDTO saveDsManualSelectedSku(SavePlatformManualSelectedSkuRequestDTO request); GetPurchaseOrderItemsAndSourceItemsResponseDTO getPurchaseOrderItemsAndSourceItems(GetPurchaseOrderItemsAndSourceItemsRequestDTO request); - CommonResponseDTO batchAddPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request); + BatchAddDsPurchaseConfirmLogResponseDTO batchAddPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request); CommonResponseDTO cancelPurchaseOrderRelate(String platform, Long shopId, String orderId, List skuIds); CommonResponseDTO cancelPurchaseOrder(String platform, Long shopId, String orderId, String purchaseOrderSn); GetPurchaseOrderPayUrlResponseDTO getPurchaseOrderPayUrl(List sourceOrderId, Long shopId); diff --git a/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderChildService.java b/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderChildService.java index 9133e59e..c267ce4d 100644 --- a/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderChildService.java +++ b/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderChildService.java @@ -1,7 +1,10 @@ package com.ms.api.service; +import com.ms.dal.entity.OpPackage; import com.ms.dal.entity.OpPackageOrderChild; +import java.util.List; + /** * */ @@ -18,4 +21,6 @@ public interface OpPackageOrderChildService { int updateByPrimaryKeySelective(OpPackageOrderChild record); int updateByPrimaryKey(OpPackageOrderChild record); + + List getListByOpPackageIds(List opPackageIds); } diff --git a/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderService.java b/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderService.java index 17d1541d..b38be3bf 100644 --- a/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderService.java +++ b/ms-biz/src/main/java/com/ms/api/service/OpPackageOrderService.java @@ -2,6 +2,8 @@ package com.ms.api.service; import com.ms.dal.entity.OpPackageOrder; +import java.util.List; + /** * */ @@ -18,4 +20,8 @@ public interface OpPackageOrderService { int updateByPrimaryKeySelective(OpPackageOrder record); int updateByPrimaryKey(OpPackageOrder record); + + List getOpPackageIdsByOrderIds(List orderIds); + + List getListByOrderIds(List orderIds); } diff --git a/ms-biz/src/main/java/com/ms/api/service/OpPackageService.java b/ms-biz/src/main/java/com/ms/api/service/OpPackageService.java index ee1de6d3..afaac2e8 100644 --- a/ms-biz/src/main/java/com/ms/api/service/OpPackageService.java +++ b/ms-biz/src/main/java/com/ms/api/service/OpPackageService.java @@ -2,6 +2,9 @@ package com.ms.api.service; import com.ms.dal.entity.OpPackage; +import java.util.HashMap; +import java.util.List; + /** * */ @@ -18,4 +21,6 @@ public interface OpPackageService { int updateByPrimaryKeySelective(OpPackage record); int updateByPrimaryKey(OpPackage record); + + List getListByOpPackageIds(List opPackageIds); } 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 a5f9a32a..096ac064 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 @@ -85,6 +85,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { @Autowired private OpLogisticsPlatformService opLogisticsPlatformService; + @Autowired + private PurchaseOrderTagService purchaseOrderTagService; + @Override public BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request) { List platformOrders = request.getPlatformOrders(); @@ -1229,6 +1232,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { opOrderChildService.getListByOrderIdsAndSkuIds(orderIds, skuIds); } + @Override public GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List orderItems) { Stream orderIdsStream = orderItems.stream().map(OrderItemDTO::getOrderId); @@ -1240,7 +1244,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { Map orderIdAndOpOrderMap = orders.stream().collect(Collectors.toMap(OpOrder::getOrderId, x->x)); Stream shopIdsStream = orders.stream().map(OpOrder::getShopId); Set shopIdSet = shopIdsStream.collect(Collectors.toSet()); - if (shopIdSet.size() != 1 || shopIdSet.contains(shopId)) { + if (shopIdSet.size() != 1 || !shopIdSet.contains(shopId)) { throw new RuntimeException("订单归属异常"); } @@ -1267,11 +1271,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } @Override - public void batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request) { - CommonResponseDTO response = dsApiService.batchAddPurchaseConfirmLog(request); + public HashMap batchAddDsPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request) { + BatchAddDsPurchaseConfirmLogResponseDTO response = dsApiService.batchAddPurchaseConfirmLog(shopId, request); if (!response.isSuccess()) { throw new RuntimeException(response.getReason()); } + return response.getPlatformOrderIdAndPurchaseConfirmLogIdMap(); } @Override 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 a72b088a..612ba6c3 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 @@ -47,9 +47,17 @@ public class DsApiServiceImpl implements DsApiService { } @Override - public CommonResponseDTO batchAddPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request) { + public BatchAddDsPurchaseConfirmLogResponseDTO batchAddPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request) { + request.setPlatform("dd"); + request.setUserId(SecurityTool.encodeByAES(String.valueOf(shopId))); + request.setOperateInfo(createOperateInfo(shopId)); + for (PlatformOrderDTO platformOrder: request.getPlatformOrders()) { + for (PlatformOrderItemDTO item: platformOrder.getItems()) { + item.setPlatformItemId(SecurityTool.encodeByAES(item.getPlatformItemId())); + } + } String resp = execute("/order/batchAddPurchaseConfirmLog", objectToMap(request)); - return JSON.parseObject(resp, CommonResponseDTO.class); + return JSON.parseObject(resp, BatchAddDsPurchaseConfirmLogResponseDTO.class); } @Override diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderChildServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderChildServiceImpl.java index d0813501..9303b358 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderChildServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderChildServiceImpl.java @@ -6,6 +6,8 @@ import com.ms.dal.mapper.OpPackageOrderChildMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * @@ -46,6 +48,10 @@ public class OpPackageOrderChildServiceImpl implements OpPackageOrderChildServic return opPackageOrderChildMapper.updateByPrimaryKey(record); } + @Override + public List getListByOpPackageIds(List opPackageIds) { + return opPackageOrderChildMapper.getListByOpPackageIds(opPackageIds); + } } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderServiceImpl.java index aeb05202..9eb49863 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageOrderServiceImpl.java @@ -6,6 +6,9 @@ import com.ms.dal.mapper.OpPackageOrderMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.stream.Collectors; + /** * @@ -46,6 +49,16 @@ public class OpPackageOrderServiceImpl implements OpPackageOrderService{ return opPackageOrderMapper.updateByPrimaryKey(record); } + @Override + public List getOpPackageIdsByOrderIds(List orderIds) { + List packageOrders = getListByOrderIds(orderIds); + return packageOrders.stream().map(OpPackageOrder::getOpPackageId).collect(Collectors.toList()); + } + + @Override + public List getListByOrderIds(List orderIds) { + return opPackageOrderMapper.getListByOrderIds(orderIds); + } } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageServiceImpl.java index df3033de..fd4ad712 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpPackageServiceImpl.java @@ -6,6 +6,8 @@ import com.ms.dal.mapper.OpPackageMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * @@ -46,6 +48,10 @@ public class OpPackageServiceImpl implements OpPackageService{ return opPackageMapper.updateByPrimaryKey(record); } + @Override + public List getListByOpPackageIds(List opPackageIds) { + return opPackageMapper.getListByOpPackageIds(opPackageIds); + } } 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 fb27ef24..84a47dd7 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 @@ -1751,13 +1751,13 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService { String productId = opOrderChild.getProductId(); ProductToDsItem productToDsItem = productIdAndProductToDsItemMap.getOrDefault(productId, null); if (ObjectUtil.isNotEmpty(productToDsItem)) { - if (PurchaseOrderConst.PURCHASE_PLATFORM_SOOXIE_D_S.equals(productToDsItem.getSource_platform())) { + if (PurchaseOrderConst.PURCHASE_PLATFORM_SOOXIE_D_S.equals(productToDsItem.getSourcePlatform())) { productToDsItem.setSourceSellerId(null); - productToDsItem.setSource_platform(null); + productToDsItem.setSourcePlatform(null); productToDsItem.setSourceItemId(null); } opOrderChild.setSourceSellerId(productToDsItem.getSourceSellerId()); - opOrderChild.setSource_platform(productToDsItem.getSource_platform()); + opOrderChild.setSource_platform(productToDsItem.getSourcePlatform()); opOrderChild.setSourceItemId(productToDsItem.getSourceItemId()); opOrderChild.setSourceItem(productToDsItem); } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/BatchAddDsPurchaseConfirmLogService.java b/ms-biz/src/main/java/com/ms/api/spi/order/BatchAddDsPurchaseConfirmLogService.java index 3ac8bbd2..dd18e6b0 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/BatchAddDsPurchaseConfirmLogService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/BatchAddDsPurchaseConfirmLogService.java @@ -13,6 +13,9 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import java.util.HashMap; +import java.util.Map; + @ExtensionService("batchAddDsPurchaseConfirmLog") @Slf4j @AllArgsConstructor @@ -22,9 +25,16 @@ public class BatchAddDsPurchaseConfirmLogService extends SPIBaseService implemen @Override public BaseResponse handle(BaseRequest req) { - initHandle(req); - BatchAddPurchaseConfirmLogRequestDTO requestDTO = req.getData(); - distributionOrderService.batchAddDsPurchaseConfirmLog(requestDTO); - return R.ok(Ret.success()); + try { + initHandle(req); + BatchAddPurchaseConfirmLogRequestDTO requestDTO = req.getData(); + HashMap platformOrderIdAndPurchaseConfirmLogIdMap = distributionOrderService.batchAddDsPurchaseConfirmLog(shopId, requestDTO); + Map data = new HashMap<>(); + data.put("platformItemIdAndSourceItemInfoMap", platformOrderIdAndPurchaseConfirmLogIdMap); + return R.ok(Ret.success(data)); + } catch (Exception e) { + log.error("batchAddDsPurchaseConfirmLog fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); + } } } 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 5486028c..3205f84d 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 @@ -8,11 +8,15 @@ import com.ms.api.common.R; import com.ms.api.common.Ret; import com.ms.api.common.SPIBaseService; import com.ms.api.dto.dsapi.request.BatchCreateDistributionOrdersRequestDTO; +import com.ms.api.dto.dsapi.response.BatchCreateDistributionOrdersResponseDTO; import com.ms.api.service.DistributionOrderService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import java.util.HashMap; +import java.util.Map; + @ExtensionService("batchCreateDistributionOrders") @Slf4j @AllArgsConstructor @@ -22,9 +26,19 @@ public class BatchCreateDistributionOrdersService extends SPIBaseService impleme @Override public BaseResponse handle(BaseRequest req) { - initHandle(req); - BatchCreateDistributionOrdersRequestDTO requestDTO = req.getData(); - distributionOrderService.batchCreateDistributionOrders(shopId, requestDTO); - return R.ok(Ret.success()); + try { + initHandle(req); + BatchCreateDistributionOrdersRequestDTO requestDTO = req.getData(); + BatchCreateDistributionOrdersResponseDTO response = distributionOrderService.batchCreateDistributionOrders(shopId, requestDTO); + Map data = new HashMap<>(); + data.put("successCount", response.getSuccessCount()); + data.put("failCount", response.getFailCount()); + data.put("successList", response.getSuccessList()); + data.put("errorList", response.getErrorList()); + return R.ok(Ret.success(data)); + } catch (Exception e) { + log.error("batchCreateDistributionOrders fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); + } } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/CancelPurchaseOrderService.java b/ms-biz/src/main/java/com/ms/api/spi/order/CancelPurchaseOrderService.java index 5b197fa8..1b0cc42c 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/CancelPurchaseOrderService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/CancelPurchaseOrderService.java @@ -23,10 +23,15 @@ public class CancelPurchaseOrderService extends SPIBaseService implements Extens @Override public BaseResponse handle(BaseRequest req) { - initHandle(req); - CanclePurchaseOrderRequestDTO requestDTO = req.getData(); - String source = PurchaseOrderConst.PURCHASE_ORDER_CANCEL_SOURCE_CG_CANCEL; - distributionOrderService.cancelPurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getSkuIds(), source, false); - return R.ok(Ret.success()); + try { + initHandle(req); + CanclePurchaseOrderRequestDTO requestDTO = req.getData(); + String source = PurchaseOrderConst.PURCHASE_ORDER_CANCEL_SOURCE_CG_CANCEL; + distributionOrderService.cancelPurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getSkuIds(), source, false); + return R.ok(Ret.success()); + } catch (Exception e) { + log.error("cancelPurchaseOrder fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); + } } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/ClosePurchaseOrderService.java b/ms-biz/src/main/java/com/ms/api/spi/order/ClosePurchaseOrderService.java index e0deb983..c597bb17 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/ClosePurchaseOrderService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/ClosePurchaseOrderService.java @@ -22,9 +22,14 @@ public class ClosePurchaseOrderService extends SPIBaseService implements Extensi @Override public BaseResponse handle(BaseRequest req) { - initHandle(req); - ClosePurchaseOrderRequestDTO requestDTO = req.getData(); - distributionOrderService.closeSourceOrderAndCancelRelatePurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getPurchaseOrderSn()); - return R.ok(Ret.success()); + try { + initHandle(req); + ClosePurchaseOrderRequestDTO requestDTO = req.getData(); + distributionOrderService.closeSourceOrderAndCancelRelatePurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getPurchaseOrderSn()); + return R.ok(Ret.success()); + } catch (Exception e) { + log.error("closePurchaseOrder fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); + } } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/GetDsPurchaseOrderPayUrlService.java b/ms-biz/src/main/java/com/ms/api/spi/order/GetDsPurchaseOrderPayUrlService.java index 5740cbce..d7294153 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/GetDsPurchaseOrderPayUrlService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/GetDsPurchaseOrderPayUrlService.java @@ -25,11 +25,16 @@ public class GetDsPurchaseOrderPayUrlService extends SPIBaseService implements E @Override public BaseResponse handle(BaseRequest req) { - initHandle(req); - GetDsPurchaseOrderPayUrlRequestDTO requestDTO = req.getData(); - String payUrl = distributionOrderService.getDsPurchaseOrderPayUrl(shopId, requestDTO); - Map data = new HashMap<>(); - data.put("payUrl", payUrl); - return R.ok(Ret.success(data)); + try { + initHandle(req); + GetDsPurchaseOrderPayUrlRequestDTO requestDTO = req.getData(); + String payUrl = distributionOrderService.getDsPurchaseOrderPayUrl(shopId, requestDTO); + Map data = new HashMap<>(); + data.put("payUrl", payUrl); + return R.ok(Ret.success(data)); + } catch (Exception e) { + log.error("getDsPurchaseOrderPayUrl fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); + } } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/GetSourceSkuInfosService.java b/ms-biz/src/main/java/com/ms/api/spi/order/GetSourceSkuInfosService.java index 424e3038..f7aa1fad 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/GetSourceSkuInfosService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/GetSourceSkuInfosService.java @@ -27,19 +27,24 @@ public class GetSourceSkuInfosService extends SPIBaseService implements Extensio @Override public BaseResponse handle(BaseRequest req) { - initHandle(req); - GetSourceSkuInfosRequestDTO requestDTO = req.getData(); - GetPurchaseOrderItemsAndSourceItemsResponseDTO response = distributionOrderService.getSourceSkuInfos(shopId, requestDTO.getOrderItems()); - if (!response.isSuccess()) { - throw new RuntimeException(response.getReason()); + try { + initHandle(req); + GetSourceSkuInfosRequestDTO requestDTO = req.getData(); + GetPurchaseOrderItemsAndSourceItemsResponseDTO response = distributionOrderService.getSourceSkuInfos(shopId, requestDTO.getOrderItems()); + if (!response.isSuccess()) { + throw new RuntimeException(response.getReason()); + } + Map data = new HashMap<>(); + data.put("platformItemIdAndSourceItemInfoMap", response.getPlatformItemIdAndSourceItemInfoMap()); + data.put("platformOrderIdAndPurchaseOrderItemsMap", response.getPlatformOrderIdAndPurchaseOrderItemsMap()); + data.put("sourceItemIdAndProductInfoMap", response.getSourceItemIdAndProductInfoMap()); + data.put("platformOrderIdAndPurchaseOrdersMap", response.getPlatformOrderIdAndPurchaseOrdersMap()); + data.put("platformItemIdAndSourceItemSkuRelationMap", response.getPlatformItemIdAndSourceItemSkuRelationMap()); + data.put("sourceItemIdAndProductApiRetMap", response.getSourceItemIdAndProductApiRetMap()); + return R.ok(Ret.success(data)); + } catch (Exception e) { + log.error("getSourceSkuInfos fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); } - Map data = new HashMap<>(); - data.put("platformItemIdAndSourceItemInfoMap", response.getPlatformItemIdAndSourceItemInfoMap()); - data.put("platformOrderIdAndPurchaseOrderItemsMap", response.getPlatformOrderIdAndPurchaseOrderItemsMap()); - data.put("sourceItemIdAndProductInfoMap", response.getSourceItemIdAndProductInfoMap()); - data.put("platformOrderIdAndPurchaseOrdersMap", response.getPlatformOrderIdAndPurchaseOrdersMap()); - data.put("platformItemIdAndSourceItemSkuRelationMap", response.getPlatformItemIdAndSourceItemSkuRelationMap()); - data.put("sourceItemIdAndProductApiRetMap", response.getSourceItemIdAndProductApiRetMap()); - return R.ok(Ret.success(data)); } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/SaveDsManualSelectedSkuService.java b/ms-biz/src/main/java/com/ms/api/spi/order/SaveDsManualSelectedSkuService.java index 87e913d2..23e47039 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/SaveDsManualSelectedSkuService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/SaveDsManualSelectedSkuService.java @@ -5,28 +5,41 @@ import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.ms.api.common.R; +import com.ms.api.common.Ret; +import com.ms.api.common.SPIBaseService; import com.ms.api.dto.dsapi.request.OperateInfoDTO; import com.ms.api.dto.dsapi.request.SavePlatformManualSelectedSkuRequestDTO; import com.ms.api.dto.dsapi.response.CommonResponseDTO; import com.ms.api.service.DsApiService; +import com.ms.api.tool.SecurityTool; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @ExtensionService("saveDsManualSelectedSku") @Slf4j -public class SaveDsManualSelectedSkuService implements ExtensionServiceHandler { +public class SaveDsManualSelectedSkuService extends SPIBaseService implements ExtensionServiceHandler { @Autowired private DsApiService dsApiService; @Override - public BaseResponse handle(BaseRequest req) { - String shopId = req.getAuthId(); - SavePlatformManualSelectedSkuRequestDTO dto = req.getData(); - dto.setShopId(shopId); - dto.setOperateInfo(new OperateInfoDTO(shopId)); - dto.setPlatform("dd"); - CommonResponseDTO responseDTO = dsApiService.saveDsManualSelectedSku(dto); - return R.ok(responseDTO); + public BaseResponse handle(BaseRequest req) { + try { + initHandle(req); + String shopId = SecurityTool.encodeByAES(req.getAuthId()); + SavePlatformManualSelectedSkuRequestDTO dto = req.getData(); + dto.setPlatformItemId(SecurityTool.encodeByAES(dto.getPlatformItemId())); + dto.setUserId(shopId); + dto.setOperateInfo(new OperateInfoDTO(shopId)); + dto.setPlatform("dd"); + CommonResponseDTO responseDTO = dsApiService.saveDsManualSelectedSku(dto); + if (!responseDTO.isSuccess()) { + throw new RuntimeException(responseDTO.getReason()); + } + return R.ok(Ret.success()); + } catch (Exception e) { + log.error("saveDsManualSelectedSku fail:" + e.getMessage()); + return R.ok(Ret.fail(e.getMessage())); + } } } \ No newline at end of file diff --git a/ms-dal/src/main/java/com/ms/dal/entity/ProductToDsItem.java b/ms-dal/src/main/java/com/ms/dal/entity/ProductToDsItem.java index 20f0db54..6daa1ca5 100644 --- a/ms-dal/src/main/java/com/ms/dal/entity/ProductToDsItem.java +++ b/ms-dal/src/main/java/com/ms/dal/entity/ProductToDsItem.java @@ -52,7 +52,7 @@ public class ProductToDsItem implements Serializable { /** * 货源平台 */ - private String source_platform; + private String sourcePlatform; /** * 创建时间 diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageMapper.java index ce08cf6b..5bbaae37 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageMapper.java @@ -3,6 +3,8 @@ package com.ms.dal.mapper; import com.ms.dal.entity.OpPackage; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @Entity com.ms.dal.entity.OpPackage */ @@ -23,4 +25,5 @@ public interface OpPackageMapper { int updateByPrimaryKey(OpPackage record); + List getListByOpPackageIds(List opPackageIds); } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderChildMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderChildMapper.java index 4491269e..f81634fd 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderChildMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderChildMapper.java @@ -3,6 +3,8 @@ package com.ms.dal.mapper; import com.ms.dal.entity.OpPackageOrderChild; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @Entity com.ms.dal.entity.OpPackageOrderChild */ @@ -23,4 +25,5 @@ public interface OpPackageOrderChildMapper { int updateByPrimaryKey(OpPackageOrderChild record); + List getListByOpPackageIds(List opPackageIds); } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderMapper.java index 0d0ccfb2..3cefbbbc 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpPackageOrderMapper.java @@ -3,6 +3,8 @@ package com.ms.dal.mapper; import com.ms.dal.entity.OpPackageOrder; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @Entity com.ms.dal.entity.OpPackageOrder */ @@ -23,4 +25,5 @@ public interface OpPackageOrderMapper { int updateByPrimaryKey(OpPackageOrder record); + List getListByOrderIds(List orderIds); } diff --git a/ms-dal/src/main/resources/mapper/OpPackageMapper.xml b/ms-dal/src/main/resources/mapper/OpPackageMapper.xml index fa6c52a5..5aa29d87 100644 --- a/ms-dal/src/main/resources/mapper/OpPackageMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpPackageMapper.xml @@ -38,7 +38,23 @@ from op_package where op_package_id = #{opPackageId,jdbcType=BIGINT} - + delete from op_package where op_package_id = #{opPackageId,jdbcType=BIGINT} diff --git a/ms-dal/src/main/resources/mapper/OpPackageOrderChildMapper.xml b/ms-dal/src/main/resources/mapper/OpPackageOrderChildMapper.xml index afff0620..5801d765 100644 --- a/ms-dal/src/main/resources/mapper/OpPackageOrderChildMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpPackageOrderChildMapper.xml @@ -27,7 +27,23 @@ from op_package_order_child where op_package_order_child_id = #{opPackageOrderChildId,jdbcType=BIGINT} - + delete from op_package_order_child where op_package_order_child_id = #{opPackageOrderChildId,jdbcType=BIGINT} diff --git a/ms-dal/src/main/resources/mapper/OpPackageOrderMapper.xml b/ms-dal/src/main/resources/mapper/OpPackageOrderMapper.xml index 7acf274d..7dc4dfd3 100644 --- a/ms-dal/src/main/resources/mapper/OpPackageOrderMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpPackageOrderMapper.xml @@ -24,6 +24,23 @@ from op_package_order where op_package_order_id = #{opPackageOrderId,jdbcType=BIGINT} + delete from op_package_order diff --git a/ms-web/src/main/java/com/ms/web/OrderTestController.java b/ms-web/src/main/java/com/ms/web/OrderTestController.java index 0d37a07e..c392663c 100644 --- a/ms-web/src/main/java/com/ms/web/OrderTestController.java +++ b/ms-web/src/main/java/com/ms/web/OrderTestController.java @@ -6,6 +6,7 @@ import java.util.Map; import javax.annotation.Resource; import com.alibaba.fastjson.JSONObject; +import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseResponse; import com.ms.api.common.ApiResult; import com.ms.api.common.Pager; @@ -14,11 +15,14 @@ import com.ms.api.common.Ret; import com.ms.api.consts.AppConst; import com.ms.api.consts.DsOrderConst; import com.ms.api.consts.PurchaseOrderConst; +import com.ms.api.dto.dsapi.response.GetPurchaseOrderItemsAndSourceItemsResponseDTO; +import com.ms.api.dto.dsorder.GetSourceSkuInfosRequestDTO; import com.ms.api.dto.order.ManualRsyncDdOrdersDTO; import com.ms.api.dto.order.RsyncAfterSaleRequestDTO; import com.ms.api.dto.order.RsyncFullOrderRequestDTO; import com.ms.api.dto.order.SearchDsOrderFilterDTO; import com.ms.api.dto.order.SearchDsOrderListRequestDTO; +import com.ms.api.service.DistributionOrderService; import com.ms.api.service.OpOrderService; import com.ms.api.service.PurchaseOrderService; import com.ms.api.util.OrderUtil; @@ -56,6 +60,9 @@ public class OrderTestController { @Resource private OpOrderService opOrderService; + @Resource + private DistributionOrderService distributionOrderService; + @PostMapping("/searchDsOrderList") public BaseResponse searchDsOrderList(@RequestBody SearchDsOrderListRequestDTO dto) { String shopId = AppConst.TEST_SHOP_ID;