Merge remote-tracking branch 'refs/remotes/yudao/develop' into develop

This commit is contained in:
puhui999
2024-08-07 17:09:36 +08:00
46 changed files with 906 additions and 362 deletions

View File

@ -9,6 +9,6 @@ public interface MessageTemplateConstants {
//======================= 小程序订阅消息模版 =======================
String COMBINATION_RESULT = "拼团结果通知";
String COMBINATION_SUCCESS = "拼团结果通知";
}

View File

@ -44,7 +44,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.afterNow;
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.beforeNow;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.promotion.enums.MessageTemplateConstants.COMBINATION_RESULT;
import static cn.iocoder.yudao.module.promotion.enums.MessageTemplateConstants.COMBINATION_SUCCESS;
// TODO 芋艿:等拼团记录做完,完整 review 下
@ -212,10 +212,10 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
}
updateRecords.add(updateRecord);
});
Boolean result = combinationRecordMapper.updateBatch(updateRecords);
Boolean updateSuccess = combinationRecordMapper.updateBatch(updateRecords);
// 3. 拼团成功发送订阅消息
if (result && isFull) {
if (updateSuccess && isFull) {
records.forEach(item -> {
getSelf().sendCombinationResultMessage(item);
});
@ -227,7 +227,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
// 构建并发送模版消息
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
.setUserId(record.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
.setTemplateTitle(COMBINATION_RESULT)
.setTemplateTitle(COMBINATION_SUCCESS)
.setPage("pages/order/detail?id=" + record.getOrderId()) // 订单详情页
.addMessage("thing1", "商品拼团活动") // 活动标题
.addMessage("thing2", "恭喜您拼团成功!我们将尽快为您发货。")); // 温馨提示

View File

@ -7,15 +7,15 @@ package cn.iocoder.yudao.module.trade.enums;
*/
public interface MessageTemplateConstants {
//======================= 短信消息模版 =======================
// ======================= 短信消息模版 =======================
String ORDER_DELIVERY = "order_delivery"; // 短信模版编号
String SMS_ORDER_DELIVERY = "order_delivery"; // 短信模版编号
String BROKERAGE_WITHDRAW_AUDIT_APPROVE = "brokerage_withdraw_audit_approve"; // 佣金提现(审核通过)
String BROKERAGE_WITHDRAW_AUDIT_REJECT = "brokerage_withdraw_audit_reject"; // 佣金提现(审核不通过)
String SMS_BROKERAGE_WITHDRAW_AUDIT_APPROVE = "brokerage_withdraw_audit_approve"; // 佣金提现(审核通过)
String SMS_BROKERAGE_WITHDRAW_AUDIT_REJECT = "brokerage_withdraw_audit_reject"; // 佣金提现(审核不通过)
//======================= 小程序订阅消息模版 =======================
// ======================= 小程序订阅消息模版 =======================
String DELIVERY_ORDER = "订单发货通知";
String WXA_ORDER_DELIVERY = "订单发货通知";
}

View File

@ -77,14 +77,14 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
String templateCode;
if (BrokerageWithdrawStatusEnum.AUDIT_SUCCESS.equals(status)) {
templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_APPROVE;
templateCode = MessageTemplateConstants.SMS_BROKERAGE_WITHDRAW_AUDIT_APPROVE;
// 3.1 通过时佣金转余额
if (BrokerageWithdrawTypeEnum.WALLET.getType().equals(withdraw.getType())) {
// todo 疯狂:
}
// TODO 疯狂:调用转账接口
} else if (BrokerageWithdrawStatusEnum.AUDIT_FAIL.equals(status)) {
templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_REJECT;
templateCode = MessageTemplateConstants.SMS_BROKERAGE_WITHDRAW_AUDIT_REJECT;
// 3.2 驳回时需要退还用户佣金
brokerageRecordService.addBrokerage(withdraw.getUserId(), BrokerageRecordBizTypeEnum.WITHDRAW_REJECT,
String.valueOf(withdraw.getId()), withdraw.getPrice(), BrokerageRecordBizTypeEnum.WITHDRAW_REJECT.getTitle());

View File

@ -37,7 +37,7 @@ public class TradeMessageServiceImpl implements TradeMessageService {
notifyMessageSendApi.sendSingleMessageToMember(
new NotifySendSingleToUserReqDTO()
.setUserId(reqBO.getUserId())
.setTemplateCode(MessageTemplateConstants.ORDER_DELIVERY)
.setTemplateCode(MessageTemplateConstants.SMS_ORDER_DELIVERY)
.setTemplateParams(msgMap));
}

View File

@ -7,6 +7,7 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
@ -71,7 +72,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.web.core.util.WebFrameworkUtils.getTerminal;
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants.DELIVERY_ORDER;
import static cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants.WXA_ORDER_DELIVERY;
/**
* 交易订单【写】Service 实现类
@ -384,12 +385,12 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
Long orderId = order.getId();
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
.setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
.setTemplateTitle(DELIVERY_ORDER)
.setTemplateTitle(WXA_ORDER_DELIVERY)
.setPage("pages/order/detail?id=" + orderId) // 订单详情页
.addMessage("character_string3", String.valueOf(orderId)) // 订单编号
.addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态
.addMessage("date4", LocalDateTimeUtil.formatNormal(LocalDateTime.now()))// 发货时间
.addMessage("character_string5", deliveryReqVO.getLogisticsNo()) // 快递单号
.addMessage("character_string5", StrUtil.blankToDefault(deliveryReqVO.getLogisticsNo(), "-")) // 快递单号
.addMessage("thing9", order.getReceiverDetailAddress())); // 收货地址
}