mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-07 01:18:33 +08:00
新增京东云国内短信接入
This commit is contained in:
parent
203862a102
commit
e0c96fabc8
@ -24,16 +24,17 @@
|
|||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
<modules>
|
<modules>
|
||||||
<module>sms-aggregation-api</module>
|
|
||||||
<module>sms-aggregation-comm</module>
|
<module>sms-aggregation-comm</module>
|
||||||
<module>sms-aggregation-aliyun</module>
|
<module>sms-aggregation-api</module>
|
||||||
<module>sms-aggregation-unisms</module>
|
|
||||||
<module>sms-aggregation-tencent</module>
|
|
||||||
<module>sms-aggregation-yunpian</module>
|
|
||||||
<module>sms-aggregation-spring-boot-starter</module>
|
|
||||||
<module>sms-aggregation-huawei</module>
|
|
||||||
<module>sms-aggregation-autoimmit</module>
|
|
||||||
<module>sms-aggregation-core</module>
|
<module>sms-aggregation-core</module>
|
||||||
|
<module>sms-aggregation-autoimmit</module>
|
||||||
|
<module>sms-aggregation-spring-boot-starter</module>
|
||||||
|
<module>sms-aggregation-aliyun</module>
|
||||||
|
<module>sms-aggregation-tencent</module>
|
||||||
|
<module>sms-aggregation-unisms</module>
|
||||||
|
<module>sms-aggregation-yunpian</module>
|
||||||
|
<module>sms-aggregation-huawei</module>
|
||||||
|
<module>sms-aggregation-jdcloud</module>
|
||||||
</modules>
|
</modules>
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:https://gitee.com/MR-wind/sms_aggregation.git</connection>
|
<connection>scm:git:https://gitee.com/MR-wind/sms_aggregation.git</connection>
|
||||||
@ -61,6 +62,7 @@
|
|||||||
<hutool.version>5.8.16</hutool.version>
|
<hutool.version>5.8.16</hutool.version>
|
||||||
<tencent.version>3.1.622</tencent.version>
|
<tencent.version>3.1.622</tencent.version>
|
||||||
<revision>1.0.5</revision>
|
<revision>1.0.5</revision>
|
||||||
|
<jdcloud.version>1.3.3</jdcloud.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -76,6 +78,31 @@
|
|||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
<version>${spring.boot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-spring-boot-starter</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-autoimmit</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-core</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-comm</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-api</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms-aggregation-aliyun</artifactId>
|
<artifactId>sms-aggregation-aliyun</artifactId>
|
||||||
@ -103,27 +130,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms-aggregation-spring-boot-starter</artifactId>
|
<artifactId>sms-aggregation-jdcloud</artifactId>
|
||||||
<version>1.0.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-autoimmit</artifactId>
|
|
||||||
<version>1.0.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-core</artifactId>
|
|
||||||
<version>1.0.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-comm</artifactId>
|
|
||||||
<version>1.0.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-api</artifactId>
|
|
||||||
<version>1.0.5</version>
|
<version>1.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -180,6 +187,11 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jdcloud.sdk</groupId>
|
||||||
|
<artifactId>sms</artifactId>
|
||||||
|
<version>${jdcloud.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
|
|||||||
90
pom.xml
90
pom.xml
@ -11,16 +11,17 @@
|
|||||||
<url>https://gitee.com/dromara/sms_aggregation</url>
|
<url>https://gitee.com/dromara/sms_aggregation</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>sms-aggregation-api</module>
|
|
||||||
<module>sms-aggregation-comm</module>
|
<module>sms-aggregation-comm</module>
|
||||||
<module>sms-aggregation-aliyun</module>
|
<module>sms-aggregation-api</module>
|
||||||
<module>sms-aggregation-unisms</module>
|
|
||||||
<module>sms-aggregation-tencent</module>
|
|
||||||
<module>sms-aggregation-yunpian</module>
|
|
||||||
<module>sms-aggregation-spring-boot-starter</module>
|
|
||||||
<module>sms-aggregation-huawei</module>
|
|
||||||
<module>sms-aggregation-autoimmit</module>
|
|
||||||
<module>sms-aggregation-core</module>
|
<module>sms-aggregation-core</module>
|
||||||
|
<module>sms-aggregation-autoimmit</module>
|
||||||
|
<module>sms-aggregation-spring-boot-starter</module>
|
||||||
|
<module>sms-aggregation-aliyun</module>
|
||||||
|
<module>sms-aggregation-tencent</module>
|
||||||
|
<module>sms-aggregation-unisms</module>
|
||||||
|
<module>sms-aggregation-yunpian</module>
|
||||||
|
<module>sms-aggregation-huawei</module>
|
||||||
|
<module>sms-aggregation-jdcloud</module>
|
||||||
</modules>
|
</modules>
|
||||||
<!-- 开源协议 apache 2.0 -->
|
<!-- 开源协议 apache 2.0 -->
|
||||||
<licenses>
|
<licenses>
|
||||||
@ -53,10 +54,11 @@
|
|||||||
<spring.boot.version>2.7.10</spring.boot.version>
|
<spring.boot.version>2.7.10</spring.boot.version>
|
||||||
<revision>1.0.5</revision>
|
<revision>1.0.5</revision>
|
||||||
<aliyun.version>2.0.23</aliyun.version>
|
<aliyun.version>2.0.23</aliyun.version>
|
||||||
|
<tencent.version>3.1.622</tencent.version>
|
||||||
|
<unisms.version>0.0.4</unisms.version>
|
||||||
|
<jdcloud.version>1.3.3</jdcloud.version>
|
||||||
<json.version>2.0.15</json.version>
|
<json.version>2.0.15</json.version>
|
||||||
<okhttp.version>3.14.9</okhttp.version>
|
<okhttp.version>3.14.9</okhttp.version>
|
||||||
<unisms.version>0.0.4</unisms.version>
|
|
||||||
<tencent.version>3.1.622</tencent.version>
|
|
||||||
<forest.version>1.5.30</forest.version>
|
<forest.version>1.5.30</forest.version>
|
||||||
<hutool.version>5.8.16</hutool.version>
|
<hutool.version>5.8.16</hutool.version>
|
||||||
<okhttp.version>3.14.9</okhttp.version>
|
<okhttp.version>3.14.9</okhttp.version>
|
||||||
@ -79,6 +81,38 @@
|
|||||||
<version>${spring.boot.version}</version>
|
<version>${spring.boot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-spring-boot-starter</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-autoimmit</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-core</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--通用模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-comm</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--api模块-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms-aggregation-aliyun</artifactId>
|
<artifactId>sms-aggregation-aliyun</artifactId>
|
||||||
@ -111,33 +145,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms-aggregation-spring-boot-starter</artifactId>
|
<artifactId>sms-aggregation-jdcloud</artifactId>
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-autoimmit</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-core</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--通用模块-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-comm</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--api模块-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>kim.wind</groupId>
|
|
||||||
<artifactId>sms-aggregation-api</artifactId>
|
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -208,6 +216,14 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 京东云短信依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jdcloud.sdk</groupId>
|
||||||
|
<artifactId>sms</artifactId>
|
||||||
|
<version>${jdcloud.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- okhttp依赖,防止出现java.lang.NoSuchFieldError: Companion异常-->
|
<!-- okhttp依赖,防止出现java.lang.NoSuchFieldError: Companion异常-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package org.dromara.sms.autoimmit.config;
|
|||||||
import org.dromara.sms.aliyun.config.AlibabaConfig;
|
import org.dromara.sms.aliyun.config.AlibabaConfig;
|
||||||
import org.dromara.sms.core.config.SupplierFactory;
|
import org.dromara.sms.core.config.SupplierFactory;
|
||||||
import org.dromara.sms.huawei.config.HuaweiConfig;
|
import org.dromara.sms.huawei.config.HuaweiConfig;
|
||||||
|
import org.dromara.sms.jdcloud.config.JdCloudConfig;
|
||||||
import org.dromara.sms.tencent.config.TencentConfig;
|
import org.dromara.sms.tencent.config.TencentConfig;
|
||||||
import org.dromara.sms.unisms.config.UniConfig;
|
import org.dromara.sms.unisms.config.UniConfig;
|
||||||
import org.dromara.sms.yunpian.config.YunpianConfig;
|
import org.dromara.sms.yunpian.config.YunpianConfig;
|
||||||
@ -44,4 +45,11 @@ public class SupplierConfig {
|
|||||||
protected TencentConfig tencentConfig(){
|
protected TencentConfig tencentConfig(){
|
||||||
return SupplierFactory.getTencentConfig();
|
return SupplierFactory.getTencentConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 京东云短信差异化配置 */
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties(prefix = "sms.jdcloud")
|
||||||
|
protected JdCloudConfig jdCloudConfig(){
|
||||||
|
return SupplierFactory.getJdCloudConfig();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,9 @@ public enum SupplierType {
|
|||||||
/** 腾讯云*/
|
/** 腾讯云*/
|
||||||
TENCENT("腾讯云短信"),
|
TENCENT("腾讯云短信"),
|
||||||
/** 合一短信*/
|
/** 合一短信*/
|
||||||
UNI_SMS("合一短信")
|
UNI_SMS("合一短信"),
|
||||||
|
/** 京东云 */
|
||||||
|
JD_CLOUD("京东云短信"),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,10 @@
|
|||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms-aggregation-huawei</artifactId>
|
<artifactId>sms-aggregation-huawei</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-jdcloud</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build />
|
<build />
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -40,6 +40,11 @@
|
|||||||
<groupId>kim.wind</groupId>
|
<groupId>kim.wind</groupId>
|
||||||
<artifactId>sms-aggregation-huawei</artifactId>
|
<artifactId>sms-aggregation-huawei</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-jdcloud</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package org.dromara.sms.core.config;
|
|||||||
|
|
||||||
import org.dromara.sms.aliyun.config.AlibabaConfig;
|
import org.dromara.sms.aliyun.config.AlibabaConfig;
|
||||||
import org.dromara.sms.huawei.config.HuaweiConfig;
|
import org.dromara.sms.huawei.config.HuaweiConfig;
|
||||||
|
import org.dromara.sms.jdcloud.config.JdCloudConfig;
|
||||||
import org.dromara.sms.tencent.config.TencentConfig;
|
import org.dromara.sms.tencent.config.TencentConfig;
|
||||||
import org.dromara.sms.unisms.config.UniConfig;
|
import org.dromara.sms.unisms.config.UniConfig;
|
||||||
import org.dromara.sms.yunpian.config.YunpianConfig;
|
import org.dromara.sms.yunpian.config.YunpianConfig;
|
||||||
@ -31,6 +32,9 @@ public class SupplierFactory {
|
|||||||
/** 云片短信差异配置*/
|
/** 云片短信差异配置*/
|
||||||
private static YunpianConfig yunpianConfig;
|
private static YunpianConfig yunpianConfig;
|
||||||
|
|
||||||
|
/** 京东云短信差异配置 */
|
||||||
|
private static JdCloudConfig jdCloudConfig;
|
||||||
|
|
||||||
/** 阿里云配置获取*/
|
/** 阿里云配置获取*/
|
||||||
public static AlibabaConfig getAlibabaConfig() {
|
public static AlibabaConfig getAlibabaConfig() {
|
||||||
if (alibabaConfig == null){
|
if (alibabaConfig == null){
|
||||||
@ -70,4 +74,12 @@ public class SupplierFactory {
|
|||||||
}
|
}
|
||||||
return yunpianConfig;
|
return yunpianConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 京东云短信配置获取 */
|
||||||
|
public static JdCloudConfig getJdCloudConfig() {
|
||||||
|
if (jdCloudConfig == null){
|
||||||
|
jdCloudConfig = new JdCloudConfig();
|
||||||
|
}
|
||||||
|
return jdCloudConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import org.dromara.sms.comm.enumerate.SupplierType;
|
|||||||
import org.dromara.sms.comm.exception.SmsBlendException;
|
import org.dromara.sms.comm.exception.SmsBlendException;
|
||||||
import org.dromara.sms.core.config.SupplierFactory;
|
import org.dromara.sms.core.config.SupplierFactory;
|
||||||
import org.dromara.sms.huawei.config.HuaweiSmsConfig;
|
import org.dromara.sms.huawei.config.HuaweiSmsConfig;
|
||||||
|
import org.dromara.sms.jdcloud.config.JdCloudSmsConfig;
|
||||||
import org.dromara.sms.tencent.config.TencentSmsConfig;
|
import org.dromara.sms.tencent.config.TencentSmsConfig;
|
||||||
import org.dromara.sms.unisms.config.UniSmsConfig;
|
import org.dromara.sms.unisms.config.UniSmsConfig;
|
||||||
|
|
||||||
@ -34,6 +35,8 @@ public class SmsFactory {
|
|||||||
return UniSmsConfig.createUniSms(SupplierFactory.getUniConfig());
|
return UniSmsConfig.createUniSms(SupplierFactory.getUniConfig());
|
||||||
case TENCENT:
|
case TENCENT:
|
||||||
return TencentSmsConfig.createTencentSms(SupplierFactory.getTencentConfig());
|
return TencentSmsConfig.createTencentSms(SupplierFactory.getTencentConfig());
|
||||||
|
case JD_CLOUD:
|
||||||
|
return JdCloudSmsConfig.createJdCloudSms(SupplierFactory.getJdCloudConfig());
|
||||||
}
|
}
|
||||||
throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid");
|
throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid");
|
||||||
}
|
}
|
||||||
|
|||||||
37
sms-aggregation-jdcloud/.flattened-pom.xml
Normal file
37
sms-aggregation-jdcloud/.flattened-pom.xml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms_aggregation</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</parent>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-jdcloud</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
<name>sms-aggregation-jdcloud</name>
|
||||||
|
<description>sms-aggregation-jdcloud</description>
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>Apache 2</name>
|
||||||
|
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
<comments>A business-friendly OSS license</comments>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jdcloud.sdk</groupId>
|
||||||
|
<artifactId>sms</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-comm</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
BIN
sms-aggregation-jdcloud/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
sms-aggregation-jdcloud/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
18
sms-aggregation-jdcloud/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
18
sms-aggregation-jdcloud/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
|
||||||
|
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
|
||||||
35
sms-aggregation-jdcloud/pom.xml
Normal file
35
sms-aggregation-jdcloud/pom.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms_aggregation</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>sms-aggregation-jdcloud</artifactId>
|
||||||
|
<name>sms-aggregation-jdcloud</name>
|
||||||
|
<description>sms-aggregation-jdcloud</description>
|
||||||
|
<version>${revision}</version>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- 京东云短信依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jdcloud.sdk</groupId>
|
||||||
|
<artifactId>sms</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-comm</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>kim.wind</groupId>
|
||||||
|
<artifactId>sms-aggregation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package org.dromara.sms.jdcloud.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东云短信配置属性
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/4/10 20:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class JdCloudConfig {
|
||||||
|
|
||||||
|
/** Access Key */
|
||||||
|
private String accessKeyId;
|
||||||
|
|
||||||
|
/** Access Key Secret */
|
||||||
|
private String accessKeySecret;
|
||||||
|
|
||||||
|
/** 短信签名 */
|
||||||
|
private String signature;
|
||||||
|
|
||||||
|
/** 模板 ID */
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/** 地域信息 */
|
||||||
|
private String region = "cn-north-1";
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package org.dromara.sms.jdcloud.config;
|
||||||
|
|
||||||
|
import com.jdcloud.sdk.auth.CredentialsProvider;
|
||||||
|
import com.jdcloud.sdk.auth.StaticCredentialsProvider;
|
||||||
|
import com.jdcloud.sdk.http.HttpRequestConfig;
|
||||||
|
import com.jdcloud.sdk.http.Protocol;
|
||||||
|
import com.jdcloud.sdk.service.sms.client.SmsClient;
|
||||||
|
import org.dromara.sms.comm.factory.BeanFactory;
|
||||||
|
import org.dromara.sms.jdcloud.service.JdCloudSmsImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东云短信配置
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/4/10 20:01
|
||||||
|
*/
|
||||||
|
public class JdCloudSmsConfig {
|
||||||
|
|
||||||
|
private static JdCloudSmsImpl jdCloudSms;
|
||||||
|
|
||||||
|
private static JdCloudSmsConfig jdCloudSmsConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端对象
|
||||||
|
*
|
||||||
|
* @param jdCloudConfig 京东云短信配置属性
|
||||||
|
* @return 客户端对象
|
||||||
|
*/
|
||||||
|
public SmsClient client(JdCloudConfig jdCloudConfig) {
|
||||||
|
CredentialsProvider credentialsProvider = new StaticCredentialsProvider(jdCloudConfig.getAccessKeyId(),
|
||||||
|
jdCloudConfig.getAccessKeySecret());
|
||||||
|
return SmsClient.builder().credentialsProvider(credentialsProvider)
|
||||||
|
.httpRequestConfig(new HttpRequestConfig.Builder().protocol(Protocol.HTTP).build()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建京东云短信实现
|
||||||
|
*/
|
||||||
|
public static JdCloudSmsImpl createJdCloudSms(JdCloudConfig jdCloudConfig) {
|
||||||
|
if (jdCloudSmsConfig == null) {
|
||||||
|
jdCloudSmsConfig = new JdCloudSmsConfig();
|
||||||
|
}
|
||||||
|
if (jdCloudSms == null) {
|
||||||
|
jdCloudSms = new JdCloudSmsImpl(
|
||||||
|
jdCloudSmsConfig.client(jdCloudConfig),
|
||||||
|
jdCloudConfig,
|
||||||
|
BeanFactory.getExecutor(),
|
||||||
|
BeanFactory.getDelayedTime()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return jdCloudSms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新对象
|
||||||
|
*/
|
||||||
|
public static JdCloudSmsImpl refresh(JdCloudConfig jdCloudConfig) {
|
||||||
|
if (jdCloudSmsConfig == null) {
|
||||||
|
jdCloudSmsConfig = new JdCloudSmsConfig();
|
||||||
|
}
|
||||||
|
jdCloudSms = new JdCloudSmsImpl(
|
||||||
|
jdCloudSmsConfig.client(jdCloudConfig),
|
||||||
|
jdCloudConfig,
|
||||||
|
BeanFactory.getExecutor(),
|
||||||
|
BeanFactory.getDelayedTime()
|
||||||
|
);
|
||||||
|
return jdCloudSms;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,181 @@
|
|||||||
|
package org.dromara.sms.jdcloud.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.jdcloud.sdk.service.sms.client.SmsClient;
|
||||||
|
import com.jdcloud.sdk.service.sms.model.BatchSendRequest;
|
||||||
|
import com.jdcloud.sdk.service.sms.model.BatchSendResult;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.sms.api.SmsBlend;
|
||||||
|
import org.dromara.sms.api.callback.CallBack;
|
||||||
|
import org.dromara.sms.api.entity.SmsResponse;
|
||||||
|
import org.dromara.sms.comm.annotation.Restricted;
|
||||||
|
import org.dromara.sms.comm.delayedTime.DelayedTime;
|
||||||
|
import org.dromara.sms.comm.exception.SmsBlendException;
|
||||||
|
import org.dromara.sms.jdcloud.config.JdCloudConfig;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 京东云短信实现
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2023/4/10 20:01
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class JdCloudSmsImpl implements SmsBlend {
|
||||||
|
|
||||||
|
private final SmsClient client;
|
||||||
|
|
||||||
|
private final JdCloudConfig config;
|
||||||
|
|
||||||
|
private final Executor pool;
|
||||||
|
|
||||||
|
private final DelayedTime delayed;
|
||||||
|
|
||||||
|
public JdCloudSmsImpl(SmsClient client, JdCloudConfig config, Executor pool, DelayedTime delayed) {
|
||||||
|
this.client = client;
|
||||||
|
this.config = config;
|
||||||
|
this.pool = pool;
|
||||||
|
this.delayed = delayed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public SmsResponse sendMessage(String phone, String message) {
|
||||||
|
return massTexting(Collections.singletonList(phone), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public SmsResponse sendMessage(String phone, String templateId, LinkedHashMap<String, String> messages) {
|
||||||
|
return massTexting(Collections.singletonList(phone), templateId, messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public SmsResponse massTexting(List<String> phones, String message) {
|
||||||
|
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||||
|
map.put(IdUtil.fastSimpleUUID(), message);
|
||||||
|
return massTexting(phones, config.getTemplateId(), map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public SmsResponse massTexting(List<String> phones, String templateId, LinkedHashMap<String, String> messages) {
|
||||||
|
try {
|
||||||
|
BatchSendRequest request = new BatchSendRequest();
|
||||||
|
request.setPhoneList(phones);
|
||||||
|
request.setRegionId(config.getRegion());
|
||||||
|
request.setTemplateId(templateId);
|
||||||
|
request.setSignId(config.getSignature());
|
||||||
|
List<String> params = messages.entrySet().stream().map(messages::get)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
request.setParams(params);
|
||||||
|
|
||||||
|
BatchSendResult result = client.batchSend(request).getResult();
|
||||||
|
return getSmsResponse(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new SmsBlendException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||||
|
pool.execute(() -> {
|
||||||
|
SmsResponse smsResponse = sendMessage(phone, message);
|
||||||
|
callBack.callBack(smsResponse);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void sendMessageAsync(String phone, String message) {
|
||||||
|
pool.execute(() -> sendMessage(phone, message));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void sendMessageAsync(String phone, String templateId, LinkedHashMap<String, String> messages, CallBack callBack) {
|
||||||
|
pool.execute(() -> {
|
||||||
|
SmsResponse smsResponse = sendMessage(phone, templateId, messages);
|
||||||
|
callBack.callBack(smsResponse);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void sendMessageAsync(String phone, String templateId, LinkedHashMap<String, String> messages) {
|
||||||
|
pool.execute(() -> sendMessage(phone, templateId, messages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void delayedMessage(String phone, String message, Long delayedTime) {
|
||||||
|
this.delayed.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
sendMessage(phone, message);
|
||||||
|
}
|
||||||
|
}, delayedTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void delayedMessage(String phone, String templateId, LinkedHashMap<String, String> messages, Long delayedTime) {
|
||||||
|
this.delayed.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
sendMessage(phone, templateId, messages);
|
||||||
|
}
|
||||||
|
}, delayedTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void delayMassTexting(List<String> phones, String message, Long delayedTime) {
|
||||||
|
this.delayed.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
massTexting(phones, message);
|
||||||
|
}
|
||||||
|
}, delayedTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Restricted
|
||||||
|
public void delayMassTexting(List<String> phones, String templateId, LinkedHashMap<String, String> messages, Long delayedTime) {
|
||||||
|
this.delayed.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
massTexting(phones, templateId, messages);
|
||||||
|
}
|
||||||
|
}, delayedTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取短信返回信息
|
||||||
|
*
|
||||||
|
* @param res 云商原始响应信息
|
||||||
|
* @return 发送短信返回信息
|
||||||
|
*/
|
||||||
|
private SmsResponse getSmsResponse(BatchSendResult res) {
|
||||||
|
SmsResponse smsResponse = new SmsResponse();
|
||||||
|
smsResponse.setBizId(res.getData().getSequenceNumber());
|
||||||
|
smsResponse.setData(res.getData());
|
||||||
|
smsResponse.setCode(String.valueOf(res.getCode()));
|
||||||
|
smsResponse.setMessage(res.getMessage());
|
||||||
|
Boolean status = res.getStatus();
|
||||||
|
boolean isSuccess = status != null && status;
|
||||||
|
if (!isSuccess) {
|
||||||
|
smsResponse.setErrMessage(res.getMessage());
|
||||||
|
smsResponse.setErrorCode(String.valueOf(res.getCode()));
|
||||||
|
}
|
||||||
|
return smsResponse;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user