Commit 345f41b1535d8ec7ead8b312259e70fbce028ff2
1 parent
f46d47a9
【代码评审】SYSTEM:订阅消息
Showing
5 changed files
with
8 additions
and
0 deletions
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/MessageTemplateConstants.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/message/subscribe/SubscribeMessageClient.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.java
| ... | ... | @@ -139,8 +139,10 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { |
| 139 | 139 | sendPayWalletChangeMessage(payOrderId, walletRecharge); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | + // TODO @puhui999:发送,使用异步发送;@Async | |
| 142 | 143 | private void sendPayWalletChangeMessage(Long payOrderId, PayWalletRechargeDO walletRecharge) { |
| 143 | 144 | PayWalletDO wallet = payWalletService.getWallet(walletRecharge.getWalletId()); |
| 145 | + // TODO @puhui999:可以使用 MapUtil.builder();另外,不应该是并发 hashmap 哈 | |
| 144 | 146 | Map<String, String> messages = MapUtil.newConcurrentHashMap(4); |
| 145 | 147 | messages.put(MessageTemplateConstants.PayWalletChangeTemplateParams.NO, String.valueOf(payOrderId)); |
| 146 | 148 | messages.put(MessageTemplateConstants.PayWalletChangeTemplateParams.PRICE, | ... | ... |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApi.java
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/social/SocialClientApiImpl.java
| ... | ... | @@ -75,6 +75,7 @@ public class SocialClientApiImpl implements SocialClientApi { |
| 75 | 75 | |
| 76 | 76 | public void sendSubscribeMessage(String templateTitle, Map<String, String> messages, Integer userType, Long userId, |
| 77 | 77 | Integer socialType, String path) { |
| 78 | + // TODO @puhui999:建议是,先不拆小方法。因为逻辑的复杂度其实不高哈。合在一个方法里,因为咱写了 1.1 1.2 2. 这样的逻辑,也能一下子看懂。 | |
| 78 | 79 | // 1.1 获得订阅模版 |
| 79 | 80 | SocialWxSubscribeTemplateRespDTO template = getTemplate(templateTitle, userType); |
| 80 | 81 | if (template == null) { |
| ... | ... | @@ -104,6 +105,7 @@ public class SocialClientApiImpl implements SocialClientApi { |
| 104 | 105 | .setTemplateId(template.getId()).setToUser(openId).setPage(path); |
| 105 | 106 | } |
| 106 | 107 | |
| 108 | + // TODO @puhui999:建议下沉到 service 实现。 | |
| 107 | 109 | /** |
| 108 | 110 | * 获得小程序订阅消息模版 |
| 109 | 111 | * |
| ... | ... | @@ -120,6 +122,7 @@ public class SocialClientApiImpl implements SocialClientApi { |
| 120 | 122 | return CollectionUtil.findOne(templateList, item -> ObjUtil.equal(item.getTitle(), templateTitle)); |
| 121 | 123 | } |
| 122 | 124 | |
| 125 | + // TODO @puhui999:建议下沉到 service 实现。 | |
| 123 | 126 | /** |
| 124 | 127 | * 获得用户 openId |
| 125 | 128 | * | ... | ... |