diff --git a/austin-common/src/main/java/com/java3y/austin/common/domain/TaskInfo.java b/austin-common/src/main/java/com/java3y/austin/common/domain/TaskInfo.java index 9001d6c..af8f377 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/domain/TaskInfo.java +++ b/austin-common/src/main/java/com/java3y/austin/common/domain/TaskInfo.java @@ -1,6 +1,6 @@ package com.java3y.austin.common.domain; -import com.java3y.austin.common.dto.ContentModel; +import com.java3y.austin.common.dto.model.ContentModel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/domain/dingding/DingDingRobotAccount.java b/austin-common/src/main/java/com/java3y/austin/common/dto/account/DingDingRobotAccount.java similarity index 89% rename from austin-handler/src/main/java/com/java3y/austin/handler/domain/dingding/DingDingRobotAccount.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/account/DingDingRobotAccount.java index 435fc40..40737dd 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/domain/dingding/DingDingRobotAccount.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/account/DingDingRobotAccount.java @@ -1,4 +1,4 @@ -package com.java3y.austin.handler.domain.dingding; +package com.java3y.austin.common.dto.account; import lombok.AllArgsConstructor; diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/account/DingDingWorkNoticeAccount.java b/austin-common/src/main/java/com/java3y/austin/common/dto/account/DingDingWorkNoticeAccount.java new file mode 100644 index 0000000..5b1b2d0 --- /dev/null +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/account/DingDingWorkNoticeAccount.java @@ -0,0 +1,39 @@ +package com.java3y.austin.common.dto.account; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 钉钉工作消息 账号信息 + *

+ * AppKey和AppSecret以及agentId都可在钉钉开发者后台的应用详情页面获取。 + *

+ * https://open-dev.dingtalk.com/?spm=ding_open_doc.document.0.0.13b6722fd9ojfy + * + * @author 3y + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class DingDingWorkNoticeAccount { + + /** + * 应用的唯一标识key。 + */ + private String appKey; + + /** + * 应用的密钥 + */ + private String appSecret; + + /** + * 发送消息时使用的微应用的AgentID + */ + private String agentId; + +} diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/TencentSmsParam.java b/austin-common/src/main/java/com/java3y/austin/common/dto/account/TencentSmsAccount.java similarity index 92% rename from austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/TencentSmsParam.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/account/TencentSmsAccount.java index c798cb0..81a1353 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/domain/sms/TencentSmsParam.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/account/TencentSmsAccount.java @@ -1,4 +1,4 @@ -package com.java3y.austin.handler.domain.sms; +package com.java3y.austin.common.dto.account; import lombok.AllArgsConstructor; import lombok.Builder; @@ -17,7 +17,7 @@ import lombok.NoArgsConstructor; @Builder @AllArgsConstructor @NoArgsConstructor -public class TencentSmsParam { +public class TencentSmsAccount { /** * api相关 diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/domain/wechat/OfficialAccountParam.java b/austin-common/src/main/java/com/java3y/austin/common/dto/account/WechatOfficialAccount.java similarity index 91% rename from austin-handler/src/main/java/com/java3y/austin/handler/domain/wechat/OfficialAccountParam.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/account/WechatOfficialAccount.java index 5b1a797..1dfecc0 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/domain/wechat/OfficialAccountParam.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/account/WechatOfficialAccount.java @@ -1,4 +1,4 @@ -package com.java3y.austin.handler.domain.wechat; +package com.java3y.austin.common.dto.account; import lombok.AllArgsConstructor; import lombok.Builder; @@ -19,7 +19,7 @@ import java.util.Map; @Builder @AllArgsConstructor @NoArgsConstructor -public class OfficialAccountParam { +public class WechatOfficialAccount { /** * 服务号关注者的openId diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/ContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/ContentModel.java similarity index 73% rename from austin-common/src/main/java/com/java3y/austin/common/dto/ContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/ContentModel.java index 9d85b9e..03397e1 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/ContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/ContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; /** * 发送内容的模型 diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/DingDingContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/DingDingContentModel.java similarity index 62% rename from austin-common/src/main/java/com/java3y/austin/common/dto/DingDingContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/DingDingContentModel.java index 17c0d33..3973258 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/DingDingContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/DingDingContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; import lombok.AllArgsConstructor; import lombok.Builder; @@ -7,8 +7,11 @@ import lombok.NoArgsConstructor; /** * @author 3y - * 钉钉 自定义机器人 + * 钉钉 自定义机器人 + 工作通知 + *

* https://open.dingtalk.com/document/group/custom-robot-access + *

+ * https://open.dingtalk.com/document/orgapp-server/asynchronous-sending-of-enterprise-session-messages */ @Data @Builder diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/EmailContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/EmailContentModel.java similarity index 89% rename from austin-common/src/main/java/com/java3y/austin/common/dto/EmailContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/EmailContentModel.java index e2dec9c..2764627 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/EmailContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/EmailContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/EnterpriseWeChatContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/EnterpriseWeChatContentModel.java similarity index 93% rename from austin-common/src/main/java/com/java3y/austin/common/dto/EnterpriseWeChatContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/EnterpriseWeChatContentModel.java index ad6a4b1..fc7dda5 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/EnterpriseWeChatContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/EnterpriseWeChatContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/ImContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/ImContentModel.java similarity index 63% rename from austin-common/src/main/java/com/java3y/austin/common/dto/ImContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/ImContentModel.java index 97a5118..d961f0c 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/ImContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/ImContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; /** * @author 3y diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/MiniProgramContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/MiniProgramContentModel.java similarity index 66% rename from austin-common/src/main/java/com/java3y/austin/common/dto/MiniProgramContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/MiniProgramContentModel.java index 7d1486c..4601781 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/MiniProgramContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/MiniProgramContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; /** * @author 3y diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/OfficialAccountsContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/OfficialAccountsContentModel.java similarity index 90% rename from austin-common/src/main/java/com/java3y/austin/common/dto/OfficialAccountsContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/OfficialAccountsContentModel.java index a65db9c..f30fd41 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/OfficialAccountsContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/OfficialAccountsContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/PushContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/PushContentModel.java similarity index 64% rename from austin-common/src/main/java/com/java3y/austin/common/dto/PushContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/PushContentModel.java index dadd5d9..abb427d 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/PushContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/PushContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; /** diff --git a/austin-common/src/main/java/com/java3y/austin/common/dto/SmsContentModel.java b/austin-common/src/main/java/com/java3y/austin/common/dto/model/SmsContentModel.java similarity index 91% rename from austin-common/src/main/java/com/java3y/austin/common/dto/SmsContentModel.java rename to austin-common/src/main/java/com/java3y/austin/common/dto/model/SmsContentModel.java index 3ed9f12..58fb6f7 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/dto/SmsContentModel.java +++ b/austin-common/src/main/java/com/java3y/austin/common/dto/model/SmsContentModel.java @@ -1,4 +1,4 @@ -package com.java3y.austin.common.dto; +package com.java3y.austin.common.dto.model; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/austin-common/src/main/java/com/java3y/austin/common/enums/ChannelType.java b/austin-common/src/main/java/com/java3y/austin/common/enums/ChannelType.java index bb8cd2c..2329673 100644 --- a/austin-common/src/main/java/com/java3y/austin/common/enums/ChannelType.java +++ b/austin-common/src/main/java/com/java3y/austin/common/enums/ChannelType.java @@ -1,7 +1,7 @@ package com.java3y.austin.common.enums; -import com.java3y.austin.common.dto.*; +import com.java3y.austin.common.dto.model.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.ToString; @@ -25,7 +25,7 @@ public enum ChannelType { MINI_PROGRAM(60, "miniProgram(小程序)", MiniProgramContentModel.class, "mini_program"), ENTERPRISE_WE_CHAT(70, "EnterpriseWeChat(企业微信)", EnterpriseWeChatContentModel.class, "enterprise_we_chat"), DING_DING_ROBOT(80, "dingDingRobot(钉钉机器人)", DingDingContentModel.class, "ding_ding_robot"), - + DING_DING_WORK_NOTICE(90, "dingDingWorkNotice(钉钉工作通知)", DingDingContentModel.class, "ding_ding_work_notice"), ; /** diff --git a/austin-cron/src/main/java/com/java3y/austin/cron/handler/RefreshDingDingAccessTokenHandler.java b/austin-cron/src/main/java/com/java3y/austin/cron/handler/RefreshDingDingAccessTokenHandler.java new file mode 100644 index 0000000..e4b38d2 --- /dev/null +++ b/austin-cron/src/main/java/com/java3y/austin/cron/handler/RefreshDingDingAccessTokenHandler.java @@ -0,0 +1,80 @@ +package com.java3y.austin.cron.handler; + +import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.DingTalkClient; +import com.dingtalk.api.request.OapiGettokenRequest; +import com.dingtalk.api.response.OapiGettokenResponse; +import com.java3y.austin.common.dto.account.DingDingWorkNoticeAccount; +import com.java3y.austin.support.config.SupportThreadPoolConfig; +import com.java3y.austin.support.utils.AccountUtils; +import com.java3y.austin.support.utils.RedisUtils; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * 刷新钉钉的access_token + *

+ * https://open.dingtalk.com/document/orgapp-server/obtain-orgapp-token + * + * @author 3y + */ +@Service +@Slf4j +public class RefreshDingDingAccessTokenHandler { + + private static final String DING_DING_ROBOT_ACCOUNT_KEY = "dingDingWorkNoticeAccount"; + private static final String PREFIX = "ding_ding_work_notice_"; + + + private static final String URL = "https://oapi.dingtalk.com/gettoken"; + + + + @Autowired + private RedisUtils redisUtils; + + @Autowired + private AccountUtils accountUtils; + + /** + * 每小时请求一次接口刷新(以防失效) + */ + @XxlJob("refreshAccessTokenJob") + public void execute() { + log.info("refreshAccessTokenJob#execute!"); + SupportThreadPoolConfig.getPendingSingleThreadPool().execute(() -> { + for (int index = 10; index < 1000; index = index + 10) { + DingDingWorkNoticeAccount account = accountUtils.getAccount(10, DING_DING_ROBOT_ACCOUNT_KEY, PREFIX, new DingDingWorkNoticeAccount()); + if (account == null) { + break; + } + String accessToken = getAccessToken(account); + + } + }); + } + + /** + * 获取 access_token + * @param account + * @return + */ + private String getAccessToken(DingDingWorkNoticeAccount account) { + try { + DingTalkClient client = new DefaultDingTalkClient(URL); + OapiGettokenRequest req = new OapiGettokenRequest(); + req.setAppkey(account.getAppKey()); + req.setAppsecret(account.getAppSecret()); + req.setHttpMethod("GET"); + OapiGettokenResponse rsp = client.execute(req); + System.out.println(rsp.getBody()); + } catch (Exception e) { + + } + + return null; + } +} diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingRobotHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingRobotHandler.java index 4fb4be5..bfa56eb 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingRobotHandler.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingRobotHandler.java @@ -7,9 +7,9 @@ import com.alibaba.fastjson.JSON; import com.google.common.base.Throwables; import com.java3y.austin.common.constant.AustinConstant; import com.java3y.austin.common.domain.TaskInfo; -import com.java3y.austin.common.dto.DingDingContentModel; +import com.java3y.austin.common.dto.model.DingDingContentModel; import com.java3y.austin.common.enums.ChannelType; -import com.java3y.austin.handler.domain.dingding.DingDingRobotAccount; +import com.java3y.austin.common.dto.account.DingDingRobotAccount; import com.java3y.austin.handler.domain.dingding.DingDingRobotParam; import com.java3y.austin.handler.domain.dingding.DingDingRobotResult; import com.java3y.austin.handler.handler.BaseHandler; diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingWorkNoticeHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingWorkNoticeHandler.java new file mode 100644 index 0000000..9fec412 --- /dev/null +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/DingDingWorkNoticeHandler.java @@ -0,0 +1,44 @@ +package com.java3y.austin.handler.handler.impl; + +import com.java3y.austin.common.domain.TaskInfo; +import com.java3y.austin.common.dto.account.DingDingWorkNoticeAccount; +import com.java3y.austin.common.enums.ChannelType; +import com.java3y.austin.handler.handler.BaseHandler; +import com.java3y.austin.handler.handler.Handler; +import com.java3y.austin.support.utils.AccountUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * 钉钉消息自定义机器人 消息处理器 + *

+ * https://open.dingtalk.com/document/group/custom-robot-access + * + * @author 3y + */ +@Slf4j +@Service +public class DingDingWorkNoticeHandler extends BaseHandler implements Handler { + + private static final String DING_DING_ROBOT_ACCOUNT_KEY = "dingDingWorkNoticeAccount"; + private static final String PREFIX = "ding_ding_work_notice_"; + + @Autowired + private AccountUtils accountUtils; + + public DingDingWorkNoticeHandler() { + channelCode = ChannelType.DING_DING_WORK_NOTICE.getCode(); + } + + @Override + public boolean handler(TaskInfo taskInfo) { + + DingDingWorkNoticeAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), DING_DING_ROBOT_ACCOUNT_KEY, PREFIX, new DingDingWorkNoticeAccount()); + + return false; + } + + +} + diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EmailHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EmailHandler.java index 993cf89..300f112 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EmailHandler.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EmailHandler.java @@ -5,7 +5,7 @@ import cn.hutool.extra.mail.MailAccount; import cn.hutool.extra.mail.MailUtil; import com.google.common.base.Throwables; import com.java3y.austin.common.domain.TaskInfo; -import com.java3y.austin.common.dto.EmailContentModel; +import com.java3y.austin.common.dto.model.EmailContentModel; import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.handler.handler.BaseHandler; import com.java3y.austin.handler.handler.Handler; diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EnterpriseWeChatHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EnterpriseWeChatHandler.java index 8f7c283..85517e4 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EnterpriseWeChatHandler.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/EnterpriseWeChatHandler.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSON; import com.google.common.base.Throwables; import com.java3y.austin.common.constant.AustinConstant; import com.java3y.austin.common.domain.TaskInfo; -import com.java3y.austin.common.dto.EnterpriseWeChatContentModel; +import com.java3y.austin.common.dto.model.EnterpriseWeChatContentModel; import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.handler.handler.BaseHandler; import com.java3y.austin.handler.handler.Handler; diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/OfficialAccountHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/OfficialAccountHandler.java index 5a2632e..a1f274b 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/OfficialAccountHandler.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/OfficialAccountHandler.java @@ -3,7 +3,7 @@ package com.java3y.austin.handler.handler.impl; import com.alibaba.fastjson.JSON; import com.google.common.base.Throwables; import com.java3y.austin.common.domain.TaskInfo; -import com.java3y.austin.common.dto.OfficialAccountsContentModel; +import com.java3y.austin.common.dto.model.OfficialAccountsContentModel; import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.handler.handler.BaseHandler; import com.java3y.austin.handler.handler.Handler; diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java index 7a23499..e833a3e 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/handler/impl/SmsHandler.java @@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.google.common.base.Throwables; import com.java3y.austin.common.domain.TaskInfo; -import com.java3y.austin.common.dto.SmsContentModel; +import com.java3y.austin.common.dto.model.SmsContentModel; import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.handler.domain.sms.SmsParam; import com.java3y.austin.handler.handler.BaseHandler; diff --git a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java index 510bbfc..4d31384 100644 --- a/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java +++ b/austin-handler/src/main/java/com/java3y/austin/handler/script/impl/TencentSmsScript.java @@ -6,7 +6,7 @@ import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.IdUtil; import com.java3y.austin.common.enums.SmsStatus; import com.java3y.austin.handler.domain.sms.SmsParam; -import com.java3y.austin.handler.domain.sms.TencentSmsParam; +import com.java3y.austin.common.dto.account.TencentSmsAccount; import com.java3y.austin.handler.script.SmsScript; import com.java3y.austin.support.domain.SmsRecord; import com.java3y.austin.support.utils.AccountUtils; @@ -46,15 +46,15 @@ public class TencentSmsScript implements SmsScript { @Override public List send(SmsParam smsParam) throws Exception { - TencentSmsParam tencentSmsParam = accountUtils.getAccount(smsParam.getSendAccount(), SMS_ACCOUNT_KEY, PREFIX, TencentSmsParam.builder().build()); - SmsClient client = init(tencentSmsParam); - SendSmsRequest request = assembleReq(smsParam, tencentSmsParam); + TencentSmsAccount tencentSmsAccount = accountUtils.getAccount(smsParam.getSendAccount(), SMS_ACCOUNT_KEY, PREFIX, TencentSmsAccount.builder().build()); + SmsClient client = init(tencentSmsAccount); + SendSmsRequest request = assembleReq(smsParam, tencentSmsAccount); SendSmsResponse response = client.SendSms(request); - return assembleSmsRecord(smsParam, response, tencentSmsParam); + return assembleSmsRecord(smsParam, response, tencentSmsAccount); } - private List assembleSmsRecord(SmsParam smsParam, SendSmsResponse response, TencentSmsParam tencentSmsParam) { + private List assembleSmsRecord(SmsParam smsParam, SendSmsResponse response, TencentSmsAccount tencentSmsAccount) { if (response == null || ArrayUtil.isEmpty(response.getSendStatusSet())) { return null; } @@ -70,8 +70,8 @@ public class TencentSmsScript implements SmsScript { .sendDate(Integer.valueOf(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN))) .messageTemplateId(smsParam.getMessageTemplateId()) .phone(Long.valueOf(phone)) - .supplierId(tencentSmsParam.getSupplierId()) - .supplierName(tencentSmsParam.getSupplierName()) + .supplierId(tencentSmsAccount.getSupplierId()) + .supplierName(tencentSmsAccount.getSupplierName()) .msgContent(smsParam.getContent()) .seriesId(sendStatus.getSerialNo()) .chargingNum(Math.toIntExact(sendStatus.getFee())) @@ -89,7 +89,7 @@ public class TencentSmsScript implements SmsScript { /** * 组装发送短信参数 */ - private SendSmsRequest assembleReq(SmsParam smsParam, TencentSmsParam account) { + private SendSmsRequest assembleReq(SmsParam smsParam, TencentSmsAccount account) { SendSmsRequest req = new SendSmsRequest(); String[] phoneNumberSet1 = smsParam.getPhones().toArray(new String[smsParam.getPhones().size() - 1]); req.setPhoneNumberSet(phoneNumberSet1); @@ -107,7 +107,7 @@ public class TencentSmsScript implements SmsScript { * * @param account */ - private SmsClient init(TencentSmsParam account) { + private SmsClient init(TencentSmsAccount account) { Credential cred = new Credential(account.getSecretId(), account.getSecretKey()); HttpProfile httpProfile = new HttpProfile(); httpProfile.setEndpoint(account.getUrl()); diff --git a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java index 9f7da3e..403b07c 100644 --- a/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java +++ b/austin-service-api-impl/src/main/java/com/java3y/austin/service/api/impl/action/AssembleAction.java @@ -7,7 +7,7 @@ import com.alibaba.fastjson.JSONObject; import com.google.common.base.Throwables; import com.java3y.austin.common.constant.AustinConstant; import com.java3y.austin.common.domain.TaskInfo; -import com.java3y.austin.common.dto.ContentModel; +import com.java3y.austin.common.dto.model.ContentModel; import com.java3y.austin.common.enums.ChannelType; import com.java3y.austin.common.enums.RespStatusEnum; import com.java3y.austin.common.vo.BasicResultVO; diff --git a/austin-support/pom.xml b/austin-support/pom.xml index 0a9a1bf..6a9b651 100644 --- a/austin-support/pom.xml +++ b/austin-support/pom.xml @@ -86,7 +86,7 @@ com.aliyun - dingtalk + alibaba-dingtalk-service-sdk diff --git a/pom.xml b/pom.xml index 5571aed..6388c08 100644 --- a/pom.xml +++ b/pom.xml @@ -177,10 +177,9 @@ com.aliyun - dingtalk - 1.3.22 + alibaba-dingtalk-service-sdk + 2.0.0 -