Commit b5d5fa8ea4167468f84e37b0926166f3d2799def

Authored by YunaiV
1 parent ba068c35

fix:【mall 商城】门店自提时,缺少上传订单物流信息到微信小程序

yudao-module-mall/yudao-module-trade/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeStatusSyncToWxaOrderHandler.java
... ... @@ -42,6 +42,40 @@ public class TradeStatusSyncToWxaOrderHandler implements TradeOrderHandler {
42 42 if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
43 43 return;
44 44 }
  45 +
  46 + // 上传订单物流信息到微信小程序
  47 + uploadWxaOrderShippingInfo(order);
  48 + }
  49 +
  50 + @Override
  51 + public void afterReceiveOrder(TradeOrderDO order) {
  52 + // 注意:只有微信小程序支付的订单,才需要同步
  53 + if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
  54 + return;
  55 + }
  56 + PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
  57 + SocialWxaOrderNotifyConfirmReceiveReqDTO reqDTO = new SocialWxaOrderNotifyConfirmReceiveReqDTO()
  58 + .setTransactionId(payOrder.getChannelOrderNo())
  59 + .setReceivedTime(order.getReceiveTime());
  60 + try {
  61 + socialClientApi.notifyWxaOrderConfirmReceive(UserTypeEnum.MEMBER.getValue(), reqDTO);
  62 + } catch (Exception ex) {
  63 + log.error("[afterReceiveOrder][订单({}) 通知订单收货到微信小程序失败]", order, ex);
  64 + }
  65 +
  66 + // 如果是门店自提订单,上传订单物流信息到微信小程序
  67 + // 原因是,门店自提订单没有 “afterDeliveryOrder” 阶段。可见 https://t.zsxq.com/KWD3u 反馈
  68 + if (DeliveryTypeEnum.PICK_UP.getType().equals(order.getDeliveryType())) {
  69 + uploadWxaOrderShippingInfo(order);
  70 + }
  71 + }
  72 +
  73 + /**
  74 + * 上传订单物流信息到微信小程序
  75 + *
  76 + * @param order 订单
  77 + */
  78 + private void uploadWxaOrderShippingInfo(TradeOrderDO order) {
45 79 PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
46 80 SocialWxaOrderUploadShippingInfoReqDTO reqDTO = new SocialWxaOrderUploadShippingInfoReqDTO()
47 81 .setTransactionId(payOrder.getChannelOrderNo())
... ... @@ -64,23 +98,6 @@ public class TradeStatusSyncToWxaOrderHandler implements TradeOrderHandler {
64 98 }
65 99 }
66 100  
67   - @Override
68   - public void afterReceiveOrder(TradeOrderDO order) {
69   - // 注意:只有微信小程序支付的订单,才需要同步
70   - if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
71   - return;
72   - }
73   - PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId());
74   - SocialWxaOrderNotifyConfirmReceiveReqDTO reqDTO = new SocialWxaOrderNotifyConfirmReceiveReqDTO()
75   - .setTransactionId(payOrder.getChannelOrderNo())
76   - .setReceivedTime(order.getReceiveTime());
77   - try {
78   - socialClientApi.notifyWxaOrderConfirmReceive(UserTypeEnum.MEMBER.getValue(), reqDTO);
79   - } catch (Exception ex) {
80   - log.error("[afterReceiveOrder][订单({}) 通知订单收货到微信小程序失败]", order, ex);
81   - }
82   - }
83   -
84 101 // TODO @芋艿:【设置路径】 https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order-shipping/order-shipping.html#%E5%85%AD%E3%80%81%E6%B6%88%E6%81%AF%E8%B7%B3%E8%BD%AC%E8%B7%AF%E5%BE%84%E8%AE%BE%E7%BD%AE%E6%8E%A5%E5%8F%A3
85 102  
86 103 }
... ...