From 58368d04788d78358bb4814ad380e09a7fbba523 Mon Sep 17 00:00:00 2001 From: liruohrh <2372221537@qq.com> Date: Mon, 1 Apr 2024 21:47:26 +0800 Subject: [PATCH 1/3] #I9CYEO: optimize clone to taskinfo --- .../com/java3y/austin/handler/action/SendMessageAction.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/action/SendMessageAction.java b/austin-handler/src/main/java/com/java3y/austin/handler/action/SendMessageAction.java index d3c57b5..2b1a6ab 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/action/SendMessageAction.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/action/SendMessageAction.java @@ -10,7 +10,6 @@ import com.java3y.austin.handler.handler.HandlerHolder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - /** * 发送消息,路由到对应的渠道下发消息 * @@ -29,8 +28,8 @@ public class SendMessageAction implements BusinessProcess { if (ChannelType.MINI_PROGRAM.getCode().equals(taskInfo.getSendChannel()) || ChannelType.OFFICIAL_ACCOUNT.getCode().equals(taskInfo.getSendChannel()) || ChannelType.ALIPAY_MINI_PROGRAM.getCode().equals(taskInfo.getSendChannel())) { + TaskInfo taskClone = ObjectUtil.cloneByStream(taskInfo); for (String receiver : taskInfo.getReceiver()) { - TaskInfo taskClone = ObjectUtil.cloneByStream(taskInfo); taskClone.setReceiver(Sets.newHashSet(receiver)); handlerHolder.route(taskInfo.getSendChannel()).doHandler(taskClone); } From c6d981ffc694cd651f0851bcf2b47b442592fd84 Mon Sep 17 00:00:00 2001 From: liruohrh <2372221537@qq.com> Date: Sat, 6 Apr 2024 13:46:15 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E8=BD=BB=E9=87=8F=E4=BC=98=E5=8C=96:=20?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E5=8F=96=E4=B8=80=E4=B8=AA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=BF=A1=E6=81=AF=3D=3D>=E5=8F=AA=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liruohrh <2372221537@qq.com> --- .../java3y/austin/web/exception/ExceptionHandlerAdvice.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/austin-web/src/main/java/com/java3y/austin/web/exception/ExceptionHandlerAdvice.java b/austin-web/src/main/java/com/java3y/austin/web/exception/ExceptionHandlerAdvice.java index 8e8ca1a..461ab6f 100644 --- a/austin-web/src/main/java/com/java3y/austin/web/exception/ExceptionHandlerAdvice.java +++ b/austin-web/src/main/java/com/java3y/austin/web/exception/ExceptionHandlerAdvice.java @@ -26,8 +26,9 @@ public class ExceptionHandlerAdvice { @ExceptionHandler({Exception.class}) @ResponseStatus(HttpStatus.OK) public BasicResultVO exceptionResponse(Exception e) { - log.error(Throwables.getStackTrace(e)); - return BasicResultVO.fail(RespStatusEnum.ERROR_500, "\r\n" + Throwables.getStackTrace(e) + "\r\n"); + String errStackStr = Throwables.getStackTrace(e); + log.error(errStackStr); + return BasicResultVO.fail(RespStatusEnum.ERROR_500, "\r\n" + errStackStr + "\r\n"); } @ExceptionHandler({CommonException.class}) From 5c83a786f2f4ba82d58702f5696b1a9671361d39 Mon Sep 17 00:00:00 2001 From: 3y Date: Sun, 28 Apr 2024 16:34:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix#=20=E6=B8=A0=E9=81=93=E5=8E=BB=E9=87=8D?= =?UTF-8?q?=20key=20=E4=BF=AE=E5=A4=8D=20&&=20=E5=AE=98=E6=96=B9=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7Redis=E5=88=9D=E5=A7=8B=E5=8C=96=20key=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20&&=20=E4=BA=91=E7=89=87=E5=8F=82=E6=95=B0=E5=88=A4?= =?UTF-8?q?=E7=A9=BA=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dto/account/YunPianSmsAccount.java | 45 ------------------- .../FrequencyDeduplicationService.java | 3 +- .../handler/script/impl/YunPianSmsScript.java | 5 ++- .../austin/support/utils/AccountUtils.java | 2 +- 4 files changed, 6 insertions(+), 49 deletions(-) delete mode 100644 austin-common/src/main/java/com/java3y/austin/common/dto/account/YunPianSmsAccount.java diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/account/YunPianSmsAccount.java b/austin-common/src/main/java/com/java3y/austin/common/dto/account/YunPianSmsAccount.java deleted file mode 100644 index 12f1e10..0000000 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/account/YunPianSmsAccount.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.java3y.austin.common.dto.account; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 云片账号信息 - *

- * 参数示例: - * [{"sms_20":{"url":"https://sms.yunpian.com/v2/sms/tpl_batch_send.json","apikey":"ca55d4c8544444444444622221b5cd7","tpl_id":"533332222282","supplierId":20,"supplierName":"云片"}}] - * - * @author 3y - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class YunPianSmsAccount { - - /** - * apikey - */ - private String apikey; - /** - * tplId - */ - private String tplId; - - /** - * api相关 - */ - private String url; - - /** - * 标识渠道商Id - */ - private Integer supplierId; - - /** - * 标识渠道商名字 - */ - private String supplierName; -} diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/deduplication/service/FrequencyDeduplicationService.java b/austin-handler/src/main/java/com/java3y/austin/handler/deduplication/service/FrequencyDeduplicationService.java index 075d1e3..78dd8a4 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/deduplication/service/FrequencyDeduplicationService.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/deduplication/service/FrequencyDeduplicationService.java @@ -31,7 +31,7 @@ public class FrequencyDeduplicationService extends AbstractDeduplicationService /** * 业务规则去重 构建key *

- * key : receiver + templateId + sendChannel + * key : receiver + sendChannel *

* 一天内一个用户只能收到某个渠道的消息 N 次 * @@ -43,7 +43,6 @@ public class FrequencyDeduplicationService extends AbstractDeduplicationService public String deduplicationSingleKey(TaskInfo taskInfo, String receiver) { return PREFIX + StrPool.C_UNDERLINE + receiver + StrPool.C_UNDERLINE - + taskInfo.getMessageTemplateId() + StrPool.C_UNDERLINE + taskInfo.getSendChannel(); } } diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java index c9c14dc..01c6a61 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/YunPianSmsScript.java @@ -6,6 +6,7 @@ import cn.hutool.core.net.URLEncodeUtil; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.StrPool; import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.Header; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; @@ -82,7 +83,9 @@ public class YunPianSmsScript implements SmsScript { params.put("apikey", account.getApikey()); params.put("mobile", StringUtils.join(smsParam.getPhones(), StrPool.COMMA)); params.put("tpl_id", account.getTplId()); - params.put("tpl_value", getTplValue(smsParam)); + if (CharSequenceUtil.isNotBlank(smsParam.getContent()) && smsParam.getContent().contains(PARAMS_KV_SPLIT_KEY)) { + params.put("tpl_value", getTplValue(smsParam)); + } return params; } diff --git a/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java b/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java index f9ab9d2..91817aa 100644 --- a/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java +++ b/austin-support/src/main/java/com/java3y/austin/support/utils/AccountUtils.java @@ -119,7 +119,7 @@ public class AccountUtils { */ public WxMpService initOfficialAccountService(WeChatOfficialAccount officialAccount) { WxMpService wxMpService = new WxMpServiceImpl(); - WxMpRedisConfigImpl config = new WxMpRedisConfigImpl(redisTemplateWxRedisOps(), ChannelType.ENTERPRISE_WE_CHAT.getAccessTokenPrefix()); + WxMpRedisConfigImpl config = new WxMpRedisConfigImpl(redisTemplateWxRedisOps(), ChannelType.OFFICIAL_ACCOUNT.getAccessTokenPrefix()); config.setAppId(officialAccount.getAppId()); config.setSecret(officialAccount.getSecret()); config.setToken(officialAccount.getToken());