mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
【代码优化】SYSTEM:微信小程序的订阅
This commit is contained in:
parent
1f65dd2ec9
commit
ba18788517
@ -9,6 +9,6 @@ public interface MessageTemplateConstants {
|
|||||||
|
|
||||||
//======================= 小程序订阅消息模版 =======================
|
//======================= 小程序订阅消息模版 =======================
|
||||||
|
|
||||||
String COMBINATION_RESULT = "拼团结果通知";
|
String COMBINATION_SUCCESS = "拼团结果通知";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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.afterNow;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.beforeNow;
|
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.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 下
|
// TODO 芋艿:等拼团记录做完,完整 review 下
|
||||||
|
|
||||||
@ -212,10 +212,10 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
|
|||||||
}
|
}
|
||||||
updateRecords.add(updateRecord);
|
updateRecords.add(updateRecord);
|
||||||
});
|
});
|
||||||
Boolean result = combinationRecordMapper.updateBatch(updateRecords);
|
Boolean updateSuccess = combinationRecordMapper.updateBatch(updateRecords);
|
||||||
|
|
||||||
// 3. 拼团成功发送订阅消息
|
// 3. 拼团成功发送订阅消息
|
||||||
if (result && isFull) {
|
if (updateSuccess && isFull) {
|
||||||
records.forEach(item -> {
|
records.forEach(item -> {
|
||||||
getSelf().sendCombinationResultMessage(item);
|
getSelf().sendCombinationResultMessage(item);
|
||||||
});
|
});
|
||||||
@ -227,7 +227,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
|
|||||||
// 构建并发送模版消息
|
// 构建并发送模版消息
|
||||||
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
||||||
.setUserId(record.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
|
.setUserId(record.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
|
||||||
.setTemplateTitle(COMBINATION_RESULT)
|
.setTemplateTitle(COMBINATION_SUCCESS)
|
||||||
.setPage("pages/order/detail?id=" + record.getOrderId()) // 订单详情页
|
.setPage("pages/order/detail?id=" + record.getOrderId()) // 订单详情页
|
||||||
.addMessage("thing1", "商品拼团活动") // 活动标题
|
.addMessage("thing1", "商品拼团活动") // 活动标题
|
||||||
.addMessage("thing2", "恭喜您拼团成功!我们将尽快为您发货。")); // 温馨提示
|
.addMessage("thing2", "恭喜您拼团成功!我们将尽快为您发货。")); // 温馨提示
|
||||||
|
@ -7,15 +7,15 @@ package cn.iocoder.yudao.module.trade.enums;
|
|||||||
*/
|
*/
|
||||||
public interface MessageTemplateConstants {
|
public interface MessageTemplateConstants {
|
||||||
|
|
||||||
//======================= 短信消息模版 =======================
|
// ======================= 短信消息模版 =======================
|
||||||
|
|
||||||
String ORDER_DELIVERY = "order_delivery"; // 短信模版编号
|
String SMS_ORDER_DELIVERY = "order_delivery"; // 短信模版编号
|
||||||
|
|
||||||
String BROKERAGE_WITHDRAW_AUDIT_APPROVE = "brokerage_withdraw_audit_approve"; // 佣金提现(审核通过)
|
String SMS_BROKERAGE_WITHDRAW_AUDIT_APPROVE = "brokerage_withdraw_audit_approve"; // 佣金提现(审核通过)
|
||||||
String BROKERAGE_WITHDRAW_AUDIT_REJECT = "brokerage_withdraw_audit_reject"; // 佣金提现(审核不通过)
|
String SMS_BROKERAGE_WITHDRAW_AUDIT_REJECT = "brokerage_withdraw_audit_reject"; // 佣金提现(审核不通过)
|
||||||
|
|
||||||
//======================= 小程序订阅消息模版 =======================
|
// ======================= 小程序订阅消息模版 =======================
|
||||||
|
|
||||||
String DELIVERY_ORDER = "订单发货通知";
|
String WXA_ORDER_DELIVERY = "订单发货通知";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,14 +77,14 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
|||||||
|
|
||||||
String templateCode;
|
String templateCode;
|
||||||
if (BrokerageWithdrawStatusEnum.AUDIT_SUCCESS.equals(status)) {
|
if (BrokerageWithdrawStatusEnum.AUDIT_SUCCESS.equals(status)) {
|
||||||
templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_APPROVE;
|
templateCode = MessageTemplateConstants.SMS_BROKERAGE_WITHDRAW_AUDIT_APPROVE;
|
||||||
// 3.1 通过时佣金转余额
|
// 3.1 通过时佣金转余额
|
||||||
if (BrokerageWithdrawTypeEnum.WALLET.getType().equals(withdraw.getType())) {
|
if (BrokerageWithdrawTypeEnum.WALLET.getType().equals(withdraw.getType())) {
|
||||||
// todo 疯狂:
|
// todo 疯狂:
|
||||||
}
|
}
|
||||||
// TODO 疯狂:调用转账接口
|
// TODO 疯狂:调用转账接口
|
||||||
} else if (BrokerageWithdrawStatusEnum.AUDIT_FAIL.equals(status)) {
|
} else if (BrokerageWithdrawStatusEnum.AUDIT_FAIL.equals(status)) {
|
||||||
templateCode = MessageTemplateConstants.BROKERAGE_WITHDRAW_AUDIT_REJECT;
|
templateCode = MessageTemplateConstants.SMS_BROKERAGE_WITHDRAW_AUDIT_REJECT;
|
||||||
// 3.2 驳回时需要退还用户佣金
|
// 3.2 驳回时需要退还用户佣金
|
||||||
brokerageRecordService.addBrokerage(withdraw.getUserId(), BrokerageRecordBizTypeEnum.WITHDRAW_REJECT,
|
brokerageRecordService.addBrokerage(withdraw.getUserId(), BrokerageRecordBizTypeEnum.WITHDRAW_REJECT,
|
||||||
String.valueOf(withdraw.getId()), withdraw.getPrice(), BrokerageRecordBizTypeEnum.WITHDRAW_REJECT.getTitle());
|
String.valueOf(withdraw.getId()), withdraw.getPrice(), BrokerageRecordBizTypeEnum.WITHDRAW_REJECT.getTitle());
|
||||||
|
@ -37,7 +37,7 @@ public class TradeMessageServiceImpl implements TradeMessageService {
|
|||||||
notifyMessageSendApi.sendSingleMessageToMember(
|
notifyMessageSendApi.sendSingleMessageToMember(
|
||||||
new NotifySendSingleToUserReqDTO()
|
new NotifySendSingleToUserReqDTO()
|
||||||
.setUserId(reqBO.getUserId())
|
.setUserId(reqBO.getUserId())
|
||||||
.setTemplateCode(MessageTemplateConstants.ORDER_DELIVERY)
|
.setTemplateCode(MessageTemplateConstants.SMS_ORDER_DELIVERY)
|
||||||
.setTemplateParams(msgMap));
|
.setTemplateParams(msgMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +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;
|
import static cn.iocoder.yudao.module.trade.enums.MessageTemplateConstants.WXA_ORDER_DELIVERY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交易订单【写】Service 实现类
|
* 交易订单【写】Service 实现类
|
||||||
@ -384,7 +384,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
Long orderId = order.getId();
|
Long orderId = order.getId();
|
||||||
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
||||||
.setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
|
.setUserId(order.getUserId()).setUserType(UserTypeEnum.MEMBER.getValue())
|
||||||
.setTemplateTitle(DELIVERY_ORDER)
|
.setTemplateTitle(WXA_ORDER_DELIVERY)
|
||||||
.setPage("pages/order/detail?id=" + orderId) // 订单详情页
|
.setPage("pages/order/detail?id=" + orderId) // 订单详情页
|
||||||
.addMessage("character_string3", String.valueOf(orderId)) // 订单编号
|
.addMessage("character_string3", String.valueOf(orderId)) // 订单编号
|
||||||
.addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态
|
.addMessage("phrase6", TradeOrderStatusEnum.DELIVERED.getName()) // 订单状态
|
||||||
|
@ -7,8 +7,8 @@ package cn.iocoder.yudao.module.pay.enums;
|
|||||||
*/
|
*/
|
||||||
public interface MessageTemplateConstants {
|
public interface MessageTemplateConstants {
|
||||||
|
|
||||||
//======================= 小程序订阅消息 =======================
|
// ======================= 小程序订阅消息 =======================
|
||||||
|
|
||||||
String WALLET_RECHARGER_PAID = "充值成功通知";
|
String WXA_WALLET_RECHARGER_PAID = "充值成功通知";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString
|
|||||||
import static cn.iocoder.yudao.framework.common.util.number.MoneyUtils.fenToYuanStr;
|
import static cn.iocoder.yudao.framework.common.util.number.MoneyUtils.fenToYuanStr;
|
||||||
import static cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert.INSTANCE;
|
import static cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert.INSTANCE;
|
||||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
||||||
import static cn.iocoder.yudao.module.pay.enums.MessageTemplateConstants.WALLET_RECHARGER_PAID;
|
import static cn.iocoder.yudao.module.pay.enums.MessageTemplateConstants.WXA_WALLET_RECHARGER_PAID;
|
||||||
import static cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum.*;
|
import static cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
|||||||
// 2. 构建并发送模版消息
|
// 2. 构建并发送模版消息
|
||||||
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
socialClientApi.sendWxaSubscribeMessage(new SocialWxaSubscribeMessageSendReqDTO()
|
||||||
.setUserId(wallet.getUserId()).setUserType(wallet.getUserType())
|
.setUserId(wallet.getUserId()).setUserType(wallet.getUserType())
|
||||||
.setTemplateTitle(WALLET_RECHARGER_PAID)
|
.setTemplateTitle(WXA_WALLET_RECHARGER_PAID)
|
||||||
.setPage("pages/user/wallet/money") // 钱包详情界面
|
.setPage("pages/user/wallet/money") // 钱包详情界面
|
||||||
.addMessage("character_string1", String.valueOf(payOrderId)) // 支付单编号
|
.addMessage("character_string1", String.valueOf(payOrderId)) // 支付单编号
|
||||||
.addMessage("amount2", fenToYuanStr(walletRecharge.getTotalPrice())) // 充值金额
|
.addMessage("amount2", fenToYuanStr(walletRecharge.getTotalPrice())) // 充值金额
|
||||||
|
@ -82,7 +82,11 @@ public class SocialClientServiceImpl implements SocialClientService {
|
|||||||
@Value("${yudao.wxa-code.env-version:release}")
|
@Value("${yudao.wxa-code.env-version:release}")
|
||||||
public String envVersion;
|
public String envVersion;
|
||||||
/**
|
/**
|
||||||
* 订阅消息跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;
|
* 订阅消息跳转小程序类型
|
||||||
|
*
|
||||||
|
* 1. developer:开发版
|
||||||
|
* 2. trial:体验版
|
||||||
|
* 3. formal:正式版
|
||||||
*/
|
*/
|
||||||
@Value("${yudao.wxa-subscribe-message.miniprogram-state:formal}")
|
@Value("${yudao.wxa-subscribe-message.miniprogram-state:formal}")
|
||||||
public String miniprogramState;
|
public String miniprogramState;
|
||||||
|
@ -224,7 +224,7 @@ yudao:
|
|||||||
wxa-code:
|
wxa-code:
|
||||||
env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
|
env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
|
||||||
wxa-subscribe-message:
|
wxa-subscribe-message:
|
||||||
miniprogram-state: developer # 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;
|
miniprogram-state: developer # 跳转小程序类型:开发版为 “developer”;体验版为 “trial”为;正式版为 “formal”
|
||||||
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
|
||||||
|
|
||||||
justauth:
|
justauth:
|
||||||
|
Loading…
Reference in New Issue
Block a user