mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-24 16:05:08 +08:00
【代码优化】SYSTEM:微信小程序的订阅
This commit is contained in:
@ -66,7 +66,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
|
||||
private ProductSkuApi productSkuApi;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
@Lazy // 延迟加载,避免循环依赖
|
||||
private TradeOrderApi tradeOrderApi;
|
||||
|
||||
// TODO @芋艿:在详细预览下;
|
||||
|
@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
@ -56,6 +57,7 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||
public class AfterSaleServiceImpl implements AfterSaleService {
|
||||
|
||||
@Resource
|
||||
@Lazy // 延迟加载,避免循环依赖
|
||||
private TradeOrderUpdateService tradeOrderUpdateService;
|
||||
@Resource
|
||||
private TradeOrderQueryService tradeOrderQueryService;
|
||||
|
@ -83,8 +83,6 @@ import static cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants.DELIV
|
||||
@Slf4j
|
||||
public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
|
||||
public static final String ORDER_DETAIL_PATH = "pages/order/detail"; // 订单详情页
|
||||
|
||||
@Resource
|
||||
private TradeOrderMapper tradeOrderMapper;
|
||||
@Resource
|
||||
@ -373,6 +371,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
MapUtil.<String, Object>builder().put("expressName", express != null ? express.getName() : "")
|
||||
.put("logisticsNo", express != null ? deliveryReqVO.getLogisticsNo() : "").build());
|
||||
|
||||
// TODO @puhui999:可以改成 4.1 4.2。因为都算通知哈;
|
||||
// 4. 发送站内信
|
||||
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO()
|
||||
.setOrderId(order.getId()).setUserId(order.getUserId()).setMessage(null));
|
||||
@ -384,8 +383,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
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)
|
||||
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
||||
.setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
|
||||
.setTemplateTitle(DELIVERY_ORDER)
|
||||
.setPage("pages/order/detail?id=" + orderId) // 订单详情页
|
||||
.addMessage("character_string3", String.valueOf(orderId)) // 订单编号
|
||||
.addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态
|
||||
.addMessage("date4", LocalDateTimeUtil.formatNormal(LocalDateTime.now()))// 发货时间
|
||||
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
@ -28,11 +29,13 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.ORDER_DELIV
|
||||
public class TradeCombinationOrderHandler implements TradeOrderHandler {
|
||||
|
||||
@Resource
|
||||
@Lazy // 延迟加载,避免循环依赖
|
||||
private TradeOrderUpdateService orderUpdateService;
|
||||
@Resource
|
||||
private TradeOrderQueryService orderQueryService;
|
||||
|
||||
@Resource
|
||||
@Lazy // 延迟加载,避免循环依赖
|
||||
private CombinationRecordApi combinationRecordApi;
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user