mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
【新增】MALL: 订单发货订阅消息
This commit is contained in:
parent
5307852fb2
commit
0cca6be63a
@ -17,16 +17,6 @@ public interface MessageTemplateConstants {
|
|||||||
//======================= 小程序订阅消息模版 =======================
|
//======================= 小程序订阅消息模版 =======================
|
||||||
|
|
||||||
String TRADE_AFTER_SALE_CHANGE = "售后进度通知";
|
String TRADE_AFTER_SALE_CHANGE = "售后进度通知";
|
||||||
|
String DELIVERY_ORDER = "订单发货通知";
|
||||||
/**
|
|
||||||
* 售后进度通知相关参数枚举
|
|
||||||
*
|
|
||||||
* @author HUIHUI
|
|
||||||
*/
|
|
||||||
class TradeAfterSaleChangeReqParams {
|
|
||||||
|
|
||||||
public static final String ORDER_DELIVERY = "order_delivery";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.trade.service.order;
|
package cn.iocoder.yudao.module.trade.service.order;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
@ -19,6 +20,8 @@ import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
|||||||
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
||||||
import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
|
import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi;
|
||||||
import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
|
import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxaSubscribeMessageSendReqDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdateAddressReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdateAddressReqVO;
|
||||||
@ -52,6 +55,7 @@ import cn.iocoder.yudao.module.trade.service.price.calculator.TradePriceCalculat
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -67,6 +71,7 @@ import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.min
|
|||||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getTerminal;
|
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getTerminal;
|
||||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||||
|
import static cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants.DELIVERY_ORDER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交易订单【写】Service 实现类
|
* 交易订单【写】Service 实现类
|
||||||
@ -78,6 +83,8 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
|
|
||||||
|
public static final String ORDER_DETAIL_PATH = "pages/order/detail"; // 订单详情页
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TradeOrderMapper tradeOrderMapper;
|
private TradeOrderMapper tradeOrderMapper;
|
||||||
@Resource
|
@Resource
|
||||||
@ -103,6 +110,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
private MemberAddressApi addressApi;
|
private MemberAddressApi addressApi;
|
||||||
@Resource
|
@Resource
|
||||||
private ProductCommentApi productCommentApi;
|
private ProductCommentApi productCommentApi;
|
||||||
|
@Resource
|
||||||
|
public SocialClientApi socialClientApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TradeOrderProperties tradeOrderProperties;
|
private TradeOrderProperties tradeOrderProperties;
|
||||||
@ -367,6 +376,21 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
// 4. 发送站内信
|
// 4. 发送站内信
|
||||||
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO()
|
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO()
|
||||||
.setOrderId(order.getId()).setUserId(order.getUserId()).setMessage(null));
|
.setOrderId(order.getId()).setUserId(order.getUserId()).setMessage(null));
|
||||||
|
// 5. 发送订阅消息
|
||||||
|
getSelf().sendDeliveryOrderMessage(order, deliveryReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void sendDeliveryOrderMessage(TradeOrderDO order, TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||||
|
// 构建并发送模版消息
|
||||||
|
Long orderId = order.getId();
|
||||||
|
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO().setPage(ORDER_DETAIL_PATH + "?id=" + orderId)
|
||||||
|
.setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue()).setTemplateTitle(DELIVERY_ORDER)
|
||||||
|
.addMessage("character_string3", String.valueOf(orderId)) // 订单编号
|
||||||
|
.addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态
|
||||||
|
.addMessage("date4", LocalDateTimeUtil.formatNormal(LocalDateTime.now()))// 发货时间
|
||||||
|
.addMessage("character_string5", deliveryReqVO.getLogisticsNo()) // 快递单号
|
||||||
|
.addMessage("thing9", order.getReceiverDetailAddress())); // 收货地址
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user