publish 1.1.0
This commit is contained in:
20
pom.xml
20
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -57,55 +57,55 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tiesheng.message.config.aliyun;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||
|
||||
public interface AliyunSmsHandler {
|
||||
|
||||
|
||||
/**
|
||||
* 数据处理
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
AliyunTempParam handler(JSONObject obj);
|
||||
|
||||
}
|
||||
@@ -10,11 +10,15 @@ import cn.hutool.extra.validation.ValidationUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.service.TieshengMessageSender;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -39,7 +43,9 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
||||
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String signName;
|
||||
|
||||
@Autowired(required = false)
|
||||
AliyunSmsHandler aliyunSmsHandler;
|
||||
|
||||
/**
|
||||
* 特殊字符替换
|
||||
@@ -105,29 +111,28 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
||||
* 创建发送请求
|
||||
*
|
||||
* @param phoneNumbers 手机号,多个用,隔开
|
||||
* @param templateCode 短信模板
|
||||
* @param params 模板参数
|
||||
* @param tempParam 短信模板
|
||||
* @return
|
||||
*/
|
||||
public MessageReqResp sendSms(String phoneNumbers, String templateCode, JSONObject params) {
|
||||
public MessageReqResp sendSms(String phoneNumbers, AliyunTempParam tempParam) {
|
||||
|
||||
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
|
||||
reqResp.setTarget(phoneNumbers);
|
||||
reqResp.setResult(1);
|
||||
reqResp.setContent(JSONUtil.createObj()
|
||||
.putOpt("PhoneNumbers", phoneNumbers)
|
||||
.putOpt("SignName", getSignName())
|
||||
.putOpt("TemplateCode", templateCode)
|
||||
.putOpt("TemplateParam", params)
|
||||
.putOpt("SignName", tempParam.getSignName())
|
||||
.putOpt("TemplateCode", tempParam.getTemplateCode())
|
||||
.putOpt("TemplateParam", tempParam.getTemplateParam())
|
||||
.toString());
|
||||
|
||||
// 业务API参数
|
||||
ConcurrentHashMap<String, String> queryMap = new ConcurrentHashMap<>();
|
||||
queryMap.put("PhoneNumbers", phoneNumbers);
|
||||
queryMap.put("SignName", getSignName());
|
||||
queryMap.put("TemplateCode", templateCode);
|
||||
if (params != null) {
|
||||
queryMap.put("TemplateParam", params.toString());
|
||||
queryMap.put("SignName", tempParam.getSignName());
|
||||
queryMap.put("TemplateCode", tempParam.getTemplateCode());
|
||||
if (tempParam.getTemplateParam() != null) {
|
||||
queryMap.put("TemplateParam", tempParam.getTemplateParam().toString());
|
||||
}
|
||||
|
||||
reqResp.setRespBody(request("SendSms", queryMap));
|
||||
@@ -146,11 +151,17 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
||||
if (!mobile) {
|
||||
return null;
|
||||
}
|
||||
String templateCode = body.getStr("template_code");
|
||||
if (StrUtil.isEmpty(templateCode)) {
|
||||
return null;
|
||||
|
||||
if (aliyunSmsHandler == null) {
|
||||
throw new ApiException("未注册短信参数处理器");
|
||||
}
|
||||
return sendSms(user, templateCode, body);
|
||||
|
||||
AliyunTempParam tempParam = aliyunSmsHandler.handler(body);
|
||||
if (tempParam == null) {
|
||||
throw new ApiException("未配置短信参数处理器");
|
||||
}
|
||||
|
||||
return sendSms(user, tempParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,7 +171,7 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
||||
|
||||
@Override
|
||||
public boolean support() {
|
||||
return StrUtil.isAllNotEmpty(accessKeyId, accessKeySecret, signName);
|
||||
return StrUtil.isAllNotEmpty(accessKeyId, accessKeySecret);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -183,12 +194,5 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
public String getSignName() {
|
||||
return signName;
|
||||
}
|
||||
|
||||
public void setSignName(String signName) {
|
||||
this.signName = signName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.tiesheng.message.pojos;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
public class AliyunTempParam {
|
||||
|
||||
private String signName;
|
||||
private String templateCode;
|
||||
private JSONObject templateParam;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getSignName() {
|
||||
return signName;
|
||||
}
|
||||
|
||||
public void setSignName(String signName) {
|
||||
this.signName = signName;
|
||||
}
|
||||
|
||||
public String getTemplateCode() {
|
||||
return templateCode;
|
||||
}
|
||||
|
||||
public void setTemplateCode(String templateCode) {
|
||||
this.templateCode = templateCode;
|
||||
}
|
||||
|
||||
public JSONObject getTemplateParam() {
|
||||
return templateParam;
|
||||
}
|
||||
|
||||
public void setTemplateParam(JSONObject templateParam) {
|
||||
this.templateParam = templateParam;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.0.24</version>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user