diff --git a/iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/JsonUtils.java b/iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/JsonUtils.java index 4036ffda..03f1a1e7 100644 --- a/iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/JsonUtils.java +++ b/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 parseObject(byte[] bytes, Class clazz) { - if (ArrayUtil.isEmpty(bytes)) { + if (PrimitiveArrayUtil.isEmpty(bytes)) { return null; } try { diff --git a/iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/file/FileUtils.java b/iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/file/FileUtils.java index 8d4b4b60..025fb11b 100644 --- a/iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/file/FileUtils.java +++ b/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; - /** * 文件处理工具类 * diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java index a0680e6a..ed4be129 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java @@ -22,9 +22,10 @@ public interface IOwnedData, ID> extends ICommonData /** * 按所属用户取数据 + * @return */ - default List findByUid(String uid) { - return Collections.EMPTY_LIST; + default List findByUid(String uid) { + return Collections.emptyList(); } diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml index 123dcf65..a244b011 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml @@ -58,11 +58,6 @@ - - - - - io.github.linpeilie mapstruct-plus-spring-boot-starter @@ -106,21 +101,21 @@ ${java.version} ${java.version} - - org.projectlombok - lombok - ${lombok.version} - - - io.github.linpeilie - mapstruct-plus-processor - ${mapstruct-plus.version} - - - org.projectlombok - lombok-mapstruct-binding - 0.2.0 - + + org.projectlombok + lombok + ${lombok.version} + + + io.github.linpeilie + mapstruct-plus-processor + ${mapstruct-plus.version} + + + org.projectlombok + lombok-mapstruct-binding + 0.2.0 + diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/config/AutoMapperConfig3.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/config/AutoMapperConfig3.java index 7dafb1ae..2cd5706c 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/config/AutoMapperConfig3.java +++ b/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; /** diff --git a/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml b/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml index 54d2ad40..ea66d2e1 100644 --- a/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml +++ b/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml @@ -29,10 +29,6 @@ jackson-annotations - - - - io.github.linpeilie mapstruct-plus-spring-boot-starter diff --git a/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/VirtualDeviceLogDataImpl.java b/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/VirtualDeviceLogDataImpl.java index 10bc4bd2..5e9fd9e5 100644 --- a/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/VirtualDeviceLogDataImpl.java +++ b/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())); } diff --git a/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml b/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml index d9dc4e61..fe7c557c 100644 --- a/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml +++ b/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml @@ -44,10 +44,6 @@ jackson-annotations - - - - cn.hutool diff --git a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/VirtualDeviceLogDataImpl.java b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/VirtualDeviceLogDataImpl.java index 0022154a..2bc3db40 100644 --- a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/VirtualDeviceLogDataImpl.java +++ b/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 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(), diff --git a/iot-common/iot-common-dao/pom.xml b/iot-common/iot-common-dao/pom.xml index 76bb0946..1706c87c 100644 --- a/iot-common/iot-common-dao/pom.xml +++ b/iot-common/iot-common-dao/pom.xml @@ -22,7 +22,6 @@ iot-data-serviceImpl-rdb iot-temporal-service iot-temporal-serviceImpl-es - iot-temproal-serviceImpl-td @@ -32,18 +31,6 @@ - - - - - - - - - - - - diff --git a/iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelListener.java b/iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelListener.java index 224a49da..9e7381d0 100644 --- a/iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelListener.java +++ b/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 extends AnalysisEventListener implements // 如果是某一个单元格的转换异常 能获取到具体行号 Integer rowIndex = excelDataConvertException.getRowIndex(); Integer columnIndex = excelDataConvertException.getColumnIndex(); - errMsg = StrUtil.format("第{}行-第{}列-表头{}: 解析异常
", + errMsg = CharSequenceUtil.format("第{}行-第{}列-表头{}: 解析异常
", rowIndex + 1, columnIndex + 1, headMap.get(columnIndex)); if (log.isDebugEnabled()) { log.error(errMsg); @@ -70,7 +71,7 @@ public class DefaultExcelListener extends AnalysisEventListener implements ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception; Set> 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); } diff --git a/iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelResult.java b/iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelResult.java index de88ff29..2a6d5396 100644 --- a/iot-common/iot-common-excel/src/main/java/cc/iotkit/common/excel/core/DefaultExcelResult.java +++ b/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 implements ExcelResult { return "读取失败,未解析到数据"; } else { if (errorCount == 0) { - return StrUtil.format("恭喜您,全部读取成功!共{}条", successCount); + return CharSequenceUtil.format("恭喜您,全部读取成功!共{}条", successCount); } else { return ""; } diff --git a/iot-common/iot-common-web/src/main/java/cc/iotkit/common/web/utils/UnsignedMathGenerator.java b/iot-common/iot-common-web/src/main/java/cc/iotkit/common/web/utils/UnsignedMathGenerator.java index 94f8f4e5..abc810f2 100644 --- a/iot-common/iot-common-web/src/main/java/cc/iotkit/common/web/utils/UnsignedMathGenerator.java +++ b/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 + '='; } diff --git a/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java b/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java index 8dbd32a1..eea4a04e 100644 --- a/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java +++ b/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqConsumer.java @@ -30,9 +30,7 @@ public class VertxMqConsumer implements MqConsumer { @SneakyThrows public VertxMqConsumer(Class cls) { consumerVerticle = new MqConsumerVerticle<>(cls); - VertxManager.getVertx().deployVerticle(consumerVerticle, stringAsyncResult -> { - countDownLatch.countDown(); - }); + VertxManager.getVertx().deployVerticle(consumerVerticle, stringAsyncResult -> countDownLatch.countDown()); //等待初始化穿完成 countDownLatch.await(); } diff --git a/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java b/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java index c4813cdb..531ed616 100644 --- a/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java +++ b/iot-common/iot-message-bus/iot-message-event-bus/src/main/java/cc/iotkit/vertx/VertxMqProducer.java @@ -21,12 +21,7 @@ public class VertxMqProducer implements MqProducer { @SneakyThrows public VertxMqProducer(Class cls) { producerVerticle = new MqProducerVerticle<>(cls); - VertxManager.getVertx().deployVerticle(producerVerticle, new Handler>() { - @Override - public void handle(AsyncResult stringAsyncResult) { - countDownLatch.countDown(); - } - }); + VertxManager.getVertx().deployVerticle(producerVerticle, stringAsyncResult -> countDownLatch.countDown()); //等待初始化完成 countDownLatch.await(); } diff --git a/项目规范.md b/项目规范.md index c29bb689..12c70296 100644 --- a/项目规范.md +++ b/项目规范.md @@ -1,8 +1,7 @@ # **项目规范** ## **接口** -请求类型统一未POST,路径大致为模块归类/动作+资源,请求参数所有均封装下Request,超过一个参数必须 -封装成Bo对象 +请求类型统一为POST,路径大致为模块归类/动作+资源,请求参数所有均封装下Request,超过一个参数必须封装成Bo对象 ## **数据库**