mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-07 17:38:38 +08:00
Merge branch 'dev-2.x'
# Conflicts: # sms4j-aliyun/.flattened-pom.xml # sms4j-api/.flattened-pom.xml # sms4j-autoimmit/.flattened-pom.xml # sms4j-cloopen/.flattened-pom.xml # sms4j-core/.flattened-pom.xml # sms4j-emay/.flattened-pom.xml # sms4j-huawei/.flattened-pom.xml # sms4j-jdcloud/.flattened-pom.xml # sms4j-spring-boot-starter/.flattened-pom.xml # sms4j-tencent/.flattened-pom.xml # sms4j-unisms/.flattened-pom.xml # sms4j-yunpian/.flattened-pom.xml
This commit is contained in:
commit
7e96649b41
@ -1,309 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://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>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>sms4j</name>
|
||||
<description>sms_aggregation</description>
|
||||
<url>https://gitee.com/dromara/sms_aggregation</url>
|
||||
<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>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>wind</name>
|
||||
<email>wzsf1810@qq.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
<modules>
|
||||
<module>sms4j-comm</module>
|
||||
<module>sms4j-api</module>
|
||||
<module>sms4j-core</module>
|
||||
<module>sms4j-autoimmit</module>
|
||||
<module>sms4j-spring-boot-starter</module>
|
||||
<module>sms4j-aliyun</module>
|
||||
<module>sms4j-tencent</module>
|
||||
<module>sms4j-unisms</module>
|
||||
<module>sms4j-yunpian</module>
|
||||
<module>sms4j-huawei</module>
|
||||
<module>sms4j-jdcloud</module>
|
||||
<module>sms4j-cloopen</module>
|
||||
<module>sms4j-emay</module>
|
||||
</modules>
|
||||
<scm>
|
||||
<connection>scm:git:https://gitee.com/MR-wind/sms_aggregation.git</connection>
|
||||
<developerConnection>scm:git:https://gitee.com/MR-wind/sms_aggregation.git</developerConnection>
|
||||
<tag>master</tag>
|
||||
<url>https://gitee.com/MR-wind/sms_aggregation.git</url>
|
||||
</scm>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<json.version>2.0.15</json.version>
|
||||
<hutool.version>5.8.16</hutool.version>
|
||||
<okhttp.version>3.14.9</okhttp.version>
|
||||
<tencent.version>3.1.622</tencent.version>
|
||||
<revision>2.0.1</revision>
|
||||
<unisms.version>0.0.4</unisms.version>
|
||||
<spring.boot.version>2.7.10</spring.boot.version>
|
||||
<forest.version>1.5.30</forest.version>
|
||||
<jdcloud.version>1.3.3</jdcloud.version>
|
||||
<aliyun.version>2.0.23</aliyun.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-autoimmit</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-core</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-aliyun</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-tencent</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-unisms</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-yunpian</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-huawei</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-jdcloud</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-cloopen</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-emay</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>${aliyun.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${json.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-core</artifactId>
|
||||
<version>${forest.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.apistd.uni</groupId>
|
||||
<artifactId>uni-sdk</artifactId>
|
||||
<version>${unisms.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
<version>${tencent.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jdcloud.sdk</groupId>
|
||||
<artifactId>sms</artifactId>
|
||||
<version>${jdcloud.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<show>private</show>
|
||||
<nohelp>true</nohelp>
|
||||
<charset>UTF-8</charset>
|
||||
<encoding>UTF-8</encoding>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<fork>true</fork>
|
||||
<verbose>true</verbose>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.2.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>resolveCiFriendliesOnly</flattenMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@ -30,7 +30,11 @@ target/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
.flattened-pom.xml
|
||||
**/.flattened-pom.xml
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Temp
|
||||
.flattened-pom.xml
|
||||
**/.flattened-pom.xml
|
||||
/.fastRequest/**
|
||||
|
||||
14
README.md
14
README.md
@ -1,9 +1,9 @@
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sms4j v2.0.1</h1>
|
||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sms4j v2.0.2</h1>
|
||||
<h4 align="center" style="margin: 30px 0 30px; font-weight: bold;">sms4j -- 让发送短信变的更简单</h4>
|
||||
<p align="center">
|
||||
<a href="https://gitee.com/the-wind-is-like-a-song/sms_aggregation/stargazers"><img src="https://gitee.com/the-wind-is-like-a-song/sms_aggregation/badge/star.svg?theme=gvp"></a>
|
||||
<a href="https://gitee.com/the-wind-is-like-a-song/sms_aggregation/master/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green"></a>
|
||||
<a href="https://gitee.com/the-wind-is-like-a-song/sms_aggregation"><img src="https://img.shields.io/badge/version-v2.0.1-blue"></a>
|
||||
<a href="https://gitee.com/dromara/sms4j/stargazers"><img src="https://gitee.com/dromara/sms4j/badge/star.svg?theme=gvp"></a>
|
||||
<a href="https://gitee.com/dromara/sms4j/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green"></a>
|
||||
<a href="https://gitee.com/dromara/sms4j"><img src="https://img.shields.io/badge/version-v2.0.2-blue"></a>
|
||||
</p>
|
||||
<img src="/public/logo.png">
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
这个工具的目的就是为了统一下各个厂商的短信发送工具的标准,甚至于更换短信厂商只需要更改yml配置文件即可。
|
||||
如果我们的项目对你产生了帮助,或者你觉得还算值得鼓励,请用你发财的小手帮助点上一个start
|
||||
[gitee](https://gitee.com/dromara/sms4j)
|
||||
[github](https://github.com/dromara/sms_aggregation)
|
||||
[github](https://github.com/dromara/sms4j)
|
||||
|
||||
#### [官方文档](http://wind.kim)
|
||||
#### [JavaDoc文档](https://apidoc.gitee.com/dromara/sms4j/)
|
||||
@ -39,7 +39,7 @@
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<version> version </version>
|
||||
<version>最新版本</version>
|
||||
</dependency>
|
||||
```
|
||||
2. 设置配置文件
|
||||
@ -125,7 +125,7 @@ sms:
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request 到 dev-test分支
|
||||
4. 新建 Pull Request 到 dev-2.x 分支
|
||||
```
|
||||
## 贡献原则
|
||||
- 我们原则上欢迎任何人为sms4j添加加瓦贡献代码
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
{
|
||||
"hash": "2b79d460",
|
||||
"browserHash": "bbb5b341",
|
||||
"optimized": {
|
||||
"@vueuse/core": {
|
||||
"src": "../../../../node_modules/@vueuse/core/index.mjs",
|
||||
"file": "@vueuse_core.js",
|
||||
"fileHash": "49add9e9",
|
||||
"needsInterop": false
|
||||
},
|
||||
"@vuepress/shared": {
|
||||
"src": "../../../../node_modules/@vuepress/shared/dist/index.js",
|
||||
"file": "@vuepress_shared.js",
|
||||
"fileHash": "30dbdfc5",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vue": {
|
||||
"src": "../../../../node_modules/vue/dist/vue.runtime.esm-bundler.js",
|
||||
"file": "vue.js",
|
||||
"fileHash": "0859a21c",
|
||||
"needsInterop": false
|
||||
},
|
||||
"vue-router": {
|
||||
"src": "../../../../node_modules/vue-router/dist/vue-router.esm-bundler.js",
|
||||
"file": "vue-router.js",
|
||||
"fileHash": "3d5d324e",
|
||||
"needsInterop": false
|
||||
}
|
||||
},
|
||||
"chunks": {
|
||||
"chunk-AWA6B2ZS": {
|
||||
"file": "chunk-AWA6B2ZS.js"
|
||||
},
|
||||
"chunk-JXWQMH7G": {
|
||||
"file": "chunk-JXWQMH7G.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
168
pom.xml
168
pom.xml
@ -5,28 +5,22 @@
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>sms4j</name>
|
||||
<packaging>pom</packaging>
|
||||
<description>sms_aggregation</description>
|
||||
<url>https://gitee.com/dromara/sms_aggregation</url>
|
||||
<description>让发送短信变的更简单</description>
|
||||
<url>https://gitee.com/dromara/sms4j</url>
|
||||
|
||||
<modules>
|
||||
<module>sms4j-comm</module>
|
||||
<module>sms4j-api</module>
|
||||
<module>sms4j-provider</module>
|
||||
<module>sms4j-core</module>
|
||||
<module>sms4j-autoimmit</module>
|
||||
<module>sms4j-spring-boot-starter</module>
|
||||
<module>sms4j-aliyun</module>
|
||||
<module>sms4j-tencent</module>
|
||||
<module>sms4j-unisms</module>
|
||||
<module>sms4j-yunpian</module>
|
||||
<module>sms4j-huawei</module>
|
||||
<module>sms4j-jdcloud</module>
|
||||
<module>sms4j-cloopen</module>
|
||||
<module>sms4j-emay</module>
|
||||
</modules>
|
||||
<!-- 开源协议 apache 2.0 -->
|
||||
|
||||
<!-- 开源协议 Apache 2.0 -->
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache 2</name>
|
||||
@ -47,15 +41,14 @@
|
||||
<!-- 仓库信息 -->
|
||||
<scm>
|
||||
<tag>master</tag>
|
||||
<url>https://gitee.com/MR-wind/sms_aggregation.git</url>
|
||||
<connection>scm:git:https://gitee.com/MR-wind/sms_aggregation.git</connection>
|
||||
<developerConnection>scm:git:https://gitee.com/MR-wind/sms_aggregation.git</developerConnection>
|
||||
<url>https://gitee.com/dromara/sms4j.git</url>
|
||||
<connection>scm:git:https://gitee.com/dromara/sms4j.git</connection>
|
||||
<developerConnection>scm:git:https://gitee.com/dromara/sms4j.git</developerConnection>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
|
||||
<spring.boot.version>2.7.10</spring.boot.version>
|
||||
<revision>2.0.1</revision>
|
||||
<spring.boot.version>2.7.11</spring.boot.version>
|
||||
<revision>2.0.2</revision>
|
||||
<aliyun.version>2.0.23</aliyun.version>
|
||||
<tencent.version>3.1.622</tencent.version>
|
||||
<unisms.version>0.0.4</unisms.version>
|
||||
@ -65,6 +58,8 @@
|
||||
<forest.version>1.5.30</forest.version>
|
||||
<hutool.version>5.8.16</hutool.version>
|
||||
<okhttp.version>3.14.9</okhttp.version>
|
||||
<xmlblend.version>2.3.0</xmlblend.version>
|
||||
<activation.version>1.1.1</activation.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@ -96,6 +91,7 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!--核心模块-->
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-core</artifactId>
|
||||
@ -116,67 +112,13 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 短信厂商对接模块(国内短信) -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-aliyun</artifactId>
|
||||
<artifactId>sms4j-provider</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-tencent</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-unisms</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-yunpian</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-huawei</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-jdcloud</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-cloopen</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-emay</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云短信依赖-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>${aliyun.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里JSON解析器 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
@ -206,32 +148,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!--合一短信依赖-->
|
||||
<dependency>
|
||||
<groupId>com.apistd.uni</groupId>
|
||||
<artifactId>uni-sdk</artifactId>
|
||||
<version>${unisms.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 腾讯云短信-->
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
<version>${tencent.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- 京东云短信依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.jdcloud.sdk</groupId>
|
||||
@ -239,11 +155,25 @@
|
||||
<version>${jdcloud.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- okhttp依赖,防止出现java.lang.NoSuchFieldError: Companion异常-->
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>${okhttp.version}</version>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>${xmlblend.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>${xmlblend.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>${xmlblend.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<version>${activation.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
@ -274,7 +204,6 @@
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Source -->
|
||||
@ -314,20 +243,20 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- <!– GPG –>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
|
||||
<!-- <version>1.6</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>verify</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>sign</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- <!– GPG –>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!-- <artifactId>maven-gpg-plugin</artifactId>-->
|
||||
<!-- <version>1.6</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>verify</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>sign</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!--Compiler -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -385,7 +314,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-aliyun</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-aliyun</name>
|
||||
<description>sms4j-aliyun</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.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.14.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,37 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-aliyun</artifactId>
|
||||
<name>sms4j-aliyun</name>
|
||||
<description>sms4j-aliyun</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.14.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-api</name>
|
||||
<description>sms4j-api</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -10,12 +10,9 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
|
||||
<name>sms4j-api</name>
|
||||
<description>sms4j-api</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 公共API
|
||||
* @author :Wind
|
||||
*/
|
||||
package org.dromara.sms4j.api;
|
||||
@ -1,43 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-autoimmit</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-autoimmit</name>
|
||||
<description>sms4j-autoimmit</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>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -10,13 +10,10 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-autoimmit</artifactId>
|
||||
<version>${revision}</version>
|
||||
|
||||
<name>sms4j-autoimmit</name>
|
||||
<description>sms4j-autoimmit</description>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--aop依赖-->
|
||||
<dependency>
|
||||
|
||||
@ -8,6 +8,8 @@ import org.dromara.sms4j.comm.config.SmsBanner;
|
||||
import org.dromara.sms4j.comm.config.SmsConfig;
|
||||
import org.dromara.sms4j.comm.config.SmsSqlConfig;
|
||||
import org.dromara.sms4j.comm.delayedTime.DelayedTime;
|
||||
import org.dromara.sms4j.comm.enumerate.ConfigType;
|
||||
import org.dromara.sms4j.comm.enumerate.SupplierType;
|
||||
import org.dromara.sms4j.comm.factory.BeanFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.core.SupplierSqlConfig;
|
||||
@ -65,8 +67,8 @@ public class SmsAutowiredConfig {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "sms", name = "config-type", havingValue = "sql_config")
|
||||
protected void supplierSqlConfig(SmsSqlConfig smsSqlConfig){
|
||||
SupplierSqlConfig.refreshSqlConfig();
|
||||
protected SupplierSqlConfig supplierSqlConfig(SmsSqlConfig smsSqlConfig){
|
||||
return new SupplierSqlConfig();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Spring Boot自动装配配置
|
||||
* @author :Wind
|
||||
*/
|
||||
package org.dromara.sms4j.autoimmit;
|
||||
@ -1,33 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-cloopen</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-cloopen</name>
|
||||
<description>sms4j-cloopen</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,29 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-cloopen</artifactId>
|
||||
<name>sms4j-cloopen</name>
|
||||
<description>sms4j-cloopen</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<name>sms4j-comm</name>
|
||||
<description>sms4j-comm</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.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -10,15 +10,11 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
|
||||
<name>sms4j-comm</name>
|
||||
<description>sms4j-comm</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
|
||||
@ -2,14 +2,14 @@ package org.dromara.sms4j.comm.config;
|
||||
|
||||
public class SmsBanner {
|
||||
private static final String banner =
|
||||
" _____ __ __ _____ _____ _____ _____ ______ _____ _______ _____ ____ _ _ \n" +
|
||||
" / ____| | \\/ | / ____| /\\ / ____| / ____| | __ \\ | ____| / ____| /\\ |__ __| |_ _| / __ \\ | \\ | |\n" +
|
||||
" | (___ | \\ / | | (___ / \\ | | __ | | __ | |__) | | |__ | | __ / \\ | | | | | | | | | \\| |\n" +
|
||||
" \\___ \\ | |\\/| | \\___ \\ / /\\ \\ | | |_ | | | |_ | | _ / | __| | | |_ | / /\\ \\ | | | | | | | | | . ` |\n" +
|
||||
" ____) | | | | | ____) | / ____ \\ | |__| | | |__| | | | \\ \\ | |____ | |__| | / ____ \\ | | _| |_ | |__| | | |\\ |\n" +
|
||||
" |_____/ |_| |_| |_____/ /_/ \\_\\ \\_____| \\_____| |_| \\_\\ |______| \\_____| /_/ \\_\\ |_| |_____| \\____/ |_| \\_|\n" +
|
||||
" \n" +
|
||||
" ";
|
||||
" ________ _____ ______ ________ ___ ___ ___ \n" +
|
||||
"|\\ ____\\|\\ _ \\ _ \\|\\ ____\\|\\ \\ |\\ \\ |\\ \\ \n" +
|
||||
"\\ \\ \\___|\\ \\ \\\\\\__\\ \\ \\ \\ \\___|\\ \\ \\\\_\\ \\ \\ \\ \\ \n" +
|
||||
" \\ \\_____ \\ \\ \\\\|__| \\ \\ \\_____ \\ \\______ \\ __ \\ \\ \\ \n" +
|
||||
" \\|____|\\ \\ \\ \\ \\ \\ \\|____|\\ \\|_____|\\ \\|\\ \\\\_\\ \\ \n" +
|
||||
" ____\\_\\ \\ \\__\\ \\ \\__\\____\\_\\ \\ \\ \\__\\ \\________\\\n" +
|
||||
" |\\_________\\|__| \\|__|\\_________\\ \\|__|\\|________|\n" +
|
||||
" \\|_________| \\|_________| \n";
|
||||
/** 初始化配置文件时打印banner*/
|
||||
public static void PrintBanner(String version) {
|
||||
System.out.println(banner+version);
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 公共模块
|
||||
* @author :Wind
|
||||
*/
|
||||
package org.dromara.sms4j.comm;
|
||||
@ -1,58 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-core</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-core</name>
|
||||
<description>sms4j-core</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-aliyun</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-tencent</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-unisms</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-yunpian</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-huawei</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-jdcloud</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-emay</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-cloopen</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build />
|
||||
</project>
|
||||
@ -10,57 +10,14 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-core</artifactId>
|
||||
<version>${revision}</version>
|
||||
|
||||
<name>sms4j-core</name>
|
||||
<description>sms4j-core</description>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-aliyun</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-tencent</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-unisms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-yunpian</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-huawei</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-jdcloud</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-emay</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-cloopen</artifactId>
|
||||
<artifactId>sms4j-provider</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
package org.dromara.sms4j.core.factory;
|
||||
|
||||
import org.dromara.sms4j.comm.config.SmsConfig;
|
||||
import org.dromara.sms4j.comm.enumerate.ConfigType;
|
||||
import org.dromara.sms4j.comm.factory.BeanFactory;
|
||||
import org.dromara.sms4j.core.SupplierSqlConfig;
|
||||
import org.dromara.sms4j.emay.config.EmaySmsConfig;
|
||||
import org.dromara.sms4j.aliyun.config.AlibabaSmsConfig;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.cloopen.config.CloopenSmsConfig;
|
||||
import org.dromara.sms4j.comm.enumerate.SupplierType;
|
||||
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||
import org.dromara.sms4j.core.SupplierSqlConfig;
|
||||
import org.dromara.sms4j.core.config.SupplierFactory;
|
||||
import org.dromara.sms4j.emay.config.EmaySmsConfig;
|
||||
import org.dromara.sms4j.huawei.config.HuaweiSmsConfig;
|
||||
import org.dromara.sms4j.jdcloud.config.JdCloudSmsConfig;
|
||||
import org.dromara.sms4j.tencent.config.TencentSmsConfig;
|
||||
@ -21,6 +18,7 @@ import org.dromara.sms4j.unisms.config.UniSmsConfig;
|
||||
* <p>构造工厂,用于获取一个厂商的短信实现对象
|
||||
* 在调用对应厂商的短信发送方法前,请先确保你的配置已经实现,否则无法发送该厂商对应的短信,一般情况下厂商会回执因缺少的配置所造成的的异常,但不会
|
||||
* 以java异常的形式抛出
|
||||
*
|
||||
* @author :Wind
|
||||
* 2023/4/8 15:55
|
||||
**/
|
||||
@ -31,6 +29,7 @@ public abstract class SmsFactory {
|
||||
/**
|
||||
* createSmsBlend
|
||||
* <p>获取各个厂商的实现类
|
||||
*
|
||||
* @param supplierType 厂商枚举
|
||||
* @author :Wind
|
||||
*/
|
||||
@ -55,12 +54,13 @@ public abstract class SmsFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* refresh
|
||||
* refresh
|
||||
* <p>刷新配置,用于切换配置后的刷新,防止因厂商sdk内部的保存导致配置更新不及时
|
||||
* 此方法会造成一定的性能损失,不建议经常性调用
|
||||
*
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void refresh(){
|
||||
*/
|
||||
public static void refresh() {
|
||||
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
||||
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
||||
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
||||
@ -71,36 +71,46 @@ public abstract class SmsFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* refresh
|
||||
* refresh
|
||||
* <p>根据厂商类型枚举刷新对应厂商的配置,此方法不会刷新全部厂商的配置对象,只会重构所选厂商的对象,性能损失相对较小
|
||||
*
|
||||
* @param supplierType 厂商类型枚举
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void refresh(SupplierType supplierType){
|
||||
*/
|
||||
public static void refresh(SupplierType supplierType) {
|
||||
switch (supplierType) {
|
||||
case ALIBABA:
|
||||
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
||||
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
||||
break;
|
||||
case HUAWEI:
|
||||
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
||||
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
||||
break;
|
||||
case UNI_SMS:
|
||||
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
||||
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
||||
break;
|
||||
case TENCENT:
|
||||
TencentSmsConfig.refresh(SupplierFactory.getTencentConfig());
|
||||
TencentSmsConfig.refresh(SupplierFactory.getTencentConfig());
|
||||
break;
|
||||
case JD_CLOUD:
|
||||
JdCloudSmsConfig.refresh(SupplierFactory.getJdCloudConfig());
|
||||
JdCloudSmsConfig.refresh(SupplierFactory.getJdCloudConfig());
|
||||
break;
|
||||
case CLOOPEN:
|
||||
CloopenSmsConfig.refresh(SupplierFactory.getCloopenConfig());
|
||||
CloopenSmsConfig.refresh(SupplierFactory.getCloopenConfig());
|
||||
break;
|
||||
case EMAY:
|
||||
EmaySmsConfig.refresh(SupplierFactory.getEmayConfig());
|
||||
EmaySmsConfig.refresh(SupplierFactory.getEmayConfig());
|
||||
break;
|
||||
default:
|
||||
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");
|
||||
}
|
||||
|
||||
/**
|
||||
* refreshSqlConfig
|
||||
* refreshSqlConfig
|
||||
* <p>重新读取sql配置
|
||||
*
|
||||
* @author :Wind
|
||||
*/
|
||||
*/
|
||||
public static void refreshSqlConfig() {
|
||||
SupplierSqlConfig.refreshSqlConfig();
|
||||
}
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package org.dromara.sms4j.core.load;
|
||||
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
|
||||
public class LoadServer {
|
||||
private SmsBlend smsServer;
|
||||
private int weight;
|
||||
private int currentWeight;
|
||||
|
||||
protected LoadServer(SmsBlend smsServer, int weight, int currentWeight) {
|
||||
this.smsServer = smsServer;
|
||||
this.weight = weight;
|
||||
this.currentWeight = currentWeight;
|
||||
}
|
||||
|
||||
protected SmsBlend getSmsServer() {
|
||||
return smsServer;
|
||||
}
|
||||
|
||||
protected int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
protected int getCurrentWeight() {
|
||||
return currentWeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 smsServer
|
||||
*/
|
||||
protected void setSmsServer(SmsBlend smsServer) {
|
||||
this.smsServer = smsServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 weight
|
||||
*/
|
||||
protected void setWeight(int weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 currentWeight
|
||||
*/
|
||||
protected void setCurrentWeight(int currentWeight) {
|
||||
this.currentWeight = currentWeight;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package org.dromara.sms4j.core.load;
|
||||
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* SmsLoad
|
||||
* <p> 自定义的一个平滑加权负载服务,可以用于存放多个短信实现负载
|
||||
* @author :Wind
|
||||
* 2023/4/21 20:49
|
||||
**/
|
||||
public class SmsLoad {
|
||||
// 服务器列表,每个服务器有一个权重和当前权重
|
||||
private static final List<LoadServer> LoadServers = new ArrayList<>();
|
||||
|
||||
private SmsLoad() {
|
||||
}
|
||||
|
||||
/**
|
||||
* addLoadServer
|
||||
* <p> 添加服务及其权重
|
||||
* <p>添加权重应注意,不要把某个权重设置的与其他权重相差过大,否则容易出现无法负载,单一选择的情况
|
||||
* @param LoadServer 短信实现
|
||||
* @param weight 权重
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void addLoadServer(SmsBlend LoadServer, int weight) {
|
||||
LoadServers.add(new LoadServer(LoadServer, weight, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
* removeLoadServer
|
||||
* <p>移除短信服务
|
||||
* @param LoadServer 要移除的服务
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void removeLoadServer(SmsBlend LoadServer) {
|
||||
for (int i = 0; i < LoadServers.size(); i++) {
|
||||
if (LoadServers.get(i).getSmsServer().equals(LoadServer)) {
|
||||
LoadServers.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getLoadServer
|
||||
* <p>根据负载算法获取一个可获取到的短信服务,这里获取到的服务必然是addLoadServer方法中添加过的服务,不会凭空出现
|
||||
* @return SmsBlend 短信实现
|
||||
* @author :Wind
|
||||
*/
|
||||
public static SmsBlend getLoadServer() {
|
||||
int totalWeight = 0;
|
||||
LoadServer selectedLoadServer = null;
|
||||
// 计算所有服务器的权重总和,并选择当前权重最大的服务器
|
||||
for (LoadServer LoadServer : LoadServers) {
|
||||
totalWeight += LoadServer.getWeight();
|
||||
int currentWeight = LoadServer.getCurrentWeight() + LoadServer.getWeight();
|
||||
LoadServer.setCurrentWeight(currentWeight);
|
||||
if (selectedLoadServer == null || LoadServer.getCurrentWeight() > selectedLoadServer.getCurrentWeight()) {
|
||||
selectedLoadServer = LoadServer;
|
||||
}
|
||||
}
|
||||
// 如果没有服务器,则返回空
|
||||
if (selectedLoadServer == null) {
|
||||
return null;
|
||||
}
|
||||
// 更新选择的服务器的当前权重,并返回其地址
|
||||
int i = selectedLoadServer.getCurrentWeight() - totalWeight;
|
||||
selectedLoadServer.setCurrentWeight(i);
|
||||
return selectedLoadServer.getSmsServer();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 核心模块
|
||||
* @author :Wind
|
||||
*/
|
||||
package org.dromara.sms4j.core;
|
||||
@ -1,33 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-emay</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-emay</name>
|
||||
<description>sms4j-emay</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,31 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-emay</artifactId>
|
||||
<version>${revision}</version>
|
||||
<name>sms4j-emay</name>
|
||||
<description>sms4j-emay</description>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-huawei</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-huawei</name>
|
||||
<description>sms4j-huawei</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build />
|
||||
</project>
|
||||
@ -1,34 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-huawei</artifactId>
|
||||
<version>${revision}</version>
|
||||
<name>sms4j-huawei</name>
|
||||
<description>sms4j-huawei</description>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
</build>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-jdcloud</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-jdcloud</name>
|
||||
<description>sms4j-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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -7,15 +7,19 @@
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-jdcloud</artifactId>
|
||||
<name>sms4j-jdcloud</name>
|
||||
<description>sms4j-jdcloud</description>
|
||||
<version>${revision}</version>
|
||||
<artifactId>sms4j-provider</artifactId>
|
||||
|
||||
<name>sms4j-provider</name>
|
||||
<description>短信厂商对接模块(国内短信)</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 京东云短信依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.jdcloud.sdk</groupId>
|
||||
@ -23,13 +27,23 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -17,6 +17,7 @@ import org.dromara.sms4j.comm.factory.BeanFactory;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
@ -92,7 +93,7 @@ public class AlibabaSmsImpl implements SmsBlend {
|
||||
log.error("aliyun send message error", e);
|
||||
throw new SmsBlendException(e.getMessage());
|
||||
}
|
||||
log.info("requestUrl {}", requestUrl);
|
||||
log.debug("requestUrl {}", requestUrl);
|
||||
http.post(requestUrl)
|
||||
.addHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||
.addBody(paramStr)
|
||||
@ -111,10 +112,8 @@ public class AlibabaSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,10 +127,8 @@ public class AlibabaSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone,templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -14,6 +14,7 @@ import org.dromara.sms4j.comm.annotation.Restricted;
|
||||
import org.dromara.sms4j.comm.delayedTime.DelayedTime;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
@ -75,10 +76,8 @@ public class CloopenSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -90,10 +89,8 @@ public class CloopenSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone,templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -14,6 +14,7 @@ import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||
import org.dromara.sms4j.comm.factory.BeanFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@ -89,10 +90,8 @@ public class EmaySmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,10 +103,8 @@ public class EmaySmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static org.dromara.sms4j.huawei.utils.HuaweiBuilder.listToString;
|
||||
@ -94,10 +95,8 @@ public class HuaweiSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,10 +108,8 @@ public class HuaweiSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -17,6 +17,7 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -87,10 +88,8 @@ public class JdCloudSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,10 +101,8 @@ public class JdCloudSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* 厂商模块
|
||||
* @author :Wind
|
||||
*/
|
||||
package org.dromara.sms4j;
|
||||
@ -16,6 +16,7 @@ import org.dromara.sms4j.tencent.config.TencentConfig;
|
||||
import org.dromara.sms4j.tencent.utils.TencentUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
@Slf4j
|
||||
@ -119,10 +120,8 @@ public class TencentSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -136,10 +135,8 @@ public class TencentSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1,7 +1,7 @@
|
||||
package org.dromara.sms4j.unisms.config;
|
||||
|
||||
import com.apistd.uni.Uni;
|
||||
import org.dromara.sms4j.comm.factory.BeanFactory;
|
||||
import org.dromara.sms4j.unisms.core.Uni;
|
||||
import org.dromara.sms4j.unisms.service.UniSmsImpl;
|
||||
|
||||
/**
|
||||
@ -0,0 +1,93 @@
|
||||
package org.dromara.sms4j.unisms.core;
|
||||
|
||||
|
||||
/**
|
||||
* 初始化统一环境的单例类.
|
||||
*/
|
||||
public class Uni {
|
||||
/** 模仿SDK版本*/
|
||||
public static final String VERSION = "0.0.4";
|
||||
|
||||
public static String signingAlgorithm = "hmac-sha256";
|
||||
public static String endpoint = System.getenv().getOrDefault("UNI_ENDPOINT", "https://uni.apistd.com");
|
||||
public static String accessKeyId = System.getenv("UNI_ACCESS_KEY_ID");
|
||||
|
||||
private static String accessKeySecret = System.getenv("UNI_ACCESS_KEY_SECRET");
|
||||
private static volatile UniClient client;
|
||||
|
||||
private Uni() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化Uni环境(简单验证模式).
|
||||
*
|
||||
* @param accessKeyId access key ID
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void init(final String accessKeyId) {
|
||||
Uni.setAccessKeyId(accessKeyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化Uni环境(HMAC验证模式).
|
||||
*
|
||||
* @param accessKeyId access key ID
|
||||
* @param accessKeySecret access key secret
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void init(final String accessKeyId, final String accessKeySecret) {
|
||||
Uni.setAccessKeyId(accessKeyId);
|
||||
Uni.setAccessKeySecret(accessKeySecret);
|
||||
}
|
||||
|
||||
|
||||
public static void setAccessKeyId(final String accessKeyId) {
|
||||
Uni.accessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
|
||||
public static void setAccessKeySecret(final String accessKeySecret) {
|
||||
Uni.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
|
||||
public static void setEndpoint(final String endpoint) {
|
||||
Uni.endpoint = endpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回(如果未初始化则初始化)统一客户端.
|
||||
*
|
||||
* @return the Uni Client
|
||||
* @author :Wind
|
||||
*/
|
||||
public static UniClient getClient() {
|
||||
if (Uni.client == null) {
|
||||
synchronized (Uni.class) {
|
||||
if (Uni.client == null) {
|
||||
Uni.client = buildClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Uni.client;
|
||||
}
|
||||
|
||||
public static void setClient(final UniClient client) {
|
||||
synchronized (Uni.class) {
|
||||
Uni.client = client;
|
||||
}
|
||||
}
|
||||
|
||||
private static UniClient buildClient() {
|
||||
UniClient.Builder builder = new UniClient.Builder(Uni.accessKeyId);
|
||||
|
||||
if (Uni.accessKeySecret != null) {
|
||||
builder.accessKeySecret(Uni.accessKeySecret);
|
||||
}
|
||||
|
||||
builder.endpoint(Uni.endpoint);
|
||||
builder.signingAlgorithm(Uni.signingAlgorithm);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package org.dromara.sms4j.unisms.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dtflys.forest.config.ForestConfiguration;
|
||||
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||
import org.dromara.sms4j.comm.factory.BeanFactory;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.util.Base64;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UniClient {
|
||||
|
||||
public static final String USER_AGENT = "uni-java-sdk" + "/" + Uni.VERSION;
|
||||
private final ForestConfiguration http = BeanFactory.getForestConfiguration();
|
||||
|
||||
private final String accessKeyId;
|
||||
private final String accessKeySecret;
|
||||
private final String endpoint;
|
||||
private final String signingAlgorithm;
|
||||
|
||||
protected UniClient(Builder b) {
|
||||
this.accessKeyId = b.accessKeyId;
|
||||
this.accessKeySecret = b.accessKeySecret;
|
||||
this.endpoint = b.endpoint;
|
||||
this.signingAlgorithm = b.signingAlgorithm;
|
||||
}
|
||||
|
||||
private static String getSignature(final String message, final String secretKey) {
|
||||
try {
|
||||
Mac hmac = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
|
||||
hmac.init(secretKeySpec);
|
||||
|
||||
byte[] bytes = hmac.doFinal(message.getBytes());
|
||||
return Base64.getEncoder().encodeToString(bytes);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String queryStringify(final Map<String, Object> params) {
|
||||
Map<String, Object> sortedMap = new TreeMap<>(new MapKeyComparator());
|
||||
sortedMap.putAll(params);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Iterator<?> iter = sortedMap.entrySet().iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append('&');
|
||||
}
|
||||
Entry<?, ?> entry = (Entry<?, ?>) iter.next();
|
||||
sb.append(entry.getKey()).append("=").append(entry.getValue());
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Map<String, Object> sign(final Map<String, Object> query) {
|
||||
if (this.accessKeySecret != null) {
|
||||
query.put("algorithm", this.signingAlgorithm);
|
||||
query.put("timestamp", new Date().getTime());
|
||||
query.put("nonce", UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
|
||||
String strToSign = UniClient.queryStringify(query);
|
||||
query.put("signature", UniClient.getSignature(strToSign, this.accessKeySecret));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* request
|
||||
* <p>向 uni-sms发送请求
|
||||
* @param action 接口名称
|
||||
* @author :Wind
|
||||
*/
|
||||
public UniResponse request(final String action, final Map<String, Object> data) throws SmsBlendException {
|
||||
Map<String, Object> query = new HashMap<String, Object>();
|
||||
query.put("action", action);
|
||||
query.put("accessKeyId", this.accessKeyId);
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", USER_AGENT);
|
||||
headers.put("Content-Type", "application/json;charset=utf-8");
|
||||
headers.put("Accept", "application/json");
|
||||
return new UniResponse(
|
||||
JSONObject.parseObject(
|
||||
http.post(this.endpoint)
|
||||
.addHeader(headers)
|
||||
.addQuery(this.sign(query))
|
||||
.addBody(JSONObject.toJSONString(data))
|
||||
.successWhen(((req, res) -> {
|
||||
return res.noException() && // 请求过程没有异常
|
||||
res.statusIsNot(500); // 不能是 500
|
||||
}))
|
||||
.onError((ex, req, res) -> {
|
||||
throw new SmsBlendException(ex.getMessage());
|
||||
})
|
||||
.executeAsString()
|
||||
));
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String endpoint;
|
||||
private String signingAlgorithm;
|
||||
|
||||
public Builder(final String accessKeyId) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
public Builder(final String accessKeyId, final String accessKeySecret) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
public Builder accessKeySecret(final String accessKeySecret) {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder endpoint(final String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder signingAlgorithm(final String signingAlgorithm) {
|
||||
this.signingAlgorithm = signingAlgorithm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UniClient build() {
|
||||
return new UniClient(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MapKeyComparator implements Comparator<String> {
|
||||
@Override
|
||||
public int compare(String str1, String str2) {
|
||||
return str1.compareTo(str2);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package org.dromara.sms4j.unisms.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||
|
||||
|
||||
public class UniResponse {
|
||||
public static final String REQUEST_ID_HEADER_KEY = "x-uni-request-id";
|
||||
public String requestId;
|
||||
public String code;
|
||||
public String message;
|
||||
public String status;
|
||||
public JSONObject data = null;
|
||||
public Object raw;
|
||||
|
||||
/**
|
||||
* Create a new Uni Response.
|
||||
*
|
||||
* @param response raw HTTP response
|
||||
*/
|
||||
public UniResponse(final JSONObject response) throws SmsBlendException {
|
||||
JSONObject body = response.getJSONObject("data");
|
||||
this.status = body.getJSONArray("messages").getJSONObject(0).getString("status");
|
||||
this.requestId = body.getJSONArray("messages").getJSONObject(0).getString("id");
|
||||
this.raw = body;
|
||||
|
||||
if (this.status != "400") {
|
||||
String code = response.getString("code");
|
||||
String message = body.getJSONArray("messages").getString(0);
|
||||
if (!"0".equals(code)) {
|
||||
throw new SmsBlendException(message, code, this.requestId);
|
||||
}
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.data = body;
|
||||
}
|
||||
else {
|
||||
throw new SmsBlendException(response.getString("message"), "-1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UniResponse{" +
|
||||
"requestId='" + requestId + '\'' +
|
||||
", code='" + code + '\'' +
|
||||
", message='" + message + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", data=" + data +
|
||||
", raw=" + raw +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,22 +1,26 @@
|
||||
package org.dromara.sms4j.unisms.service;
|
||||
|
||||
import com.apistd.uni.UniResponse;
|
||||
import com.apistd.uni.sms.UniMessage;
|
||||
import com.apistd.uni.sms.UniSMS;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.callback.CallBack;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.comm.annotation.Restricted;
|
||||
import org.dromara.sms4j.comm.delayedTime.DelayedTime;
|
||||
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||
import org.dromara.sms4j.comm.utils.http.HttpJsonTool;
|
||||
import org.dromara.sms4j.unisms.config.UniConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.unisms.core.Uni;
|
||||
import org.dromara.sms4j.unisms.core.UniResponse;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
/**
|
||||
@ -53,10 +57,12 @@ public class UniSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public SmsResponse sendMessage(String phone, String templateId, LinkedHashMap<String, String> messages) {
|
||||
UniMessage uniMes = UniSMS.buildMessage().setSignature(config.getSignature()).setTo(phone)
|
||||
.setTemplateId(templateId)
|
||||
.setTemplateData(messages);
|
||||
return getSmsResponse(uniMes);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("to", Collections.singletonList(phone));
|
||||
data.put("signature", config.getSignature());
|
||||
data.put("templateId", templateId);
|
||||
data.put("templateData", messages);
|
||||
return getSmsResponse(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,20 +82,19 @@ public class UniSmsImpl implements SmsBlend {
|
||||
if (phones.size()>1000){
|
||||
throw new SmsBlendException("单次发送超过最大发送上限,建议每次群发短信人数低于1000");
|
||||
}
|
||||
String[] s = new String[phones.size()];
|
||||
UniMessage uniMes = UniSMS.buildMessage().setSignature(config.getSignature()).setTo(phones.toArray(s))
|
||||
.setTemplateId(templateId)
|
||||
.setTemplateData(messages);
|
||||
return getSmsResponse(uniMes);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("to", phones);
|
||||
data.put("signature", config.getSignature());
|
||||
data.put("templateId", templateId);
|
||||
data.put("templateData", messages);
|
||||
return getSmsResponse(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(()->{
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -102,10 +107,8 @@ public class UniSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -157,10 +160,10 @@ public class UniSmsImpl implements SmsBlend {
|
||||
},delayedTime);
|
||||
}
|
||||
|
||||
private SmsResponse getSmsResponse(UniMessage uniMes) {
|
||||
private SmsResponse getSmsResponse( Map<String, Object> data) {
|
||||
SmsResponse smsResponse = new SmsResponse();
|
||||
try {
|
||||
UniResponse send = uniMes.send();
|
||||
UniResponse send = Uni.getClient().request("sms.message.send", data);
|
||||
smsResponse.setCode(String.valueOf(send.status));
|
||||
smsResponse.setErrorCode(send.code);
|
||||
smsResponse.setMessage(send.message);
|
||||
@ -12,6 +12,7 @@ import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||
import org.dromara.sms4j.yunpian.config.YunpianConfig;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@ -74,10 +75,8 @@ public class YunPianSmsImpl implements SmsBlend {
|
||||
@Override
|
||||
@Restricted
|
||||
public void sendMessageAsync(String phone, String message, CallBack callBack) {
|
||||
pool.execute(() -> {
|
||||
SmsResponse smsResponse = sendMessage(phone, message);
|
||||
callBack.callBack(smsResponse);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, message), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,10 +88,8 @@ public class YunPianSmsImpl implements SmsBlend {
|
||||
@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);
|
||||
});
|
||||
CompletableFuture<SmsResponse> smsResponseCompletableFuture = CompletableFuture.supplyAsync(() -> sendMessage(phone, templateId, messages), pool);
|
||||
smsResponseCompletableFuture.thenAcceptAsync(callBack::callBack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1,41 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-spring-boot-starter</name>
|
||||
<description>sms4j-spring-boot-starter</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>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-autoimmit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build />
|
||||
</project>
|
||||
@ -10,13 +10,10 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<name>sms4j-spring-boot-starter</name>
|
||||
<description>sms4j-spring-boot-starter</description>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
<name>sms4j-spring-boot-starter</name>
|
||||
<description>sms4j-spring-boot-starter</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -36,10 +33,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package org.dromara.sms4j.test;
|
||||
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.comm.enumerate.SupplierType;
|
||||
import org.dromara.sms4j.core.config.SupplierFactory;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.sms4j.unisms.config.UniConfig;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
public class Sms4jTest {
|
||||
public static final String USER_AGENT = "uni-java-sdk" + "/0.0.4" ;
|
||||
|
||||
@Test
|
||||
public void uniSmsTest() {
|
||||
UniConfig build = UniConfig.builder()
|
||||
.signature("洙旭阁")
|
||||
.accessKeyId("7Cr1ZaQVJQ11Ap4HBQMo7xmFg")
|
||||
.templateId("2001")
|
||||
.templateName("message")
|
||||
.isSimple(true)
|
||||
.build();
|
||||
SupplierFactory.setUniConfig(build);
|
||||
|
||||
SmsResponse smsResponse = SmsFactory.createSmsBlend(SupplierType.UNI_SMS).sendMessage("17531165952", "123123");
|
||||
System.out.println(smsResponse);
|
||||
// UniResponse sms = UniSMS.buildMessage().setTo("17531165952").setSignature("洙旭阁").setTemplateId("2001").setTemplateData(map).send();
|
||||
// System.out.println(sms);
|
||||
// Uni.getClient().request("sms.message.send",mes)
|
||||
// UniClient.request()
|
||||
}
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-tencent</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-tencent</name>
|
||||
<description>sms4j-tencent</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,38 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-tencent</artifactId>
|
||||
<name>sms4j-tencent</name>
|
||||
<description>sms4j-tencent</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-unisms</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-unisms</name>
|
||||
<description>sms4j-unisms</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.apistd.uni</groupId>
|
||||
<artifactId>uni-sdk</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,41 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-unisms</artifactId>
|
||||
<name>sms4j-unisms</name>
|
||||
<description>sms4j-unisms</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.apistd.uni</groupId>
|
||||
<artifactId>uni-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-yunpian</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<name>sms4j-yunpian</name>
|
||||
<description>sms4j-yunpian</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>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,30 +0,0 @@
|
||||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>sms4j-yunpian</artifactId>
|
||||
<name>sms4j-yunpian</name>
|
||||
<description>sms4j-yunpian</description>
|
||||
<version>${revision}</version>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-comm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1 +0,0 @@
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user