commit
982c94ef6a
|
@ -1,8 +1,8 @@
|
||||||
package cc.iotkit.common.utils;
|
package cc.iotkit.common.utils;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Dict;
|
import cn.hutool.core.lang.Dict;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.PrimitiveArrayUtil;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
@ -61,7 +61,7 @@ public class JsonUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
|
public static <T> T parseObject(byte[] bytes, Class<T> clazz) {
|
||||||
if (ArrayUtil.isEmpty(bytes)) {
|
if (PrimitiveArrayUtil.isEmpty(bytes)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -4,10 +4,6 @@ import cn.hutool.core.io.FileUtil;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件处理工具类
|
* 文件处理工具类
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,9 +22,10 @@ public interface IOwnedData<T extends Owned<ID>, ID> extends ICommonData<T, ID>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按所属用户取数据
|
* 按所属用户取数据
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
default List<T> findByUid(String uid) {
|
default List findByUid(String uid) {
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.emptyList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>io.github.linpeilie</groupId>-->
|
|
||||||
<!-- <artifactId>mapstruct-plus</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.linpeilie</groupId>
|
<groupId>io.github.linpeilie</groupId>
|
||||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||||
|
@ -106,21 +101,21 @@
|
||||||
<source>${java.version}</source> <!-- depending on your project -->
|
<source>${java.version}</source> <!-- depending on your project -->
|
||||||
<target>${java.version}</target> <!-- depending on your project -->
|
<target>${java.version}</target> <!-- depending on your project -->
|
||||||
<annotationProcessorPaths>
|
<annotationProcessorPaths>
|
||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>${lombok.version}</version>
|
<version>${lombok.version}</version>
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<groupId>io.github.linpeilie</groupId>
|
<groupId>io.github.linpeilie</groupId>
|
||||||
<artifactId>mapstruct-plus-processor</artifactId>
|
<artifactId>mapstruct-plus-processor</artifactId>
|
||||||
<version>${mapstruct-plus.version}</version>
|
<version>${mapstruct-plus.version}</version>
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||||
<version>0.2.0</version>
|
<version>0.2.0</version>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- other annotation processors -->
|
<!-- other annotation processors -->
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package cc.iotkit.data.config;
|
package cc.iotkit.data.config;
|
||||||
|
|
||||||
import io.github.linpeilie.annotations.ComponentModelConfig;
|
|
||||||
import io.github.linpeilie.annotations.MapperConfig;
|
import io.github.linpeilie.annotations.MapperConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>io.github.linpeilie</groupId>-->
|
|
||||||
<!-- <artifactId>mapstruct-plus</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.linpeilie</groupId>
|
<groupId>io.github.linpeilie</groupId>
|
||||||
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
|
||||||
|
|
|
@ -35,9 +35,7 @@ public class VirtualDeviceLogDataImpl implements IVirtualDeviceLogData {
|
||||||
.findByVirtualDeviceId(virtualDeviceId,
|
.findByVirtualDeviceId(virtualDeviceId,
|
||||||
Pageable.ofSize(size).withPage(page - 1));
|
Pageable.ofSize(size).withPage(page - 1));
|
||||||
return new Paging<>(paged.getTotalElements(), paged.getContent().stream()
|
return new Paging<>(paged.getTotalElements(), paged.getContent().stream()
|
||||||
.map(o -> {
|
.map(o -> MapstructUtils.convert(o, VirtualDeviceLog.class))
|
||||||
return MapstructUtils.convert(o, VirtualDeviceLog.class);
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,6 @@
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.mapstruct</groupId>-->
|
|
||||||
<!-- <artifactId>mapstruct</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class VirtualDeviceLogDataImpl implements IVirtualDeviceLogData {
|
||||||
sql = "select count(*) from virtual_device_log_" + virtualDeviceId.toLowerCase();
|
sql = "select count(*) from virtual_device_log_" + virtualDeviceId.toLowerCase();
|
||||||
List<Long> counts = tdTemplate.queryForList(sql, Long.class);
|
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,
|
new VirtualDeviceLog(r.getTime().toString(), virtualDeviceId,
|
||||||
r.getVirtualDeviceName(),
|
r.getVirtualDeviceName(),
|
||||||
r.getDeviceTotal(), r.getResult(),
|
r.getDeviceTotal(), r.getResult(),
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
<module>iot-data-serviceImpl-rdb</module>
|
<module>iot-data-serviceImpl-rdb</module>
|
||||||
<module>iot-temporal-service</module>
|
<module>iot-temporal-service</module>
|
||||||
<module>iot-temporal-serviceImpl-es</module>
|
<module>iot-temporal-serviceImpl-es</module>
|
||||||
<!--<module>iot-temporal-serviceImpl-ts</module>-->
|
|
||||||
<module>iot-temproal-serviceImpl-td</module>
|
<module>iot-temproal-serviceImpl-td</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
@ -32,18 +31,6 @@
|
||||||
|
|
||||||
<dependencies>
|
<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>
|
</dependencies>
|
||||||
|
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package cc.iotkit.common.excel.core;
|
||||||
import cc.iotkit.common.utils.JsonUtils;
|
import cc.iotkit.common.utils.JsonUtils;
|
||||||
import cc.iotkit.common.utils.StreamUtils;
|
import cc.iotkit.common.utils.StreamUtils;
|
||||||
import cc.iotkit.common.utils.ValidatorUtils;
|
import cc.iotkit.common.utils.ValidatorUtils;
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.event.AnalysisEventListener;
|
import com.alibaba.excel.event.AnalysisEventListener;
|
||||||
|
@ -60,7 +61,7 @@ public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements
|
||||||
// 如果是某一个单元格的转换异常 能获取到具体行号
|
// 如果是某一个单元格的转换异常 能获取到具体行号
|
||||||
Integer rowIndex = excelDataConvertException.getRowIndex();
|
Integer rowIndex = excelDataConvertException.getRowIndex();
|
||||||
Integer columnIndex = excelDataConvertException.getColumnIndex();
|
Integer columnIndex = excelDataConvertException.getColumnIndex();
|
||||||
errMsg = StrUtil.format("第{}行-第{}列-表头{}: 解析异常<br/>",
|
errMsg = CharSequenceUtil.format("第{}行-第{}列-表头{}: 解析异常<br/>",
|
||||||
rowIndex + 1, columnIndex + 1, headMap.get(columnIndex));
|
rowIndex + 1, columnIndex + 1, headMap.get(columnIndex));
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.error(errMsg);
|
log.error(errMsg);
|
||||||
|
@ -70,7 +71,7 @@ public class DefaultExcelListener<T> extends AnalysisEventListener<T> implements
|
||||||
ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception;
|
ConstraintViolationException constraintViolationException = (ConstraintViolationException) exception;
|
||||||
Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations();
|
Set<ConstraintViolation<?>> constraintViolations = constraintViolationException.getConstraintViolations();
|
||||||
String constraintViolationsMsg = StreamUtils.join(constraintViolations, ConstraintViolation::getMessage, ", ");
|
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()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.error(errMsg);
|
log.error(errMsg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package cc.iotkit.common.excel.core;
|
package cc.iotkit.common.excel.core;
|
||||||
|
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ public class DefaultExcelResult<T> implements ExcelResult<T> {
|
||||||
return "读取失败,未解析到数据";
|
return "读取失败,未解析到数据";
|
||||||
} else {
|
} else {
|
||||||
if (errorCount == 0) {
|
if (errorCount == 0) {
|
||||||
return StrUtil.format("恭喜您,全部读取成功!共{}条", successCount);
|
return CharSequenceUtil.format("恭喜您,全部读取成功!共{}条", successCount);
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package cc.iotkit.common.web.utils;
|
||||||
import cc.iotkit.common.utils.StringUtils;
|
import cc.iotkit.common.utils.StringUtils;
|
||||||
import cn.hutool.captcha.generator.CodeGenerator;
|
import cn.hutool.captcha.generator.CodeGenerator;
|
||||||
import cn.hutool.core.math.Calculator;
|
import cn.hutool.core.math.Calculator;
|
||||||
import cn.hutool.core.util.CharUtil;
|
import cn.hutool.core.text.CharPool;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,8 +44,8 @@ public class UnsignedMathGenerator implements CodeGenerator {
|
||||||
int b = RandomUtil.randomInt(limit);
|
int b = RandomUtil.randomInt(limit);
|
||||||
String max = Integer.toString(Math.max(a,b));
|
String max = Integer.toString(Math.max(a,b));
|
||||||
String min = Integer.toString(Math.min(a,b));
|
String min = Integer.toString(Math.min(a,b));
|
||||||
max = StringUtils.rightPad(max, this.numberLength, CharUtil.SPACE);
|
max = StringUtils.rightPad(max, this.numberLength, CharPool.SPACE);
|
||||||
min = StringUtils.rightPad(min, this.numberLength, CharUtil.SPACE);
|
min = StringUtils.rightPad(min, this.numberLength, CharPool.SPACE);
|
||||||
|
|
||||||
return max + RandomUtil.randomChar(OPERATORS) + min + '=';
|
return max + RandomUtil.randomChar(OPERATORS) + min + '=';
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,7 @@ public class VertxMqConsumer<T> implements MqConsumer<T> {
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public VertxMqConsumer(Class<T> cls) {
|
public VertxMqConsumer(Class<T> cls) {
|
||||||
consumerVerticle = new MqConsumerVerticle<>(cls);
|
consumerVerticle = new MqConsumerVerticle<>(cls);
|
||||||
VertxManager.getVertx().deployVerticle(consumerVerticle, stringAsyncResult -> {
|
VertxManager.getVertx().deployVerticle(consumerVerticle, stringAsyncResult -> countDownLatch.countDown());
|
||||||
countDownLatch.countDown();
|
|
||||||
});
|
|
||||||
//等待初始化穿完成
|
//等待初始化穿完成
|
||||||
countDownLatch.await();
|
countDownLatch.await();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,7 @@ public class VertxMqProducer<T> implements MqProducer<T> {
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public VertxMqProducer(Class<T> cls) {
|
public VertxMqProducer(Class<T> cls) {
|
||||||
producerVerticle = new MqProducerVerticle<>(cls);
|
producerVerticle = new MqProducerVerticle<>(cls);
|
||||||
VertxManager.getVertx().deployVerticle(producerVerticle, new Handler<AsyncResult<String>>() {
|
VertxManager.getVertx().deployVerticle(producerVerticle, stringAsyncResult -> countDownLatch.countDown());
|
||||||
@Override
|
|
||||||
public void handle(AsyncResult<String> stringAsyncResult) {
|
|
||||||
countDownLatch.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//等待初始化完成
|
//等待初始化完成
|
||||||
countDownLatch.await();
|
countDownLatch.await();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue