From 804a410f0f9884b58c3edac05a7d9d12c82d3482 Mon Sep 17 00:00:00 2001 From: ljl Date: Fri, 24 Nov 2023 19:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms/api/dto/dsorder/AlibabaMessage.java | 22 ++ .../PurchaseOrderChangeMessageDTO.java | 1 + .../com/ms/biz/consts/Refund1688Const.java | 173 +++++++++++ .../service/RefundPurchaseOrderService.java | 21 ++ .../RefundPurchaseOrderSkuService.java | 21 ++ .../impl/DistributionOrderServiceImpl.java | 6 +- .../service/impl/DsMessageServiceImpl.java | 151 ++++++--- .../impl/RefundPurchaseOrderServiceImpl.java | 53 ++++ .../RefundPurchaseOrderSkuServiceImpl.java | 53 ++++ .../java/com/ms/dal/entity/PurchaseOrder.java | 5 + .../com/ms/dal/entity/PurchaseOrderItem.java | 5 + .../ms/dal/entity/RefundPurchaseOrder.java | 106 +++++++ .../ms/dal/entity/RefundPurchaseOrderSku.java | 66 ++++ .../dal/mapper/RefundPurchaseOrderMapper.java | 28 ++ .../mapper/RefundPurchaseOrderSkuMapper.java | 26 ++ .../mapper/PurchaseOrderItemMapper.xml | 31 +- .../resources/mapper/PurchaseOrderMapper.xml | 21 +- .../mapper/RefundPurchaseOrderMapper.xml | 291 ++++++++++++++++++ .../mapper/RefundPurchaseOrderSkuMapper.xml | 181 +++++++++++ .../main/java/com/ms/web/controller/Test.java | 10 +- 20 files changed, 1202 insertions(+), 69 deletions(-) create mode 100644 ms-api/src/main/java/com/ms/api/dto/dsorder/AlibabaMessage.java create mode 100644 ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderService.java create mode 100644 ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderSkuService.java create mode 100644 ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderServiceImpl.java create mode 100644 ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderSkuServiceImpl.java create mode 100644 ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrder.java create mode 100644 ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrderSku.java create mode 100644 ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderMapper.java create mode 100644 ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderSkuMapper.java create mode 100644 ms-dal/src/main/resources/mapper/RefundPurchaseOrderMapper.xml create mode 100644 ms-dal/src/main/resources/mapper/RefundPurchaseOrderSkuMapper.xml diff --git a/ms-api/src/main/java/com/ms/api/dto/dsorder/AlibabaMessage.java b/ms-api/src/main/java/com/ms/api/dto/dsorder/AlibabaMessage.java new file mode 100644 index 0000000..c6bdb6c --- /dev/null +++ b/ms-api/src/main/java/com/ms/api/dto/dsorder/AlibabaMessage.java @@ -0,0 +1,22 @@ +package com.ms.api.dto.dsorder; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +@Data +public class AlibabaMessage { + private String msgType; + private JSONObject msgData; + + public boolean isRefundAfterMsg() { + return "ORDER_BUYER_VIEW_ORDER_REFUND_AFTER_SALES".equals(msgType); + } + + public boolean isRefundInMsg() { + return "ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES".equals(msgType); + } + + public boolean isRefundMsg() { + return isRefundAfterMsg() || isRefundInMsg(); + } +} diff --git a/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderChangeMessageDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderChangeMessageDTO.java index 5bc610d..d42f22e 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderChangeMessageDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsorder/PurchaseOrderChangeMessageDTO.java @@ -7,4 +7,5 @@ import lombok.EqualsAndHashCode; @Data public class PurchaseOrderChangeMessageDTO extends DsMessageDTO { private PurchaseOrderDTO purchaseOrderInfo; + private AlibabaMessage alibabaMsg; } diff --git a/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java b/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java index a4a172a..d527b49 100644 --- a/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java +++ b/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java @@ -1,6 +1,8 @@ package com.ms.biz.consts; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; public class Refund1688Const { @@ -15,4 +17,175 @@ public class Refund1688Const { public static final String REFUND_STATUS_WAIT_BUYER_SEND = "waitbuyersend"; public static final String REFUND_STATUS_WAIT_SELLER_RECEIVE = "waitsellerreceive"; + + /** + * 买家申请退款 + */ + public static final String ACTION_BUYER_APPLY_REFUND = "BUYER_APPLY_REFUND"; + + /** + * 买家确认收货关闭 + */ + public static final String ACTION_BUYER_RECEIVE_CLOSE = "BUYER_RECEIVE_CLOSE"; + + /** + * 卖家发货关闭 + */ + public static final String ACTION_SELLER_SEND_GOODS_CLOSE = "SELLER_SEND_GOODS_CLOSE"; + + /** + * 买家撤销退款申请关闭 + */ + public static final String ACTION_BUYER_CANCEL_REFUND_CLOSE = "BUYER_CANCEL_REFUND_CLOSE"; + + /** + * 买家上传凭证 + */ + public static final String ACTION_BUYER_UPLOAD_BILL = "BUYER_UPLOAD_BILL"; + + /** + * 卖家上传凭证 + */ + public static final String ACTION_SELLER_UPLOAD_BILL = "SELLER_UPLOAD_BILL"; + + /** + * 卖家拒绝退款 + */ + public static final String ACTION_SELLER_REJECT_REFUND = "SELLER_REJECT_REFUND"; + + /** + * 卖家同意退款 + */ + public static final String ACTION_SELLER_AGREE_REFUND = "SELLER_AGREE_REFUND"; + + /** + * 卖家确认收货 + */ + public static final String ACTION_SELLER_RECEIVE_GOODS = "SELLER_RECEIVE_GOODS"; + + /** + * 买家声明发货 + */ + public static final String ACTION_BUYER_SEND_GOODS = "BUYER_SEND_GOODS"; + + /** + * 买家修改退款协议 + */ + public static final String ACTION_BUYER_MODIFY_REFUND_PROTOCOL = "BUYER_MODIFY_REFUND_PROTOCOL"; + + /** + * 买家申请客服介入 + */ + public static final String ACTION_BUYER_APPLY_SUPPORT = "BUYER_APPLY_SUPPORT"; + + /** + * 卖家申请客服介入 + */ + public static final String ACTION_SELLER_APPLY_SUPPORT = "SELLER_APPLY_SUPPORT"; + + /** + * 系统超时同意退款协议 + */ + public static final String ACTION_SYSTEM_AGREE_REFUND_PROTOCOL = "SYSTEM_AGREE_REFUND_PROTOCOL"; + + /** + * 系统超时同意退款,即退款成功 + */ + public static final String ACTION_SYSTEM_AGREE_REFUND = "SYSTEM_AGREE_REFUND"; + + /** + * 系统超时退货,主交易流程的退货 + */ + public static final String ACTION_SYSTEM_SEND_GOODS = "SYSTEM_SEND_GOODS"; + + /** + * 系统超时修改协议 + */ + public static final String ACTION_SYSTEM_MODIFY_REFUND_PROTOCOL = "SYSTEM_MODIFY_REFUND_PROTOCOL"; + + /** + * 系统通知申请客服介入 + */ + public static final String ACTION_SYSTEM_NOTIFY_APPLY_SUPPORT = "SYSTEM_NOTIFY_APPLY_SUPPORT"; + + /** + * 卖家同意退款协议 + */ + public static final String ACTION_SELLER_AGREE_REFUND_PROCOTOL = "SELLER_AGREE_REFUND_PROCOTOL"; + + /** + * 卖家拒绝退款协议 + */ + public static final String ACTION_SELLER_REJECT_REFUND_PROCOTOL = "SELLER_REJECT_REFUND_PROCOTOL"; + + /** + * 申请客服介入,超时关闭,目前仅售后业务在用 + */ + public static final String ACTION_CRM_APPLY_TIMEOUT_CLOSE = "CRM_APPLY_TIMEOUT_CLOSE"; + + /** + * CRM申请介入 + */ + public static final String ACTION_CRM_APPLY_SUPPORT = "CRM_APPLY_SUPPORT"; + + /** + * CRM介入处理 + */ + public static final String ACTION_CRM_INTERVENE_TASK = "CRM_INTERVENE_TASK"; + + /** + * CRM撤销工单 + */ + public static final String ACTION_CRM_DISMISS_TASK = "CRM_DISMISS_TASK"; + + /** + * CRM完结工单 + */ + public static final String ACTION_CRM_FINISH_TASK = "CRM_FINISH_TASK"; + + /** + * 买家支付,退款关闭,分阶段订单情况 + */ + public static final String ACTION_BUYER_STEP_PAY_ORDER_CLOSE = "BUYER_STEP_PAY_ORDER_CLOSE"; + + /** + * 买家确认,退款关闭,分阶段订单情况 + */ + public static final String ACTION_BUYER_STEP_CONFIRM_CLOSE = "BUYER_STEP_CONFIRM_CLOSE"; + + /** + * 买家终止交易,退款关闭,分阶段订单情况 + */ + public static final String ACTION_BUYER_CLOSE_TRADE_CLOSE = "BUYER_CLOSE_TRADE_CLOSE"; + + /** + * 卖家确认,退款关闭,分阶段订单情况 + */ + public static final String ACTION_SELLER_CONFIRM_ORDER_CLOSE = "SELLER_CONFIRM_ORDER_CLOSE"; + + /** + * 卖家推进,退款关闭,分阶段订单情况 + */ + public static final String ACTION_SELLER_STEP_PUSH_CLOSE = "SELLER_STEP_PUSH_CLOSE"; + + public static boolean isCloseAction(String refundAction) { + List closeActions = Arrays.asList( + ACTION_BUYER_CANCEL_REFUND_CLOSE, + ACTION_CRM_APPLY_TIMEOUT_CLOSE, + ACTION_BUYER_STEP_PAY_ORDER_CLOSE, + ACTION_BUYER_STEP_CONFIRM_CLOSE, + ACTION_BUYER_CLOSE_TRADE_CLOSE, + ACTION_SELLER_CONFIRM_ORDER_CLOSE, + ACTION_SELLER_STEP_PUSH_CLOSE + ); + return closeActions.contains(refundAction); + } + + public static boolean isAgreeRefundAction(String refundAction) { + List closeActions = Arrays.asList( + ACTION_SELLER_AGREE_REFUND, + ACTION_SYSTEM_AGREE_REFUND + ); + return closeActions.contains(refundAction); + } } diff --git a/ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderService.java b/ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderService.java new file mode 100644 index 0000000..cb2244e --- /dev/null +++ b/ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderService.java @@ -0,0 +1,21 @@ +package com.ms.biz.service; + +import com.ms.dal.entity.RefundPurchaseOrder; + +/** + * + */ +public interface RefundPurchaseOrderService { + + int deleteByPrimaryKey(Long id); + + int insert(RefundPurchaseOrder record); + + int insertSelective(RefundPurchaseOrder record); + + RefundPurchaseOrder selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RefundPurchaseOrder record); + + int updateByPrimaryKey(RefundPurchaseOrder record); +} diff --git a/ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderSkuService.java b/ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderSkuService.java new file mode 100644 index 0000000..f981f7d --- /dev/null +++ b/ms-biz/src/main/java/com/ms/biz/service/RefundPurchaseOrderSkuService.java @@ -0,0 +1,21 @@ +package com.ms.biz.service; + +import com.ms.dal.entity.RefundPurchaseOrderSku; + +/** + * + */ +public interface RefundPurchaseOrderSkuService { + + int deleteByPrimaryKey(Long id); + + int insert(RefundPurchaseOrderSku record); + + int insertSelective(RefundPurchaseOrderSku record); + + RefundPurchaseOrderSku selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RefundPurchaseOrderSku record); + + int updateByPrimaryKey(RefundPurchaseOrderSku record); +} diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java index 9b08a92..422e7e6 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java @@ -100,7 +100,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { for (DsSuccessRetDTO successRet: response.getSuccessList()) { for (PurchaseOrderDTO purchaseOrderDTO: successRet.getRelatePurchaseOrderInfos()) { String purOrderId = orderIdAndPurOrderIdMap.get(purchaseOrderDTO.getPlatformOrderId()); - PurchaseOrder purchaseOrder = buildPurchaseOrderByDTO(purchaseOrderDTO, purOrderId); + PurchaseOrder purchaseOrder = buildPurchaseOrderByDTO(shopId, purchaseOrderDTO, purOrderId); purchaseOrders.add(purchaseOrder); List items = buildPurchaseOrderItemsByPurchaseOrderDTO(purchaseOrder, purchaseOrderDTO, purOrderId); purchaseOrderItems.addAll(items); @@ -114,7 +114,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { purchaseOrderItemMapper.insertBatch(purchaseOrderItems); } - private PurchaseOrder buildPurchaseOrderByDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) { + private PurchaseOrder buildPurchaseOrderByDTO(Long shopId, PurchaseOrderDTO purchaseOrderDTO, String purOrderId) { Date purchaseOrderSendTime = null; Date purchaseOrderStartTime = null; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -133,6 +133,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder.setPurchaseOrderId(Long.valueOf(purchaseOrderId)); + purchaseOrder.setShopId(shopId); purchaseOrder.setPurOrderId(purOrderId); purchaseOrder.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId())); purchaseOrder.setPurchasePlatform(purchaseOrderDTO.getPurchasePlatform()); @@ -161,6 +162,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { PurchaseOrderItem item = new PurchaseOrderItem(); item.setPurOrderId(purOrderId); item.setPurchaseOrderId(purchaseOrder.getPurchaseOrderId()); + item.setShopId(purchaseOrder.getShopId()); item.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId())); item.setPurchaseNum(itemDTO.getPurchaseNum()); item.setSkuId(itemDTO.getSkuId()); diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java index 2cf801f..2c338a7 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java @@ -17,6 +17,7 @@ import com.doudian.open.api.supplyCenter_order_syncSupplierInfo.param.SupplyCent import com.doudian.open.api.supplyCenter_refund_operate.param.Address; import com.doudian.open.api.supplyCenter_refund_operate.param.SkuRefundInfosItem; import com.doudian.open.api.supplyCenter_refund_operate.param.SupplyCenterRefundOperateParam; +import com.doudian.open.utils.StringUtil; import com.jinritemai.cloud.base.core.util.AuthThreadLocalUtil; import com.ms.biz.consts.*; import com.ms.biz.quque.Group; @@ -59,6 +60,8 @@ public class DsMessageServiceImpl implements DsMessageService { private PurchaseOrderMapper purchaseOrderMapper; private PurchaseOrderItemMapper purchaseOrderItemMapper; private LogisticsMapper logisticsMapper; + private RefundPurchaseOrderMapper refundPurchaseOrderMapper; + private RefundPurchaseOrderSkuMapper refundPurchaseOrderSkuMapper; @Override public int deleteByPrimaryKey(Long id) { @@ -256,7 +259,9 @@ public class DsMessageServiceImpl implements DsMessageService { String purchaseOrderStatus = purchaseOrderDTO.getPurchaseOrderStatus(); - handlePurchaseOrderRefund(purchaseOrderDTO, purchaseOrder, skuIdAndPlatformPurchaseOrderSkuMap); + if (messageDTO.getAlibabaMsg() != null && messageDTO.getAlibabaMsg().isRefundMsg()) { + handlePurchaseOrderRefund(purchaseOrderDTO, purchaseOrder, messageDTO.getAlibabaMsg()); + } log.error("handleDsMessage purchaseOrderStatus: " + purchaseOrderStatus); @@ -377,10 +382,17 @@ public class DsMessageServiceImpl implements DsMessageService { DDApi.supplyCenterOrderCancel(param); } - private void handlePurchaseOrderRefund(PurchaseOrderDTO purchaseOrderDTO, PurchaseOrder purchaseOrder, Map skuIdAndPlatformPurchaseOrderSkuMap) { - if (purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) { + private void handlePurchaseOrderRefund(PurchaseOrderDTO purchaseOrderDTO, PurchaseOrder purchaseOrder, AlibabaMessage alibabaMessage) { + if (alibabaMessage == null || purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) { return; } + String refundId = (String) alibabaMessage.getMsgData().get("refundId"); + RefundInfoDTO refundInfo = purchaseOrderDTO.getRefundInfo().get(refundId); + if (refundInfo == null) { + throw new RuntimeException("未找到售后信息"); + } + + saveRefundPurchaseOrder(refundInfo, purchaseOrder); Map subItemIdAndSkuIdMap = new HashMap<>(); for (PurchaseOrderItemDTO itemDTO: purchaseOrderDTO.getItems()) { @@ -394,71 +406,110 @@ public class DsMessageServiceImpl implements DsMessageService { SupplyCenterRefundOperateParam param = new SupplyCenterRefundOperateParam(); param.setPurOrderId(purchaseOrder.getPurOrderId()); + List skuRefundInfosItems = new ArrayList<>(); - for (Map.Entry entry: purchaseOrderDTO.getRefundInfo().entrySet()) { - Set subItemIds = entry.getValue().getOrderEntryCountMap().keySet(); - for (String subItemId: subItemIds) { - if (!subItemIdAndSkuIdMap.containsKey(subItemId)) { - log.info("sku unFound, subItemId: " + subItemId + "subItemIdAndSkuIdMap: " + subItemIdAndSkuIdMap); - continue; - } - Long skuId = subItemIdAndSkuIdMap.get(subItemId); - if (!skuIdAndPurSkuOrderIdMap.containsKey(String.valueOf(skuId))) { - log.info("purSkuOrderId unFound skuId: " + skuId + "skuIdAndPurSkuOrderIdMap: " + skuIdAndPurSkuOrderIdMap); - continue; - } - String purSkuOrderId = skuIdAndPurSkuOrderIdMap.get(String.valueOf(skuId)); - SkuRefundInfosItem skuRefundInfosItem = buildSkuRefundInfosItem(purSkuOrderId, entry.getValue()); - skuRefundInfosItems.add(skuRefundInfosItem); + Set subItemIds = refundInfo.getOrderEntryCountMap().keySet(); + for (String subItemId: subItemIds) { + if (!subItemIdAndSkuIdMap.containsKey(subItemId)) { + log.info("sku unFound, subItemId: " + subItemId + "subItemIdAndSkuIdMap: " + subItemIdAndSkuIdMap); + continue; } + Long skuId = subItemIdAndSkuIdMap.get(subItemId); + if (!skuIdAndPurSkuOrderIdMap.containsKey(String.valueOf(skuId))) { + log.info("purSkuOrderId unFound skuId: " + skuId + "skuIdAndPurSkuOrderIdMap: " + skuIdAndPurSkuOrderIdMap); + continue; + } + String purSkuOrderId = skuIdAndPurSkuOrderIdMap.get(String.valueOf(skuId)); + SkuRefundInfosItem skuRefundInfosItem = buildSkuRefundInfosItem(purSkuOrderId, refundInfo, alibabaMessage); + skuRefundInfosItems.add(skuRefundInfosItem); } param.setSkuRefundInfos(skuRefundInfosItems); DDApi.supplyCenterRefundOperate(param); } - private SkuRefundInfosItem buildSkuRefundInfosItem(String purSkuOrderId, RefundInfoDTO refundInfo) { - Address address = new Address(); - address.setUserName(refundInfo.getSellerRealName()); - address.setDetail(refundInfo.getSellerReceiveAddress()); - address.setMobile(refundInfo.getSellerMobile()); + private void saveRefundPurchaseOrder(RefundInfoDTO refundInfo, PurchaseOrder purchaseOrder) { + RefundPurchaseOrder refundPurchaseOrder = refundPurchaseOrderMapper.getByRefundId(refundInfo.getRefundId()); + if (refundPurchaseOrder == null) { + refundPurchaseOrder = new RefundPurchaseOrder(); + refundPurchaseOrder.setGmtCreate(new Date()); + } + refundPurchaseOrder.setOrderId(String.valueOf(purchaseOrder.getOrderId())); + refundPurchaseOrder.setPurOrderId(purchaseOrder.getPurOrderId()); + refundPurchaseOrder.setRefundId(refundInfo.getRefundId()); + refundPurchaseOrder.setOnlyRefund(refundInfo.getOnlyRefund()); + refundPurchaseOrder.setRefundGoods(refundInfo.getRefundGoods()); + refundPurchaseOrder.setRejectReason(refundInfo.getRejectReason() == null ? "" : refundInfo.getRejectReason()); + refundPurchaseOrder.setGoodsReceived(refundInfo.getGoodsReceived() ? 1 : 0); + refundPurchaseOrder.setGoodsStatus(refundInfo.getGoodsStatus()); + refundPurchaseOrder.setShopId(purchaseOrder.getShopId()); + refundPurchaseOrder.setStatus(refundInfo.getStatus()); + refundPurchaseOrder.setSellerMobile(refundInfo.getSellerMobile()); + refundPurchaseOrder.setSellerTel(refundInfo.getSellerTel()); + refundPurchaseOrder.setSellerRealName(refundInfo.getSellerRealName()); + refundPurchaseOrder.setSellerReceiveAddress(refundInfo.getSellerReceiveAddress()); + refundPurchaseOrder.setGmtTimeOut(refundInfo.getGmtTimeOut()); + refundPurchaseOrder.setGmtModified(new Date()); + if (refundPurchaseOrder.getRefundPurchaseOrderId() != null) { + refundPurchaseOrderMapper.insertSelective(refundPurchaseOrder); + } else { + refundPurchaseOrderMapper.updateByPrimaryKeySelective(refundPurchaseOrder); + } + } + + private SkuRefundInfosItem buildSkuRefundInfosItem(String purSkuOrderId, RefundInfoDTO refundInfo, AlibabaMessage alibabaMessage) { SkuRefundInfosItem skuRefundInfosItem = new SkuRefundInfosItem(); skuRefundInfosItem.setPurSkuOrderId(purSkuOrderId); skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason()); - skuRefundInfosItem.setAddress(address); + + if (StringUtil.isNotEmpty(refundInfo.getSellerRealName()) || StringUtil.isNotEmpty(refundInfo.getSellerMobile()) || StringUtil.isNotEmpty(refundInfo.getSellerReceiveAddress())) { + Address address = new Address(); + address.setUserName(refundInfo.getSellerRealName()); + address.setDetail(refundInfo.getSellerReceiveAddress()); + address.setMobile(refundInfo.getSellerMobile()); + skuRefundInfosItem.setAddress(address); + } skuRefundInfosItem.setCloseReason(""); - skuRefundInfosItem.setOperationType(getOperateType(refundInfo)); - skuRefundInfosItem.setAftersaleType(getAftersaleType(refundInfo)); + skuRefundInfosItem.setOperationType(getOperateType(refundInfo, alibabaMessage)); + skuRefundInfosItem.setAftersaleType(getAftersaleType(refundInfo, alibabaMessage)); return skuRefundInfosItem; } - private int getOperateType(RefundInfoDTO refundInfo) { - int operateType = 0; - if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_SELLER_AGREE)) { - operateType = 0; - } else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_BUYER_SEND)) { - operateType = 2; - } else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_SELLER_RECEIVE)) { - operateType = 2; - } else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_SUCCESS)) { - operateType = 1; - } else if (refundInfo.getOnlyRefund() == 0 && refundInfo.getGoodsStatus() == 3 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_SUCCESS)) { - operateType = 6; - } else if (refundInfo.getOnlyRefund() == 0 && refundInfo.getGoodsStatus() == 3 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) { - operateType = 7; - } else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) { - operateType = 3; - } else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) { - operateType = 5; - } - return operateType; + private int getOperateType(RefundInfoDTO refundInfo, AlibabaMessage alibabaMessage) { + JSONObject msgData = alibabaMessage.getMsgData(); + String refundAction = (String) msgData.get("refundAction"); + if (refundAction.equals(Refund1688Const.ACTION_BUYER_APPLY_REFUND)) { + return 0; + } + if (Refund1688Const.isCloseAction(refundAction)) { + return 5; + } + if (refundAction.equals(Refund1688Const.ACTION_SELLER_AGREE_REFUND_PROCOTOL)) { + return 2; + } + if (refundInfo.getGoodsStatus() == 3 && refundAction.equals(Refund1688Const.ACTION_SELLER_REJECT_REFUND)) { + return 7; + } + if (refundInfo.getGoodsStatus() == 3 && Refund1688Const.isAgreeRefundAction(refundAction)) { + return 4; + } + if (refundAction.equals(Refund1688Const.ACTION_BUYER_SEND_GOODS)) { + return 6; + } + if (Refund1688Const.isAgreeRefundAction(refundAction)) { + return 1; + } + if (refundAction.equals(Refund1688Const.ACTION_SELLER_REJECT_REFUND)) { + return 3; + } } - private int getAftersaleType(RefundInfoDTO refundInfo) { - if (refundInfo.getOnlyRefund() == 1 && refundInfo.getGoodsReceived()) { - return 1; - } else if (refundInfo.getOnlyRefund() == 1) { + private int getAftersaleType(RefundInfoDTO refundInfo, AlibabaMessage alibabaMessage) { + if (alibabaMessage.isRefundInMsg() && refundInfo.getOnlyRefund() == 1) { return 2; } + if (alibabaMessage.isRefundAfterMsg() && refundInfo.getOnlyRefund() == 1) { + return 1; + } return 3; } diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderServiceImpl.java new file mode 100644 index 0000000..ccca187 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderServiceImpl.java @@ -0,0 +1,53 @@ +package com.ms.biz.service.impl; + +import com.ms.dal.entity.RefundPurchaseOrder; +import com.ms.dal.service.RefundPurchaseOrderService; +import com.ms.dal.mapper.RefundPurchaseOrderMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * + */ +@Service +public class RefundPurchaseOrderServiceImpl implements RefundPurchaseOrderService{ + + @Autowired + private RefundPurchaseOrderMapper refundPurchaseOrderMapper; + + @Override + public int deleteByPrimaryKey(Long id) { + return refundPurchaseOrderMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(RefundPurchaseOrder record) { + return refundPurchaseOrderMapper.insert(record); + } + + @Override + public int insertSelective(RefundPurchaseOrder record) { + return refundPurchaseOrderMapper.insertSelective(record); + } + + @Override + public RefundPurchaseOrder selectByPrimaryKey(Long id) { + return refundPurchaseOrderMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(RefundPurchaseOrder record) { + return refundPurchaseOrderMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(RefundPurchaseOrder record) { + return refundPurchaseOrderMapper.updateByPrimaryKey(record); + } + +} + + + + diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderSkuServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderSkuServiceImpl.java new file mode 100644 index 0000000..dfc71a4 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/RefundPurchaseOrderSkuServiceImpl.java @@ -0,0 +1,53 @@ +package com.ms.biz.service.impl; + +import com.ms.dal.entity.RefundPurchaseOrderSku; +import com.ms.dal.service.RefundPurchaseOrderSkuService; +import com.ms.dal.mapper.RefundPurchaseOrderSkuMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * + */ +@Service +public class RefundPurchaseOrderSkuServiceImpl implements RefundPurchaseOrderSkuService{ + + @Autowired + private RefundPurchaseOrderSkuMapper refundPurchaseOrderSkuMapper; + + @Override + public int deleteByPrimaryKey(Long id) { + return refundPurchaseOrderSkuMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(RefundPurchaseOrderSku record) { + return refundPurchaseOrderSkuMapper.insert(record); + } + + @Override + public int insertSelective(RefundPurchaseOrderSku record) { + return refundPurchaseOrderSkuMapper.insertSelective(record); + } + + @Override + public RefundPurchaseOrderSku selectByPrimaryKey(Long id) { + return refundPurchaseOrderSkuMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(RefundPurchaseOrderSku record) { + return refundPurchaseOrderSkuMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(RefundPurchaseOrderSku record) { + return refundPurchaseOrderSkuMapper.updateByPrimaryKey(record); + } + +} + + + + diff --git a/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrder.java b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrder.java index e8d642c..4a1ce10 100644 --- a/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrder.java +++ b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrder.java @@ -18,6 +18,11 @@ public class PurchaseOrder implements Serializable { */ private Long purchaseOrderId; + /** + * 店铺ID + */ + private Long shopId; + /** * 选品采购单号 */ diff --git a/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderItem.java b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderItem.java index 2ba2f9b..afddb32 100644 --- a/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderItem.java +++ b/ms-dal/src/main/java/com/ms/dal/entity/PurchaseOrderItem.java @@ -23,6 +23,11 @@ public class PurchaseOrderItem implements Serializable { */ private Long purchaseOrderId; + /** + * 店铺ID + */ + private Long shopId; + /** * 选品采购单号 */ diff --git a/ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrder.java b/ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrder.java new file mode 100644 index 0000000..88ab928 --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrder.java @@ -0,0 +1,106 @@ +package com.ms.dal.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 退款单表 + * @TableName refund_purchase_order + */ + +@Data +public class RefundPurchaseOrder implements Serializable { + /** + * + */ + private Long refundPurchaseOrderId; + + /** + * 退款单号 + */ + private String refundId; + + /** + * 选品采购单号 + */ + private String purOrderId; + + /** + * 订单id + */ + private String orderId; + + /** + * 店铺id + */ + private Long shopId; + + /** + * 拒绝原因 + */ + private String rejectReason; + + /** + * 仅退款 + */ + private Integer onlyRefund; + + /** + * 是否要求退货 + */ + private Integer refundGoods; + + /** + * 买家是否已收到货 + */ + private Integer goodsReceived; + + /** + * 1:买家未收到货 2:买家已收到货 3:买家已退货 + */ + private Integer goodsStatus; + + /** + * 卖家手机号 + */ + private String sellerMobile; + + /** + * 卖家电话 + */ + private String sellerTel; + + /** + * 卖家姓名 + */ + private String sellerRealName; + + /** + * 卖家地址 + */ + private String sellerReceiveAddress; + + /** + * 超时时间 + */ + private Date gmtTimeOut; + + /** + * 采购单状态 + */ + private String status; + + /** + * 创建时间 + */ + 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/RefundPurchaseOrderSku.java b/ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrderSku.java new file mode 100644 index 0000000..ae8f12d --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/entity/RefundPurchaseOrderSku.java @@ -0,0 +1,66 @@ +package com.ms.dal.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 退款子单表 + * @TableName refund_purchase_order_sku + */ + +@Data +public class RefundPurchaseOrderSku implements Serializable { + /** + * + */ + private Long refundPurchaseOrderSkuId; + + /** + * 退款单号 + */ + private String refundId; + + /** + * 店铺id + */ + private Long shopId; + + /** + * 选品采购单号 + */ + private String purOrderId; + + /** + * 采购子单 + */ + private String purSkuOrderId; + + /** + * 订单id + */ + private String orderId; + + /** + * 1688采购子单号 + */ + private String subItemId; + + /** + * sku数量 + */ + private Integer num; + + /** + * 创建时间 + */ + 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/RefundPurchaseOrderMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderMapper.java new file mode 100644 index 0000000..7a2dccb --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderMapper.java @@ -0,0 +1,28 @@ +package com.ms.dal.mapper; + +import com.ms.dal.entity.RefundPurchaseOrder; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @Entity com.ms.dal.entity.RefundPurchaseOrder + */ +@Mapper +public interface RefundPurchaseOrderMapper { + + int deleteByPrimaryKey(Long id); + + int insert(RefundPurchaseOrder record); + + int insertOrUpdate(RefundPurchaseOrder record); + + int insertSelective(RefundPurchaseOrder record); + + RefundPurchaseOrder selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RefundPurchaseOrder record); + + int updateByPrimaryKey(RefundPurchaseOrder record); + + RefundPurchaseOrder getByRefundId(@Param("refundId") String refundId); +} diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderSkuMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderSkuMapper.java new file mode 100644 index 0000000..8e138e0 --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/mapper/RefundPurchaseOrderSkuMapper.java @@ -0,0 +1,26 @@ +package com.ms.dal.mapper; + +import com.ms.dal.entity.RefundPurchaseOrderSku; +import org.apache.ibatis.annotations.Mapper; + +/** + * @Entity com.ms.dal.entity.RefundPurchaseOrderSku + */ +@Mapper +public interface RefundPurchaseOrderSkuMapper { + + int deleteByPrimaryKey(Long id); + + int insert(RefundPurchaseOrderSku record); + + int insertOrUpdate(RefundPurchaseOrderSku record); + + int insertSelective(RefundPurchaseOrderSku record); + + RefundPurchaseOrderSku selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(RefundPurchaseOrderSku record); + + int updateByPrimaryKey(RefundPurchaseOrderSku record); + +} diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml index 8371242..1c2753d 100644 --- a/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml @@ -7,6 +7,7 @@ + @@ -21,8 +22,8 @@ - purchase_order_item_id,purchase_order_id,pur_order_id, - sub_item_id,order_id,ware_id,sku_id, + purchase_order_item_id,purchase_order_id,shop_id, + pur_order_id,sub_item_id,order_id,ware_id,sku_id, purchase_url,purchase_price,purchase_num, status,gmt_create,gmt_modified @@ -46,13 +47,13 @@ insert into purchase_order_item - ( purchase_order_item_id,purchase_order_id,pur_order_id - ,sub_item_id,order_id,ware_id,sku_id + ( purchase_order_item_id,purchase_order_id,shop_id + ,pur_order_id,sub_item_id,order_id,ware_id,sku_id ,purchase_url,purchase_price,purchase_num ,status,gmt_create,gmt_modified ) - values (#{purchaseOrderItemId,jdbcType=BIGINT},#{purchaseOrderId,jdbcType=BIGINT},#{purOrderId,jdbcType=VARCHAR} - ,#{subItemId,jdbcType=VARCHAR},#{orderId,jdbcType=BIGINT},#{wareId,jdbcType=BIGINT},#{skuId,jdbcType=BIGINT} + values (#{purchaseOrderItemId,jdbcType=BIGINT},#{purchaseOrderId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT} + ,#{purOrderId,jdbcType=VARCHAR},#{subItemId,jdbcType=VARCHAR},#{orderId,jdbcType=BIGINT},#{wareId,jdbcType=BIGINT},#{skuId,jdbcType=BIGINT} ,#{purchaseUrl,jdbcType=VARCHAR},#{purchasePrice,jdbcType=DECIMAL},#{purchaseNum,jdbcType=SMALLINT} ,#{status,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP} ) @@ -63,6 +64,7 @@ purchase_order_item_id, purchase_order_id, + shop_id, pur_order_id, sub_item_id, order_id, @@ -78,6 +80,7 @@ #{purchaseOrderItemId,jdbcType=BIGINT}, #{purchaseOrderId,jdbcType=BIGINT}, + #{shopId,jdbcType=BIGINT}, #{purOrderId,jdbcType=VARCHAR}, #{subItemId,jdbcType=VARCHAR}, #{orderId,jdbcType=BIGINT}, @@ -95,6 +98,9 @@ purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}, + + shop_id = #{shopId,jdbcType=BIGINT}, + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, @@ -135,6 +141,7 @@ purchase_order_item_id, purchase_order_id, + shop_id, pur_order_id, sub_item_id, order_id, @@ -150,6 +157,7 @@ #{purchaseOrderItemId,jdbcType=BIGINT}, #{purchaseOrderId,jdbcType=BIGINT}, + #{shopId,jdbcType=BIGINT}, #{purOrderId,jdbcType=VARCHAR}, #{subItemId,jdbcType=VARCHAR}, #{orderId,jdbcType=BIGINT}, @@ -169,6 +177,9 @@ purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}, + + shop_id = #{shopId,jdbcType=BIGINT}, + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, @@ -209,6 +220,7 @@ update purchase_order_item set purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}, + shop_id = #{shopId,jdbcType=BIGINT}, pur_order_id = #{purOrderId,jdbcType=VARCHAR}, sub_item_id = #{subItemId,jdbcType=VARCHAR}, order_id = #{orderId,jdbcType=BIGINT}, @@ -224,13 +236,14 @@ insert into purchase_order_item - (purchase_order_item_id,purchase_order_id,sub_item_id - ,order_id,pur_order_id,ware_id,sku_id,purchase_url + (purchase_order_item_id,purchase_order_id,shop_id + ,sub_item_id,order_id,pur_order_id,ware_id,sku_id,purchase_url ,purchase_price,purchase_num,status ,gmt_create,gmt_modified) values - (#{item.purchaseOrderItemId,jdbcType=BIGINT},#{item.purchaseOrderId,jdbcType=BIGINT},#{item.subItemId,jdbcType=VARCHAR},#{item.orderId,jdbcType=BIGINT} + (#{item.purchaseOrderItemId,jdbcType=BIGINT},#{item.purchaseOrderId,jdbcType=BIGINT},#{item.shopId,jdbcType=BIGINT} + ,#{item.subItemId,jdbcType=VARCHAR},#{item.orderId,jdbcType=BIGINT} ,#{item.purOrderId,jdbcType=VARCHAR},#{item.wareId,jdbcType=BIGINT},#{item.skuId,jdbcType=BIGINT},#{item.purchaseUrl,jdbcType=VARCHAR} ,#{item.purchasePrice,jdbcType=DECIMAL},#{item.purchaseNum,jdbcType=SMALLINT},#{item.status,jdbcType=VARCHAR} ,#{item.gmtCreate,jdbcType=TIMESTAMP},#{item.gmtModified,jdbcType=TIMESTAMP}) diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml index 10fe90e..9ffe860 100644 --- a/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml @@ -6,6 +6,7 @@ + @@ -28,7 +29,7 @@ - purchase_order_id,pur_order_id,order_id, + purchase_order_id,shop_id,pur_order_id,order_id, purchase_platform,purchase_order_sn,purchase_order_buyer, purchase_order_seller,purchase_order_payment,purchase_order_status, purchase_order_logistics_name,purchase_order_waybill_code,purchase_order_send_time, @@ -62,14 +63,14 @@ insert into purchase_order - ( purchase_order_id,pur_order_id,order_id + ( purchase_order_id,shop_id,pur_order_id,order_id ,purchase_platform,purchase_order_sn,purchase_order_buyer ,purchase_order_seller,purchase_order_payment,purchase_order_status ,purchase_order_logistics_name,purchase_order_waybill_code,purchase_order_send_time ,purchase_order_fullname,purchase_order_mobile,purchase_order_full_address ,purchase_order_start_time,logistics_is_accept,status ,gmt_create,gmt_modified) - values (#{purchaseOrderId,jdbcType=BIGINT},#{purOrderId,jdbcType=VARCHAR},#{orderId,jdbcType=BIGINT} + values (#{purchaseOrderId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT},#{purOrderId,jdbcType=VARCHAR},#{orderId,jdbcType=BIGINT} ,#{purchasePlatform,jdbcType=VARCHAR},#{purchaseOrderSn,jdbcType=VARCHAR},#{purchaseOrderBuyer,jdbcType=VARCHAR} ,#{purchaseOrderSeller,jdbcType=VARCHAR},#{purchaseOrderPayment,jdbcType=DECIMAL},#{purchaseOrderStatus,jdbcType=VARCHAR} ,#{purchaseOrderLogisticsName,jdbcType=VARCHAR},#{purchaseOrderWaybillCode,jdbcType=VARCHAR},#{purchaseOrderSendTime,jdbcType=TIMESTAMP} @@ -82,6 +83,7 @@ insert into purchase_order purchase_order_id, + shop_id, pur_order_id, order_id, purchase_platform, @@ -104,6 +106,7 @@ #{purchaseOrderId,jdbcType=BIGINT}, + #{shopId,jdbcType=BIGINT}, #{purOrderId,jdbcType=VARCHAR}, #{orderId,jdbcType=BIGINT}, #{purchasePlatform,jdbcType=VARCHAR}, @@ -189,6 +192,7 @@ insert into purchase_order purchase_order_id, + shop_id, pur_order_id, order_id, purchase_platform, @@ -211,6 +215,7 @@ #{purchaseOrderId,jdbcType=BIGINT}, + #{shopId,jdbcType=BIGINT}, #{purOrderId,jdbcType=VARCHAR}, #{orderId,jdbcType=BIGINT}, #{purchasePlatform,jdbcType=VARCHAR}, @@ -235,6 +240,9 @@ update purchase_order + + shop_id = #{shopId,jdbcType=BIGINT}, + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, @@ -297,7 +305,8 @@ update purchase_order - set + set + shop_id = #{shopId,jdbcType=BIGINT}, pur_order_id = #{purOrderId,jdbcType=VARCHAR}, order_id = #{orderId,jdbcType=BIGINT}, purchase_platform = #{purchasePlatform,jdbcType=VARCHAR}, @@ -321,7 +330,7 @@ insert into purchase_order - (purchase_order_id,order_id,purchase_platform,pur_order_id + (purchase_order_id,shop_id,order_id,purchase_platform,pur_order_id ,purchase_order_sn,purchase_order_buyer,purchase_order_seller ,purchase_order_payment,purchase_order_status,purchase_order_logistics_name ,purchase_order_waybill_code,purchase_order_send_time,purchase_order_fullname @@ -330,7 +339,7 @@ ,gmt_modified) values - (#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.purchasePlatform,jdbcType=VARCHAR},#{item.purOrderId,jdbcType=VARCHAR} + (#{item.purchaseOrderId,jdbcType=BIGINT},#{item.shopId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.purchasePlatform,jdbcType=VARCHAR},#{item.purOrderId,jdbcType=VARCHAR} ,#{item.purchaseOrderSn,jdbcType=VARCHAR},#{item.purchaseOrderBuyer,jdbcType=VARCHAR},#{item.purchaseOrderSeller,jdbcType=VARCHAR} ,#{item.purchaseOrderPayment,jdbcType=DECIMAL},#{item.purchaseOrderStatus,jdbcType=VARCHAR},#{item.purchaseOrderLogisticsName,jdbcType=VARCHAR} ,#{item.purchaseOrderWaybillCode,jdbcType=VARCHAR},#{item.purchaseOrderSendTime,jdbcType=TIMESTAMP},#{item.purchaseOrderFullname,jdbcType=VARCHAR} diff --git a/ms-dal/src/main/resources/mapper/RefundPurchaseOrderMapper.xml b/ms-dal/src/main/resources/mapper/RefundPurchaseOrderMapper.xml new file mode 100644 index 0000000..c1c958a --- /dev/null +++ b/ms-dal/src/main/resources/mapper/RefundPurchaseOrderMapper.xml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + refund_purchase_order_id,refund_id,pur_order_id, + order_id,shop_id,reject_reason, + only_refund,refund_goods,goods_received, + goods_status,seller_mobile,seller_tel, + seller_real_name,seller_receive_address,gmt_time_out, + status,gmt_create,gmt_modified + + + + + + + delete from refund_purchase_order + where refund_purchase_order_id = #{refundPurchaseOrderId,jdbcType=BIGINT} + + + insert into refund_purchase_order + ( refund_purchase_order_id,refund_id,pur_order_id + ,order_id,shop_id,reject_reason + ,only_refund,refund_goods,goods_received + ,goods_status,seller_mobile,seller_tel + ,seller_real_name,seller_receive_address,gmt_time_out + ,status,gmt_create,gmt_modified + ) + values (#{refundPurchaseOrderId,jdbcType=BIGINT},#{refundId,jdbcType=VARCHAR},#{purOrderId,jdbcType=VARCHAR} + ,#{orderId,jdbcType=VARCHAR},#{shopId,jdbcType=BIGINT},#{rejectReason,jdbcType=VARCHAR} + ,#{onlyRefund,jdbcType=TINYINT},#{refundGoods,jdbcType=TINYINT},#{goodsReceived,jdbcType=TINYINT} + ,#{goodsStatus,jdbcType=TINYINT},#{sellerMobile,jdbcType=VARCHAR},#{sellerTel,jdbcType=VARCHAR} + ,#{sellerRealName,jdbcType=VARCHAR},#{sellerReceiveAddress,jdbcType=VARCHAR},#{gmtTimeOut,jdbcType=TIMESTAMP} + ,#{status,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP} + ) + + + insert into refund_purchase_order + + refund_purchase_order_id, + refund_id, + pur_order_id, + order_id, + shop_id, + reject_reason, + only_refund, + refund_goods, + goods_received, + goods_status, + seller_mobile, + seller_tel, + seller_real_name, + seller_receive_address, + gmt_time_out, + status, + gmt_create, + gmt_modified, + + + #{refundPurchaseOrderId,jdbcType=BIGINT}, + #{refundId,jdbcType=VARCHAR}, + #{purOrderId,jdbcType=VARCHAR}, + #{orderId,jdbcType=VARCHAR}, + #{shopId,jdbcType=BIGINT}, + #{rejectReason,jdbcType=VARCHAR}, + #{onlyRefund,jdbcType=TINYINT}, + #{refundGoods,jdbcType=TINYINT}, + #{goodsReceived,jdbcType=TINYINT}, + #{goodsStatus,jdbcType=TINYINT}, + #{sellerMobile,jdbcType=VARCHAR}, + #{sellerTel,jdbcType=VARCHAR}, + #{sellerRealName,jdbcType=VARCHAR}, + #{sellerReceiveAddress,jdbcType=VARCHAR}, + #{gmtTimeOut,jdbcType=TIMESTAMP}, + #{status,jdbcType=VARCHAR}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + ON DUPLICATE KEY UPDATE + + + refund_id = #{refundId,jdbcType=VARCHAR}, + + + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, + + + order_id = #{orderId,jdbcType=VARCHAR}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + reject_reason = #{rejectReason,jdbcType=VARCHAR}, + + + only_refund = #{onlyRefund,jdbcType=TINYINT}, + + + refund_goods = #{refundGoods,jdbcType=TINYINT}, + + + goods_received = #{goodsReceived,jdbcType=TINYINT}, + + + goods_status = #{goodsStatus,jdbcType=TINYINT}, + + + seller_mobile = #{sellerMobile,jdbcType=VARCHAR}, + + + seller_tel = #{sellerTel,jdbcType=VARCHAR}, + + + seller_real_name = #{sellerRealName,jdbcType=VARCHAR}, + + + seller_receive_address = #{sellerReceiveAddress,jdbcType=VARCHAR}, + + + gmt_time_out = #{gmtTimeOut,jdbcType=TIMESTAMP}, + + + status = #{status,jdbcType=VARCHAR}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + + + insert into refund_purchase_order + + refund_purchase_order_id, + refund_id, + pur_order_id, + order_id, + shop_id, + reject_reason, + only_refund, + refund_goods, + goods_received, + goods_status, + seller_mobile, + seller_tel, + seller_real_name, + seller_receive_address, + gmt_time_out, + status, + gmt_create, + gmt_modified, + + + #{refundPurchaseOrderId,jdbcType=BIGINT}, + #{refundId,jdbcType=VARCHAR}, + #{purOrderId,jdbcType=VARCHAR}, + #{orderId,jdbcType=VARCHAR}, + #{shopId,jdbcType=BIGINT}, + #{rejectReason,jdbcType=VARCHAR}, + #{onlyRefund,jdbcType=TINYINT}, + #{refundGoods,jdbcType=TINYINT}, + #{goodsReceived,jdbcType=TINYINT}, + #{goodsStatus,jdbcType=TINYINT}, + #{sellerMobile,jdbcType=VARCHAR}, + #{sellerTel,jdbcType=VARCHAR}, + #{sellerRealName,jdbcType=VARCHAR}, + #{sellerReceiveAddress,jdbcType=VARCHAR}, + #{gmtTimeOut,jdbcType=TIMESTAMP}, + #{status,jdbcType=VARCHAR}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + + + update refund_purchase_order + + + refund_id = #{refundId,jdbcType=VARCHAR}, + + + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, + + + order_id = #{orderId,jdbcType=VARCHAR}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + reject_reason = #{rejectReason,jdbcType=VARCHAR}, + + + only_refund = #{onlyRefund,jdbcType=TINYINT}, + + + refund_goods = #{refundGoods,jdbcType=TINYINT}, + + + goods_received = #{goodsReceived,jdbcType=TINYINT}, + + + goods_status = #{goodsStatus,jdbcType=TINYINT}, + + + seller_mobile = #{sellerMobile,jdbcType=VARCHAR}, + + + seller_tel = #{sellerTel,jdbcType=VARCHAR}, + + + seller_real_name = #{sellerRealName,jdbcType=VARCHAR}, + + + seller_receive_address = #{sellerReceiveAddress,jdbcType=VARCHAR}, + + + gmt_time_out = #{gmtTimeOut,jdbcType=TIMESTAMP}, + + + status = #{status,jdbcType=VARCHAR}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + where refund_purchase_order_id = #{refundPurchaseOrderId,jdbcType=BIGINT} + + + update refund_purchase_order + set + refund_id = #{refundId,jdbcType=VARCHAR}, + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, + order_id = #{orderId,jdbcType=VARCHAR}, + shop_id = #{shopId,jdbcType=BIGINT}, + reject_reason = #{rejectReason,jdbcType=VARCHAR}, + only_refund = #{onlyRefund,jdbcType=TINYINT}, + refund_goods = #{refundGoods,jdbcType=TINYINT}, + goods_received = #{goodsReceived,jdbcType=TINYINT}, + goods_status = #{goodsStatus,jdbcType=TINYINT}, + seller_mobile = #{sellerMobile,jdbcType=VARCHAR}, + seller_tel = #{sellerTel,jdbcType=VARCHAR}, + seller_real_name = #{sellerRealName,jdbcType=VARCHAR}, + seller_receive_address = #{sellerReceiveAddress,jdbcType=VARCHAR}, + gmt_time_out = #{gmtTimeOut,jdbcType=TIMESTAMP}, + status = #{status,jdbcType=VARCHAR}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + where refund_purchase_order_id = #{refundPurchaseOrderId,jdbcType=BIGINT} + + diff --git a/ms-dal/src/main/resources/mapper/RefundPurchaseOrderSkuMapper.xml b/ms-dal/src/main/resources/mapper/RefundPurchaseOrderSkuMapper.xml new file mode 100644 index 0000000..fe8724f --- /dev/null +++ b/ms-dal/src/main/resources/mapper/RefundPurchaseOrderSkuMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + refund_purchase_order_sku_id,refund_id,shop_id, + pur_order_id,pur_sku_order_id,order_id, + sub_item_id,num,gmt_create, + gmt_modified + + + + + + delete from refund_purchase_order_sku + where refund_purchase_order_sku_id = #{refundPurchaseOrderSkuId,jdbcType=BIGINT} + + + insert into refund_purchase_order_sku + ( refund_purchase_order_sku_id,refund_id,shop_id + ,pur_order_id,pur_sku_order_id,order_id + ,sub_item_id,num,gmt_create + ,gmt_modified) + values (#{refundPurchaseOrderSkuId,jdbcType=BIGINT},#{refundId,jdbcType=VARCHAR},#{shopId,jdbcType=BIGINT} + ,#{purOrderId,jdbcType=VARCHAR},#{purSkuOrderId,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR} + ,#{subItemId,jdbcType=VARCHAR},#{num,jdbcType=INTEGER},#{gmtCreate,jdbcType=TIMESTAMP} + ,#{gmtModified,jdbcType=TIMESTAMP}) + + + insert into refund_purchase_order_sku + + refund_purchase_order_sku_id, + refund_id, + shop_id, + pur_order_id, + pur_sku_order_id, + order_id, + sub_item_id, + num, + gmt_create, + gmt_modified, + + + #{refundPurchaseOrderSkuId,jdbcType=BIGINT}, + #{refundId,jdbcType=VARCHAR}, + #{shopId,jdbcType=BIGINT}, + #{purOrderId,jdbcType=VARCHAR}, + #{purSkuOrderId,jdbcType=VARCHAR}, + #{orderId,jdbcType=VARCHAR}, + #{subItemId,jdbcType=VARCHAR}, + #{num,jdbcType=INTEGER}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + ON DUPLICATE KEY UPDATE + + + refund_id = #{refundId,jdbcType=VARCHAR}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, + + + pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR}, + + + order_id = #{orderId,jdbcType=VARCHAR}, + + + sub_item_id = #{subItemId,jdbcType=VARCHAR}, + + + num = #{num,jdbcType=INTEGER}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + + + insert into refund_purchase_order_sku + + refund_purchase_order_sku_id, + refund_id, + shop_id, + pur_order_id, + pur_sku_order_id, + order_id, + sub_item_id, + num, + gmt_create, + gmt_modified, + + + #{refundPurchaseOrderSkuId,jdbcType=BIGINT}, + #{refundId,jdbcType=VARCHAR}, + #{shopId,jdbcType=BIGINT}, + #{purOrderId,jdbcType=VARCHAR}, + #{purSkuOrderId,jdbcType=VARCHAR}, + #{orderId,jdbcType=VARCHAR}, + #{subItemId,jdbcType=VARCHAR}, + #{num,jdbcType=INTEGER}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + + + update refund_purchase_order_sku + + + refund_id = #{refundId,jdbcType=VARCHAR}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, + + + pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR}, + + + order_id = #{orderId,jdbcType=VARCHAR}, + + + sub_item_id = #{subItemId,jdbcType=VARCHAR}, + + + num = #{num,jdbcType=INTEGER}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + where refund_purchase_order_sku_id = #{refundPurchaseOrderSkuId,jdbcType=BIGINT} + + + update refund_purchase_order_sku + set + refund_id = #{refundId,jdbcType=VARCHAR}, + shop_id = #{shopId,jdbcType=BIGINT}, + pur_order_id = #{purOrderId,jdbcType=VARCHAR}, + pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR}, + order_id = #{orderId,jdbcType=VARCHAR}, + sub_item_id = #{subItemId,jdbcType=VARCHAR}, + num = #{num,jdbcType=INTEGER}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + where refund_purchase_order_sku_id = #{refundPurchaseOrderSkuId,jdbcType=BIGINT} + + diff --git a/ms-web/src/main/java/com/ms/web/controller/Test.java b/ms-web/src/main/java/com/ms/web/controller/Test.java index 209c410..5e6f04a 100644 --- a/ms-web/src/main/java/com/ms/web/controller/Test.java +++ b/ms-web/src/main/java/com/ms/web/controller/Test.java @@ -1,6 +1,7 @@ package com.ms.web.controller; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.doudian.open.api.supplyCenter_cargo_detail.data.SupplyCenterCargoDetailData; import com.doudian.open.api.supplyCenter_cargo_detail.param.SupplyCenterCargoDetailParam; @@ -11,6 +12,7 @@ import com.ms.api.dto.dsapi.response.CheckDsAppAuthExpireResponseDTO; import com.ms.api.dto.dsapi.response.GetAuthInfoResponseDTO; import com.ms.api.dto.dsapi.response.GetAuthShopMemberInfosResponseDTO; import com.ms.api.dto.dsapi.response.GetSourceItemInfosResponseDTO; +import com.ms.api.dto.dsorder.AlibabaMessage; import com.ms.biz.common.R; import com.ms.biz.common.Ret; import com.ms.api.dto.dsorder.DsMessageCallbackDTO; @@ -115,6 +117,10 @@ public class Test { } public static void main(String[] args) throws ParseException { + String dd = "{\"msgType\": \"ORDER_BUYER_VIEW_ORDER_BUYER_REFUND_IN_SALES\",\"msgData\":{\"buyerMemberId\":\"b2b-2216888144113f9b08\",\"currentStatus\":\"refundsuccess\",\"orderId\":3643602985932141341,\"refundAction\":\"SELLER_AGREE_REFUND\",\"sellerMemberId\":\"b2b-22103074731230f732\",\"msgSendTime\":\"2023-11-23 17:48:34\",\"operator\":\"system\",\"refundId\":\"TQ246736332522144113\"}}"; + AlibabaMessage msg= JSONObject.parseObject(dd, AlibabaMessage.class); + System.out.println(msg.getMsgData().get("buyerMemberId")); + Long shopId = 111111111L; String shopName = SecurityTool.MD5(shopId.toString()); assert shopName != null; @@ -136,8 +142,8 @@ public class Test { System.out.println(JSON.parseObject(JSON.toJSONString(data))); String str = "{\"data\":\"{\\\"activity_id\\\":\\\"0\\\",\\\"after\\\":\\\"false\\\",\\\"before\\\":\\\"true\\\",\\\"channel_id\\\":\\\"0\\\",\\\"channel_type\\\":0,\\\"process_time\\\":1699455945,\\\"product_id\\\":\\\"3649553844716833566\\\",\\\"shop_id\\\":\\\"121233657\\\",\\\"sku_id\\\":\\\"3384401776121602\\\"}\",\"tag\":\"420\",\"msg_id\":\"66533861744835594630:0:420:1699455945:2560971988:7264840234423027259\"}"; - DoudianMessage msg = JSON.parseObject(str, DoudianMessage.class); - System.out.println(msg); + DoudianMessage msg1 = JSON.parseObject(str, DoudianMessage.class); + System.out.println(msg1); System.out.println(Double.valueOf(CommonTool.doubleTrans(CommonTool.noZeros(2.00d)))); System.out.println("ni号顺11".length());