From 6b5dfa9e74b177ae1c40bd44a8ef053ca81c23d4 Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 4 Sep 2023 20:42:25 +0800 Subject: [PATCH 1/6] 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/6] 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/6] 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 cea5061172336a4f2eef728d1a5a99508cdf67d2 Mon Sep 17 00:00:00 2001 From: daixiaogang <2510234660@qq.com> Date: Tue, 5 Sep 2023 15:41:42 +0800 Subject: [PATCH 4/6] =?UTF-8?q?purchase=5Forder=5Fcustom=20purchase=5Forde?= =?UTF-8?q?r=5Fds=5Fencrypt=20=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=20?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=AE=9A=E6=97=B6=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ms/api/consts/QueueConst.java | 27 ++++ .../api/service/OpOrderRsyncQueueService.java | 4 + .../service/PurchaseOrderCustomService.java | 21 +++ .../PurchaseOrderDsEncryptService.java | 21 +++ .../java/com/ms/api/service/QueueService.java | 4 + .../impl/OpOrderRsyncQueueServiceImpl.java | 37 ++++- .../impl/PurchaseOrderCustomServiceImpl.java | 53 +++++++ .../PurchaseOrderDsEncryptServiceImpl.java | 53 +++++++ .../ms/api/service/impl/QueueServiceImpl.java | 30 ++++ .../com/ms/api/task/RsyncOpTaskService.java | 126 +++++++++++++++ .../ms/dal/entity/PurchaseOrderCustom.java | 70 +++++++++ .../ms/dal/entity/PurchaseOrderDsEncrypt.java | 64 ++++++++ .../dal/mapper/OpOrderRsyncQueueMapper.java | 2 + .../dal/mapper/PurchaseOrderCustomMapper.java | 26 ++++ .../mapper/PurchaseOrderDsEncryptMapper.java | 26 ++++ .../java/com/ms/dal/mapper/QueueMapper.java | 8 + .../mapper/OpOrderRsyncQueueMapper.xml | 3 + .../mapper/PurchaseOrderCustomMapper.xml | 144 ++++++++++++++++++ .../mapper/PurchaseOrderDsEncryptMapper.xml | 137 +++++++++++++++++ .../src/main/resources/mapper/QueueMapper.xml | 8 + 20 files changed, 861 insertions(+), 3 deletions(-) create mode 100644 ms-biz/src/main/java/com/ms/api/consts/QueueConst.java create mode 100644 ms-biz/src/main/java/com/ms/api/service/PurchaseOrderCustomService.java create mode 100644 ms-biz/src/main/java/com/ms/api/service/PurchaseOrderDsEncryptService.java create mode 100644 ms-biz/src/main/java/com/ms/api/service/QueueService.java create mode 100644 ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderCustomServiceImpl.java create mode 100644 ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderDsEncryptServiceImpl.java create mode 100644 ms-biz/src/main/java/com/ms/api/service/impl/QueueServiceImpl.java create mode 100644 ms-biz/src/main/java/com/ms/api/task/RsyncOpTaskService.java create mode 100644 ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderCustom.java create mode 100644 ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderDsEncrypt.java create mode 100644 ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderCustomMapper.java create mode 100644 ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderDsEncryptMapper.java create mode 100644 ms-dal/src/main/java/com/ms/dal/mapper/QueueMapper.java create mode 100644 ms-dal/src/main/resources/mapper/PurchaseOrderCustomMapper.xml create mode 100644 ms-dal/src/main/resources/mapper/PurchaseOrderDsEncryptMapper.xml create mode 100644 ms-dal/src/main/resources/mapper/QueueMapper.xml diff --git a/ms-biz/src/main/java/com/ms/api/consts/QueueConst.java b/ms-biz/src/main/java/com/ms/api/consts/QueueConst.java new file mode 100644 index 00000000..c58ed01a --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/consts/QueueConst.java @@ -0,0 +1,27 @@ +package com.ms.api.consts; +public class QueueConst { + + public static final String orderCareRsyncQueue = "order_care_rsync_queue"; + public static final String orderFullRsyncQueue = "order_full_rsync_queue"; + public static final String orderQuickRsyncQueue = "order_quick_rsync_queue"; + + public static final String wareQuickRsyncQueue = "ware_quick_rsync_queue"; + public static final String wareFullRsyncQueue = "ware_full_rsync_queue"; + + public static final String crmMemberFullRsyncQueue = "crm_member_full_rsync_queue"; + public static final String crmMemberQuickRsyncQueue = "crm_member_quick_rsync_queue"; + + public static final String titleKeywordRsyncQueue = "title_keyword_rsync_queue"; + + public static final String statusProcessing = "processing"; + public static final String statusWait = "wait"; + public static final String statusFinish = "finish"; + + public static final Integer maxMoveImportTaskQueueCount = 1000; + public static final Integer maxMoveImportTaskQueueCountSelf = 50; + + public static String getQueueIdColumnName(String queueName) { + return queueName.concat("_id"); + } + +} diff --git a/ms-biz/src/main/java/com/ms/api/service/OpOrderRsyncQueueService.java b/ms-biz/src/main/java/com/ms/api/service/OpOrderRsyncQueueService.java index 28b4cb60..a1dcd612 100644 --- a/ms-biz/src/main/java/com/ms/api/service/OpOrderRsyncQueueService.java +++ b/ms-biz/src/main/java/com/ms/api/service/OpOrderRsyncQueueService.java @@ -1,5 +1,7 @@ package com.ms.api.service; +import java.util.List; + import com.ms.dal.entity.OpOrderRsyncQueue; /** @@ -18,4 +20,6 @@ public interface OpOrderRsyncQueueService { int updateByPrimaryKeySelective(OpOrderRsyncQueue record); int updateByPrimaryKey(OpOrderRsyncQueue record); + + OpOrderRsyncQueue lockSolidRedisQueue(Long timerLockId, boolean isAdminSelf); } diff --git a/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderCustomService.java b/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderCustomService.java new file mode 100644 index 00000000..0433658d --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderCustomService.java @@ -0,0 +1,21 @@ +package com.ms.api.service; + +import com.ms.dal.entity.PurchaseOrderCustom; + +/** + * + */ +public interface PurchaseOrderCustomService { + + int deleteByPrimaryKey(Long id); + + int insert(PurchaseOrderCustom record); + + int insertSelective(PurchaseOrderCustom record); + + PurchaseOrderCustom selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(PurchaseOrderCustom record); + + int updateByPrimaryKey(PurchaseOrderCustom record); +} diff --git a/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderDsEncryptService.java b/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderDsEncryptService.java new file mode 100644 index 00000000..ab8402ec --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/service/PurchaseOrderDsEncryptService.java @@ -0,0 +1,21 @@ +package com.ms.api.service; + +import com.ms.dal.entity.PurchaseOrderDsEncrypt; + +/** + * + */ +public interface PurchaseOrderDsEncryptService { + + int deleteByPrimaryKey(Long id); + + int insert(PurchaseOrderDsEncrypt record); + + int insertSelective(PurchaseOrderDsEncrypt record); + + PurchaseOrderDsEncrypt selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(PurchaseOrderDsEncrypt record); + + int updateByPrimaryKey(PurchaseOrderDsEncrypt record); +} diff --git a/ms-biz/src/main/java/com/ms/api/service/QueueService.java b/ms-biz/src/main/java/com/ms/api/service/QueueService.java new file mode 100644 index 00000000..423276be --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/service/QueueService.java @@ -0,0 +1,4 @@ +package com.ms.api.service; + +public interface QueueService { +} diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderRsyncQueueServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderRsyncQueueServiceImpl.java index ad7138b7..528e507d 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderRsyncQueueServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderRsyncQueueServiceImpl.java @@ -1,20 +1,27 @@ package com.ms.api.service.impl; -import com.ms.dal.entity.OpOrderRsyncQueue; +import java.util.Date; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.ms.api.consts.RedisKeyConst; import com.ms.api.service.OpOrderRsyncQueueService; +import com.ms.dal.entity.OpOrderRsyncQueue; import com.ms.dal.mapper.OpOrderRsyncQueueMapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; - /** * */ @Service -public class OpOrderRsyncQueueServiceImpl implements OpOrderRsyncQueueService{ +public class OpOrderRsyncQueueServiceImpl implements OpOrderRsyncQueueService { @Autowired private OpOrderRsyncQueueMapper opOrderRsyncQueueMapper; + @Autowired + private RedisTemplate redisTemplate; @Override public int deleteByPrimaryKey(Long id) { @@ -46,6 +53,30 @@ public class OpOrderRsyncQueueServiceImpl implements OpOrderRsyncQueueService{ return opOrderRsyncQueueMapper.updateByPrimaryKey(record); } + @Override + public OpOrderRsyncQueue lockSolidRedisQueue(Long timerLockId, boolean isAdminSelf) { + String queueRedisKey = RedisKeyConst.getQueueRedisKey("op_order_rsync_queue", isAdminSelf); + String queueIdRedis = redisTemplate.opsForList().rightPop(queueRedisKey); + if (StrUtil.isBlank(queueIdRedis)) { + return null; + } + OpOrderRsyncQueue row = opOrderRsyncQueueMapper.queryFirstRowByQueueId(queueIdRedis); + if (ObjectUtil.isEmpty(row)) { + return null; + } + Date date = new Date(); + row.setLocked(timerLockId); + row.setHostname(""); + row.setGmtLastHeartbeat(date); + row.setGmtModified(date); + row.setGmtLocked(date); + int affectRows = opOrderRsyncQueueMapper.updateByPrimaryKey(row); + if (affectRows == 1) { + return row; + } + return null; + } + } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderCustomServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderCustomServiceImpl.java new file mode 100644 index 00000000..1a0f41b4 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderCustomServiceImpl.java @@ -0,0 +1,53 @@ +package com.ms.api.service.impl; + +import com.ms.dal.entity.PurchaseOrderCustom; +import com.ms.api.service.PurchaseOrderCustomService; +import com.ms.dal.mapper.PurchaseOrderCustomMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * + */ +@Service +public class PurchaseOrderCustomServiceImpl implements PurchaseOrderCustomService{ + + @Autowired + private PurchaseOrderCustomMapper purchaseOrderCustomMapper; + + @Override + public int deleteByPrimaryKey(Long id) { + return purchaseOrderCustomMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(PurchaseOrderCustom record) { + return purchaseOrderCustomMapper.insert(record); + } + + @Override + public int insertSelective(PurchaseOrderCustom record) { + return purchaseOrderCustomMapper.insertSelective(record); + } + + @Override + public PurchaseOrderCustom selectByPrimaryKey(Long id) { + return purchaseOrderCustomMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(PurchaseOrderCustom record) { + return purchaseOrderCustomMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(PurchaseOrderCustom record) { + return purchaseOrderCustomMapper.updateByPrimaryKey(record); + } + +} + + + + diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderDsEncryptServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderDsEncryptServiceImpl.java new file mode 100644 index 00000000..246a0b04 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderDsEncryptServiceImpl.java @@ -0,0 +1,53 @@ +package com.ms.api.service.impl; + +import com.ms.dal.entity.PurchaseOrderDsEncrypt; +import com.ms.api.service.PurchaseOrderDsEncryptService; +import com.ms.dal.mapper.PurchaseOrderDsEncryptMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * + */ +@Service +public class PurchaseOrderDsEncryptServiceImpl implements PurchaseOrderDsEncryptService{ + + @Autowired + private PurchaseOrderDsEncryptMapper purchaseOrderDsEncryptMapper; + + @Override + public int deleteByPrimaryKey(Long id) { + return purchaseOrderDsEncryptMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(PurchaseOrderDsEncrypt record) { + return purchaseOrderDsEncryptMapper.insert(record); + } + + @Override + public int insertSelective(PurchaseOrderDsEncrypt record) { + return purchaseOrderDsEncryptMapper.insertSelective(record); + } + + @Override + public PurchaseOrderDsEncrypt selectByPrimaryKey(Long id) { + return purchaseOrderDsEncryptMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(PurchaseOrderDsEncrypt record) { + return purchaseOrderDsEncryptMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(PurchaseOrderDsEncrypt record) { + return purchaseOrderDsEncryptMapper.updateByPrimaryKey(record); + } + +} + + + + diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/QueueServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/QueueServiceImpl.java new file mode 100644 index 00000000..4d6310f9 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/service/impl/QueueServiceImpl.java @@ -0,0 +1,30 @@ +package com.ms.api.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.ms.api.consts.QueueConst; +import com.ms.api.consts.RedisKeyConst; +import com.ms.api.service.QueueService; +import com.ms.dal.mapper.QueueMapper; +import lombok.AllArgsConstructor; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +@Service +@AllArgsConstructor +public class QueueServiceImpl implements QueueService { + + private final RedisTemplate redisTemplate; + + private final QueueMapper queueMapper; + +// public void lockSolidRedisQueue(Integer timerLockId, String queueName, boolean isAdminSelf) { +// String queueRedisKey = RedisKeyConst.getQueueRedisKey(queueName, isAdminSelf); +// String queueId = redisTemplate.opsForList().rightPop(queueRedisKey); +// if (StrUtil.isBlank(queueId)) { +// return; +// } +// String primaryColumn = QueueConst.getQueueIdColumnName(queueName); +// queueMapper.queryFirstRow("select * from %b where `locked` = 0 and %b = %i"); +// +// } +} diff --git a/ms-biz/src/main/java/com/ms/api/task/RsyncOpTaskService.java b/ms-biz/src/main/java/com/ms/api/task/RsyncOpTaskService.java new file mode 100644 index 00000000..a01d0b72 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/task/RsyncOpTaskService.java @@ -0,0 +1,126 @@ +package com.ms.api.task; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.Executor; +import java.util.stream.Collectors; +import javax.annotation.Resource; + +import cn.hutool.core.util.StrUtil; +import com.ms.api.common.StrObjMap; +import com.ms.api.common.TaskBaseService; +import com.ms.api.consts.RedisKeyConst; +import com.ms.api.service.MoveProductPublishQueueService; +import com.ms.api.service.OpOrderRsyncQueueService; +import com.ms.api.tool.CommonTool; +import com.ms.dal.entity.MoveProductPublishBuffer; +import com.ms.dal.entity.MoveProductPublishQueue; +import com.ms.dal.entity.MoveShopConfig; +import com.ms.dal.entity.OpOrderRsyncQueue; +import com.ms.dal.mapper.OpOrderRsyncQueueMapper; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + +/** + * 将move_product_publish_buffer中的数据 + * 移到move_product_publish_queue中的操作 + */ +@Configuration +@Component +@Slf4j +public class RsyncOpTaskService extends TaskBaseService { + + private static final String TASK_NAME = "RsyncOp"; + + @Autowired + private OpOrderRsyncQueueService opOrderRsyncQueueService; + + + /** + * 同时开启任务处理数量 + */ + @Override + public int getCorePoolSiz() { + return 3; + } + + /** + * 任务管理器名称 + */ + @Override + public String getTaskExecutorName() { + return "rsyncOpTaskPool"; + } + + @Bean(name = "rsyncOpTaskPool") + @Override + public Executor getAsyncExecutor() { + return super.getAsyncExecutor(); + } + + @Resource(name = "rsyncOpTaskPool") + protected Executor taskPool; + + @Override + protected Executor getTaskPool() { + return taskPool; + } + + @Override + public void runTask() { + super.runTask(); + } + + /** + * 获取任务 + */ + @Override + public Object getTask() { + return getBuffer(500); + } + + /** + * 处理任务 + * + * @param params + * @return + */ + @Override + public Object processTask(Object params) { + Map selectMap = (Map) params; + log.info("start moveProductPublishBufferToQueue"); + Map bufferCountMap = bufferToQueue(selectMap); + log.info("end moveProductPublishBufferToQueue ret: " + bufferCountMap.toString()); + return bufferCountMap; + } + + private Map bufferToQueue(Map selectMap) { + return new HashMap(); + } + + /** + * 清理任务 + * + * @param params + */ + @Override + public void clearTask(Object params) { + } + private Map getBuffer(int maxQueueCount) { + log.info("handle {}",TASK_NAME); + return new HashMap<>(); + } + + private void lockRsyncOpQueue(Long timerLockId){ + opOrderRsyncQueueService.lockSolidRedisQueue(timerLockId,false); + } + +} diff --git a/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderCustom.java b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderCustom.java new file mode 100644 index 00000000..958f292b --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderCustom.java @@ -0,0 +1,70 @@ +package com.ms.dal.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * + * @TableName purchase_order_custom + */ +@Data +public class PurchaseOrderCustom implements Serializable { + /** + * + */ + private Long purchaseOrderCustomId; + + /** + * + */ + private Long purchaseOrderId; + + /** + * + */ + private Long shopId; + + /** + * + */ + private BigDecimal customPurchaseOrderPayment; + + /** + * + */ + private String customPurchaseOrderBuyer; + + /** + * + */ + private String customPurchaseOrderSeller; + + /** + * + */ + private Long operateShopId; + + /** + * + */ + private String operateIp; + + /** + * + */ + private String lastPayFailReason; + + /** + * + */ + private Date gmtCreate; + + /** + * + */ + private Date gmtModified; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderDsEncrypt.java b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderDsEncrypt.java new file mode 100644 index 00000000..32b6a8e4 --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderDsEncrypt.java @@ -0,0 +1,64 @@ +package com.ms.dal.entity; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * + * @TableName purchase_order_ds_encrypt + */ +@Data +public class PurchaseOrderDsEncrypt implements Serializable { + /** + * + */ + private Long purchaseOrderDsEncryptId; + + /** + * + */ + private Long shopId; + + /** + * + */ + private String orderId; + + /** + * + */ + private String purchaseOrderSn; + + /** + * + */ + private Boolean isSupportEncryptOrder; + + /** + * + */ + private Byte isEncryptOrder; + + /** + * + */ + private String result; + + /** + * + */ + private String reason; + + /** + * + */ + private Date gmtCreate; + + /** + * + */ + private Date gmtModified; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java index 8c8461ed..6719c732 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java @@ -27,4 +27,6 @@ public interface OpOrderRsyncQueueMapper { List getByShopId(@Param("shopIds") List shopid); int insertUpdate(OpOrderRsyncQueue queueInfo); + + OpOrderRsyncQueue queryFirstRowByQueueId(@Param("queueId") String queueId); } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderCustomMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderCustomMapper.java new file mode 100644 index 00000000..3a2f12bd --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderCustomMapper.java @@ -0,0 +1,26 @@ +package com.ms.dal.mapper; + +import com.ms.dal.entity.PurchaseOrderCustom; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Entity com.ms.dal.entity.PurchaseOrderCustom + */ +@Mapper +public interface PurchaseOrderCustomMapper { + + int deleteByPrimaryKey(Long id); + + int insert(PurchaseOrderCustom record); + + int insertOrUpdate(PurchaseOrderCustom record); + + int insertSelective(PurchaseOrderCustom record); + + PurchaseOrderCustom selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(PurchaseOrderCustom record); + + int updateByPrimaryKey(PurchaseOrderCustom record); + +} diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderDsEncryptMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderDsEncryptMapper.java new file mode 100644 index 00000000..2f753c0d --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderDsEncryptMapper.java @@ -0,0 +1,26 @@ +package com.ms.dal.mapper; + +import com.ms.dal.entity.PurchaseOrderDsEncrypt; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Entity com.ms.dal.entity.PurchaseOrderDsEncrypt + */ +@Mapper +public interface PurchaseOrderDsEncryptMapper { + + int deleteByPrimaryKey(Long id); + + int insert(PurchaseOrderDsEncrypt record); + + int insertOrUpdate(PurchaseOrderDsEncrypt record); + + int insertSelective(PurchaseOrderDsEncrypt record); + + PurchaseOrderDsEncrypt selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(PurchaseOrderDsEncrypt record); + + int updateByPrimaryKey(PurchaseOrderDsEncrypt record); + +} diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/QueueMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/QueueMapper.java new file mode 100644 index 00000000..0df9566e --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/mapper/QueueMapper.java @@ -0,0 +1,8 @@ +package com.ms.dal.mapper; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface QueueMapper { + +} diff --git a/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml b/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml index 9db03b89..7cbfdd42 100644 --- a/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml @@ -51,6 +51,9 @@ + delete from op_order_rsync_queue diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderCustomMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderCustomMapper.xml new file mode 100644 index 00000000..00a66803 --- /dev/null +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderCustomMapper.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + purchase_order_custom_id,purchase_order_id,shop_id, + custom_purchase_order_payment,custom_purchase_order_buyer,custom_purchase_order_seller, + operate_shop_id,operate_ip,last_pay_fail_reason, + gmt_create,gmt_modified + + + + + + delete from purchase_order_custom + where purchase_order_custom_id = #{purchaseOrderCustomId,jdbcType=BIGINT} + + + insert into purchase_order_custom + ( purchase_order_custom_id,purchase_order_id,shop_id + ,custom_purchase_order_payment,custom_purchase_order_buyer,custom_purchase_order_seller + ,operate_shop_id,operate_ip,last_pay_fail_reason + ,gmt_create,gmt_modified) + values (#{purchaseOrderCustomId,jdbcType=BIGINT},#{purchaseOrderId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT} + ,#{customPurchaseOrderPayment,jdbcType=DECIMAL},#{customPurchaseOrderBuyer,jdbcType=VARCHAR},#{customPurchaseOrderSeller,jdbcType=VARCHAR} + ,#{operateShopId,jdbcType=BIGINT},#{operateIp,jdbcType=VARCHAR},#{lastPayFailReason,jdbcType=VARCHAR} + ,#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP}) + + + insert into purchase_order_custom + ( purchase_order_custom_id,purchase_order_id,shop_id + ,custom_purchase_order_payment,custom_purchase_order_buyer,custom_purchase_order_seller + ,operate_shop_id,operate_ip,last_pay_fail_reason + ,gmt_create,gmt_modified) + values (#{purchaseOrderCustomId,jdbcType=BIGINT},#{purchaseOrderId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT} + ,#{customPurchaseOrderPayment,jdbcType=DECIMAL},#{customPurchaseOrderBuyer,jdbcType=VARCHAR},#{customPurchaseOrderSeller,jdbcType=VARCHAR} + ,#{operateShopId,jdbcType=BIGINT},#{operateIp,jdbcType=VARCHAR},#{lastPayFailReason,jdbcType=VARCHAR} + ,#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP}) + ON DUPLICATE KEY UPDATE + purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}, shop_id = #{shopId,jdbcType=BIGINT}, custom_purchase_order_payment = #{customPurchaseOrderPayment,jdbcType=DECIMAL}, custom_purchase_order_buyer = #{customPurchaseOrderBuyer,jdbcType=VARCHAR}, custom_purchase_order_seller = #{customPurchaseOrderSeller,jdbcType=VARCHAR}, operate_shop_id = #{operateShopId,jdbcType=BIGINT}, operate_ip = #{operateIp,jdbcType=VARCHAR}, last_pay_fail_reason = #{lastPayFailReason,jdbcType=VARCHAR}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + + + insert into purchase_order_custom + + purchase_order_custom_id, + purchase_order_id, + shop_id, + custom_purchase_order_payment, + custom_purchase_order_buyer, + custom_purchase_order_seller, + operate_shop_id, + operate_ip, + last_pay_fail_reason, + gmt_create, + gmt_modified, + + + #{purchaseOrderCustomId,jdbcType=BIGINT}, + #{purchaseOrderId,jdbcType=BIGINT}, + #{shopId,jdbcType=BIGINT}, + #{customPurchaseOrderPayment,jdbcType=DECIMAL}, + #{customPurchaseOrderBuyer,jdbcType=VARCHAR}, + #{customPurchaseOrderSeller,jdbcType=VARCHAR}, + #{operateShopId,jdbcType=BIGINT}, + #{operateIp,jdbcType=VARCHAR}, + #{lastPayFailReason,jdbcType=VARCHAR}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + + + update purchase_order_custom + + + purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + custom_purchase_order_payment = #{customPurchaseOrderPayment,jdbcType=DECIMAL}, + + + custom_purchase_order_buyer = #{customPurchaseOrderBuyer,jdbcType=VARCHAR}, + + + custom_purchase_order_seller = #{customPurchaseOrderSeller,jdbcType=VARCHAR}, + + + operate_shop_id = #{operateShopId,jdbcType=BIGINT}, + + + operate_ip = #{operateIp,jdbcType=VARCHAR}, + + + last_pay_fail_reason = #{lastPayFailReason,jdbcType=VARCHAR}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + where purchase_order_custom_id = #{purchaseOrderCustomId,jdbcType=BIGINT} + + + update purchase_order_custom + set + purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}, + shop_id = #{shopId,jdbcType=BIGINT}, + custom_purchase_order_payment = #{customPurchaseOrderPayment,jdbcType=DECIMAL}, + custom_purchase_order_buyer = #{customPurchaseOrderBuyer,jdbcType=VARCHAR}, + custom_purchase_order_seller = #{customPurchaseOrderSeller,jdbcType=VARCHAR}, + operate_shop_id = #{operateShopId,jdbcType=BIGINT}, + operate_ip = #{operateIp,jdbcType=VARCHAR}, + last_pay_fail_reason = #{lastPayFailReason,jdbcType=VARCHAR}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + where purchase_order_custom_id = #{purchaseOrderCustomId,jdbcType=BIGINT} + + diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderDsEncryptMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderDsEncryptMapper.xml new file mode 100644 index 00000000..3086f4bd --- /dev/null +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderDsEncryptMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + purchase_order_ds_encrypt_id,shop_id,order_id, + purchase_order_sn,is_support_encrypt_order,is_encrypt_order, + result,reason,gmt_create, + gmt_modified + + + + + + delete from purchase_order_ds_encrypt + where purchase_order_ds_encrypt_id = #{purchaseOrderDsEncryptId,jdbcType=BIGINT} + + + insert into purchase_order_ds_encrypt + ( purchase_order_ds_encrypt_id,shop_id,order_id + ,purchase_order_sn,is_support_encrypt_order,is_encrypt_order + ,result,reason,gmt_create + ,gmt_modified) + values (#{purchaseOrderDsEncryptId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR} + ,#{purchaseOrderSn,jdbcType=VARCHAR},#{isSupportEncryptOrder,jdbcType=BOOLEAN},#{isEncryptOrder,jdbcType=TINYINT} + ,#{result,jdbcType=VARCHAR},#{reason,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP} + ,#{gmtModified,jdbcType=TIMESTAMP}) + + + insert into purchase_order_ds_encrypt + ( purchase_order_ds_encrypt_id,shop_id,order_id + ,purchase_order_sn,is_support_encrypt_order,is_encrypt_order + ,result,reason,gmt_create + ,gmt_modified) + values (#{purchaseOrderDsEncryptId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR} + ,#{purchaseOrderSn,jdbcType=VARCHAR},#{isSupportEncryptOrder,jdbcType=BOOLEAN},#{isEncryptOrder,jdbcType=TINYINT} + ,#{result,jdbcType=VARCHAR},#{reason,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP} + ,#{gmtModified,jdbcType=TIMESTAMP}) + ON DUPLICATE KEY UPDATE + shop_id = #{shopId,jdbcType=BIGINT}, order_id = #{orderId,jdbcType=VARCHAR}, purchase_order_sn = #{purchaseOrderSn,jdbcType=VARCHAR}, is_support_encrypt_order = #{isSupportEncryptOrder,jdbcType=BOOLEAN}, is_encrypt_order = #{isEncryptOrder,jdbcType=TINYINT}, result = #{result,jdbcType=VARCHAR}, reason = #{reason,jdbcType=VARCHAR}, gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + + + insert into purchase_order_ds_encrypt + + purchase_order_ds_encrypt_id, + shop_id, + order_id, + purchase_order_sn, + is_support_encrypt_order, + is_encrypt_order, + result, + reason, + gmt_create, + gmt_modified, + + + #{purchaseOrderDsEncryptId,jdbcType=BIGINT}, + #{shopId,jdbcType=BIGINT}, + #{orderId,jdbcType=VARCHAR}, + #{purchaseOrderSn,jdbcType=VARCHAR}, + #{isSupportEncryptOrder,jdbcType=BOOLEAN}, + #{isEncryptOrder,jdbcType=TINYINT}, + #{result,jdbcType=VARCHAR}, + #{reason,jdbcType=VARCHAR}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + + + update purchase_order_ds_encrypt + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + order_id = #{orderId,jdbcType=VARCHAR}, + + + purchase_order_sn = #{purchaseOrderSn,jdbcType=VARCHAR}, + + + is_support_encrypt_order = #{isSupportEncryptOrder,jdbcType=BOOLEAN}, + + + is_encrypt_order = #{isEncryptOrder,jdbcType=TINYINT}, + + + result = #{result,jdbcType=VARCHAR}, + + + reason = #{reason,jdbcType=VARCHAR}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + where purchase_order_ds_encrypt_id = #{purchaseOrderDsEncryptId,jdbcType=BIGINT} + + + update purchase_order_ds_encrypt + set + shop_id = #{shopId,jdbcType=BIGINT}, + order_id = #{orderId,jdbcType=VARCHAR}, + purchase_order_sn = #{purchaseOrderSn,jdbcType=VARCHAR}, + is_support_encrypt_order = #{isSupportEncryptOrder,jdbcType=BOOLEAN}, + is_encrypt_order = #{isEncryptOrder,jdbcType=TINYINT}, + result = #{result,jdbcType=VARCHAR}, + reason = #{reason,jdbcType=VARCHAR}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + where purchase_order_ds_encrypt_id = #{purchaseOrderDsEncryptId,jdbcType=BIGINT} + + diff --git a/ms-dal/src/main/resources/mapper/QueueMapper.xml b/ms-dal/src/main/resources/mapper/QueueMapper.xml new file mode 100644 index 00000000..9efd4ad3 --- /dev/null +++ b/ms-dal/src/main/resources/mapper/QueueMapper.xml @@ -0,0 +1,8 @@ + + + + + + From 1469e9f0111d33fc6b9f78edd03ffc24151c089c Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 5 Sep 2023 15:51:09 +0800 Subject: [PATCH 5/6] =?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; From 7fdc878910932c3ca5bcb4350f305d798fc66904 Mon Sep 17 00:00:00 2001 From: laolin <237007180@qq.com> Date: Tue, 5 Sep 2023 15:51:53 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=90=AC=E5=AE=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetCurrentShopMoveSettingService.java | 23 ++++++++---- .../SaveCurrentShopMoveSettingService.java | 37 +++++++++++++++++-- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/GetCurrentShopMoveSettingService.java b/ms-biz/src/main/java/com/ms/api/spi/move/GetCurrentShopMoveSettingService.java index f41ed436..b010c10a 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/GetCurrentShopMoveSettingService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/GetCurrentShopMoveSettingService.java @@ -5,33 +5,40 @@ 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.move.GetCurrentShopMoveSettingRequestDTO; +import com.ms.api.service.MoveShopSettingService; import com.ms.api.tool.DsJsonRequestTemplate; +import com.ms.dal.entity.MoveShopSetting; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import java.util.HashMap; +import java.util.Map; + /** * 获取搬家配置 */ @ExtensionService("getCurrentShopMoveSetting") @Slf4j -public class GetCurrentShopMoveSettingService extends SPIBaseService implements ExtensionServiceHandler { +public class GetCurrentShopMoveSettingService extends SPIBaseService implements ExtensionServiceHandler { @Autowired private DsJsonRequestTemplate dsJsonRequestTemplate; + @Autowired + private MoveShopSettingService moveShopSettingService; @Override - public BaseResponse handle(BaseRequest req) { + public BaseResponse handle(BaseRequest req) { initHandle(req); - // ----参数校验---- - GetCurrentShopMoveSettingRequestDTO fields = req.getData(); - // ----逻辑校验---- - // ----业务处理---- + MoveShopSetting moveShopSettings = moveShopSettingService.getDetailByShopId(shopId); + Map retData = new HashMap(); + retData.put("detail", moveShopSettings); + return R.ok(Ret.success(retData)); + - // ----结果返回---- - return R.ok(); } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/SaveCurrentShopMoveSettingService.java b/ms-biz/src/main/java/com/ms/api/spi/move/SaveCurrentShopMoveSettingService.java index fe2da785..e24bca46 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/SaveCurrentShopMoveSettingService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/SaveCurrentShopMoveSettingService.java @@ -1,5 +1,6 @@ package com.ms.api.spi.move; +import cn.hutool.core.bean.BeanUtil; import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.ExtensionService; @@ -7,10 +8,15 @@ import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.ms.api.common.R; import com.ms.api.common.SPIBaseService; import com.ms.api.dto.move.SaveCurrentShopMoveSettingRequestDTO; +import com.ms.api.service.MoveShopSettingService; import com.ms.api.tool.DsJsonRequestTemplate; +import com.ms.dal.entity.MoveShopSetting; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; +import java.util.List; + /** * 保存搬家配置 * 搬家配置编辑页面,客户可以修改搬家配置 @@ -22,17 +28,40 @@ public class SaveCurrentShopMoveSettingService extends SPIBaseService implements @Autowired private DsJsonRequestTemplate dsJsonRequestTemplate; + @Autowired + private MoveShopSettingService moveShopSettingService; + @Override public BaseResponse handle(BaseRequest req) { initHandle(req); // ----参数校验---- - SaveCurrentShopMoveSettingRequestDTO fields = req.getData(); + SaveCurrentShopMoveSettingRequestDTO fields = req.getData(); - // ----逻辑校验---- + MoveShopSetting moveShopSettings = new MoveShopSetting(); + moveShopSettings.setShopId(shopId); + moveShopSettings.setDeliveryDelayDay(fields.getDeliveryDelayDay()); + moveShopSettings.setAliPriceType(fields.getAliPriceType()); + moveShopSettings.setNoConsignPriceType(fields.getNoConsignPriceType()); + if (fields.getPriceDecimalTypeRedio().equals("priceTail")) { + moveShopSettings.setPriceTail(fields.getPriceTail()); + moveShopSettings.setPriceDecimal(null); + } else if (fields.getPriceDecimalTypeRedio().equals("priceDecimalType")) { + moveShopSettings.setPriceTail(0); + moveShopSettings.setPriceDecimal(fields.getPriceDecimalType()); + } + moveShopSettings.setMoveOnsaleType(fields.getMoveOnsaleType()); + moveShopSettings.setFreightTemplateId(fields.getFreightTemplateId()); + moveShopSettings.setReduceType(fields.getReduceType()); + moveShopSettings.setSupply7dayReturn(fields.getSupply7dayReturn()); - // ----业务处理---- + int moveShopConfigId = fields.getMoveShopConfigId(); + if (moveShopConfigId == 0) { + moveShopSettingService.insertSelective(moveShopSettings); + } else { + moveShopSettings.setMoveShopSettingId(fields.getMoveShopConfigId()); + moveShopSettingService.updateByPrimaryKeySelective(moveShopSettings); + } - // ----结果返回---- return R.ok(); } }