Эх сурвалжийг харах

Merge remote-tracking branch 'origin/dev-V0.4.5' into dev-V0.4.5

tangfudong 1 жил өмнө
parent
commit
e034d249da
16 өөрчлөгдсөн 33 нэмэгдсэн , 71 устгасан
  1. 2 2
      iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/JsonUtils.java
  2. 0 4
      iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/file/FileUtils.java
  3. 3 2
      iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java
  4. 15 20
      iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml
  5. 0 1
      iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/config/AutoMapperConfig3.java
  6. 0 4
      iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml
  7. 1 3
      iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/VirtualDeviceLogDataImpl.java
  8. 0 4
      iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml
  9. 1 1
      iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/VirtualDeviceLogDataImpl.java
  10. 0 13
      iot-common/iot-common-dao/pom.xml
  11. 3 2
      iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelListener.java
  12. 2 1
      iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelResult.java
  13. 3 3
      iot-common/iot-common-web/src/main/java/cc/iotkit/common/web/utils/UnsignedMathGenerator.java
  14. 1 3
      iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java
  15. 1 6
      iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java
  16. 1 2
      项目规范.md

+ 2 - 2
iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/JsonUtils.java

@@ -1,8 +1,8 @@
 package cc.iotkit.common.utils;
 
 import cn.hutool.core.lang.Dict;
-import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.PrimitiveArrayUtil;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -61,7 +61,7 @@ public class JsonUtils {
     }
 
     public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
-        if (ArrayUtil.isEmpty(bytes)) {
+        if (PrimitiveArrayUtil.isEmpty(bytes)) {
             return null;
         }
         try {

+ 0 - 4
iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/file/FileUtils.java

@@ -4,10 +4,6 @@ import cn.hutool.core.io.FileUtil;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 
-
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-
 /**
  * 文件处理工具类
  *

+ 3 - 2
iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java

@@ -22,9 +22,10 @@ public interface IOwnedData<T extends Owned<ID>, ID> extends ICommonData<T, ID>
 
     /**
      * 按所属用户取数据
+     * @return
      */
-    default List<T> findByUid(String uid) {
-        return Collections.EMPTY_LIST;
+    default List findByUid(String uid) {
+        return Collections.emptyList();
 
     }
 

+ 15 - 20
iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml

@@ -58,11 +58,6 @@
         </dependency>
 
 
-<!--        <dependency>-->
-<!--            <groupId>io.github.linpeilie</groupId>-->
-<!--            <artifactId>mapstruct-plus</artifactId>-->
-<!--        </dependency>-->
-
         <dependency>
             <groupId>io.github.linpeilie</groupId>
             <artifactId>mapstruct-plus-spring-boot-starter</artifactId>
@@ -106,21 +101,21 @@
                     <source>${java.version}</source> <!-- depending on your project -->
                     <target>${java.version}</target> <!-- depending on your project -->
                     <annotationProcessorPaths>
-                       <path>
-                        <groupId>org.projectlombok</groupId>
-                        <artifactId>lombok</artifactId>
-                           <version>${lombok.version}</version>
-                    </path>
-                    <path>
-                        <groupId>io.github.linpeilie</groupId>
-                        <artifactId>mapstruct-plus-processor</artifactId>
-                        <version>${mapstruct-plus.version}</version>
-                    </path>
-                    <path>
-                        <groupId>org.projectlombok</groupId>
-                        <artifactId>lombok-mapstruct-binding</artifactId>
-                        <version>0.2.0</version>
-                    </path>
+                        <path>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                            <version>${lombok.version}</version>
+                        </path>
+                        <path>
+                            <groupId>io.github.linpeilie</groupId>
+                            <artifactId>mapstruct-plus-processor</artifactId>
+                            <version>${mapstruct-plus.version}</version>
+                        </path>
+                        <path>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok-mapstruct-binding</artifactId>
+                            <version>0.2.0</version>
+                        </path>
 
                         <!-- other annotation processors -->
                     </annotationProcessorPaths>

+ 0 - 1
iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/config/AutoMapperConfig3.java

@@ -1,6 +1,5 @@
 package cc.iotkit.data.config;
 
-import io.github.linpeilie.annotations.ComponentModelConfig;
 import io.github.linpeilie.annotations.MapperConfig;
 
 /**

+ 0 - 4
iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml

@@ -29,10 +29,6 @@
             <artifactId>jackson-annotations</artifactId>
         </dependency>
 
-<!--        <dependency>-->
-<!--            <groupId>io.github.linpeilie</groupId>-->
-<!--            <artifactId>mapstruct-plus</artifactId>-->
-<!--        </dependency>-->
         <dependency>
             <groupId>io.github.linpeilie</groupId>
             <artifactId>mapstruct-plus-spring-boot-starter</artifactId>

+ 1 - 3
iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/VirtualDeviceLogDataImpl.java

@@ -35,9 +35,7 @@ public class VirtualDeviceLogDataImpl implements IVirtualDeviceLogData {
                 .findByVirtualDeviceId(virtualDeviceId,
                         Pageable.ofSize(size).withPage(page - 1));
         return new Paging<>(paged.getTotalElements(), paged.getContent().stream()
-                .map(o -> {
-                    return MapstructUtils.convert(o, VirtualDeviceLog.class);
-                })
+                .map(o -> MapstructUtils.convert(o, VirtualDeviceLog.class))
                 .collect(Collectors.toList()));
     }
 

+ 0 - 4
iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml

@@ -44,10 +44,6 @@
             <artifactId>jackson-annotations</artifactId>
         </dependency>
 
-<!--        <dependency>-->
-<!--            <groupId>org.mapstruct</groupId>-->
-<!--            <artifactId>mapstruct</artifactId>-->
-<!--        </dependency>-->
 
         <dependency>
             <groupId>cn.hutool</groupId>

+ 1 - 1
iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/VirtualDeviceLogDataImpl.java

@@ -36,7 +36,7 @@ public class VirtualDeviceLogDataImpl implements IVirtualDeviceLogData {
         sql = "select count(*) from virtual_device_log_" + virtualDeviceId.toLowerCase();
         List<Long> counts = tdTemplate.queryForList(sql, Long.class);
 
-        return new Paging<>(counts.size() > 0 ? counts.get(0) : 0, logs.stream().map(r ->
+        return new Paging<>(!counts.isEmpty() ? counts.get(0) : 0, logs.stream().map(r ->
                 new VirtualDeviceLog(r.getTime().toString(), virtualDeviceId,
                         r.getVirtualDeviceName(),
                         r.getDeviceTotal(), r.getResult(),

+ 0 - 13
iot-common/iot-common-dao/pom.xml

@@ -22,7 +22,6 @@
         <module>iot-data-serviceImpl-rdb</module>
         <module>iot-temporal-service</module>
         <module>iot-temporal-serviceImpl-es</module>
-        <!--<module>iot-temporal-serviceImpl-ts</module>-->
         <module>iot-temproal-serviceImpl-td</module>
     </modules>
 
@@ -32,18 +31,6 @@
 
         <dependencies>
 
-<!--            <dependency>-->
-<!--                <groupId>org.mapstruct</groupId>-->
-<!--                <artifactId>mapstruct</artifactId>-->
-<!--                <version>1.4.2.Final</version>-->
-<!--            </dependency>-->
-
-<!--            <dependency>-->
-<!--                <groupId>org.mapstruct</groupId>-->
-<!--                <artifactId>mapstruct-processor</artifactId>-->
-<!--                <version>1.4.2.Final</version>-->
-<!--            </dependency>-->
-
         </dependencies>
 
     </dependencyManagement>

+ 3 - 2
iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelListener.java

@@ -3,6 +3,7 @@ package cc.iotkit.common.excel.core;
 import cc.iotkit.common.utils.JsonUtils;
 import cc.iotkit.common.utils.StreamUtils;
 import cc.iotkit.common.utils.ValidatorUtils;
+import cn.hutool.core.text.CharSequenceUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
@@ -60,7 +61,7 @@ public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements
             // 如果是某一个单元格的转换异常 能获取到具体行号
             Integer rowIndex = excelDataConvertException.getRowIndex();
             Integer columnIndex = excelDataConvertException.getColumnIndex();
-            errMsg = StrUtil.format("第{}行-第{}列-表头{}: 解析异常<br/>",
+            errMsg = CharSequenceUtil.format("第{}行-第{}列-表头{}: 解析异常<br/>",
                     rowIndex + 1, columnIndex + 1, headMap.get(columnIndex));
             if (log.isDebugEnabled()) {
                 log.error(errMsg);
@@ -70,7 +71,7 @@ public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements
             ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception;
             Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations();
             String constraintViolationsMsg = StreamUtils.join(constraintViolations, ConstraintViolation::getMessage, ", ");
-            errMsg = StrUtil.format("第{}行数据校验异常: {}", context.readRowHolder().getRowIndex() + 1, constraintViolationsMsg);
+            errMsg = CharSequenceUtil.format("第{}行数据校验异常: {}", context.readRowHolder().getRowIndex() + 1, constraintViolationsMsg);
             if (log.isDebugEnabled()) {
                 log.error(errMsg);
             }

+ 2 - 1
iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelResult.java

@@ -1,5 +1,6 @@
 package cc.iotkit.common.excel.core;
 
+import cn.hutool.core.text.CharSequenceUtil;
 import cn.hutool.core.util.StrUtil;
 import lombok.Setter;
 
@@ -64,7 +65,7 @@ public class DefaultExcelResult<T> implements ExcelResult<T> {
             return "读取失败,未解析到数据";
         } else {
             if (errorCount == 0) {
-                return StrUtil.format("恭喜您,全部读取成功!共{}条", successCount);
+                return CharSequenceUtil.format("恭喜您,全部读取成功!共{}条", successCount);
             } else {
                 return "";
             }

+ 3 - 3
iot-common/iot-common-web/src/main/java/cc/iotkit/common/web/utils/UnsignedMathGenerator.java

@@ -3,7 +3,7 @@ package cc.iotkit.common.web.utils;
 import cc.iotkit.common.utils.StringUtils;
 import cn.hutool.captcha.generator.CodeGenerator;
 import cn.hutool.core.math.Calculator;
-import cn.hutool.core.util.CharUtil;
+import cn.hutool.core.text.CharPool;
 import cn.hutool.core.util.RandomUtil;
 
 /**
@@ -44,8 +44,8 @@ public class UnsignedMathGenerator implements CodeGenerator {
         int b = RandomUtil.randomInt(limit);
         String max = Integer.toString(Math.max(a,b));
         String min = Integer.toString(Math.min(a,b));
-        max = StringUtils.rightPad(max, this.numberLength, CharUtil.SPACE);
-        min = StringUtils.rightPad(min, this.numberLength, CharUtil.SPACE);
+        max = StringUtils.rightPad(max, this.numberLength, CharPool.SPACE);
+        min = StringUtils.rightPad(min, this.numberLength, CharPool.SPACE);
 
         return max + RandomUtil.randomChar(OPERATORS) + min + '=';
     }

+ 1 - 3
iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java

@@ -30,9 +30,7 @@ public class VertxMqConsumer<T> implements MqConsumer<T> {
     @SneakyThrows
     public VertxMqConsumer(Class<T> cls) {
         consumerVerticle = new MqConsumerVerticle<>(cls);
-        VertxManager.getVertx().deployVerticle(consumerVerticle, stringAsyncResult -> {
-            countDownLatch.countDown();
-        });
+        VertxManager.getVertx().deployVerticle(consumerVerticle, stringAsyncResult -> countDownLatch.countDown());
         //等待初始化穿完成
         countDownLatch.await();
     }

+ 1 - 6
iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java

@@ -21,12 +21,7 @@ public class VertxMqProducer<T> implements MqProducer<T> {
     @SneakyThrows
     public VertxMqProducer(Class<T> cls) {
         producerVerticle = new MqProducerVerticle<>(cls);
-        VertxManager.getVertx().deployVerticle(producerVerticle, new Handler<AsyncResult<String>>() {
-            @Override
-            public void handle(AsyncResult<String> stringAsyncResult) {
-                countDownLatch.countDown();
-            }
-        });
+        VertxManager.getVertx().deployVerticle(producerVerticle, stringAsyncResult -> countDownLatch.countDown());
         //等待初始化完成
         countDownLatch.await();
     }

+ 1 - 2
项目规范.md

@@ -1,8 +1,7 @@
 # **项目规范**
 
 ## **接口**
-请求类型统一未POST,路径大致为模块归类/动作+资源,请求参数所有均封装下Request,超过一个参数必须
-封装成Bo对象
+请求类型统一为POST,路径大致为模块归类/动作+资源,请求参数所有均封装下Request,超过一个参数必须封装成Bo对象
 
 ## **数据库**