【同步】BOOT 和 CLOUD 的功能

This commit is contained in:
YunaiV
2025-08-18 00:26:28 +08:00
parent 49572b2994
commit 8e45cf5787
19 changed files with 250 additions and 97 deletions

View File

@@ -42,6 +42,40 @@ public class TradeStatusSyncToWxaOrderHandler implements TradeOrderHandler {
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
return;
}
// 上传订单物流信息到微信小程序
uploadWxaOrderShippingInfo(order);
}
@Override
public void afterReceiveOrder(TradeOrderDO order) {
// 注意:只有微信小程序支付的订单,才需要同步
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
return;
}
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId()).getCheckedData();
SocialWxaOrderNotifyConfirmReceiveReqDTO reqDTO = new SocialWxaOrderNotifyConfirmReceiveReqDTO()
.setTransactionId(payOrder.getChannelOrderNo())
.setReceivedTime(order.getReceiveTime());
try {
socialClientApi.notifyWxaOrderConfirmReceive(UserTypeEnum.MEMBER.getValue(), reqDTO);
} catch (Exception ex) {
log.error("[afterReceiveOrder][订单({}) 通知订单收货到微信小程序失败]", order, ex);
}
// 如果是门店自提订单,上传订单物流信息到微信小程序
// 原因是,门店自提订单没有 “afterDeliveryOrder” 阶段。可见 https://t.zsxq.com/KWD3u 反馈
if (DeliveryTypeEnum.PICK_UP.getType().equals(order.getDeliveryType())) {
uploadWxaOrderShippingInfo(order);
}
}
/**
* 上传订单物流信息到微信小程序
*
* @param order 订单
*/
private void uploadWxaOrderShippingInfo(TradeOrderDO order) {
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId()).getCheckedData();
SocialWxaOrderUploadShippingInfoReqDTO reqDTO = new SocialWxaOrderUploadShippingInfoReqDTO()
.setTransactionId(payOrder.getChannelOrderNo())
@@ -58,29 +92,12 @@ public class TradeStatusSyncToWxaOrderHandler implements TradeOrderHandler {
reqDTO.setLogisticsType(SocialWxaOrderUploadShippingInfoReqDTO.LOGISTICS_TYPE_VIRTUAL);
}
try {
socialClientApi.uploadWxaOrderShippingInfo(UserTypeEnum.MEMBER.getValue(), reqDTO).checkError();
socialClientApi.uploadWxaOrderShippingInfo(UserTypeEnum.MEMBER.getValue(), reqDTO);
} catch (Exception ex) {
log.error("[afterDeliveryOrder][订单({}) 上传订单物流信息到微信小程序失败]", order, ex);
}
}
@Override
public void afterReceiveOrder(TradeOrderDO order) {
// 注意:只有微信小程序支付的订单,才需要同步
if (ObjUtil.notEqual(order.getPayChannelCode(), PayChannelEnum.WX_LITE.getCode())) {
return;
}
PayOrderRespDTO payOrder = payOrderApi.getOrder(order.getPayOrderId()).getCheckedData();
SocialWxaOrderNotifyConfirmReceiveReqDTO reqDTO = new SocialWxaOrderNotifyConfirmReceiveReqDTO()
.setTransactionId(payOrder.getChannelOrderNo())
.setReceivedTime(order.getReceiveTime());
try {
socialClientApi.notifyWxaOrderConfirmReceive(UserTypeEnum.MEMBER.getValue(), reqDTO).getCheckedData();
} catch (Exception ex) {
log.error("[afterReceiveOrder][订单({}) 通知订单收货到微信小程序失败]", order, ex);
}
}
// 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
}