【同步】BOOT 和 CLOUD 的功能
This commit is contained in:
@@ -30,7 +30,7 @@ public interface CouponConvert {
|
||||
CouponRespDTO convert(CouponDO bean);
|
||||
|
||||
default CouponDO convert(CouponTemplateDO template, Long userId) {
|
||||
CouponDO couponDO = new CouponDO()
|
||||
CouponDO coupon = new CouponDO()
|
||||
.setTemplateId(template.getId())
|
||||
.setName(template.getName())
|
||||
.setTakeType(template.getTakeType())
|
||||
@@ -44,13 +44,13 @@ public interface CouponConvert {
|
||||
.setStatus(CouponStatusEnum.UNUSED.getStatus())
|
||||
.setUserId(userId);
|
||||
if (CouponTemplateValidityTypeEnum.DATE.getType().equals(template.getValidityType())) {
|
||||
couponDO.setValidStartTime(template.getValidStartTime());
|
||||
couponDO.setValidEndTime(template.getValidEndTime());
|
||||
coupon.setValidStartTime(template.getValidStartTime());
|
||||
coupon.setValidEndTime(template.getValidEndTime());
|
||||
} else if (CouponTemplateValidityTypeEnum.TERM.getType().equals(template.getValidityType())) {
|
||||
couponDO.setValidStartTime(LocalDateTime.now().plusDays(template.getFixedStartTerm()));
|
||||
couponDO.setValidEndTime(LocalDateTime.now().plusDays(template.getFixedEndTerm()));
|
||||
coupon.setValidStartTime(LocalDateTime.now().plusDays(template.getFixedStartTerm()));
|
||||
coupon.setValidEndTime(coupon.getValidStartTime().plusDays(template.getFixedEndTerm()));
|
||||
}
|
||||
return couponDO;
|
||||
return coupon;
|
||||
}
|
||||
|
||||
CouponPageReqVO convert(AppCouponPageReqVO pageReqVO, Collection<Long> userIds);
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user