1、渠道账号信息存储至 数据库

2、优化部分代码(短信拉取回执)
3、开始接入微信服务号推送
pull/26/head
3y 2 years ago
commit 6ac0f13ba5

@ -63,14 +63,14 @@ austin项目**核心流程**`austin-api`接收到发送消息请求,直接
目前引用的中间件教程的安装姿势均基于`Centos 7.6`austin项目**强依赖**`MySQL`/`Redis`/(**大概需要2G内存**)**弱依赖**`kafka`/`prometheus`/`graylog`/`flink`/`xxl-job`/`apollo`(**完全部署所有的服务大概8G+内存**)。如果缺少相关的组件可戳:[安装相关组件教程](INSTALL.md)。
> 实在想要`clone`项目后不用自己部署环境直接在本地启动`debug`,我这提供了[会员服务](https://mp.weixin.qq.com/s?__biz=MzI4Njg5MDA5NA==&mid=2247505577&idx=1&sn=5114f8f583755899c2946fbea0b22e4b&chksm=ebd497a8dca31ebe8f98344483a00c860863dfc3586e51eed95b25988151427fee8101311f4f&token=735778370&lang=zh_CN#rd)**直连**部署好的服务器
> 实在想要`clone`项目后不用自己部署环境直接在本地启动`debug`,我这提供了[会员服务](https://mp.weixin.qq.com/s/4cOhNG5JBSvBkbSKTfw7eQ)**直连**部署好的服务器
**1**、austin使用的MySQL版本**5.7x**。如果目前使用的MySQL版本8.0,注意改变`pom.xml`所依赖的版本
**2**、填写`application.properties`中`austin-database`对应的`ip/port/username/password`信息
**3**、执行`sql`文件夹下的`austin.sql`创建对应的表以及插入测试数据
**3**、执行`sql`文件夹下的`austin.sql`创建对应的表
**4**、如果配置`austin.mq.pipeline=kafka`,需要填写`application.properties`中`austin.kafka`对应的`ip`/`port`信息
@ -80,15 +80,7 @@ austin项目**核心流程**`austin-api`接收到发送消息请求,直接
**7**、以上配置信息都在`application.properties`文件中修改。(`prometheus`/`graylog`/`flink`/`xxl-job`/`apollo`可选)
**8**、发送渠道**账号的信息**都配置在**local.properties**,配置的示例参照`com.java3y.austin.support.utils#getAccount`中的注释
**10**、调用http接口`com.java3y.austin.web.controller#send`给自己发一条邮件或短信感受(**邮件门槛相对较低,建议配置邮件**)
```shell
curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"code":"send","messageParam":{"extra":null,"receiver":"13719333899"},"messageTemplateId":1}'
```
**11**、austin前端管理系统部署一分钟即能打开戳[GitHub](https://github.com/ZhongFuCheng3y/austin-admin)或[Gitee](https://gitee.com/zhongfucheng/austin-admin)查看
**8**、austin前端管理系统部署一分钟即能打开戳[GitHub](https://github.com/ZhongFuCheng3y/austin-admin)或[Gitee](https://gitee.com/zhongfucheng/austin-admin)查看
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/a023d9082fa644bda9b50144e02985cb~tplv-k3u1fbpfcp-zoom-1.image)
@ -98,6 +90,14 @@ curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"co
![](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/01d028359e6e4229825a7fd8cc22c6c7~tplv-k3u1fbpfcp-zoom-1.image)
**9**、发送渠道**账号的信息**都在**账号**,配置的示例可参照对应的提示案例
![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/2039b96045494ded8e6f55528eb20b1d~tplv-k3u1fbpfcp-watermark.image?)
**10**、新建一个模板消息(**邮件门槛相对较低,建议配置邮件**)
**11**、测试发送一条消息
**12**、正常使用**数据管理**(查看实时数据链路下发)需要将`austin-stream`的`jar`包上传至`Flink`,根据[部署文档](INSTALL.md)启动Flink。在打`jar`包前需要填写`com.java3y.austin.stream.constants.AustinFlinkConstant`中的`redis`和`kafka`的`ip/port`日志的topic在`application.properties`中的`austin.business.log.topic.name`。如果没有该topic需要提前创建并使用Kafka作为消息队列实现)
**13**、正常使用**定时任务**需要部署`xxl-job`,根据[部署文档](INSTALL.md)启动xxl的调度中心并在`application.properteis`中填写 `austin.xxl.job.ip`和`austin.xxl.job.port`
@ -124,7 +124,7 @@ curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"co
5、除了项目还可以问我些学习经验、学习路线、简历编写、面试经验等等问题技术和学习上的知识**知无不言**
详情可以看戳:[我开通了付费渠道](https://mp.weixin.qq.com/s?__biz=MzI4Njg5MDA5NA==&mid=2247507166&idx=1&sn=d4437089c2db18b90a6d3ec742380554&chksm=ebd49ddfdca314c94d49a02da2ecb1358ac08d86616b6f1fce34720cc96e81d3006a51e86beb&token=28465847&lang=zh_CN#rd)
详情可以看戳:[我开通了付费渠道](https://mp.weixin.qq.com/s/4cOhNG5JBSvBkbSKTfw7eQ)
## 项目交流
@ -147,6 +147,8 @@ curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"co
## 里程碑
![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/80fc1c550ee145eda95cfac4bd617a04~tplv-k3u1fbpfcp-watermark.image?)
- [x] Maven+SpringBoot项目搭建
- [x] logback日志记录项目运行时信息引入common/guava/Hutool/Lombok/fastjson/OkHttp工具包
- [x] 接入腾讯云渠道发送一条短信
@ -178,9 +180,10 @@ curl -XPOST "127.0.0.1:8080/send" -H 'Content-Type: application/json' -d '{"co
- [x] 完成接入钉钉工作渠道所有类型的消息,包括对文件素材的上传功能
- [x] Kafka消息支持tag过滤
- [x] MQ层支持可插拔默认使用eventbus单机队列Kafka变为弱依赖
- [x] 渠道账号改为读取数据库,优化短信回执拉取功能
- [ ] 总体架构已完成,持续做基础建设和优化代码
**近期更新时间**7月11号
**近期更新时间**11月27
**近期更新功能**MQ层可插拔重构
**近期更新功能**渠道账号改为读取数据库,优化短信回执拉取功能

@ -2,30 +2,16 @@ package com.java3y.austin.common.constant;
/**
*
* Austin
*
* @author 3y
*/
public class AustinConstant {
/**
* boolean
*
*/
public final static Integer TRUE = 1;
public final static Integer FALSE = 0;
/**
* cron
*/
public final static String CRON_FORMAT = "ss mm HH dd MM ? yyyy-yyyy";
/**
* apollo
*/
public final static String APOLLO_DEFAULT_VALUE_JSON_OBJECT = "{}";
public final static String APOLLO_DEFAULT_VALUE_JSON_ARRAY = "[]";
public static final String ORIGIN_VALUE = "http://localhost:3000";
/**
* businessId
@ -33,6 +19,10 @@ public class AustinConstant {
*/
public final static Integer BUSINESS_ID_LENGTH = 16;
/**
*
*/
public static final Integer BATCH_RECEIVER_SIZE = 100;
/**
*
@ -43,23 +33,5 @@ public class AustinConstant {
public static final String SEND_ALL = "@all";
/**
*
*/
public static final String HMAC_SHA256_ENCRYPTION_ALGO = "HmacSHA256";
/**
*
*/
public static final String CHARSET_NAME = "UTF-8";
/**
* HTTP
*/
public static final String REQUEST_METHOD_GET = "GET";
public static final String REQUEST_METHOD_POST = "POST";
}

@ -1,6 +1,7 @@
package com.java3y.austin.common.constant;
public class CommonConstant {
public final static String PERIOD = ".";
public final static String COMMA = ",";
public final static String COLON = ":";
@ -9,10 +10,54 @@ public class CommonConstant {
public final static String SLASH = "/";
public final static String BACKSLASH = "\\";
public final static String EMPTY_STRING = "";
//
public final static String RADICAL = "|";
public final static String QM_STRING = "?";
public final static String EQUAL_STRING = "=";
public final static String AND_STRING = "&";
public final static String ONE = "1";
public final static String ZERO = "0";
public final static String MINUS_ONE = "-1";
public final static String YES = "Y";
public final static String NO = "N";
public final static char QM = '?';
/**
* boolean
*/
public final static Integer TRUE = 1;
public final static Integer FALSE = 0;
/**
*
*/
public static final String HMAC_SHA256_ENCRYPTION_ALGO = "HmacSHA256";
/**
*
*/
public static final String CHARSET_NAME = "UTF-8";
/**
* HTTP
*/
public static final String REQUEST_METHOD_GET = "GET";
public static final String REQUEST_METHOD_POST = "POST";
/**
* JSON
*/
public final static String EMPTY_JSON_OBJECT = "{}";
public final static String EMPTY_VALUE_JSON_ARRAY = "[]";
/**
* cron
*/
public final static String CRON_FORMAT = "ss mm HH dd MM ? yyyy-yyyy";
}

@ -3,99 +3,19 @@ package com.java3y.austin.common.constant;
/**
*
* <p>
* (apollokey)
* <p>
* 1010
*
* @author 3y
*/
public class SendAccountConstant {
/**
* 1010
*/
public static final Integer START = 10;
public static final Integer STEP = 10;
/**
*
*/
public static final String DING_DING_WORK_NOTICE_ACCOUNT_KEY = "dingDingWorkNoticeAccount";
public static final String DING_DING_WORK_NOTICE_PREFIX = "ding_ding_work_notice_";
public static final String DING_DING_ACCESS_TOKEN_PREFIX = "ding_ding_access_token_";
/**
* PUSH
*/
public static final String GE_TUI_ACCOUNT_KEY = "geTuiAccount";
public static final String GE_TUI_ACCOUNT_PREFIX = "ge_tui_account_";
public static final String GE_TUI_ACCESS_TOKEN_PREFIX = "ge_tui_access_token_";
/**
*
*/
public static final String EMAIL_ACCOUNT_KEY = "emailAccount";
public static final String EMAIL_ACCOUNT_PREFIX = "email_";
/**
*
*/
public static final String DING_DING_ROBOT_ACCOUNT_KEY = "dingDingRobotAccount";
public static final String DING_DING_ROBOT_PREFIX = "ding_ding_robot_";
/**
*
*/
public static final String ENTERPRISE_WECHAT_ROBOT_ACCOUNT_KEY = "enterpriseWechatAccountRobot";
public static final String ENTERPRISE_WECHAT_ROBOT_PREFIX = "enterprise_wechat_robot_";
/**
*
*/
public static final String FEI_SHU_ROBOT_ACCOUNT_KEY = "feiShuAccountRobot";
public static final String FEI_SHU_ROBOT_PREFIX = "fei_shu_robot_";
/**
*
*/
public static final String ENTERPRISE_WECHAT_ACCOUNT_KEY = "enterpriseWechatAccount";
public static final String ENTERPRISE_WECHAT_PREFIX = "enterprise_wechat_";
/**
*
*/
public static final String WECHAT_OFFICIAL_ACCOUNT_KEY = "officialAccount";
public static final String WECHAT_OFFICIAL__PREFIX = "official_";
/**
*
*/
public static final String WECHAT_MINI_PROGRAM_ACCOUNT_KEY = "miniProgramAccount";
public static final String WECHAT_MINI_PROGRAM_PREFIX = "mini_program_";
/**
*
*/
public static final String ALIPAY_MINI_PROGRAM_ACCOUNT_KEY = "alipayMiniProgramAccount";
public static final String ALIPAY_MINI_PROGRAM_PREFIX = "alipay_mini_program_";
/**
*
*/
public static final String SMS_ACCOUNT_KEY = "smsAccount";
public static final String SMS_PREFIX = "sms_";
/**
* code
*/
public static final Integer TENCENT_SMS_CODE = 10;
public static final Integer YUN_PIAN_SMS_CODE = 20;
}

@ -1,47 +0,0 @@
package com.java3y.austin.common.dto.account;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
*
*
* [{"sms_10":{"url":"sms.tencentcloudapi.com","region":"ap-guangzhou","secretId":"AKIDhDUUDfffffMEqBF1WljQq","secretKey":"B4h39yWnfffff7D2btue7JErDJ8gxyi","smsSdkAppId":"140025","templateId":"11897","signName":"Java3y公众号","supplierId":10,"supplierName":"腾讯云"}}]
*
* @author 3y
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TencentSmsAccount {
/**
* api
*/
private String url;
private String region ;
/**
*
*/
private String secretId;
private String secretKey;
private String smsSdkAppId;
private String templateId;
private String signName;
/**
* Id
*/
private Integer supplierId;
/**
*
*/
private String supplierName;
}

@ -0,0 +1,28 @@
package com.java3y.austin.common.dto.account.sms;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SmsAccount {
/**
* Id
*/
protected Integer supplierId;
/**
*
*/
protected String supplierName;
/**
* "下发"/"回执"
* ScriptName
*/
protected String scriptName;
}

@ -0,0 +1,34 @@
package com.java3y.austin.common.dto.account.sms;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* <p>
*
* {"url":"sms.tencentcloudapi.com","region":"ap-guangzhou","secretId":"AKIDhDxxxxxxxx1WljQq","secretKey":"B4hwww39yxxxrrrrgxyi","smsSdkAppId":"1423123125","templateId":"1182097","signName":"Java3y公众号","supplierId":10,"supplierName":"腾讯云","scriptName":"TencentSmsScript"}
*
* @author 3y
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TencentSmsAccount extends SmsAccount {
/**
* api
*/
private String url;
private String region;
/**
*
*/
private String secretId;
private String secretKey;
private String smsSdkAppId;
private String templateId;
private String signName;
}

@ -0,0 +1,34 @@
package com.java3y.austin.common.dto.account.sms;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* <p>
*
* {"url":"https://sms.yunpian.com/v2/sms/tpl_batch_send.json","apikey":"caffff8234234231b5cd7","tpl_id":"523333332","supplierId":20,"supplierName":"云片","scriptName":"YunPianSmsScript"}
*
* @author 3y
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class YunPianSmsAccount extends SmsAccount {
/**
* apikey
*/
private String apikey;
/**
* tplId
*/
private String tplId;
/**
* api
*/
private String url;
}

@ -0,0 +1,37 @@
package com.java3y.austin.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
/**
*
* @author 3y
*/
@Getter
@ToString
@AllArgsConstructor
public enum SmsSupplier {
TENCENT(10,"腾讯渠道商"),
YUN_PAIN(20,"云片渠道商");
private Integer code;
private String description;
/**
*
* @param code
* @return
*/
public static String getDescriptionByStatus(Integer code) {
for (SmsStatus value : SmsStatus.values()) {
if (value.getCode().equals(code)) {
return value.getDescription();
}
}
return "";
}
}

@ -1,15 +1,20 @@
package com.java3y.austin.cron.handler;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiGettokenRequest;
import com.dingtalk.api.response.OapiGettokenResponse;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.DingDingWorkNoticeAccount;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.support.config.SupportThreadPoolConfig;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.utils.AccountUtils;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
@ -17,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* access_token
@ -36,7 +43,8 @@ public class RefreshDingDingAccessTokenHandler {
private StringRedisTemplate redisTemplate;
@Autowired
private AccountUtils accountUtils;
private ChannelAccountDao channelAccountDao;
/**
* )
@ -45,14 +53,12 @@ public class RefreshDingDingAccessTokenHandler {
public void execute() {
log.info("refreshAccessTokenJob#execute!");
SupportThreadPoolConfig.getPendingSingleThreadPool().execute(() -> {
for (int index = SendAccountConstant.START; true; index = index + SendAccountConstant.STEP) {
DingDingWorkNoticeAccount account = accountUtils.getAccount(index, SendAccountConstant.DING_DING_WORK_NOTICE_ACCOUNT_KEY, SendAccountConstant.DING_DING_WORK_NOTICE_PREFIX, DingDingWorkNoticeAccount.class);
if (account == null) {
break;
}
List<ChannelAccount> accountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.DING_DING_WORK_NOTICE.getCode());
for (ChannelAccount channelAccount : accountList) {
DingDingWorkNoticeAccount account = JSON.parseObject(channelAccount.getAccountConfig(), DingDingWorkNoticeAccount.class);
String accessToken = getAccessToken(account);
if (StrUtil.isNotBlank(accessToken)) {
redisTemplate.opsForValue().set(SendAccountConstant.DING_DING_ACCESS_TOKEN_PREFIX + index, accessToken);
redisTemplate.opsForValue().set(SendAccountConstant.DING_DING_ACCESS_TOKEN_PREFIX + channelAccount.getId(), accessToken);
}
}
});
@ -71,7 +77,7 @@ public class RefreshDingDingAccessTokenHandler {
OapiGettokenRequest req = new OapiGettokenRequest();
req.setAppkey(account.getAppKey());
req.setAppsecret(account.getAppSecret());
req.setHttpMethod(AustinConstant.REQUEST_METHOD_GET);
req.setHttpMethod(CommonConstant.REQUEST_METHOD_GET);
OapiGettokenResponse rsp = client.execute(req);
accessToken = rsp.getAccessToken();
} catch (Exception e) {

@ -7,11 +7,16 @@ import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.GeTuiAccount;
import com.java3y.austin.cron.dto.getui.QueryTokenParamDTO;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.cron.dto.getui.GeTuiTokenResultDTO;
import com.java3y.austin.cron.dto.getui.QueryTokenParamDTO;
import com.java3y.austin.support.config.SupportThreadPoolConfig;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.utils.AccountUtils;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
@ -19,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* token
@ -35,7 +42,8 @@ public class RefreshGeTuiAccessTokenHandler {
private StringRedisTemplate redisTemplate;
@Autowired
private AccountUtils accountUtils;
private ChannelAccountDao channelAccountDao;
/**
* )
@ -44,14 +52,12 @@ public class RefreshGeTuiAccessTokenHandler {
public void execute() {
log.info("refreshGeTuiAccessTokenJob#execute!");
SupportThreadPoolConfig.getPendingSingleThreadPool().execute(() -> {
for (int index = SendAccountConstant.START; true; index = index + SendAccountConstant.STEP) {
GeTuiAccount account = accountUtils.getAccount(index, SendAccountConstant.GE_TUI_ACCOUNT_KEY, SendAccountConstant.GE_TUI_ACCOUNT_PREFIX, GeTuiAccount.class);
if (account == null) {
break;
}
List<ChannelAccount> accountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.PUSH.getCode());
for (ChannelAccount channelAccount : accountList) {
GeTuiAccount account = JSON.parseObject(channelAccount.getAccountConfig(), GeTuiAccount.class);
String accessToken = getAccessToken(account);
if (StrUtil.isNotBlank(accessToken)) {
redisTemplate.opsForValue().set(SendAccountConstant.GE_TUI_ACCESS_TOKEN_PREFIX + index, accessToken);
redisTemplate.opsForValue().set(SendAccountConstant.GE_TUI_ACCESS_TOKEN_PREFIX + channelAccount.getId(), accessToken);
}
}
});

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.cron.config.CronAsyncThreadPoolConfig;
import com.java3y.austin.cron.constants.PendingConstant;
import com.java3y.austin.cron.vo.CrowdInfoVo;
@ -40,9 +41,9 @@ public class CrowdBatchTaskPending extends AbstractLazyPending<CrowdInfoVo> {
public CrowdBatchTaskPending() {
PendingParam<CrowdInfoVo> pendingParam = new PendingParam<>();
pendingParam.setNumThreshold(PendingConstant.NUM_THRESHOLD)
.setQueue(new LinkedBlockingQueue(PendingConstant.QUEUE_SIZE))
pendingParam.setQueue(new LinkedBlockingQueue(PendingConstant.QUEUE_SIZE))
.setTimeThreshold(PendingConstant.TIME_THRESHOLD)
.setNumThreshold(AustinConstant.BATCH_RECEIVER_SIZE)
.setExecutorService(CronAsyncThreadPoolConfig.getConsumePendingThreadPool());
this.pendingParam = pendingParam;
}

@ -3,6 +3,7 @@ package com.java3y.austin.cron.xxl.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.cron.xxl.constants.XxlJobConstant;
@ -44,8 +45,8 @@ public class XxlJobUtils {
String scheduleConf = messageTemplate.getExpectPushTime();
// 如果没有指定cron表达式说明立即执行(给到xxl-job延迟5秒的cron表达式)
if (messageTemplate.getExpectPushTime().equals(String.valueOf(AustinConstant.FALSE))) {
scheduleConf = DateUtil.format(DateUtil.offsetSecond(new Date(), XxlJobConstant.DELAY_TIME), AustinConstant.CRON_FORMAT);
if (messageTemplate.getExpectPushTime().equals(String.valueOf(CommonConstant.FALSE))) {
scheduleConf = DateUtil.format(DateUtil.offsetSecond(new Date(), XxlJobConstant.DELAY_TIME), CommonConstant.CRON_FORMAT);
}
XxlJobInfo xxlJobInfo = XxlJobInfo.builder()
@ -61,7 +62,7 @@ public class XxlJobUtils {
.executorTimeout(XxlJobConstant.TIME_OUT)
.executorFailRetryCount(XxlJobConstant.RETRY_COUNT)
.glueType(GlueTypeEnum.BEAN.name())
.triggerStatus(AustinConstant.FALSE)
.triggerStatus(CommonConstant.FALSE)
.glueRemark(StrUtil.EMPTY)
.glueSource(StrUtil.EMPTY)
.alarmEmail(StrUtil.EMPTY)
@ -80,7 +81,7 @@ public class XxlJobUtils {
private Integer queryJobGroupId() {
BasicResultVO basicResultVO = cronTaskService.getGroupId(appName, jobHandlerName);
if (basicResultVO.getData() == null) {
XxlJobGroup xxlJobGroup = XxlJobGroup.builder().appname(appName).title(jobHandlerName).addressType(AustinConstant.FALSE).build();
XxlJobGroup xxlJobGroup = XxlJobGroup.builder().appname(appName).title(jobHandlerName).addressType(CommonConstant.FALSE).build();
if (RespStatusEnum.SUCCESS.getCode().equals(cronTaskService.createGroup(xxlJobGroup).getStatus())) {
return (int) cronTaskService.getGroupId(appName, jobHandlerName).getData();
}

@ -41,16 +41,7 @@
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</dependency>
<!--微信发送模板信息-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
</dependency>
<!--微信小程序第三方SDK-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
</dependency>
<!--企业微信发送消息-->
<dependency>

@ -38,10 +38,7 @@ public class AlipayMiniProgramAccountServiceImpl implements AlipayMiniProgramAcc
*/
@Override
public void send(AlipayMiniProgramParam miniProgramParam) throws AlipayApiException {
AlipayMiniProgramAccount miniProgramAccount = accountUtils.getAccount(miniProgramParam.getSendAccount(),
SendAccountConstant.ALIPAY_MINI_PROGRAM_ACCOUNT_KEY,
SendAccountConstant.ALIPAY_MINI_PROGRAM_PREFIX,
AlipayMiniProgramAccount.class);
AlipayMiniProgramAccount miniProgramAccount = accountUtils.getAccountById(miniProgramParam.getSendAccount(), AlipayMiniProgramAccount.class);
AlipayClient client = initService(miniProgramAccount);
List<AlipayOpenAppMiniTemplatemessageSendRequest> request = assembleReq(miniProgramParam, miniProgramAccount);

@ -1,6 +1,7 @@
package com.java3y.austin.handler.deduplication;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.enums.DeduplicationType;
import com.java3y.austin.support.service.ConfigService;
@ -27,7 +28,7 @@ public class DeduplicationRuleService {
public void duplication(TaskInfo taskInfo) {
// 配置样例:{"deduplication_10":{"num":1,"time":300},"deduplication_20":{"num":5}}
String deduplicationConfig = config.getProperty(DEDUPLICATION_RULE_KEY, AustinConstant.APOLLO_DEFAULT_VALUE_JSON_OBJECT);
String deduplicationConfig = config.getProperty(DEDUPLICATION_RULE_KEY, CommonConstant.EMPTY_JSON_OBJECT);
// 去重
List<Integer> deduplicationList = DeduplicationType.getDeduplicationList();

@ -2,6 +2,7 @@ package com.java3y.austin.handler.deduplication.limit;
import cn.hutool.core.collection.CollUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.handler.deduplication.DeduplicationParam;
import com.java3y.austin.handler.deduplication.service.AbstractDeduplicationService;
@ -66,7 +67,7 @@ public class SimpleLimitService extends AbstractLimitService {
if (inRedisValue.get(key) != null) {
keyValues.put(key, String.valueOf(Integer.valueOf(inRedisValue.get(key)) + 1));
} else {
keyValues.put(key, String.valueOf(AustinConstant.TRUE));
keyValues.put(key, String.valueOf(CommonConstant.TRUE));
}
}
if (CollUtil.isNotEmpty(keyValues)) {

@ -3,6 +3,7 @@ package com.java3y.austin.handler.discard;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.AnchorInfo;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.enums.AnchorState;
@ -33,8 +34,7 @@ public class DiscardMessageService {
*/
public boolean isDiscard(TaskInfo taskInfo) {
// 配置示例: ["1","2"]
JSONArray array = JSON.parseArray(config.getProperty(DISCARD_MESSAGE_KEY,
AustinConstant.APOLLO_DEFAULT_VALUE_JSON_ARRAY));
JSONArray array = JSON.parseArray(config.getProperty(DISCARD_MESSAGE_KEY, CommonConstant.EMPTY_VALUE_JSON_ARRAY));
if (array.contains(String.valueOf(taskInfo.getMessageTemplateId()))) {
logUtils.print(AnchorInfo.builder().businessId(taskInfo.getBusinessId()).ids(taskInfo.getReceiver()).state(AnchorState.DISCARD.getCode()).build());

@ -24,6 +24,12 @@ public class SmsParam {
*/
private Set<String> phones;
/**
*
*/
private String scriptName;
/**
*
*/

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.RateLimiter;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.handler.enums.RateLimitStrategy;
@ -76,7 +77,7 @@ public class FlowControlFactory implements ApplicationContextAware {
* @param channelCode
*/
private Double getRateLimitConfig(Integer channelCode) {
String flowControlConfig = config.getProperty(FLOW_CONTROL_KEY, AustinConstant.APOLLO_DEFAULT_VALUE_JSON_OBJECT);
String flowControlConfig = config.getProperty(FLOW_CONTROL_KEY, CommonConstant.EMPTY_JSON_OBJECT);
JSONObject jsonObject = JSON.parseObject(flowControlConfig);
if (jsonObject.getDouble(FLOW_CONTROL_PREFIX + channelCode) == null) {
return null;

@ -24,5 +24,4 @@ public interface Handler {
*/
void recall(MessageTemplate messageTemplate);
}

@ -6,6 +6,7 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.dto.account.DingDingRobotAccount;
@ -48,7 +49,7 @@ public class DingDingRobotHandler extends BaseHandler implements Handler {
@Override
public boolean handler(TaskInfo taskInfo) {
try {
DingDingRobotAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.DING_DING_ROBOT_ACCOUNT_KEY, SendAccountConstant.DING_DING_ROBOT_PREFIX, DingDingRobotAccount.class);
DingDingRobotAccount account = accountUtils.getAccountById(taskInfo.getSendAccount(), DingDingRobotAccount.class);
DingDingRobotParam dingDingRobotParam = assembleParam(taskInfo);
String httpResult = HttpUtil.post(assembleParamUrl(account), JSON.toJSONString(dingDingRobotParam));
DingDingRobotResult dingDingRobotResult = JSON.parseObject(httpResult, DingDingRobotResult.class);
@ -126,10 +127,10 @@ public class DingDingRobotHandler extends BaseHandler implements Handler {
String sign = "";
try {
String stringToSign = currentTimeMillis + String.valueOf(StrUtil.C_LF) + secret;
Mac mac = Mac.getInstance(AustinConstant.HMAC_SHA256_ENCRYPTION_ALGO);
mac.init(new SecretKeySpec(secret.getBytes(AustinConstant.CHARSET_NAME), AustinConstant.HMAC_SHA256_ENCRYPTION_ALGO));
byte[] signData = mac.doFinal(stringToSign.getBytes(AustinConstant.CHARSET_NAME));
sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), AustinConstant.CHARSET_NAME);
Mac mac = Mac.getInstance(CommonConstant.HMAC_SHA256_ENCRYPTION_ALGO);
mac.init(new SecretKeySpec(secret.getBytes(CommonConstant.CHARSET_NAME), CommonConstant.HMAC_SHA256_ENCRYPTION_ALGO));
byte[] signData = mac.doFinal(stringToSign.getBytes(CommonConstant.CHARSET_NAME));
sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), CommonConstant.CHARSET_NAME);
} catch (Exception e) {
log.error("DingDingHandler#assembleSign fail!:{}", Throwables.getStackTraceAsString(e));
}

@ -59,13 +59,14 @@ public class DingDingWorkNoticeHandler extends BaseHandler implements Handler {
private static final String SEND_URL = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2";
private static final String RECALL_URL = "https://oapi.dingtalk.com/topapi/message/corpconversation/recall";
private static final String PULL_URL = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult";
private static final String DING_DING_RECALL_KEY_PREFIX = "RECALL_";
private static final String RECALL_BIZ_TYPE = "DingDingWorkNoticeHandler#recall";
@Override
public boolean handler(TaskInfo taskInfo) {
try {
DingDingWorkNoticeAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.DING_DING_WORK_NOTICE_ACCOUNT_KEY, SendAccountConstant.DING_DING_WORK_NOTICE_PREFIX, DingDingWorkNoticeAccount.class);
DingDingWorkNoticeAccount account = accountUtils.getAccountById(taskInfo.getSendAccount(), DingDingWorkNoticeAccount.class);
OapiMessageCorpconversationAsyncsendV2Request request = assembleParam(account, taskInfo);
String accessToken = redisTemplate.opsForValue().get(SendAccountConstant.DING_DING_ACCESS_TOKEN_PREFIX + taskInfo.getSendAccount());
OapiMessageCorpconversationAsyncsendV2Response response = new DefaultDingTalkClient(SEND_URL).execute(request, accessToken);
@ -179,7 +180,7 @@ public class DingDingWorkNoticeHandler extends BaseHandler implements Handler {
public void recall(MessageTemplate messageTemplate) {
SupportThreadPoolConfig.getPendingSingleThreadPool().execute(() -> {
try {
DingDingWorkNoticeAccount account = accountUtils.getAccount(messageTemplate.getSendAccount(), SendAccountConstant.DING_DING_WORK_NOTICE_ACCOUNT_KEY, SendAccountConstant.DING_DING_WORK_NOTICE_PREFIX, DingDingWorkNoticeAccount.class);
DingDingWorkNoticeAccount account = accountUtils.getAccountById(messageTemplate.getSendAccount(), DingDingWorkNoticeAccount.class);
String accessToken = redisTemplate.opsForValue().get(SendAccountConstant.DING_DING_ACCESS_TOKEN_PREFIX + messageTemplate.getSendAccount());
while (redisTemplate.opsForList().size(DING_DING_RECALL_KEY_PREFIX + messageTemplate.getId()) > 0) {
String taskId = redisTemplate.opsForList().leftPop(DING_DING_RECALL_KEY_PREFIX + messageTemplate.getId());
@ -195,5 +196,23 @@ public class DingDingWorkNoticeHandler extends BaseHandler implements Handler {
}
});
}
/**
*
*/
public void pull(Long accountId) {
try {
// DingDingWorkNoticeAccount account = accountUtils.getAccountById(accountId, DingDingWorkNoticeAccount.class);
// String accessToken = redisTemplate.opsForValue().get(SendAccountConstant.DING_DING_ACCESS_TOKEN_PREFIX + accountId);
// DingTalkClient client = new DefaultDingTalkClient(PULL_URL);
// OapiMessageCorpconversationGetsendresultRequest req = new OapiMessageCorpconversationGetsendresultRequest();
// req.setAgentId(Long.valueOf(account.getAgentId()));
// req.setTaskId(456L);
// OapiMessageCorpconversationGetsendresultResponse rsp = client.execute(req, accessToken);
// System.out.println(rsp.getBody());
} catch (Exception e) {
log.error("DingDingWorkNoticeHandler#pull fail:{}", Throwables.getStackTraceAsString(e));
}
}
}

@ -63,7 +63,7 @@ public class EmailHandler extends BaseHandler implements Handler {
* @return
*/
private MailAccount getAccountConfig(Integer sendAccount) {
MailAccount account = accountUtils.getAccount(sendAccount, SendAccountConstant.EMAIL_ACCOUNT_KEY, SendAccountConstant.EMAIL_ACCOUNT_PREFIX, MailAccount.class);
MailAccount account = accountUtils.getAccountById(sendAccount, MailAccount.class);
try {
MailSSLSocketFactory sf = new MailSSLSocketFactory();
sf.setTrustAllHosts(true);

@ -1,9 +1,11 @@
package com.java3y.austin.handler.handler.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.dto.model.EnterpriseWeChatContentModel;
@ -38,11 +40,6 @@ import java.util.Map;
@Slf4j
public class EnterpriseWeChatHandler extends BaseHandler implements Handler {
/**
* userId
*/
private static final String DELIMITER = "|";
@Autowired
private AccountUtils accountUtils;
@ -53,7 +50,7 @@ public class EnterpriseWeChatHandler extends BaseHandler implements Handler {
@Override
public boolean handler(TaskInfo taskInfo) {
try {
WxCpDefaultConfigImpl accountConfig = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.ENTERPRISE_WECHAT_ACCOUNT_KEY, SendAccountConstant.ENTERPRISE_WECHAT_PREFIX, WxCpDefaultConfigImpl.class);
WxCpDefaultConfigImpl accountConfig = accountUtils.getAccountById(taskInfo.getSendAccount(), WxCpDefaultConfigImpl.class);
WxCpMessageServiceImpl messageService = new WxCpMessageServiceImpl(initService(accountConfig));
WxCpMessageSendResult result = messageService.send(buildWxCpMessage(taskInfo, accountConfig.getAgentId()));
if (Integer.valueOf(WxMpErrorMsgEnum.CODE_0.getCode()).equals(result.getErrCode())) {
@ -93,7 +90,7 @@ public class EnterpriseWeChatHandler extends BaseHandler implements Handler {
if (AustinConstant.SEND_ALL.equals(CollUtil.getFirst(taskInfo.getReceiver()))) {
userId = CollUtil.getFirst(taskInfo.getReceiver());
} else {
userId = StringUtils.join(taskInfo.getReceiver(), DELIMITER);
userId = StringUtils.join(taskInfo.getReceiver(), CommonConstant.RADICAL);
}
EnterpriseWeChatContentModel contentModel = (EnterpriseWeChatContentModel) taskInfo.getContentModel();

@ -51,7 +51,7 @@ public class EnterpriseWeChatRobotHandler extends BaseHandler implements Handler
@Override
public boolean handler(TaskInfo taskInfo) {
try {
EnterpriseWeChatRobotAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.ENTERPRISE_WECHAT_ROBOT_ACCOUNT_KEY, SendAccountConstant.ENTERPRISE_WECHAT_ROBOT_PREFIX, EnterpriseWeChatRobotAccount.class);
EnterpriseWeChatRobotAccount account = accountUtils.getAccountById(taskInfo.getSendAccount(), EnterpriseWeChatRobotAccount.class);
EnterpriseWeChatRobotParam enterpriseWeChatRobotParam = assembleParam(taskInfo);
String result = HttpRequest.post(account.getWebhook()).header(Header.CONTENT_TYPE.getValue(), ContentType.JSON.getValue())
.body(JSON.toJSONString(enterpriseWeChatRobotParam))

@ -50,7 +50,7 @@ public class FeiShuRobotHandler extends BaseHandler implements Handler {
@Override
public boolean handler(TaskInfo taskInfo) {
try {
FeiShuRobotAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.FEI_SHU_ROBOT_ACCOUNT_KEY, SendAccountConstant.FEI_SHU_ROBOT_PREFIX, FeiShuRobotAccount.class);
FeiShuRobotAccount account = accountUtils.getAccountById(taskInfo.getSendAccount(), FeiShuRobotAccount.class);
FeiShuRobotParam feiShuRobotParam = assembleParam(taskInfo);
String result = HttpRequest.post(account.getWebhook())
.header(Header.CONTENT_TYPE.getValue(), ContentType.JSON.getValue())

@ -58,7 +58,7 @@ public class PushHandler extends BaseHandler implements Handler {
public boolean handler(TaskInfo taskInfo) {
try {
GeTuiAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.GE_TUI_ACCOUNT_KEY, SendAccountConstant.GE_TUI_ACCOUNT_PREFIX, GeTuiAccount.class);
GeTuiAccount account = accountUtils.getAccountById(taskInfo.getSendAccount(), GeTuiAccount.class);
String token = redisTemplate.opsForValue().get(SendAccountConstant.GE_TUI_ACCESS_TOKEN_PREFIX + taskInfo.getSendAccount());
PushParam pushParam = PushParam.builder().token(token).appId(account.getAppId()).taskInfo(taskInfo).build();
@ -83,6 +83,7 @@ public class PushHandler extends BaseHandler implements Handler {
/**
*
*
* @param pushParam
* @return http result
*/
@ -101,7 +102,7 @@ public class PushHandler extends BaseHandler implements Handler {
/**
*
*
* @param taskId Id
* @param taskId Id
* @param pushParam
* @return
*/
@ -122,6 +123,7 @@ public class PushHandler extends BaseHandler implements Handler {
/**
* taskId
*
* @param pushParam
* @return http result
*/
@ -161,6 +163,7 @@ public class PushHandler extends BaseHandler implements Handler {
}
return param;
}
@Override
public void recall(MessageTemplate messageTemplate) {

@ -5,7 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.dto.model.SmsContentModel;
import com.java3y.austin.common.enums.ChannelType;
@ -48,6 +48,9 @@ public class SmsHandler extends BaseHandler implements Handler {
@Autowired
private Map<String, SmsScript> smsScripts;
private static final String FLOW_KEY = "msgTypeSmsConfig";
private static final String FLOW_KEY_PREFIX = "message_type_";
@Override
public boolean handler(TaskInfo taskInfo) {
SmsParam smsParam = SmsParam.builder()
@ -62,6 +65,7 @@ public class SmsHandler extends BaseHandler implements Handler {
*/
MessageTypeSmsConfig[] messageTypeSmsConfigs = loadBalance(getMessageTypeSmsConfig(taskInfo.getMsgType()));
for (MessageTypeSmsConfig messageTypeSmsConfig : messageTypeSmsConfigs) {
smsParam.setScriptName(messageTypeSmsConfig.getScriptName());
List<SmsRecord> recordList = smsScripts.get(messageTypeSmsConfig.getScriptName()).send(smsParam);
if (CollUtil.isNotEmpty(recordList)) {
smsRecordDao.saveAll(recordList);
@ -69,8 +73,7 @@ public class SmsHandler extends BaseHandler implements Handler {
}
}
} catch (Exception e) {
log.error("SmsHandler#handler fail:{},params:{}",
Throwables.getStackTraceAsString(e), JSON.toJSONString(smsParam));
log.error("SmsHandler#handler fail:{},params:{}", Throwables.getStackTraceAsString(e), JSON.toJSONString(smsParam));
}
return false;
}
@ -125,14 +128,10 @@ public class SmsHandler extends BaseHandler implements Handler {
* @return
*/
private List<MessageTypeSmsConfig> getMessageTypeSmsConfig(Integer msgType) {
String apolloKey = "msgTypeSmsConfig";
String messagePrefix = "message_type_";
String property = config.getProperty(apolloKey, AustinConstant.APOLLO_DEFAULT_VALUE_JSON_ARRAY);
String property = config.getProperty(FLOW_KEY, CommonConstant.EMPTY_VALUE_JSON_ARRAY);
JSONArray jsonArray = JSON.parseArray(property);
for (int i = 0; i < jsonArray.size(); i++) {
JSONArray array = jsonArray.getJSONObject(i).getJSONArray(messagePrefix + msgType);
JSONArray array = jsonArray.getJSONObject(i).getJSONArray(FLOW_KEY_PREFIX + msgType);
if (CollUtil.isNotEmpty(array)) {
List<MessageTypeSmsConfig> result = JSON.parseArray(JSON.toJSONString(array), MessageTypeSmsConfig.class);
return result;
@ -150,7 +149,7 @@ public class SmsHandler extends BaseHandler implements Handler {
private String getSmsContent(TaskInfo taskInfo) {
SmsContentModel smsContentModel = (SmsContentModel) taskInfo.getContentModel();
if (StrUtil.isNotBlank(smsContentModel.getUrl())) {
return smsContentModel.getContent() + " " + smsContentModel.getUrl();
return smsContentModel.getContent() + StrUtil.SPACE + smsContentModel.getUrl();
} else {
return smsContentModel.getContent();
}

@ -1,51 +0,0 @@
package com.java3y.austin.handler.receipt;
import cn.hutool.core.util.StrUtil;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiMessageCorpconversationGetsendresultRequest;
import com.dingtalk.api.response.OapiMessageCorpconversationGetsendresultResponse;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.DingDingWorkNoticeAccount;
import com.java3y.austin.support.utils.AccountUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
/**
*
*
* @author 3y
*/
@Component
@Slf4j
public class DingDingWorkReceipt {
private static final String URL = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult";
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
private AccountUtils accountUtils;
public void pull() {
// try {
// for (int index = SendAccountConstant.START; true; index = index + SendAccountConstant.STEP) {
// DingDingWorkNoticeAccount account = accountUtils.getAccount(index, SendAccountConstant.DING_DING_WORK_NOTICE_ACCOUNT_KEY, SendAccountConstant.DING_DING_WORK_NOTICE_PREFIX, DingDingWorkNoticeAccount.class);
// if (account == null) {
// break;
// }
// String accessToken = redisTemplate.opsForValue().get(SendAccountConstant.DING_DING_ACCESS_TOKEN_PREFIX + index);
// DingTalkClient client = new DefaultDingTalkClient(URL);
// OapiMessageCorpconversationGetsendresultRequest req = new OapiMessageCorpconversationGetsendresultRequest();
// req.setAgentId(Long.valueOf(account.getAgentId()));
// req.setTaskId(456L);
// OapiMessageCorpconversationGetsendresultResponse rsp = client.execute(req, accessToken);
// System.out.println(rsp.getBody());
// }
// } catch (Exception e) {
// log.error("DingDingWorkReceipt#pull");
// }
}
}

@ -1,31 +1,18 @@
package com.java3y.austin.handler.receipt;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.TencentSmsAccount;
import com.java3y.austin.common.enums.SmsStatus;
import com.java3y.austin.handler.receipt.stater.ReceiptMessageStater;
import com.java3y.austin.support.config.SupportThreadPoolConfig;
import com.java3y.austin.support.domain.SmsRecord;
import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.PullSmsSendStatus;
import com.tencentcloudapi.sms.v20210111.models.PullSmsSendStatusRequest;
import com.tencentcloudapi.sms.v20210111.models.PullSmsSendStatusResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
*
*
*
* @author 3y
*/
@ -34,22 +21,20 @@ import java.util.List;
public class MessageReceipt {
@Autowired
private TencentSmsReceipt tencentSmsReceipt;
@Autowired
private YunPianSmsReceipt yunPianSmsReceipt;
private List<ReceiptMessageStater> receiptMessageStaterList;
@PostConstruct
private void init() {
SupportThreadPoolConfig.getPendingSingleThreadPool().execute(() -> {
while (true) {
// TODO 回执这里自行打开(免得报错)
// tencentSmsReceipt.pull();
// yunPianSmsReceipt.pull();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
for (ReceiptMessageStater receiptMessageStater : receiptMessageStaterList) {
// 拉取回执需要打开下面一行注释
//receiptMessageStater.start();
}
Thread.sleep(2000);
} catch (Exception e) {
log.error("MessageReceiptApplication#fail:{}", Throwables.getStackTraceAsString(e));
}
}
});

@ -1,108 +0,0 @@
package com.java3y.austin.handler.receipt;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.TencentSmsAccount;
import com.java3y.austin.common.enums.SmsStatus;
import com.java3y.austin.support.config.SupportThreadPoolConfig;
import com.java3y.austin.support.dao.SmsRecordDao;
import com.java3y.austin.support.domain.SmsRecord;
import com.java3y.austin.support.utils.AccountUtils;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
*
*
* @author 3y
*/
@Component
@Slf4j
public class TencentSmsReceipt {
@Autowired
private AccountUtils accountUtils;
@Autowired
private SmsRecordDao smsRecordDao;
/**
*
*/
public void pull() {
// 获取腾讯云账号信息
TencentSmsAccount account = accountUtils.getAccount(10, SendAccountConstant.SMS_ACCOUNT_KEY, SendAccountConstant.SMS_PREFIX, TencentSmsAccount.class);
try {
SmsClient client = getSmsClient(account);
// 每次拉取10条
PullSmsSendStatusRequest req = new PullSmsSendStatusRequest();
req.setLimit(10L);
req.setSmsSdkAppId(account.getSmsSdkAppId());
PullSmsSendStatusResponse resp = client.PullSmsSendStatus(req);
List<SmsRecord> smsRecordList = new ArrayList<>();
if (resp != null && resp.getPullSmsSendStatusSet() != null && resp.getPullSmsSendStatusSet().length > 0) {
log.debug("receipt sms:{}", JSON.toJSONString(resp.getPullSmsSendStatusSet()));
for (PullSmsSendStatus pullSmsSendStatus : resp.getPullSmsSendStatusSet()) {
SmsRecord smsRecord = SmsRecord.builder()
.sendDate(Integer.valueOf(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN)))
.messageTemplateId(0L)
.phone(Long.valueOf(pullSmsSendStatus.getSubscriberNumber()))
.supplierId(account.getSupplierId())
.supplierName(account.getSupplierName())
.msgContent("")
.seriesId(pullSmsSendStatus.getSerialNo())
.chargingNum(0)
.status("SUCCESS".equals(pullSmsSendStatus.getReportStatus()) ? SmsStatus.RECEIVE_SUCCESS.getCode() : SmsStatus.RECEIVE_FAIL.getCode())
.reportContent(pullSmsSendStatus.getDescription())
.updated(Math.toIntExact(pullSmsSendStatus.getUserReceiveTime()))
.created(Math.toIntExact(DateUtil.currentSeconds()))
.build();
smsRecordList.add(smsRecord);
}
}
if (!CollUtil.isEmpty(smsRecordList)) {
smsRecordDao.saveAll(smsRecordList);
}
} catch (Exception e) {
log.error("TencentSmsReceipt#init fail!{}", Throwables.getStackTraceAsString(e));
}
}
/**
* smsClient
*
* @param account
* @return
*/
private SmsClient getSmsClient(TencentSmsAccount account) {
Credential cred = new Credential(account.getSecretId(), account.getSecretKey());
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint(account.getUrl());
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
return new SmsClient(cred, account.getRegion(), clientProfile);
}
}

@ -1,25 +0,0 @@
package com.java3y.austin.handler.receipt;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
*
* @author 3y
*/
@Component
@Slf4j
public class YunPianSmsReceipt {
/**
*
*/
public void pull() {
}
}

@ -0,0 +1,14 @@
package com.java3y.austin.handler.receipt.stater;
/**
*
*
* @author 3y
*/
public interface ReceiptMessageStater {
/**
*
*/
void start();
}

@ -0,0 +1,33 @@
package com.java3y.austin.handler.receipt.stater.impl;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.handler.handler.impl.DingDingWorkNoticeHandler;
import com.java3y.austin.handler.receipt.stater.ReceiptMessageStater;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
*
*
* @author 3y
*/
public class DingDingWorkReceiptStaterImpl implements ReceiptMessageStater {
@Autowired
private DingDingWorkNoticeHandler workNoticeHandler;
@Autowired
private ChannelAccountDao channelAccountDao;
@Override
public void start() {
List<ChannelAccount> accountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.DING_DING_WORK_NOTICE.getCode());
for (ChannelAccount channelAccount : accountList) {
workNoticeHandler.pull(channelAccount.getId());
}
}
}

@ -0,0 +1,60 @@
package com.java3y.austin.handler.receipt.stater.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.dto.account.sms.SmsAccount;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.handler.receipt.stater.ReceiptMessageStater;
import com.java3y.austin.handler.script.SmsScript;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.dao.SmsRecordDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.domain.SmsRecord;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
*
*
* @author 3y
*/
@Component
@Slf4j
public class SmsPullReceiptStarterImpl implements ReceiptMessageStater {
@Autowired
private ChannelAccountDao channelAccountDao;
@Autowired
private Map<String, SmsScript> scriptMap;
@Autowired
private SmsRecordDao smsRecordDao;
/**
*
*/
public void start() {
try {
List<ChannelAccount> channelAccountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.SMS.getCode());
for (ChannelAccount channelAccount : channelAccountList) {
SmsAccount smsAccount = JSON.parseObject(channelAccount.getAccountConfig(), SmsAccount.class);
List<SmsRecord> smsRecordList = scriptMap.get(smsAccount.getScriptName()).pull(smsAccount.getScriptName());
if (CollUtil.isNotEmpty(smsRecordList)) {
smsRecordDao.saveAll(smsRecordList);
}
}
} catch (Exception e) {
log.error("SmsPullReceiptStarter#start fail:{}", Throwables.getStackTraceAsString(e));
}
}
}

@ -9,16 +9,25 @@ import java.util.List;
/**
*
*
* @author 3y
*/
public interface SmsScript {
/**
*
*
* @param smsParam
* @return
* @return
*/
List<SmsRecord> send(SmsParam smsParam);
/**
*
* @param scriptName
* @return
*/
List<SmsRecord> pull(String scriptName);
}

@ -6,8 +6,7 @@ import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.TencentSmsAccount;
import com.java3y.austin.common.dto.account.sms.TencentSmsAccount;
import com.java3y.austin.common.enums.SmsStatus;
import com.java3y.austin.handler.domain.sms.SmsParam;
import com.java3y.austin.handler.script.SmsScript;
@ -17,9 +16,7 @@ import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.sms.v20210111.SmsClient;
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
import com.tencentcloudapi.sms.v20210111.models.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -48,19 +45,40 @@ public class TencentSmsScript implements SmsScript {
@Override
public List<SmsRecord> send(SmsParam smsParam) {
try {
TencentSmsAccount tencentSmsAccount = accountUtils.getAccount(SendAccountConstant.TENCENT_SMS_CODE, SendAccountConstant.SMS_ACCOUNT_KEY, SendAccountConstant.SMS_PREFIX, TencentSmsAccount.class);
TencentSmsAccount tencentSmsAccount = accountUtils.getSmsAccountByScriptName(smsParam.getScriptName(), TencentSmsAccount.class);
SmsClient client = init(tencentSmsAccount);
SendSmsRequest request = assembleReq(smsParam, tencentSmsAccount);
SendSmsRequest request = assembleSendReq(smsParam, tencentSmsAccount);
SendSmsResponse response = client.SendSms(request);
return assembleSmsRecord(smsParam, response, tencentSmsAccount);
return assembleSendSmsRecord(smsParam, response, tencentSmsAccount);
} catch (Exception e) {
log.error("TencentSmsScript#send fail:{},params:{}", Throwables.getStackTraceAsString(e), JSON.toJSONString(smsParam));
return null;
}
}
@Override
public List<SmsRecord> pull(String scriptName) {
try {
TencentSmsAccount account = accountUtils.getSmsAccountByScriptName(scriptName, TencentSmsAccount.class);
SmsClient client = init(account);
PullSmsSendStatusRequest req = assemblePullReq(account);
PullSmsSendStatusResponse resp = client.PullSmsSendStatus(req);
return assemblePullSmsRecord(account, resp);
} catch (Exception e) {
log.error("TencentSmsReceipt#pull fail!{}", Throwables.getStackTraceAsString(e));
return null;
}
}
private List<SmsRecord> assembleSmsRecord(SmsParam smsParam, SendSmsResponse response, TencentSmsAccount tencentSmsAccount) {
/**
*
*
* @param smsParam
* @param response
* @param tencentSmsAccount
* @return
*/
private List<SmsRecord> assembleSendSmsRecord(SmsParam smsParam, SendSmsResponse response, TencentSmsAccount tencentSmsAccount) {
if (response == null || ArrayUtil.isEmpty(response.getSendStatusSet())) {
return null;
}
@ -95,7 +113,7 @@ public class TencentSmsScript implements SmsScript {
/**
*
*/
private SendSmsRequest assembleReq(SmsParam smsParam, TencentSmsAccount account) {
private SendSmsRequest assembleSendReq(SmsParam smsParam, TencentSmsAccount account) {
SendSmsRequest req = new SendSmsRequest();
String[] phoneNumberSet1 = smsParam.getPhones().toArray(new String[smsParam.getPhones().size() - 1]);
req.setPhoneNumberSet(phoneNumberSet1);
@ -123,5 +141,50 @@ public class TencentSmsScript implements SmsScript {
return client;
}
/**
*
*
* @param account
* @param resp
* @return
*/
private List<SmsRecord> assemblePullSmsRecord(TencentSmsAccount account, PullSmsSendStatusResponse resp) {
List<SmsRecord> smsRecordList = new ArrayList<>();
if (resp != null && resp.getPullSmsSendStatusSet() != null && resp.getPullSmsSendStatusSet().length > 0) {
for (PullSmsSendStatus pullSmsSendStatus : resp.getPullSmsSendStatusSet()) {
SmsRecord smsRecord = SmsRecord.builder()
.sendDate(Integer.valueOf(DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN)))
.messageTemplateId(0L)
.phone(Long.valueOf(pullSmsSendStatus.getSubscriberNumber()))
.supplierId(account.getSupplierId())
.supplierName(account.getSupplierName())
.msgContent("")
.seriesId(pullSmsSendStatus.getSerialNo())
.chargingNum(0)
.status("SUCCESS".equals(pullSmsSendStatus.getReportStatus()) ? SmsStatus.RECEIVE_SUCCESS.getCode() : SmsStatus.RECEIVE_FAIL.getCode())
.reportContent(pullSmsSendStatus.getDescription())
.updated(Math.toIntExact(pullSmsSendStatus.getUserReceiveTime()))
.created(Math.toIntExact(DateUtil.currentSeconds()))
.build();
smsRecordList.add(smsRecord);
}
}
return smsRecordList;
}
/**
*
*
* @param account
* @return
*/
private PullSmsSendStatusRequest assemblePullReq(TencentSmsAccount account) {
PullSmsSendStatusRequest req = new PullSmsSendStatusRequest();
req.setLimit(10L);
req.setSmsSdkAppId(account.getSmsSdkAppId());
return req;
}
}

@ -8,8 +8,8 @@ import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.YunPianSmsAccount;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.dto.account.sms.YunPianSmsAccount;
import com.java3y.austin.common.enums.SmsStatus;
import com.java3y.austin.handler.domain.sms.SmsParam;
import com.java3y.austin.handler.domain.sms.YunPianSendResult;
@ -38,7 +38,7 @@ public class YunPianSmsScript implements SmsScript {
public List<SmsRecord> send(SmsParam smsParam) {
try {
YunPianSmsAccount account = accountUtils.getAccount(SendAccountConstant.YUN_PIAN_SMS_CODE, SendAccountConstant.SMS_ACCOUNT_KEY, SendAccountConstant.SMS_PREFIX, YunPianSmsAccount.class);
YunPianSmsAccount account = accountUtils.getSmsAccountByScriptName(smsParam.getScriptName(), YunPianSmsAccount.class);
Map<String, Object> params = assembleParam(smsParam, account);
String result = HttpRequest.post(account.getUrl())
@ -56,6 +56,13 @@ public class YunPianSmsScript implements SmsScript {
}
@Override
public List<SmsRecord> pull(String scriptName) {
YunPianSmsAccount account = accountUtils.getSmsAccountByScriptName(scriptName, YunPianSmsAccount.class);
// .....
return null;
}
/**
*
*
@ -90,7 +97,7 @@ public class YunPianSmsScript implements SmsScript {
.msgContent(smsParam.getContent())
.seriesId(datum.getSid())
.chargingNum(Math.toIntExact(datum.getCount()))
.status("0".equals(datum.getCode()) ? SmsStatus.SEND_SUCCESS.getCode() : SmsStatus.SEND_FAIL.getCode())
.status(CommonConstant.ZERO.equals(datum.getCode()) ? SmsStatus.SEND_SUCCESS.getCode() : SmsStatus.SEND_FAIL.getCode())
.reportContent(datum.getMsg())
.created(Math.toIntExact(DateUtil.currentSeconds()))
.updated(Math.toIntExact(DateUtil.currentSeconds()))

@ -33,9 +33,7 @@ public class MiniProgramAccountServiceImpl implements MiniProgramAccountService
@Override
public void send(WeChatMiniProgramParam miniProgramParam) throws Exception {
WeChatMiniProgramAccount miniProgramAccount = accountUtils.getAccount(miniProgramParam.getSendAccount(),
SendAccountConstant.WECHAT_MINI_PROGRAM_ACCOUNT_KEY,
SendAccountConstant.WECHAT_MINI_PROGRAM_PREFIX,
WeChatMiniProgramAccount miniProgramAccount = accountUtils.getAccountById(miniProgramParam.getSendAccount(),
WeChatMiniProgramAccount.class);
WxMaSubscribeService wxMaSubscribeService = initService(miniProgramAccount);

@ -1,10 +1,10 @@
package com.java3y.austin.handler.wechat.impl;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.dto.account.WeChatOfficialAccount;
import com.java3y.austin.handler.domain.wechat.WeChatOfficialParam;
import com.java3y.austin.handler.wechat.OfficialAccountService;
import com.java3y.austin.support.utils.AccountUtils;
import com.java3y.austin.support.utils.WxServiceUtils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
@ -31,8 +31,8 @@ public class OfficialAccountServiceImpl implements OfficialAccountService {
@Override
public List<String> send(WeChatOfficialParam officialParam) throws Exception {
WeChatOfficialAccount officialAccount = accountUtils.getAccount(officialParam.getSendAccount(), SendAccountConstant.WECHAT_OFFICIAL_ACCOUNT_KEY, SendAccountConstant.WECHAT_OFFICIAL__PREFIX, WeChatOfficialAccount.class);
WxMpService wxMpService = initService(officialAccount);
WxMpService wxMpService = WxServiceUtils.wxMpServiceMap.get(officialParam.getSendAccount());
WeChatOfficialAccount officialAccount = WxServiceUtils.accountHashMap.get(officialParam.getSendAccount());
List<WxMpTemplateMessage> messages = assembleReq(officialParam, officialAccount);
List<String> messageIds = new ArrayList<>(messages.size());
for (WxMpTemplateMessage wxMpTemplateMessage : messages) {

@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.domain.TaskInfo;
import com.java3y.austin.common.dto.model.ContentModel;
import com.java3y.austin.common.enums.ChannelType;
@ -38,6 +39,8 @@ import java.util.*;
@Service
public class AssembleAction implements BusinessProcess<SendTaskModel> {
private static final String LINK_NAME = "url";
@Autowired
private MessageTemplateDao messageTemplateDao;
@ -48,7 +51,7 @@ public class AssembleAction implements BusinessProcess<SendTaskModel> {
try {
Optional<MessageTemplate> messageTemplate = messageTemplateDao.findById(messageTemplateId);
if (!messageTemplate.isPresent() || messageTemplate.get().getIsDeleted().equals(AustinConstant.TRUE)) {
if (!messageTemplate.isPresent() || messageTemplate.get().getIsDeleted().equals(CommonConstant.TRUE)) {
context.setNeedBreak(true).setResponse(BasicResultVO.fail(RespStatusEnum.TEMPLATE_NOT_FOUND));
return;
}
@ -126,10 +129,10 @@ public class AssembleAction implements BusinessProcess<SendTaskModel> {
}
// 如果 url 字段存在则在url拼接对应的埋点参数
String url = (String) ReflectUtil.getFieldValue(contentModel, "url");
String url = (String) ReflectUtil.getFieldValue(contentModel, LINK_NAME);
if (StrUtil.isNotBlank(url)) {
String resultUrl = TaskInfoUtils.generateUrl(url, messageTemplate.getId(), messageTemplate.getTemplateType());
ReflectUtil.setFieldValue(contentModel, "url", resultUrl);
ReflectUtil.setFieldValue(contentModel, LINK_NAME, resultUrl);
}
return contentModel;
}

@ -2,6 +2,7 @@ package com.java3y.austin.service.api.impl.action;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.service.api.domain.MessageParam;
@ -24,11 +25,6 @@ import java.util.stream.Collectors;
@Service
public class PreParamCheckAction implements BusinessProcess<SendTaskModel> {
/**
*
*/
private static final Integer BATCH_RECEIVER_SIZE = 100;
@Override
public void process(ProcessContext<SendTaskModel> context) {
SendTaskModel sendTaskModel = context.getProcessModel();
@ -52,7 +48,7 @@ public class PreParamCheckAction implements BusinessProcess<SendTaskModel> {
}
// 3.过滤receiver大于100的请求
if (resultMessageParamList.stream().anyMatch(messageParam -> messageParam.getReceiver().split(StrUtil.COMMA).length > BATCH_RECEIVER_SIZE)) {
if (resultMessageParamList.stream().anyMatch(messageParam -> messageParam.getReceiver().split(StrUtil.COMMA).length > AustinConstant.BATCH_RECEIVER_SIZE)) {
context.setNeedBreak(true).setResponse(BasicResultVO.fail(RespStatusEnum.TOO_MANY_RECEIVER));
return;
}

@ -94,21 +94,31 @@
<artifactId>dynamic-tp-spring-boot-starter-apollo</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>
<!--nacos-->
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
</dependency>
</dependencies>
</project>

@ -35,4 +35,5 @@ public interface ChannelAccountDao extends JpaRepository<ChannelAccount, Long> {
* @return
*/
Long countByIsDeletedEquals(Integer deleted);
}

@ -20,7 +20,7 @@ public interface MessageTemplateDao extends JpaRepository<MessageTemplate, Long>
* @param pageable
* @return
*/
List<MessageTemplate> findAllByIsDeletedEquals(Integer deleted, Pageable pageable);
List<MessageTemplate> findAllByIsDeletedEqualsOrderByUpdatedDesc(Integer deleted, Pageable pageable);
/**

@ -1,25 +1,31 @@
package com.java3y.austin.support.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.support.service.ConfigService;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.dto.account.sms.SmsAccount;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
/**
*
*
* @author 3y
*/
@Component
@Slf4j
public class AccountUtils {
@Autowired
private ConfigService config;
private ChannelAccountDao channelAccountDao;
/**
* local.properties
@ -32,16 +38,48 @@ public class AccountUtils {
* (key:miniProgramAccount) [{"mini_program_10":{"appId":"wxecb4693d2eef1ea7","appSecret":"6240870f4d91701640d769ba20120821","templateId":"JHUk6eE9T5TasdfCrQsk-Q","grantType":"client_credential","miniProgramState":"trial","page":"index?foo=bar"}}]
* (key:alipayMiniProgramAccount) [{"alipay_mini_program_10":{"privateKey":"MIIEvQIBADANB......","alipayPublicKey":"MIIBIjANBg...","appId":"2014********7148","userTemplateId":"MDI4YzIxMDE2M2I5YTQzYjUxNWE4MjA4NmU1MTIyYmM=","page":"page/component/index"}}]
*/
public <T> T getAccount(Integer sendAccount, String apolloKey, String prefix, Class<T> clazz) {
String accountValues = config.getProperty(apolloKey, AustinConstant.APOLLO_DEFAULT_VALUE_JSON_ARRAY);
JSONArray jsonArray = JSON.parseArray(accountValues);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
T object = jsonObject.getObject(prefix + sendAccount, clazz);
if (object != null) {
return object;
public <T> T getAccountById(Integer sendAccountId, Class<T> clazz) {
try {
Optional<ChannelAccount> optionalChannelAccount = channelAccountDao.findById(Long.valueOf(sendAccountId));
if (optionalChannelAccount.isPresent()) {
ChannelAccount channelAccount = optionalChannelAccount.get();
return JSON.parseObject(channelAccount.getAccountConfig(), clazz);
}
} catch (Exception e) {
log.error("AccountUtils#getAccount fail!", Throwables.getStackTraceAsString(e));
}
log.error("AccountUtils#getAccount not found!:{}", sendAccountId);
return null;
}
/**
*
*
* @param scriptName
* @param clazz
* @param <T>
* @return
*/
public <T> T getSmsAccountByScriptName(String scriptName, Class<T> clazz) {
try {
List<ChannelAccount> channelAccountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.SMS.getCode());
for (ChannelAccount channelAccount : channelAccountList) {
try {
SmsAccount smsAccount = JSON.parseObject(channelAccount.getAccountConfig(), SmsAccount.class);
if (smsAccount.getScriptName().equals(scriptName)) {
return JSON.parseObject(channelAccount.getAccountConfig(), clazz);
}
} catch (Exception e) {
log.error("AccountUtils#getSmsAccount parse fail! e:{},account:{}", Throwables.getStackTraceAsString(e), JSON.toJSONString(channelAccount));
}
}
} catch (Exception e) {
log.error("AccountUtils#getSmsAccount fail! e:{}", Throwables.getStackTraceAsString(e));
}
log.error("AccountUtils#getSmsAccount not found!:{}", scriptName);
return null;
}
}

@ -3,6 +3,7 @@ package com.java3y.austin.support.utils;
import cn.hutool.core.collection.CollUtil;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
@ -170,7 +171,7 @@ public class RedisUtils {
try {
Long execute = redisTemplate.execute(redisScript, keys, args);
return AustinConstant.TRUE.equals(execute.intValue());
return CommonConstant.TRUE.equals(execute.intValue());
} catch (Exception e) {
log.error("redis execLimitLua fail! e:{}", Throwables.getStackTraceAsString(e));

@ -2,6 +2,8 @@ package com.java3y.austin.support.utils;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.constant.CommonConstant;
import java.util.Date;
@ -13,7 +15,7 @@ import java.util.Date;
public class TaskInfoUtils {
private static final int TYPE_FLAG = 1000000;
private static final char PARAM = '?';
private static final String CODE = "track_code_bid";
/**
* BusinessId
@ -45,10 +47,10 @@ public class TaskInfoUtils {
public static String generateUrl(String url, Long templateId, Integer templateType) {
url = url.trim();
Long businessId = generateBusinessId(templateId, templateType);
if (url.indexOf(PARAM) == -1) {
return url + "?track_code_bid=" + businessId;
if (url.indexOf(CommonConstant.QM) == -1) {
return url + CommonConstant.QM_STRING + CODE + CommonConstant.EQUAL_STRING + businessId;
} else {
return url + "&track_code_bid=" + businessId;
return url + CommonConstant.AND_STRING + CODE + CommonConstant.EQUAL_STRING + businessId;
}
}

@ -0,0 +1,60 @@
package com.java3y.austin.support.utils;
import com.alibaba.fastjson.JSON;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.dto.account.WeChatOfficialAccount;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* /
*
* @author 3y
*/
@Component
@Slf4j
public class WxServiceUtils {
public static Map<Long, WxMpService> wxMpServiceMap = new HashMap<>();
public static Map<Long, WeChatOfficialAccount> accountHashMap = new HashMap<>();
@Autowired
private ChannelAccountDao channelAccountDao;
@PostConstruct
public void init() {
List<ChannelAccount> officialAccountList = channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, ChannelType.OFFICIAL_ACCOUNT.getCode());
for (ChannelAccount channelAccount : officialAccountList) {
WeChatOfficialAccount weChatOfficialAccount = JSON.parseObject(channelAccount.getAccountConfig(), WeChatOfficialAccount.class);
wxMpServiceMap.put(channelAccount.getId(), initService(weChatOfficialAccount));
accountHashMap.put(channelAccount.getId(), weChatOfficialAccount);
}
}
/**
*
*
* @return
*/
public WxMpService initService(WeChatOfficialAccount officialAccount) {
WxMpService wxMpService = new WxMpServiceImpl();
WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
config.setAppId(officialAccount.getAppId());
config.setSecret(officialAccount.getSecret());
wxMpService.setWxMpConfigStorage(config);
return wxMpService;
}
}

@ -2,17 +2,18 @@ package com.java3y.austin.web.controller;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.web.service.ChannelAccountService;
import com.java3y.austin.web.vo.amis.CommonAmisVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -24,7 +25,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/account")
@Api("渠道账号管理接口")
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*")
@CrossOrigin(origins = AustinConstant.ORIGIN_VALUE, allowCredentials = "true", allowedHeaders = "*")
public class ChannelAccountController {
@Autowired
@ -47,7 +48,14 @@ public class ChannelAccountController {
@GetMapping("/queryByChannelType")
@ApiOperation("/根据渠道标识查询相关的记录")
public BasicResultVO query(Integer channelType) {
return BasicResultVO.success(channelAccountService.queryByChannelType(channelType));
List<CommonAmisVo> result = new ArrayList<>();
List<ChannelAccount> channelAccounts = channelAccountService.queryByChannelType(channelType);
for (ChannelAccount channelAccount : channelAccounts) {
CommonAmisVo commonAmisVo = CommonAmisVo.builder().label(channelAccount.getName()).value(String.valueOf(channelAccount.getId())).build();
result.add(commonAmisVo);
}
return BasicResultVO.success(result);
}
/**

@ -1,6 +1,7 @@
package com.java3y.austin.web.controller;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.web.service.DataService;
@ -23,7 +24,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/trace")
@Api("获取数据接口(全链路追踪)")
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*")
@CrossOrigin(origins = AustinConstant.ORIGIN_VALUE, allowCredentials = "true", allowedHeaders = "*")
public class DataController {
@Autowired
private DataService dataService;

@ -7,6 +7,7 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiMediaUploadRequest;
import com.dingtalk.api.response.OapiMediaUploadResponse;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.SendAccountConstant;
import com.java3y.austin.common.enums.ChannelType;
import com.java3y.austin.common.enums.FileType;
@ -26,15 +27,16 @@ import org.springframework.web.multipart.MultipartFile;
/**
*
*
* @author 3y
*/
@Slf4j
@RestController
@RequestMapping("/material")
@Api("素材管理接口")
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*")
public class MaterialController {
@CrossOrigin(origins = AustinConstant.ORIGIN_VALUE, allowCredentials = "true", allowedHeaders = "*")
public class MaterialController {
@Autowired
private MaterialService materialService;

@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.service.api.domain.MessageParam;
@ -43,7 +44,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/messageTemplate")
@Api("发送消息")
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*")
@CrossOrigin(origins = AustinConstant.ORIGIN_VALUE, allowCredentials = "true", allowedHeaders = "*")
public class MessageTemplateController {
@Autowired

@ -0,0 +1,100 @@
package com.java3y.austin.web.controller;
import cn.hutool.core.util.StrUtil;
import com.google.common.base.Throwables;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.enums.RespStatusEnum;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.utils.WxServiceUtils;
import com.java3y.austin.web.vo.amis.CommonAmisVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author 3y
*/
@Slf4j
@RestController
@RequestMapping("/officialAccount")
@Api("微信服务号")
@CrossOrigin(origins = {AustinConstant.ORIGIN_VALUE, "https://aisuda.bce.baidu.com"}, allowCredentials = "true", allowedHeaders = "*")
public class OfficialAccountController {
/**
* @param id Id
* @return
*/
@GetMapping("/template/list")
@ApiOperation("/根据账号Id获取模板列表")
public BasicResultVO queryList(Long id) {
try {
List<CommonAmisVo> result = new ArrayList<>();
WxMpService wxMpService = WxServiceUtils.wxMpServiceMap.get(id);
List<WxMpTemplate> allPrivateTemplate = wxMpService.getTemplateMsgService().getAllPrivateTemplate();
for (WxMpTemplate wxMpTemplate : allPrivateTemplate) {
CommonAmisVo commonAmisVo = CommonAmisVo.builder().label(wxMpTemplate.getTitle()).value(wxMpTemplate.getTemplateId()).build();
result.add(commonAmisVo);
}
return BasicResultVO.success(result);
} catch (Exception e) {
log.error("OfficialAccountController#queryList fail:{}", Throwables.getStackTraceAsString(e));
return BasicResultVO.fail(RespStatusEnum.SERVICE_ERROR);
}
}
/**
* IdID
*
* @return
* @
*/
@GetMapping("/template/detailTemplate")
@ApiOperation("/根据账号Id和模板ID获取模板列表")
public BasicResultVO queryDetailList(Long id, String wxTemplateId) {
try {
List<CommonAmisVo> result = new ArrayList<>();
WxMpService wxMpService = WxServiceUtils.wxMpServiceMap.get(id);
List<WxMpTemplate> allPrivateTemplate = wxMpService.getTemplateMsgService().getAllPrivateTemplate();
for (WxMpTemplate wxMpTemplate : allPrivateTemplate) {
if (wxTemplateId.equals(wxMpTemplate.getTemplateId())) {
String[] data = wxMpTemplate.getContent().split(StrUtil.LF);
for (String datum : data) {
String name = datum.substring(datum.indexOf("{{") + 2, datum.indexOf("."));
CommonAmisVo commonAmisVo = CommonAmisVo.builder()
.name(name)
.type("text")
.required(true)
.build();
if (datum.contains("first")) {
commonAmisVo.setLabel("名字");
} else if (datum.contains("remark")) {
commonAmisVo.setLabel("备注");
} else {
commonAmisVo.setLabel(datum.split("")[0]);
}
result.add(commonAmisVo);
}
}
}
return BasicResultVO.success(result);
} catch (Exception e) {
log.error("OfficialAccountController#queryList fail:{}", Throwables.getStackTraceAsString(e));
return BasicResultVO.fail(RespStatusEnum.SERVICE_ERROR);
}
}
}

@ -2,6 +2,7 @@ package com.java3y.austin.web.service.impl;
import cn.hutool.core.date.DateUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.web.service.ChannelAccountService;
@ -22,7 +23,7 @@ public class ChannelAccountServiceImpl implements ChannelAccountService {
public ChannelAccount save(ChannelAccount channelAccount) {
if (channelAccount.getId() == null) {
channelAccount.setCreated(Math.toIntExact(DateUtil.currentSeconds()));
channelAccount.setIsDeleted(AustinConstant.FALSE);
channelAccount.setIsDeleted(CommonConstant.FALSE);
}
channelAccount.setUpdated(Math.toIntExact(DateUtil.currentSeconds()));
return channelAccountDao.save(channelAccount);
@ -30,7 +31,7 @@ public class ChannelAccountServiceImpl implements ChannelAccountService {
@Override
public List<ChannelAccount> queryByChannelType(Integer channelType) {
return channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(AustinConstant.FALSE, channelType);
return channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(CommonConstant.FALSE, channelType);
}
@Override

@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.constant.CommonConstant;
import com.java3y.austin.common.enums.AuditStatus;
import com.java3y.austin.common.enums.MessageStatus;
import com.java3y.austin.common.enums.RespStatusEnum;
@ -44,12 +45,12 @@ public class MessageTemplateServiceImpl implements MessageTemplateService {
@Override
public List<MessageTemplate> queryList(MessageTemplateParam param) {
PageRequest pageRequest = PageRequest.of(param.getPage() - 1, param.getPerPage());
return messageTemplateDao.findAllByIsDeletedEquals(AustinConstant.FALSE, pageRequest);
return messageTemplateDao.findAllByIsDeletedEqualsOrderByUpdatedDesc(CommonConstant.FALSE, pageRequest);
}
@Override
public Long count() {
return messageTemplateDao.countByIsDeletedEquals(AustinConstant.FALSE);
return messageTemplateDao.countByIsDeletedEquals(CommonConstant.FALSE);
}
@Override
@ -68,7 +69,7 @@ public class MessageTemplateServiceImpl implements MessageTemplateService {
@Override
public void deleteByIds(List<Long> ids) {
Iterable<MessageTemplate> messageTemplates = messageTemplateDao.findAllById(ids);
messageTemplates.forEach(messageTemplate -> messageTemplate.setIsDeleted(AustinConstant.TRUE));
messageTemplates.forEach(messageTemplate -> messageTemplate.setIsDeleted(CommonConstant.TRUE));
for (MessageTemplate messageTemplate : messageTemplates) {
if (messageTemplate.getCronTaskId()!=null && messageTemplate.getCronTaskId() > 0) {
cronTaskService.deleteCronTask(messageTemplate.getCronTaskId());
@ -137,7 +138,7 @@ public class MessageTemplateServiceImpl implements MessageTemplateService {
.setMsgStatus(MessageStatus.INIT.getCode()).setAuditStatus(AuditStatus.WAIT_AUDIT.getCode())
.setCreator("Java3y").setUpdator("Java3y").setTeam("公众号Java3y").setAuditor("3y")
.setCreated(Math.toIntExact(DateUtil.currentSeconds()))
.setIsDeleted(AustinConstant.FALSE);
.setIsDeleted(CommonConstant.FALSE);
}

@ -0,0 +1,27 @@
package com.java3y.austin.web.vo.amis;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* amis
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CommonAmisVo {
private String type;
private String label;
private String value;
private String name;
private boolean required;
}

@ -40,18 +40,18 @@ austin.nacos.enabled=false
# todo [grayLog] ip 【optional】
austin.grayLog.ip=austin.graylog
##################### system properties #####################
server.shutdown=graceful
# TODO if windows os and need upload file to send message ,replace path !【optional】
austin.business.upload.crowd.path=/Users/3y/temp
##################### database properties #####################
########################################## database start ##########################################
# notice:mysql version 5.7x !!!
spring.datasource.url=jdbc:mysql://${austin.database.ip}:${austin.database.port}/austin?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
spring.datasource.username=${austin.database.username}
spring.datasource.password=${austin.database.password}
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
########################################## database end ##########################################
##################### kafka properties #####################
########################################## kafka start ##########################################
spring.kafka.bootstrap-servers=${austin.kafka.ip}:${austin.kafka.port}
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
@ -61,55 +61,47 @@ spring.kafka.consumer.auto.offset.reset=earliest
spring.kafka.consumer.auto-commit-interval=1000
spring.kafka.consumer.enable-auto-commit=true
##################### rocketmq properties #####################
###
austin.business.topic.name=austinBusiness
austin.business.recall.topic.name=austinRecall
austin.business.recall.group.name=recallGroupId
austin.business.log.topic.name=austinTraceLog
### TODO kafka tag filter,if you need, replace tagIdValue ,eg:com.java3y.austin.yyy
austin.business.tagId.key=kafka_tag_id
austin.business.tagId.value=com.java3y.austin.3y
########################################## kafka end ##########################################
########################################## rocketMq start ##########################################
rocketmq.name-server=${austin.rocketmq.nameserver.ip}:${austin.rocketmq.nameserver.port}
rocketmq.producer.group=unique-producer-group
austin.rocketmq.biz.consumer.group=unique-biz-consumer-group
austin.rocketmq.recall.consumer.group=unique-recall-consumer-group
########################################## rocketMq end ##########################################
##################### Rabbit properties #####################
#RabbitMq所在服务器IP
########################################## RabbitMq start ##########################################
spring.rabbitmq.host=${austin.rabbitmq.ip}
#连接端口号
spring.rabbitmq.port=${austin.rabbitmq.port}
server.port=8080
spring.application.name=cl
#用户名
spring.rabbitmq.username=root
#用户密码
spring.rabbitmq.password=123456
# 开启发送确认
spring.rabbitmq.publisher-confirm-type=correlated
# 开启发送失败退回
spring.rabbitmq.publisher-returns=true
spring.rabbitmq.virtual-host=/
austin.rabbitmq.topic.name=austinRabbit
austin.rabbitmq.exchange.name=austin.point
########################################## RabbitMq end ##########################################
##################### redis properties #####################
########################################## redis start ##########################################
spring.redis.host=${austin.redis.ip}
spring.redis.port=${austin.redis.port}
spring.redis.password=${austin.redis.password}
########################################## redis end ##########################################
##################### business properties #####################
austin.business.topic.name=austinBusiness
austin.business.recall.topic.name=austinRecall
austin.business.recall.group.name=recallGroupId
austin.business.log.topic.name=austinTraceLog
austin.business.graylog.ip=${austin.grayLog.ip}
# TODO kafka tag filter,if you need, replace tagIdValue ,eg:com.java3y.austin.yyy
austin.business.tagId.key=kafka_tag_id
austin.business.tagId.value=com.java3y.austin.3y
# TODO if windows os and need upload file to send message ,replace path !
austin.business.upload.crowd.path=/Users/3y/temp
##################### xxl properties #####################
########################################## xxl start ##########################################
xxl.job.admin.addresses=http://${austin.xxl.job.ip}:${austin.xxl.job.port}/xxl-job-admin
xxl.job.admin.username=admin
xxl.job.admin.password=123456
@ -120,13 +112,15 @@ xxl.job.executor.port=6666
xxl.job.executor.logpath=logs/xxl
xxl.job.executor.logretentiondays=30
xxl.job.accessToken=
########################################## xxl end ##########################################
##################### apollo #####################
########################################## apollo start ##########################################
app.id=austin
apollo.bootstrap.enabled=${austin.apollo.enabled}
apollo.bootstrap.namespaces=boss.austin,dynamic-tp-apollo-dtp.yml
########################################## apollo end ##########################################
##################### nacos #####################
########################################## nacos start ##########################################
austin.nacos.server=
austin.nacos.username=
austin.nacos.password=
@ -134,18 +128,26 @@ austin.nacos.dataId=austin
austin.nacos.group=DEFAULT_GROUP
austin.nacos.namespace=9537c674-f3a6-4203-b286-ef0c36bfacb2
nacos.config.enabled=${austin.nacos.enabled}
########################################## nacos end ##########################################
##################### httpUtils properties #####################
########################################## httpUtils start ##########################################
ok.http.connect-timeout=30
ok.http.keep-alive-duration=300
ok.http.max-idle-connections=200
ok.http.read-timeout=30
ok.http.write-timeout=30
########################################## httpUtils end ##########################################
##################### monitor properties #####################
########################################## monitor start ##########################################
management.endpoint.health.show-details=always
management.endpoint.metrics.enabled=true
management.endpoint.prometheus.enabled=true
management.endpoints.web.exposure.include=*
management.metrics.export.prometheus.enabled=true
management.health.rabbit.enabled=false
########################################## monitor end ##########################################
########################################## system start ##########################################
server.shutdown=graceful
########################################## system end ##########################################

@ -1,11 +1,4 @@
discardMsgIds = []
deduplicationRule = {"deduplication_10":{"num":1,"time":300},"deduplication_20":{"num":5}}
emailAccount = [{"email_10":{"host":"smtp.qq.com","port":465,"user":"23423432@qq.com","pass":"234324324","from":"123123@qq.com","starttlsEnable":"true","auth":true,"sslEnable":true}},{"email_20":{"host":"smtp.163.com","port":465,"user":"23423423@163.com","pass":"234234324","from":"112312312@163.com","starttlsEnable":"false","auth":true,"sslEnable":true}}]
smsAccount = [{"sms_10":{"url":"sms.tencentcloudapi.com","region":"ap-guangzhou","secretId":"234234","secretKey":"234324324","smsSdkAppId":"2343242","templateId":"234234","signName":"Java3y公众号","supplierId":10,"supplierName":"腾讯云"}},{"sms_20":{"url":"https://sms.yunpian.com/v2/sms/tpl_batch_send.json","apikey":"23423432","tpl_id":"23423432","supplierId":20,"supplierName":"云片"}}]
enterpriseWechatAccount = [{"enterprise_wechat_10":{"corpId":"23423423","corpSecret":"-234324234","agentId":1000002,"token":"234234","aesKey":"23423423"}}]
dingDingRobotAccount = [{"ding_ding_robot_10":{"secret":"234324324324","webhook":"https://oapi.dingtalk.com/robot/send?access_token=8d03b68d081f732343243242343247328b0c3003d164715d2c6c6e56"}}]
dingDingWorkNoticeAccount =[{"ding_ding_work_notice_10":{"appKey":"23423423","appSecret":"tQpvmkR863dYcuKDVfM23432432432423Nlx_fYLLLlpPJWHvWKbTu","agentId":"1523423423242"}}]
flowControlRule = {"flow_control_40":1}
geTuiAccount = [{"ge_tui_account_10":{"appId":"23423423","appKey":"234234234","masterSecret":"2342342342342"}}]
feiShuAccountRobot = [{"fei_shu_robot_10":{"webhook":"https://open.feishu.cn/open-apis/bot/v2/hook/c24b09ef-9aa3-4aad-9239-a7e05fcaf6ec"}}]
msgTypeSmsConfig = [{"message_type_10":[{"weights":99,"scriptName":"TencentSmsScript"},{"weights":1,"scriptName":"YunPianSmsScript"}]},{"message_type_20":[{"weights":99,"scriptName":"TencentSmsScript"},{"weights":1,"scriptName":"YunPianSmsScript"}]},{"message_type_30":[{"weights":20,"scriptName":"TencentSmsScript"}]},{"message_type_40":[{"weights":20,"scriptName":"TencentSmsScript"}]}]
flowControl = {"flow_control_40":1}

@ -7,7 +7,7 @@
<!-- 设置日志输出路径 可以使“${}”来使用变量。TODO 后面是可以读配置的 -->
<property name="log.path" value="logs"/>
<springProperty scope="context" name="grayLogIp" source="austin.business.graylog.ip"/>
<springProperty scope="context" name="grayLogIp" source="austin.grayLog.ip"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">

@ -77,29 +77,3 @@ CREATE TABLE `channel_account`
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='渠道账号信息';
-- 实时类型 短信(无占位符)
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path,
expect_push_time, id_type, send_channel, template_type, msg_type, msg_content,
send_account, creator, updator, auditor, team, proposer, is_deleted, created,
updated)
VALUES (1, '买一送十活动', 10, '', 10, null, '', '', 30, 30, 20, 20, '{"content":"6666","url":"","title":""}', 10, 'Java3y',
'Java3y', '3y', '公众号Java3y', '三歪', 0, 1646274112, 1646275242);
-- 实时类型 邮件(无占位符)
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path,
expect_push_time, id_type, send_channel, template_type, msg_type, msg_content,
send_account, creator, updator, auditor, team, proposer, is_deleted, created,
updated)
VALUES (2, '校招信息', 10, '', 10, null, '', '', 50, 40, 20, 10, '{"content":"你已成功获取到offer","url":"","title":"招聘通知"}', 10,
'Java3y', 'Java3y', '3y', '公众号Java3y', '鸡蛋', 0, 1646274195, 1646274195);
-- 实时类型 短信有占位符占位符key 为 content
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path,
expect_push_time, id_type, send_channel, template_type, msg_type, msg_content,
send_account, creator, updator, auditor, team, proposer, is_deleted, created,
updated)
VALUES (3, '验证码通知', 10, '', 10, null, '', '', 30, 30, 20, 30, '{"content":"{$content}","url":"","title":""}', 10,
'Java3y', 'Java3y', '3y', '公众号Java3y', '孙悟空', 0, 1646275213, 1646275213);

Loading…
Cancel
Save