瀏覽代碼

修复 pom依赖问题

18339543638 2 年之前
父節點
當前提交
cc86b9a216
共有 34 個文件被更改,包括 299 次插入166 次删除
  1. 9 10
      pom.xml
  2. 51 47
      tr-dependencies/pom.xml
  3. 2 2
      tr-framework/pom.xml
  4. 2 0
      tr-framework/src/main/java/cn/tr/core/pojo/CommonResult.java
  5. 1 1
      tr-modules/pom.xml
  6. 2 2
      tr-plugins/pom.xml
  7. 3 3
      tr-plugins/tr-spring-boot-starter-plugin-banner/pom.xml
  8. 5 2
      tr-plugins/tr-spring-boot-starter-plugin-biz-data-permission/pom.xml
  9. 3 2
      tr-plugins/tr-spring-boot-starter-plugin-biz-excel/pom.xml
  10. 1 1
      tr-plugins/tr-spring-boot-starter-plugin-biz-excel/src/test/java/cn/tr/plugin/excel/ExcelTest.java
  11. 4 1
      tr-plugins/tr-spring-boot-starter-plugin-biz-tenant/pom.xml
  12. 4 1
      tr-plugins/tr-spring-boot-starter-plugin-cache/pom.xml
  13. 4 1
      tr-plugins/tr-spring-boot-starter-plugin-dict/pom.xml
  14. 9 1
      tr-plugins/tr-spring-boot-starter-plugin-eventbus/pom.xml
  15. 44 0
      tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/main/java/cn/tr/plugin/eventbus/redisson/RedissonEventBus.java
  16. 22 0
      tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/main/resources/application-unit-test
  17. 3 2
      tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/test/java/cn/tr/plugin/eventbus/EventBusTest.java
  18. 36 0
      tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/test/java/cn/tr/plugin/eventbus/RedissonEventBusTest.java
  19. 3 2
      tr-plugins/tr-spring-boot-starter-plugin-file/pom.xml
  20. 0 1
      tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/minio/MinIoFileClient.java
  21. 7 1
      tr-plugins/tr-spring-boot-starter-plugin-file/src/test/java/cn/tr/plugin/file/config/FileClientTest.java
  22. 4 2
      tr-plugins/tr-spring-boot-starter-plugin-mybatis/pom.xml
  23. 3 1
      tr-plugins/tr-spring-boot-starter-plugin-satoken/pom.xml
  24. 3 1
      tr-plugins/tr-spring-boot-starter-plugin-sms/pom.xml
  25. 2 1
      tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/config/SmsClient.java
  26. 0 68
      tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/config/SmsCommonResult.java
  27. 0 1
      tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/config/ali/AliSmsClient.java
  28. 55 0
      tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/enums/SmsErrorCode.java
  29. 8 6
      tr-plugins/tr-spring-boot-starter-plugin-test/pom.xml
  30. 2 2
      tr-plugins/tr-spring-boot-starter-plugin-test/src/main/java/cn/tr/plugin/test/ut/BaseRedisUnitTest.java
  31. 0 0
      tr-plugins/tr-spring-boot-starter-plugin-test/src/main/resources/application-unit-test.yml
  32. 3 2
      tr-plugins/tr-spring-boot-starter-plugin-web/pom.xml
  33. 3 1
      tr-plugins/tr-spring-boot-starter-plugin-websocket/pom.xml
  34. 1 1
      tr-test/pom.xml

+ 9 - 10
pom.xml

@@ -6,11 +6,10 @@
 
     <groupId>cn.tr</groupId>
     <artifactId>tr-footstone</artifactId>
-
     <version>${revision}</version>
-
     <packaging>pom</packaging>
     <description>驼人通用型管理框架</description>
+
     <modules>
         <module>tr-plugins</module>
         <module>tr-framework</module>
@@ -90,13 +89,13 @@
     </build>
 
 
-    <!--&lt;!&ndash; 使用 aliyun 的 Maven 源,提升下载速度 &ndash;&gt;-->
-    <!--<repositories>-->
-        <!--<repository>-->
-            <!--<id>aliyunmaven</id>-->
-            <!--<name>aliyun</name>-->
-            <!--<url>https://maven.aliyun.com/repository/public</url>-->
-        <!--</repository>-->
-    <!--</repositories>-->
+    <!-- 使用 aliyun 的 Maven 源,提升下载速度 -->
+    <repositories>
+        <repository>
+            <id>aliyunmaven</id>
+            <name>aliyun</name>
+            <url>https://maven.aliyun.com/repository/public</url>
+        </repository>
+    </repositories>
 
 </project>

+ 51 - 47
tr-dependencies/pom.xml

@@ -7,6 +7,7 @@
     <groupId>cn.tr</groupId>
     <artifactId>tr-dependencies</artifactId>
     <version>${revision}</version>
+    <packaging>pom</packaging>
     <modelVersion>4.0.0</modelVersion>
 
 
@@ -14,6 +15,7 @@
     <description>基础 bom 文件,管理整个项目的依赖版本</description>
 
     <properties>
+        <skip>true</skip>
         <revision>0.0.9</revision>
 
         <spring-boot.version>2.7.8</spring-boot.version>
@@ -51,39 +53,13 @@
 
     <dependencyManagement>
         <dependencies>
+            <!--springboot pom文件-->
             <dependency>
-                <groupId>cn.tr</groupId>
-                <artifactId>tr-spring-boot-starter-plugin-test</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>cn.tr</groupId>
-                <artifactId>tr-spring-boot-starter-plugin-mybatis</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
-            <!--缓存插件-->
-            <dependency>
-                <groupId>cn.tr</groupId>
-                <artifactId>tr-spring-boot-starter-plugin-cache</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
-
-            <!--文件插件-->
-            <dependency>
-                <groupId>cn.tr</groupId>
-                <artifactId>tr-spring-boot-starter-plugin-file</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
-
-            <!--字典插件-->
-            <dependency>
-                <groupId>cn.tr</groupId>
-                <artifactId>tr-spring-boot-starter-plugin-dict</artifactId>
-                <version>${revision}</version>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
             </dependency>
 
             <!--redis客户端-->
@@ -93,21 +69,6 @@
                 <version>${redisson.version}</version>
             </dependency>
 
-            <dependency>
-                <groupId>cn.tr</groupId>
-                <artifactId>tr-framework</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
-            <!--springboot pom文件-->
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring-boot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-
             <!-- Sa-Token 权限认证,在线文档:https://sa-token.cc -->
             <dependency>
                 <groupId>cn.dev33</groupId>
@@ -256,6 +217,49 @@
                 <artifactId>eventbus-java</artifactId>
                 <version>${eventbus.version}</version>
             </dependency>
+
+
+            <!--业务组件-->
+            <dependency>
+                <groupId>cn.tr</groupId>
+                <artifactId>tr-framework</artifactId>
+                <version>${revision}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>cn.tr</groupId>
+                <artifactId>tr-spring-boot-starter-plugin-test</artifactId>
+                <version>${revision}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>cn.tr</groupId>
+                <artifactId>tr-spring-boot-starter-plugin-mybatis</artifactId>
+                <version>${revision}</version>
+            </dependency>
+
+            <!--缓存插件-->
+            <dependency>
+                <groupId>cn.tr</groupId>
+                <artifactId>tr-spring-boot-starter-plugin-cache</artifactId>
+                <version>${revision}</version>
+            </dependency>
+
+
+            <!--文件插件-->
+            <dependency>
+                <groupId>cn.tr</groupId>
+                <artifactId>tr-spring-boot-starter-plugin-file</artifactId>
+                <version>${revision}</version>
+            </dependency>
+
+
+            <!--字典插件-->
+            <dependency>
+                <groupId>cn.tr</groupId>
+                <artifactId>tr-spring-boot-starter-plugin-dict</artifactId>
+                <version>${revision}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 </project>

+ 2 - 2
tr-framework/pom.xml

@@ -5,12 +5,12 @@
     <parent>
         <artifactId>tr-footstone</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-framework</artifactId>
-    <packaging>pom</packaging>
+    <packaging>jar</packaging>
     <version>${revision}</version>
 
     <description>系统内置的核心框架功能</description>

+ 2 - 0
tr-framework/src/main/java/cn/tr/core/pojo/CommonResult.java

@@ -6,6 +6,7 @@ import cn.tr.core.exception.ServiceException;
 import cn.tr.core.exception.TRExcCode;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
+import lombok.experimental.Accessors;
 import org.springframework.util.Assert;
 
 import java.io.Serializable;
@@ -17,6 +18,7 @@ import java.util.Objects;
  * @param <T> 数据泛型
  */
 @Data
+@Accessors(chain = true)
 public class CommonResult<T> implements Serializable {
 
     private static final long serialVersionUID = -2619760277112039632L;

+ 1 - 1
tr-modules/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>tr-footstone</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 

+ 2 - 2
tr-plugins/pom.xml

@@ -5,13 +5,13 @@
     <parent>
         <artifactId>tr-footstone</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-plugins</artifactId>
     <packaging>pom</packaging>
-    <version>${revision}</version>
+    <!--<version>${revision}</version>-->
 
     <description></description>
     <modules>

+ 3 - 3
tr-plugins/tr-spring-boot-starter-plugin-banner/pom.xml

@@ -5,12 +5,13 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-banner</artifactId>
-
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <description>打印banner</description>
     <dependencies>
@@ -18,7 +19,6 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter</artifactId>
-            <scope>provided</scope>
         </dependency>
 
         <dependency>

+ 5 - 2
tr-plugins/tr-spring-boot-starter-plugin-biz-data-permission/pom.xml

@@ -5,11 +5,14 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>tr-spring-boot-starter-plugin-biz-datasource-permission</artifactId>
+    <artifactId>tr-spring-boot-starter-plugin-biz-data-permission</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
 
 
     <description>数据权限</description>

+ 3 - 2
tr-plugins/tr-spring-boot-starter-plugin-biz-excel/pom.xml

@@ -5,12 +5,13 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-biz-excel</artifactId>
-
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <description>excel的导出</description>
 

+ 1 - 1
tr-plugins/tr-spring-boot-starter-plugin-biz-excel/src/test/java/cn/tr/plugin/excel/ExcelTest.java

@@ -65,7 +65,7 @@ public class ExcelTest extends BaseMockitoUnitTest {
         long currentTimeMillis = System.currentTimeMillis();
         ExcelHelper excelHelper = excelHelperFactory.create(User.class);
         FileOutputStream fileOutputStream = new FileOutputStream(file);
-        excelHelper.exportExcel(fileOutputStream,users,"测试","用户表单");
+        excelHelper.exportExcel(fileOutputStream,"111.xlsx",users,"测试","用户表单");
         System.out.println("耗时============"+(System.currentTimeMillis() - currentTimeMillis));
     }
 

+ 4 - 1
tr-plugins/tr-spring-boot-starter-plugin-biz-tenant/pom.xml

@@ -5,12 +5,15 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <description>多租户插件</description>
     <artifactId>tr-spring-boot-starter-plugin-biz-tenant</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
 
     <dependencies>
         <dependency>

+ 4 - 1
tr-plugins/tr-spring-boot-starter-plugin-cache/pom.xml

@@ -5,11 +5,14 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-cache</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
 
     <description>缓存</description>
 

+ 4 - 1
tr-plugins/tr-spring-boot-starter-plugin-dict/pom.xml

@@ -5,11 +5,14 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-dict</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
 
     <description>字典插件</description>
 

+ 9 - 1
tr-plugins/tr-spring-boot-starter-plugin-eventbus/pom.xml

@@ -5,11 +5,13 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-eventbus</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <description>消息总线</description>
 
@@ -19,6 +21,12 @@
             <artifactId>tr-framework</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson-spring-boot-starter</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>cn.tr</groupId>
             <artifactId>tr-spring-boot-starter-plugin-test</artifactId>

+ 44 - 0
tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/main/java/cn/tr/plugin/eventbus/redisson/RedissonEventBus.java

@@ -0,0 +1,44 @@
+package cn.tr.plugin.eventbus.redisson;
+
+import org.greenrobot.eventbus.EventBus;
+import org.redisson.api.RTopic;
+import org.redisson.api.RedissonClient;
+import org.redisson.api.listener.MessageListener;
+
+/**
+ * @ClassName : RedissonEventBus
+ * @Description : 通过redisson实现分布式消息总线
+ * @Author : LF
+ * @Date: 2023年03月16日
+ */
+
+public class RedissonEventBus extends EventBus {
+    /**
+     * redisson消息总线主题
+     */
+    public static final String EVENT_TOPIC="redissonEventBus";
+
+    private final RTopic topic;
+
+    private final EventBus eventBus;
+    public RedissonEventBus(RedissonClient redissonClient) {
+        topic = redissonClient.getTopic(EVENT_TOPIC);
+        eventBus=EventBus
+                .builder()
+                .logNoSubscriberMessages(false)
+                .sendNoSubscriberEvent(false)
+                .build();
+
+        topic.addListener(Object.class, new MessageListener<Object>() {
+            @Override
+            public void onMessage(CharSequence channel, Object o) {
+                eventBus.post(o);
+            }
+        });
+    }
+
+    @Override
+    public void post(Object event) {
+        topic.publish(event);
+    }
+}

+ 22 - 0
tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/main/resources/application-unit-test

@@ -0,0 +1,22 @@
+spring:
+  redis:
+    # 地址
+    host: 192.168.100.32
+    # 端口,默认为6379
+    port: 9736
+    # 数据库索引
+    database: 6
+    # 密码
+    password: 6E6985E1F7CB40F24A\.
+    # 连接超时时间
+    timeout: 30s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 16
+        # 连接池中的最大空闲连接
+        max-idle: 16
+        # 连接池的最大数据库连接数
+        max-active: 16
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: -1ms

+ 3 - 2
tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/test/java/cn/tr/plugin/eventbus/EventBusTest.java

@@ -1,10 +1,12 @@
 package cn.tr.plugin.eventbus;
 
 import cn.tr.plugin.test.ut.BaseMockitoUnitTest;
+import cn.tr.plugin.test.ut.BaseRedisUnitTest;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
+import org.redisson.api.RedissonClient;
 
 /**
  * @ClassName : EventBusTest
@@ -13,7 +15,7 @@ import org.junit.jupiter.api.Test;
  * @Date: 2023年03月15日
  */
 
-public class EventBusTest extends BaseMockitoUnitTest {
+public class EventBusTest extends BaseRedisUnitTest {
     private EventBus eventBus;
 
     @BeforeEach
@@ -27,7 +29,6 @@ public class EventBusTest extends BaseMockitoUnitTest {
         for (int i = 0; i < 100; i++) {
             eventBus.post(String.valueOf(i));
         }
-
     }
 
 

+ 36 - 0
tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/test/java/cn/tr/plugin/eventbus/RedissonEventBusTest.java

@@ -0,0 +1,36 @@
+package cn.tr.plugin.eventbus;
+
+import cn.tr.plugin.eventbus.redisson.RedissonEventBus;
+import cn.tr.plugin.test.ut.BaseRedisUnitTest;
+import org.greenrobot.eventbus.EventBus;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.redisson.api.RedissonClient;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @ClassName : RedissonEventBusTest
+ * @Description :
+ * @Author : LF
+ * @Date: 2023年03月16日
+ */
+
+public class RedissonEventBusTest extends BaseRedisUnitTest {
+    private EventBus eventBus;
+    @Autowired
+    private RedissonClient redissonClient;
+
+
+    @BeforeEach
+    public void init(){
+        eventBus=new RedissonEventBus(redissonClient);
+        eventBus.register(new EventBusTest.StringListener());
+    }
+
+    @Test
+    public void pub(){
+        for (int i = 0; i < 100; i++) {
+            eventBus.post(String.valueOf(i));
+        }
+    }
+}

+ 3 - 2
tr-plugins/tr-spring-boot-starter-plugin-file/pom.xml

@@ -5,12 +5,13 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-file</artifactId>
-
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <description>文件OSS插件</description>
 

+ 0 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/main/java/cn/tr/plugin/file/config/minio/MinIoFileClient.java

@@ -99,7 +99,6 @@ public class MinIoFileClient extends AbstractFileClient<MinIoFileClientConfig> {
         bizPath=parseBizPath(bizPath);
         return minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
                 .bucket(getConfig().getBucketName())
-                .expiry(999*365, TimeUnit.DAYS)
                 .method(Method.GET)
                 .object(bizPath)
                 .build());

+ 7 - 1
tr-plugins/tr-spring-boot-starter-plugin-file/src/test/java/cn/tr/plugin/file/config/FileClientTest.java

@@ -2,6 +2,8 @@ package cn.tr.plugin.file.config;
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.IoUtil;
+import cn.hutool.http.HttpResponse;
+import cn.hutool.http.HttpUtil;
 import cn.tr.core.utils.JsonUtils;
 import cn.tr.plugin.file.config.ali.AliFileClient;
 import cn.tr.plugin.file.config.ali.AliFileClientConfig;
@@ -39,7 +41,11 @@ public class FileClientTest extends BaseMockitoUnitTest {
 
     @BeforeEach
     public void setUp() throws FileNotFoundException {
-        content= IoUtil.readBytes(new FileInputStream(FileUtil.file("C:\\Users\\JR\\Desktop\\0d9768d743faf52558fa9451b853482.jpg")));
+        HttpResponse response =
+                HttpUtil.createGet("https://ts1.cn.mm.bing.net/th/id/R-C.466bb61cd7cf4e8b7d9cdf645add1d6e?rik=YRZKRLNWLutoZA&riu=http%3a%2f%2f222.186.12.239%3a10010%2fwmxs_161205%2f002.jpg&ehk=WEy01YhyfNzzQNe1oIqxwgbTnzY7dMfmZZHkqpZB5WI%3d&risl=&pid=ImgRaw&r=0")
+                .execute();
+        content=response.bodyBytes();
+//        content= IoUtil.readBytes(new FileInputStream(FileUtil.file("C:\\Users\\JR\\Desktop\\0d9768d743faf52558fa9451b853482.jpg")));
         fileClientFactory=new LocalFileClientFactory();
     }
 

+ 4 - 2
tr-plugins/tr-spring-boot-starter-plugin-mybatis/pom.xml

@@ -5,12 +5,14 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-mybatis</artifactId>
-    <version>0.0.9</version>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
+
 
     <description>mybatis-plus插件配置</description>
 

+ 3 - 1
tr-plugins/tr-spring-boot-starter-plugin-satoken/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
@@ -13,6 +13,8 @@
 
     <description>认证鉴权</description>
 
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <dependencies>
         <dependency>

+ 3 - 1
tr-plugins/tr-spring-boot-starter-plugin-sms/pom.xml

@@ -5,13 +5,15 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-sms</artifactId>
 
     <description>短信发送插件</description>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <dependencies>
         <dependency>

+ 2 - 1
tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/config/SmsClient.java

@@ -1,5 +1,6 @@
 package cn.tr.plugin.sms.config;
 
+import cn.tr.core.pojo.CommonResult;
 import cn.tr.plugin.sms.bo.SmsSendRespBO;
 
 /**
@@ -22,5 +23,5 @@ public interface SmsClient<SendConfig extends SmsClientSendConfig> {
      * @param sendConfig 发送配置
      * @return 短信发送结果
      */
-     SmsCommonResult<SmsSendRespBO> sendSms(SendConfig sendConfig);
+     CommonResult<SmsSendRespBO> sendSms(SendConfig sendConfig);
 }

+ 0 - 68
tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/config/SmsCommonResult.java

@@ -1,68 +0,0 @@
-package cn.tr.plugin.sms.config;
-
-import cn.hutool.core.exceptions.ExceptionUtil;
-import cn.hutool.core.lang.Assert;
-import cn.iocoder.yudao.framework.common.exception.ErrorCode;
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.sms.core.enums.SmsFrameworkErrorCodeConstants;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
-
-/**
- * 短信的 CommonResult 拓展类
- *
- * 考虑到不同的平台,返回的 code 和 msg 是不同的,所以统一额外返回 {@link #apiCode} 和 {@link #apiMsg} 字段
- *
- * 另外,一些短信平台(例如说阿里云、腾讯云)会返回一个请求编号,用于排查请求失败的问题,我们设置到 {@link #apiRequestId} 字段
- *
- * @author 芋道源码
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-public class SmsCommonResult<T> extends CommonResult<T> {
-
-    /**
-     * API 返回错误码
-     *
-     * 由于第三方的错误码可能是字符串,所以使用 String 类型
-     */
-    private String apiCode;
-    /**
-     * API 返回提示
-     */
-    private String apiMsg;
-
-    /**
-     * API 请求编号
-     */
-    private String apiRequestId;
-
-    private SmsCommonResult() {
-    }
-
-    public static <T> SmsCommonResult<T> build(String apiCode, String apiMsg, String apiRequestId,
-                                               T data, SmsCodeMapping codeMapping) {
-        Assert.notNull(codeMapping, "参数 codeMapping 不能为空");
-        SmsCommonResult<T> result = new SmsCommonResult<T>().setApiCode(apiCode).setApiMsg(apiMsg).setApiRequestId(apiRequestId);
-        result.setData(data);
-        // 翻译错误码
-        if (codeMapping != null) {
-            ErrorCode errorCode = codeMapping.apply(apiCode);
-            if (errorCode == null) {
-                errorCode = SmsFrameworkErrorCodeConstants.SMS_UNKNOWN;
-            }
-            result.setCode(errorCode.getCode()).setMsg(errorCode.getMsg());
-        }
-        return result;
-    }
-
-    public static <T> SmsCommonResult<T> error(Throwable ex) {
-        SmsCommonResult<T> result = new SmsCommonResult<>();
-        result.setCode(SmsFrameworkErrorCodeConstants.EXCEPTION.getCode());
-        result.setMsg(ExceptionUtil.getRootCauseMessage(ex));
-        return result;
-    }
-
-}

+ 0 - 1
tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/config/ali/AliSmsClient.java

@@ -2,7 +2,6 @@ package cn.tr.plugin.sms.config.ali;
 
 import cn.tr.plugin.sms.bo.SmsSendRespBO;
 import cn.tr.plugin.sms.config.AbstractSmsClient;
-import cn.tr.plugin.sms.config.SmsCommonResult;
 
 /**
  * @ClassName : AliSmsClient

+ 55 - 0
tr-plugins/tr-spring-boot-starter-plugin-sms/src/main/java/cn/tr/plugin/sms/enums/SmsErrorCode.java

@@ -0,0 +1,55 @@
+package cn.tr.plugin.sms.enums;
+
+import cn.tr.core.exception.BaseCode;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 短信框架的错误码枚举
+
+ *
+ * @author tr
+ */
+@AllArgsConstructor
+@Getter
+public enum  SmsErrorCode implements BaseCode {
+
+    SMS_UNKNOWN("S0001", "未知错误,需要解析"),
+    // ========== 权限 / 限流等相关 S2开头 ==========
+
+    SMS_PERMISSION_DENY("S2001", "没有发送短信的权限"),
+    SMS_IP_DENY("S2002", "IP 不允许发送短信"),
+
+    // 阿里云:将短信发送频率限制在正常的业务限流范围内。默认短信验证码:使用同一签名,对同一个手机号验证码,支持 1 条 / 分钟,5 条 / 小时,累计 10 条 / 天。
+    SMS_SEND_BUSINESS_LIMIT_CONTROL("S2003", "指定手机的发送限流"),
+    // 阿里云:已经达到您在控制台设置的短信日发送量限额值。在国内消息设置 > 安全设置,修改发送总量阈值。
+    SMS_SEND_DAY_LIMIT_CONTROL ("S2004", "每天的发送限流"),
+
+    SMS_SEND_CONTENT_INVALID ("S2005", "短信内容有敏感词"),
+
+    // 腾讯云:为避免骚扰用户,营销短信只允许在8点到22点发送。
+    SMS_SEND_MARKET_LIMIT_CONTROL("S2006", "营销短信发送时间限制"),
+
+    // ========== 模板相关 2001000200 ==========
+    SMS_TEMPLATE_INVALID ("S2007", "短信模板不合法"), // 包括短信模板不存在
+    SMS_TEMPLATE_PARAM_ERROR("S2008", "模板参数不正确"),
+
+    // ========== 签名相关 2001000300 ==========
+    SMS_SIGN_INVALID ("S2009", "短信签名不可用"),
+
+    // ========== 账户相关 2001000400 ==========
+    SMS_ACCOUNT_MONEY_NOT_ENOUGH ("S2010", "账户余额不足"),
+    SMS_ACCOUNT_INVALID("S2011", "apiKey 不存在"),
+
+    // ========== 其它相关 2001000900 开头 ==========
+    SMS_API_PARAM_ERROR ("S2012", "请求参数缺失"),
+    SMS_MOBILE_INVALID("S2013", "手机格式不正确"),
+    SMS_MOBILE_BLACK ("S2014", "手机号在黑名单中"),
+    SMS_APP_ID_INVALID("S2015", "SdkAppId不合法"),
+
+    EXCEPTION("S2016", "调用异常");;
+    @Getter
+    private String errCode;
+    @Getter
+    private String errMsg;
+}

+ 8 - 6
tr-plugins/tr-spring-boot-starter-plugin-test/pom.xml

@@ -5,13 +5,14 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-test</artifactId>
 
-
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <dependencies>
         <dependency>
@@ -30,10 +31,11 @@
             <artifactId>spring-boot-starter-test</artifactId>
         </dependency>
 
-        <!--<dependency>-->
-            <!--<groupId>org.redisson</groupId>-->
-            <!--<artifactId>redisson-spring-boot-starter</artifactId>-->
-        <!--</dependency>-->
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson-spring-boot-starter</artifactId>
+            <scope>provided</scope>
+        </dependency>
 
         <dependency>
             <groupId>uk.co.jemos.podam</groupId>

+ 2 - 2
tr-plugins/tr-spring-boot-starter-plugin-test/src/main/java/cn/tr/plugin/test/ut/BaseRedisUnitTest.java

@@ -1,8 +1,8 @@
 package cn.tr.plugin.test.ut;
 
 
+import org.redisson.spring.starter.RedissonAutoConfiguration;
 import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
-import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.Import;
 import org.springframework.test.context.ActiveProfiles;
@@ -23,7 +23,7 @@ public class BaseRedisUnitTest {
 //            RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer
             RedisAutoConfiguration.class, // Spring Redis 自动配置类
 //            YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类
-//            RedissonAutoConfiguration.class, // Redisson 自动高配置类
+            RedissonAutoConfiguration.class, // Redisson 自动高配置类
     })
     public static class Application {
     }

+ 0 - 0
tr-plugins/tr-spring-boot-starter-plugin-test/src/main/resources/application-unit-test.yml


+ 3 - 2
tr-plugins/tr-spring-boot-starter-plugin-web/pom.xml

@@ -5,12 +5,13 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-web</artifactId>
-    <version>0.0.9</version>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <description>web插件配置</description>
 

+ 3 - 1
tr-plugins/tr-spring-boot-starter-plugin-websocket/pom.xml

@@ -5,11 +5,13 @@
     <parent>
         <artifactId>tr-plugins</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>tr-spring-boot-starter-plugin-websocket</artifactId>
+    <version>${revision}</version>
+    <packaging>jar</packaging>
 
     <description>websocket插件</description>
 

+ 1 - 1
tr-test/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <artifactId>tr-footstone</artifactId>
         <groupId>cn.tr</groupId>
-        <version>0.0.9</version>
+        <version>${revision}</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>