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

V0.5.x
regan 2023-07-08 17:07:02 +08:00
commit c7906551ae
125 changed files with 354 additions and 624 deletions

View File

@ -95,7 +95,8 @@ public enum ErrCode implements IEnum {
STATE_ERROR(00000000, "状态错误"), STATE_ERROR(00000000, "状态错误"),
RECORD_NOT_FOUND(00000000, "记录不存在"), RECORD_NOT_FOUND(00000000, "记录不存在"),
ADD_PLATFORM_USER_ERROR(00000000, "添加平台用户失败"), ADD_PLATFORM_USER_ERROR(00000000, "添加平台用户失败"),
UPLOAD_FILE_ERROR(00000000, "上传文件失败"); UPLOAD_FILE_ERROR(00000000, "上传文件失败"),
FILE_NAME_IS_NULL(00000000, "文件名为空,获取文件名失败");
private int code; private int code;

View File

@ -57,7 +57,7 @@ public class DLT645Component extends AbstractDeviceComponent {
deployedId = s; deployedId = s;
countDownLatch.countDown(); countDownLatch.countDown();
})); }));
future.onFailure((e) -> { future.onFailure(e -> {
countDownLatch.countDown(); countDownLatch.countDown();
log.error("start GLT645 component failed", e); log.error("start GLT645 component failed", e);
}); });
@ -68,6 +68,7 @@ public class DLT645Component extends AbstractDeviceComponent {
} }
} }
@Override
@SneakyThrows @SneakyThrows
public void stop() { public void stop() {
DLT645Verticle.stop(); DLT645Verticle.stop();

View File

@ -155,10 +155,10 @@ public class DLT645Verticle extends AbstractVerticle {
dataMap.put("mac",clientKey.split("_")[1]); dataMap.put("mac",clientKey.split("_")[1]);
executor.onReceive(dataMap, "offline", ""); executor.onReceive(dataMap, "offline", "");
} }
if(entityList.size()>0){ if (!entityList.isEmpty()) {
entityList.clear(); entityList.clear();
} }
if(!dinMap.isEmpty()){ if (!dinMap.isEmpty()) {
dinMap.clear(); dinMap.clear();
} }
clientMap.clear(); clientMap.clear();

View File

@ -4,6 +4,7 @@ import cc.iotkit.comp.DLT645.utils.ByteRef;
import cc.iotkit.comp.DLT645.utils.BytesRef; import cc.iotkit.comp.DLT645.utils.BytesRef;
import cc.iotkit.comp.DLT645.utils.ContainerUtils; import cc.iotkit.comp.DLT645.utils.ContainerUtils;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -79,10 +80,10 @@ public class DLT645Analysis {
// 检查:数据块的大小 // 检查:数据块的大小
int iDataSize = arrData.length; int iDataSize = arrData.length;
if (iDataSize > 255) { if (iDataSize > 255) {
return null; return new byte[0];
} }
if (arrAddr.length != 6) { if (arrAddr.length != 6) {
return null; return new byte[0];
} }
// 初始化数组大小 // 初始化数组大小
@ -268,7 +269,7 @@ public class DLT645Analysis {
BytesRef byAddr = new BytesRef(); BytesRef byAddr = new BytesRef();
BytesRef arrData = new BytesRef(); BytesRef arrData = new BytesRef();
if (!unPackCmd2Map(arrCmd, byAddr, byFun, arrData)) { if (!unPackCmd2Map(arrCmd, byAddr, byFun, arrData)) {
return null; return Collections.emptyMap();
} }
Map<String, Object> value = new HashMap<>(); Map<String, Object> value = new HashMap<>();

View File

@ -290,11 +290,11 @@ public class DLT645DataFormat {
// 拆解成个位数列表 // 拆解成个位数列表
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
Integer l = data[start + i] & 0x0f; int l = data[start + i] & 0x0f;
Integer h = (data[start + i] & 0xf0) >> 4; int h = (data[start + i] & 0xf0) >> 4;
list.add(l.toString()); list.add(Integer.toString(l));
list.add(h.toString()); list.add(Integer.toString(h));
} }
// 格式1 // 格式1
@ -310,12 +310,10 @@ public class DLT645DataFormat {
return result; return result;
} }
if (format.equals(FORMAT_hhmmss)) { if (format.equals(FORMAT_hhmmss)) {
String result = list.get(5) + list.get(4) + "点" + list.get(3) + list.get(2) + "分" + list.get(1) + list.get(0) + "秒"; return list.get(5) + list.get(4) + "点" + list.get(3) + list.get(2) + "分" + list.get(1) + list.get(0) + "秒";
return result;
} }
if (format.equals(FORMAT_mmmm)) { if (format.equals(FORMAT_mmmm)) {
String result = list.get(3) + list.get(2) + list.get(1) + list.get(0) + "分"; return list.get(3) + list.get(2) + list.get(1) + list.get(0) + "分";
return result;
} }
@ -325,12 +323,10 @@ public class DLT645DataFormat {
return result; return result;
} }
if (format.equals(FORMAT_DDhh)) { if (format.equals(FORMAT_DDhh)) {
String result = list.get(3) + list.get(2) + "号 " + list.get(1) + list.get(0) + "点"; return list.get(3) + list.get(2) + "号 " + list.get(1) + list.get(0) + "点";
return result;
} }
if (format.equals(FORMAT_hhmm)) { if (format.equals(FORMAT_hhmm)) {
String result = list.get(3) + list.get(2) + "点 " + list.get(1) + list.get(0) + "分"; return list.get(3) + list.get(2) + "点 " + list.get(1) + list.get(0) + "分";
return result;
} }

View File

@ -53,7 +53,7 @@ public class DLT645v1997CsvLoader {
@Data @Data
static public class JDecoderValueParam implements Serializable { public static class JDecoderValueParam implements Serializable {
private String di1h; private String di1h;
private String di1l; private String di1l;
private String di0h; private String di0h;

View File

@ -153,9 +153,9 @@ public class ContainerUtils {
return uid2deviceMap; return uid2deviceMap;
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
return null; return Collections.emptyMap();
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
return null; return Collections.emptyMap();
} }
} }
@ -171,15 +171,8 @@ public class ContainerUtils {
// 使用方法返回对应的数组 // 使用方法返回对应的数组
return ContainerUtils.buildMapByKey(objList, method); return ContainerUtils.buildMapByKey(objList, method);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | IllegalArgumentException |
return new HashMap<K, T>(); SecurityException e) {
} catch (SecurityException e) {
return new HashMap<K, T>();
} catch (IllegalAccessException e) {
return new HashMap<K, T>();
} catch (IllegalArgumentException e) {
return new HashMap<K, T>();
} catch (InvocationTargetException e) {
return new HashMap<K, T>(); return new HashMap<K, T>();
} }
} }
@ -194,10 +187,8 @@ public class ContainerUtils {
} }
return uid2deviceMap; return uid2deviceMap;
} catch (IllegalAccessException e) { } catch (IllegalAccessException | InvocationTargetException e) {
return null; return Collections.emptyMap();
} catch (InvocationTargetException e) {
return null;
} }
} }
@ -219,22 +210,13 @@ public class ContainerUtils {
Object keyObject = method.invoke(obj); Object keyObject = method.invoke(obj);
if (clazz.isInstance(keyObject)) { if (clazz.isInstance(keyObject)) {
K key = clazz.cast(keyObject); K key = clazz.cast(keyObject);
List<T> list = uid2deviceMap.computeIfAbsent(key, k -> new ArrayList<>());
List<T> list = uid2deviceMap.get(key);
if (list == null) {
list = new ArrayList<>();
uid2deviceMap.put(key, list);
}
list.add(obj); list.add(obj);
} }
} }
return uid2deviceMap; return uid2deviceMap;
} catch (IllegalAccessException e) { } catch (IllegalAccessException | InvocationTargetException e) {
return null; return Collections.emptyMap();
} catch (InvocationTargetException e) {
return null;
} }
} }
@ -285,16 +267,9 @@ public class ContainerUtils {
// 使用方法返回对应的数组 // 使用方法返回对应的数组
return ContainerUtils.buildMapByTypeAndFinalMethod(objList, clazz, method); return ContainerUtils.buildMapByTypeAndFinalMethod(objList, clazz, method);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException | InvocationTargetException | IllegalArgumentException | IllegalAccessException |
return new HashMap<K, List<T>>(); SecurityException e) {
} catch (SecurityException e) { return new HashMap<>();
return new HashMap<K, List<T>>();
} catch (IllegalAccessException e) {
return new HashMap<K, List<T>>();
} catch (IllegalArgumentException e) {
return new HashMap<K, List<T>>();
} catch (InvocationTargetException e) {
return new HashMap<K, List<T>>();
} }
} }
@ -360,11 +335,7 @@ public class ContainerUtils {
} }
return null; return null;
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
return null;
} catch (IllegalAccessException e) {
return null;
} catch (InvocationTargetException e) {
return null; return null;
} }
} }

View File

@ -12,7 +12,6 @@ package cc.iotkit.comp;
import cc.iotkit.comp.model.ReceiveResult; import cc.iotkit.comp.model.ReceiveResult;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Callable;
import java.util.function.Consumer; import java.util.function.Consumer;
public interface IMessageHandler { public interface IMessageHandler {

View File

@ -16,7 +16,6 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/** /**
* spring 便springbean * spring 便springbean
@ -65,8 +64,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
*/ */
public static <T> T getBean(Class<T> clz) throws BeansException public static <T> T getBean(Class<T> clz) throws BeansException
{ {
T result = (T) beanFactory.getBean(clz); return (T) beanFactory.getBean(clz);
return result;
} }
/** /**

View File

@ -10,9 +10,9 @@
package cc.iotkit.comps; package cc.iotkit.comps;
import cc.iotkit.common.utils.ComponentClassLoader;
import cc.iotkit.common.enums.ErrCode; import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.utils.ComponentClassLoader;
import cc.iotkit.comp.CompConfig; import cc.iotkit.comp.CompConfig;
import cc.iotkit.comp.IComponent; import cc.iotkit.comp.IComponent;
import cc.iotkit.comps.config.ComponentConfig; import cc.iotkit.comps.config.ComponentConfig;

View File

@ -10,10 +10,10 @@
package cc.iotkit.comps; package cc.iotkit.comps;
import cc.iotkit.common.utils.ComponentClassLoader;
import cc.iotkit.common.enums.ErrCode; import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.thing.ThingService; import cc.iotkit.common.thing.ThingService;
import cc.iotkit.common.utils.ComponentClassLoader;
import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.common.utils.JsonUtils;
import cc.iotkit.comp.CompConfig; import cc.iotkit.comp.CompConfig;
import cc.iotkit.comp.IComponent; import cc.iotkit.comp.IComponent;

View File

@ -14,11 +14,11 @@ import cc.iotkit.common.utils.UniqueIdUtil;
import cc.iotkit.comp.IDeviceComponent; import cc.iotkit.comp.IDeviceComponent;
import cc.iotkit.comp.IMessageHandler; import cc.iotkit.comp.IMessageHandler;
import cc.iotkit.comp.model.AuthInfo; import cc.iotkit.comp.model.AuthInfo;
import cc.iotkit.comp.model.DeviceState;
import cc.iotkit.comp.model.ReceiveResult; import cc.iotkit.comp.model.ReceiveResult;
import cc.iotkit.comp.model.RegisterInfo; import cc.iotkit.comp.model.RegisterInfo;
import cc.iotkit.converter.DeviceMessage;
import cc.iotkit.comp.model.DeviceState;
import cc.iotkit.comps.service.DeviceBehaviourService; import cc.iotkit.comps.service.DeviceBehaviourService;
import cc.iotkit.converter.DeviceMessage;
import cc.iotkit.converter.IConverter; import cc.iotkit.converter.IConverter;
import cc.iotkit.model.device.message.ThingModelMessage; import cc.iotkit.model.device.message.ThingModelMessage;
import cc.iotkit.script.IScriptEngine; import cc.iotkit.script.IScriptEngine;
@ -28,7 +28,10 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.Map; import java.util.Map;
import java.util.concurrent.*; import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer; import java.util.function.Consumer;
@Slf4j @Slf4j

View File

@ -14,7 +14,6 @@ import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.utils.DeviceUtil; import cc.iotkit.common.utils.DeviceUtil;
import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.common.utils.JsonUtils;
import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.common.utils.UniqueIdUtil; import cc.iotkit.common.utils.UniqueIdUtil;
import cc.iotkit.comp.model.DeviceState; import cc.iotkit.comp.model.DeviceState;
import cc.iotkit.comp.model.RegisterInfo; import cc.iotkit.comp.model.RegisterInfo;
@ -34,7 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
@Slf4j @Slf4j
@Service @Service

View File

@ -3,7 +3,6 @@ package cc.iotkit.comp.tcp.cilent;
import cc.iotkit.comp.IMessageHandler; import cc.iotkit.comp.IMessageHandler;
import cc.iotkit.comp.tcp.parser.PayloadParser; import cc.iotkit.comp.tcp.parser.PayloadParser;
import io.vertx.core.buffer.Buffer; import io.vertx.core.buffer.Buffer;
import io.vertx.core.net.NetClient;
import io.vertx.core.net.NetSocket; import io.vertx.core.net.NetSocket;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -100,10 +99,9 @@ public class VertxTcpClient {
.handlePayload() .handlePayload()
.onErrorContinue((err, res) -> { .onErrorContinue((err, res) -> {
log.error(err.getMessage(), err); log.error(err.getMessage(), err);
System.out.println(err.getMessage());
}) })
.subscribe(buffer -> { .subscribe(buffer -> {
System.out.println(buffer.toString()); log.info(buffer.toString());
receiveHandler.accept(buffer); receiveHandler.accept(buffer);
}); });
} }
@ -158,6 +156,7 @@ public class VertxTcpClient {
log.warn("close tcp client error", e); log.warn("close tcp client error", e);
} }
} }
/** /**
* *
*/ */

View File

@ -180,9 +180,7 @@ public class TcpServerVerticle extends AbstractVerticle {
client.setKeepAliveTimeoutMs(keepAliveTimeout); client.setKeepAliveTimeoutMs(keepAliveTimeout);
try { try {
// TCP异常和关闭处理 // TCP异常和关闭处理
socket.exceptionHandler(err -> { socket.exceptionHandler(err -> log.error("tcp server client [{}] error", socket.remoteAddress(), err)).closeHandler(nil -> {
log.error("tcp server client [{}] error", socket.remoteAddress(), err);
}).closeHandler((nil) -> {
log.debug("tcp server client [{}] closed", socket.remoteAddress()); log.debug("tcp server client [{}] closed", socket.remoteAddress());
client.shutdown(); client.shutdown();
}); });
@ -190,12 +188,10 @@ public class TcpServerVerticle extends AbstractVerticle {
client.setKeepAliveTimeoutMs(keepAliveTimeout); client.setKeepAliveTimeoutMs(keepAliveTimeout);
client.setRecordParser(parserSupplier.get()); client.setRecordParser(parserSupplier.get());
client.setSocket(socket); client.setSocket(socket);
client.onDisconnect(() -> { client.onDisconnect(() -> clientDisconnect(client.getDeviceName()));
clientDisconnect(client.getDeviceName());
});
// 设置收到消息处理 // 设置收到消息处理
client.setReceiveHandler(buffer -> { client.setReceiveHandler(buffer -> {
System.out.println(buffer.toString()); log.info(buffer.toString());
try { try {
executor.onReceive(null, "", buffer.toString(), executor.onReceive(null, "", buffer.toString(),
result -> { result -> {

View File

@ -19,7 +19,6 @@ import cc.iotkit.comp.AbstractDeviceComponent;
import cc.iotkit.comp.CompConfig; import cc.iotkit.comp.CompConfig;
import cc.iotkit.comp.IMessageHandler; import cc.iotkit.comp.IMessageHandler;
import cc.iotkit.comp.model.DeviceState; import cc.iotkit.comp.model.DeviceState;
import cc.iotkit.converter.DeviceMessage; import cc.iotkit.converter.DeviceMessage;
import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IDeviceInfoData;
import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.DeviceInfo;
@ -82,7 +81,7 @@ public class EmqxDeviceComponent extends AbstractDeviceComponent implements Runn
countDownLatch.countDown(); countDownLatch.countDown();
log.info("start emqx auth component success"); log.info("start emqx auth component success");
})); }));
future.onFailure((e) -> { future.onFailure(e -> {
countDownLatch.countDown(); countDownLatch.countDown();
log.error("start emqx auth component failed", e); log.error("start emqx auth component failed", e);
}); });

View File

@ -57,6 +57,7 @@ public class LuaScripter implements IScripter {
} }
} }
@Override
public ThingModelMessage decode(TransparentMsg msg) { public ThingModelMessage decode(TransparentMsg msg) {
try { try {
LuaTable table = new LuaTable(); LuaTable table = new LuaTable();
@ -76,6 +77,7 @@ public class LuaScripter implements IScripter {
return null; return null;
} }
@Override
public TransparentMsg encode(ThingService<?> service) { public TransparentMsg encode(ThingService<?> service) {
try { try {
LuaTable table = new LuaTable(); LuaTable table = new LuaTable();

View File

@ -13,7 +13,6 @@ package cc.iotkit.comp.emqx;
import cc.iotkit.common.enums.ErrCode; import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.thing.ThingService; import cc.iotkit.common.thing.ThingService;
import cc.iotkit.common.utils.SpringUtils; import cc.iotkit.common.utils.SpringUtils;
import cc.iotkit.converter.Device; import cc.iotkit.converter.Device;
import cc.iotkit.converter.DeviceMessage; import cc.iotkit.converter.DeviceMessage;

View File

@ -116,7 +116,7 @@ public class HttpBizComponent implements IComponent {
}); });
backendServer.requestHandler(backendRouter) backendServer.requestHandler(backendRouter)
.listen(httpConfig.getPort(), (http) -> { .listen(httpConfig.getPort(), http -> {
if (http.succeeded()) { if (http.succeeded()) {
log.info("http server create succeed,port:{}", httpConfig.getPort()); log.info("http server create succeed,port:{}", httpConfig.getPort());
} else { } else {

View File

@ -55,7 +55,7 @@ public class MqttVerticle extends AbstractVerticle {
} }
@Override @Override
public void start() throws Exception { public void start() {
MqttServerOptions options = new MqttServerOptions() MqttServerOptions options = new MqttServerOptions()
.setPort(config.getPort()); .setPort(config.getPort());
if (config.isSsl()) { if (config.isSsl()) {
@ -103,7 +103,7 @@ public class MqttVerticle extends AbstractVerticle {
endpoint.accept(false); endpoint.accept(false);
endpoint.closeHandler((v) -> { endpoint.closeHandler((v) -> {
log.warn("client connection closed,clientId:{}", clientId); log.warn("client connection closed,clientId:{}", clientId);
if (!mqttConnectPool.get(clientId)) { if (Boolean.FALSE.equals(mqttConnectPool.get(clientId))) {
return; return;
} }
executor.onReceive(new HashMap<>(), "disconnect", clientId, (r) -> { executor.onReceive(new HashMap<>(), "disconnect", clientId, (r) -> {
@ -213,8 +213,6 @@ public class MqttVerticle extends AbstractVerticle {
Future<Integer> result = endpoint.publish(topic, Buffer.buffer(msg), Future<Integer> result = endpoint.publish(topic, Buffer.buffer(msg),
MqttQoS.AT_LEAST_ONCE, false, false); MqttQoS.AT_LEAST_ONCE, false, false);
result.onFailure(e -> log.error("public topic failed", e)); result.onFailure(e -> log.error("public topic failed", e));
result.onSuccess(integer -> { result.onSuccess(integer -> log.info("publish success,topic:{},payload:{}", topic, msg));
log.info("publish success,topic:{},payload:{}", topic, msg);
});
} }
} }

View File

@ -13,7 +13,6 @@ package cc.iotkit.comp.mqtt;
import cc.iotkit.common.enums.ErrCode; import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.thing.ThingService; import cc.iotkit.common.thing.ThingService;
import cc.iotkit.common.utils.SpringUtils; import cc.iotkit.common.utils.SpringUtils;
import cc.iotkit.converter.Device; import cc.iotkit.converter.Device;
import cc.iotkit.converter.DeviceMessage; import cc.iotkit.converter.DeviceMessage;

View File

@ -22,6 +22,8 @@ import java.util.concurrent.ConcurrentHashMap;
@Slf4j @Slf4j
public class WebSocketClientVerticle extends AbstractDeviceVerticle { public class WebSocketClientVerticle extends AbstractDeviceVerticle {
public static final String DISCONNECT = "disconnect";
private HttpClient httpClient; private HttpClient httpClient;
private WebSocket webSocketClient; private WebSocket webSocketClient;
@ -40,6 +42,7 @@ public class WebSocketClientVerticle extends AbstractDeviceVerticle {
this.webSocketConfig = JsonUtils.parseObject(config, WebSocketClientConfig.class); this.webSocketConfig = JsonUtils.parseObject(config, WebSocketClientConfig.class);
} }
@Override
public void start() { public void start() {
WebSocketConnectOptions options = new WebSocketConnectOptions().setPort(webSocketConfig.getPort()) WebSocketConnectOptions options = new WebSocketConnectOptions().setPort(webSocketConfig.getPort())
.setHost(webSocketConfig.getIp()).setURI(webSocketConfig.getUrl()).setSsl(webSocketConfig.isSsl()); .setHost(webSocketConfig.getIp()).setURI(webSocketConfig.getUrl()).setSsl(webSocketConfig.isSsl());
@ -49,9 +52,9 @@ public class WebSocketClientVerticle extends AbstractDeviceVerticle {
log.info("webSocket client connect success!"); log.info("webSocket client connect success!");
ws.textMessageHandler(data -> { ws.textMessageHandler(data -> {
log.info("webSocket client receive msg:" + data); log.info("webSocket client receive msg:" + data);
executor.onReceive(new HashMap<>(), null, data, (ret) -> { executor.onReceive(new HashMap<>(), null, data, ret -> {
if (ret != null && ret.getData() instanceof RegisterInfo) { if (ret != null && ret.getData() instanceof RegisterInfo) {
executor.onReceive(null, "connected", data, (r) -> { executor.onReceive(null, "connected", data, r -> {
if (!devices.containsKey(getDeviceKey(r))) { if (!devices.containsKey(getDeviceKey(r))) {
devices.put(getDeviceKey(r), new Device(r.getDeviceName(), r.getProductKey())); devices.put(getDeviceKey(r), new Device(r.getDeviceName(), r.getProductKey()));
} }
@ -61,13 +64,13 @@ public class WebSocketClientVerticle extends AbstractDeviceVerticle {
}); });
ws.closeHandler(e -> { ws.closeHandler(e -> {
for (String deviceKey : devices.keySet()) { for (String deviceKey : devices.keySet()) {
executor.onReceive(null, "disconnect", deviceKey); executor.onReceive(null, DISCONNECT, deviceKey);
} }
log.warn("client connection closed!"); log.warn("client connection closed!");
}); });
ws.exceptionHandler(e -> { ws.exceptionHandler(e -> {
for (String deviceKey : devices.keySet()) { for (String deviceKey : devices.keySet()) {
executor.onReceive(null, "disconnect", deviceKey); executor.onReceive(null, DISCONNECT, deviceKey);
} }
log.error("webSocket client connect exception!"); log.error("webSocket client connect exception!");
}); });
@ -79,16 +82,15 @@ public class WebSocketClientVerticle extends AbstractDeviceVerticle {
executor.onReceive(new HashMap<>(), "ping", JsonUtils.toJsonString(webSocketConfig)); executor.onReceive(new HashMap<>(), "ping", JsonUtils.toJsonString(webSocketConfig));
}); });
} }
}).onFailure(e -> { }).onFailure(e -> log.info("webSocket client connect failed!"));
log.info("webSocket client connect failed!");
});
} }
@SneakyThrows @SneakyThrows
@Override
public void stop() { public void stop() {
vertx.cancelTimer(timerID); vertx.cancelTimer(timerID);
for (String deviceKey : devices.keySet()) { for (String deviceKey : devices.keySet()) {
executor.onReceive(null, "disconnect", deviceKey); executor.onReceive(null, DISCONNECT, deviceKey);
} }
httpClient.close(); httpClient.close();
} }

View File

@ -5,8 +5,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Map;
/** /**
* @author: regan * @author: regan
* @description: * @description:

View File

@ -5,8 +5,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Map;
/** /**
* @author: regan * @author: regan
* @description: * @description:

View File

@ -5,8 +5,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Map;
/** /**
* @author: regan * @author: regan
* @description: * @description:

View File

@ -1,27 +1,28 @@
package cc.iotkit.contribution.controller; package cc.iotkit.contribution.controller;
import java.util.List;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import cc.iotkit.common.log.annotation.Log;
import cc.iotkit.common.web.core.BaseController;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request; import cc.iotkit.common.api.Request;
import cc.iotkit.common.excel.utils.ExcelUtil;
import cc.iotkit.common.log.annotation.Log;
import cc.iotkit.common.log.enums.BusinessType;
import cc.iotkit.common.validate.AddGroup; import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup; import cc.iotkit.common.validate.EditGroup;
import cc.iotkit.common.log.enums.BusinessType; import cc.iotkit.common.web.core.BaseController;
import cc.iotkit.common.excel.utils.ExcelUtil;
import cc.iotkit.contribution.dto.vo.IotContributorVo;
import cc.iotkit.contribution.dto.bo.IotContributorBo; import cc.iotkit.contribution.dto.bo.IotContributorBo;
import cc.iotkit.contribution.dto.vo.IotContributorVo;
import cc.iotkit.contribution.service.IIotContributorService; import cc.iotkit.contribution.service.IIotContributorService;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**

View File

@ -1,8 +1,7 @@
package cc.iotkit.contribution.data; package cc.iotkit.contribution.data;
import cc.iotkit.data.ICommonData;
import cc.iotkit.contribution.model.IotContributor; import cc.iotkit.contribution.model.IotContributor;
import java.util.List; import cc.iotkit.data.ICommonData;
/** /**
* *

View File

@ -1,32 +1,25 @@
package cc.iotkit.contribution.data.impl; package cc.iotkit.contribution.data.impl;
import cc.iotkit.contribution.repository.IotContributorRepository;
import cc.iotkit.data.ICommonData;
import cc.iotkit.contribution.data.IIotContributorData;
import cc.iotkit.contribution.data.model.TbIotContributor;
import cc.iotkit.contribution.model.IotContributor;
import java.util.List;
import cc.iotkit.data.util.PageBuilder;
import com.google.common.collect.Lists;
import com.querydsl.core.QueryResults;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.Projections;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import cc.iotkit.data.util.PredicateBuilder;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.common.utils.StringUtils;
import java.util.Collection;
import java.util.Optional;
import cc.iotkit.common.utils.MapstructUtils; import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.contribution.data.IIotContributorData;
import cc.iotkit.contribution.data.model.TbIotContributor;
import cc.iotkit.contribution.model.IotContributor;
import cc.iotkit.contribution.repository.IotContributorRepository;
import cc.iotkit.data.util.PageBuilder;
import cc.iotkit.data.util.PredicateBuilder;
import com.google.common.collect.Lists;
import com.querydsl.core.types.Predicate;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import static cc.iotkit.contribution.data.model.QTbIotContributor.tbIotContributor; import static cc.iotkit.contribution.data.model.QTbIotContributor.tbIotContributor;
/** /**
@ -113,7 +106,6 @@ public class IotContributorDataImpl implements IIotContributorData {
@Override @Override
public IotContributor findById(Long id) { public IotContributor findById(Long id) {
TbIotContributor ret = jpaQueryFactory.select(tbIotContributor).from(tbIotContributor).where(tbIotContributor.id.eq(id)).fetchOne(); TbIotContributor ret = jpaQueryFactory.select(tbIotContributor).from(tbIotContributor).where(tbIotContributor.id.eq(id)).fetchOne();
IotContributor convert = MapstructUtils.convert(ret, IotContributor.class); return MapstructUtils.convert(ret, IotContributor.class);
return convert;
} }
} }

View File

@ -1,6 +1,7 @@
package cc.iotkit.contribution.data.model; package cc.iotkit.contribution.data.model;
import cc.iotkit.contribution.model.IotContributor; import cc.iotkit.contribution.model.IotContributor;
import cc.iotkit.data.model.BaseEntity;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,10 +14,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import cc.iotkit.data.model.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/** /**
* iot_contributor * iot_contributor

View File

@ -1,17 +1,14 @@
package cc.iotkit.contribution.dto.bo; package cc.iotkit.contribution.dto.bo;
import cc.iotkit.contribution.model.IotContributor;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request;
import cc.iotkit.common.validate.AddGroup; import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup; import cc.iotkit.common.validate.EditGroup;
import cc.iotkit.contribution.model.IotContributor;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/** /**
* iot_contributor * iot_contributor

View File

@ -1,15 +1,14 @@
package cc.iotkit.contribution.dto.vo; package cc.iotkit.contribution.dto.vo;
import cc.iotkit.common.excel.annotation.ExcelDictFormat;
import cc.iotkit.common.excel.convert.ExcelDictConvert;
import cc.iotkit.contribution.model.IotContributor; import cc.iotkit.contribution.model.IotContributor;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import cc.iotkit.common.excel.annotation.ExcelDictFormat;
import cc.iotkit.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;

View File

@ -1,7 +1,7 @@
package cc.iotkit.contribution.model; package cc.iotkit.contribution.model;
import cc.iotkit.model.Id;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,10 +1,9 @@
package cc.iotkit.contribution.service; package cc.iotkit.contribution.service;
import cc.iotkit.contribution.dto.vo.IotContributorVo;
import cc.iotkit.contribution.dto.bo.IotContributorBo;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.contribution.dto.bo.IotContributorBo;
import cc.iotkit.contribution.dto.vo.IotContributorVo;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -1,22 +1,19 @@
package cc.iotkit.contribution.service.impl; package cc.iotkit.contribution.service.impl;
import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request; import cc.iotkit.common.exception.BizException;
import lombok.RequiredArgsConstructor; import cc.iotkit.common.utils.MapstructUtils;
import org.springframework.stereotype.Service; import cc.iotkit.contribution.data.IIotContributorData;
import cc.iotkit.contribution.dto.bo.IotContributorBo; import cc.iotkit.contribution.dto.bo.IotContributorBo;
import cc.iotkit.contribution.dto.vo.IotContributorVo; import cc.iotkit.contribution.dto.vo.IotContributorVo;
import cc.iotkit.contribution.model.IotContributor; import cc.iotkit.contribution.model.IotContributor;
import cc.iotkit.contribution.service.IIotContributorService; import cc.iotkit.contribution.service.IIotContributorService;
import cc.iotkit.contribution.data.IIotContributorData; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Collection; import java.util.Collection;
import cc.iotkit.common.exception.BizException; import java.util.List;
/** /**
@ -44,8 +41,7 @@ public class IotContributorServiceImpl implements IIotContributorService {
*/ */
@Override @Override
public Paging<IotContributorVo> queryPageList(PageRequest<IotContributorBo> pageQuery) { public Paging<IotContributorVo> queryPageList(PageRequest<IotContributorBo> pageQuery) {
Paging<IotContributorVo> result = baseData.findAll(pageQuery.to(IotContributor.class)).to(IotContributorVo.class); return baseData.findAll(pageQuery.to(IotContributor.class)).to(IotContributorVo.class);
return result;
} }
/** /**
@ -79,10 +75,7 @@ public class IotContributorServiceImpl implements IIotContributorService {
IotContributor update = MapstructUtils.convert(bo, IotContributor.class); IotContributor update = MapstructUtils.convert(bo, IotContributor.class);
validEntityBeforeSave(update); validEntityBeforeSave(update);
IotContributor ret = baseData.save(update); IotContributor ret = baseData.save(update);
if(ret == null){ return ret != null;
return false;
}
return true;
} }
/** /**

View File

@ -1,21 +1,13 @@
package cc.iotkit.generator.config; package cc.iotkit.generator.config;
import cc.iotkit.generator.core.DbIdGenerator; import cc.iotkit.generator.core.DbIdGenerator;
import cc.iotkit.generator.factory.YmlPropertySourceFactory;
import cn.hutool.core.net.NetUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
//import org.dromara.common.core.factory.YmlPropertySourceFactory;
//import org.dromara.common.mybatis.handler.InjectionMetaObjectHandler;
//import org.dromara.common.mybatis.interceptor.PlusDataPermissionInterceptor;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
/** /**

View File

@ -3,25 +3,21 @@ package cc.iotkit.generator.controller;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request; import cc.iotkit.common.api.Request;
import cc.iotkit.generator.dto.bo.ImportTableBo;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.IoUtil;
import cc.iotkit.common.web.core.BaseController;
import cc.iotkit.common.log.annotation.Log; import cc.iotkit.common.log.annotation.Log;
import cc.iotkit.common.log.enums.BusinessType; import cc.iotkit.common.log.enums.BusinessType;
import cc.iotkit.common.web.core.BaseController;
import cc.iotkit.generator.domain.GenTable; import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn; import cc.iotkit.generator.domain.GenTableColumn;
import cc.iotkit.generator.dto.bo.ImportTableBo;
import cc.iotkit.generator.service.IGenTableService; import cc.iotkit.generator.service.IGenTableService;
import io.swagger.annotations.ApiOperation; import cn.hutool.core.convert.Convert;
import cn.hutool.core.io.IoUtil;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -62,7 +58,7 @@ public class GenController extends BaseController {
GenTable table = genTableService.selectGenTableById(tableId); GenTable table = genTableService.selectGenTableById(tableId);
List<GenTable> tables = genTableService.selectGenTableAll(); List<GenTable> tables = genTableService.selectGenTableAll();
List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(tableId); List<GenTableColumn> list = genTableService.selectGenTableColumnListByTableId(tableId);
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
map.put("info", table); map.put("info", table);
map.put("rows", list); map.put("rows", list);
map.put("tables", tables); map.put("tables", tables);
@ -108,7 +104,6 @@ public class GenController extends BaseController {
// 查询表信息 // 查询表信息
List<GenTable> tableList = genTableService.selectDbTableListByNames(tables); List<GenTable> tableList = genTableService.selectDbTableListByNames(tables);
genTableService.importGenTable(tableList); genTableService.importGenTable(tableList);
return;
} }
/** /**
@ -122,7 +117,6 @@ public class GenController extends BaseController {
GenTable genTable = bo.getData(); GenTable genTable = bo.getData();
genTableService.validateEdit(genTable); genTableService.validateEdit(genTable);
genTableService.updateGenTable(genTable); genTableService.updateGenTable(genTable);
return;
} }
/** /**
@ -136,7 +130,6 @@ public class GenController extends BaseController {
@ApiOperation(value = "删除代码生成", notes = "删除代码生成") @ApiOperation(value = "删除代码生成", notes = "删除代码生成")
public void remove(@Validated @RequestBody Request<List<Long>> bo) { public void remove(@Validated @RequestBody Request<List<Long>> bo) {
genTableService.deleteGenTableByIds(bo.getData()); genTableService.deleteGenTableByIds(bo.getData());
return;
} }
/** /**
@ -175,7 +168,6 @@ public class GenController extends BaseController {
@PostMapping("/genCode/{tableName}") @PostMapping("/genCode/{tableName}")
public void genCode(@PathVariable("tableName") String tableName) { public void genCode(@PathVariable("tableName") String tableName) {
genTableService.generatorCode(tableName); genTableService.generatorCode(tableName);
return ;
} }
/** /**
@ -188,7 +180,6 @@ public class GenController extends BaseController {
@PostMapping("/synchDb") @PostMapping("/synchDb")
public void synchDb(@Validated @RequestBody Request<String> bo) { public void synchDb(@Validated @RequestBody Request<String> bo) {
genTableService.synchDb(bo.getData()); genTableService.synchDb(bo.getData());
return ;
} }
/** /**

View File

@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;

View File

@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ReflectionKit; import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import org.apache.ibatis.logging.Log; import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory; import org.apache.ibatis.logging.LogFactory;

View File

@ -7,7 +7,6 @@ import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;

View File

@ -1,17 +1,9 @@
package cc.iotkit.generator.core; package cc.iotkit.generator.core;
import cn.hutool.core.net.NetUtil;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.github.yitter.contract.IdGeneratorOptions; import com.github.yitter.contract.IdGeneratorOptions;
import com.github.yitter.idgen.YitIdHelper; import com.github.yitter.idgen.YitIdHelper;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Objects;
/** /**
* @author: Jay * @author: Jay
* @description: * @description:

View File

@ -1,18 +1,10 @@
package cc.iotkit.generator.core; package cc.iotkit.generator.core;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.utils.StringUtils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* *
@ -24,12 +16,10 @@ import java.util.Map;
public class PageBuilder implements Serializable { public class PageBuilder implements Serializable {
static public Page build(PageRequest pageRequest) { public static Page build(PageRequest pageRequest) {
Integer pageNum = ObjectUtil.defaultIfNull(pageRequest.getPageNum(), PageQuery.DEFAULT_PAGE_NUM); Integer pageNum = ObjectUtil.defaultIfNull(pageRequest.getPageNum(), PageQuery.DEFAULT_PAGE_NUM);
Integer pageSize = ObjectUtil.defaultIfNull(pageRequest.getPageSize(), PageQuery.DEFAULT_PAGE_SIZE); Integer pageSize = ObjectUtil.defaultIfNull(pageRequest.getPageSize(), PageQuery.DEFAULT_PAGE_SIZE);
Page page = new Page(pageNum, pageSize); return new Page(pageNum, pageSize);
return page;
} }
} }

View File

@ -8,10 +8,9 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -81,7 +80,7 @@ public class PageQuery implements Serializable {
*/ */
private List<OrderItem> buildOrderItem() { private List<OrderItem> buildOrderItem() {
if (StringUtils.isBlank(orderByColumn) || StringUtils.isBlank(isAsc)) { if (StringUtils.isBlank(orderByColumn) || StringUtils.isBlank(isAsc)) {
return null; return Collections.emptyList();
} }
String orderBy = SqlUtil.escapeOrderBySql(orderByColumn); String orderBy = SqlUtil.escapeOrderBySql(orderByColumn);
orderBy = StringUtils.toUnderScoreCase(orderBy); orderBy = StringUtils.toUnderScoreCase(orderBy);

View File

@ -1,13 +1,12 @@
package cc.iotkit.generator.domain; package cc.iotkit.generator.domain;
import cc.iotkit.common.utils.StringUtils; import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.generator.core.BaseEntity; import cc.iotkit.generator.core.BaseEntity;
import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import cc.iotkit.generator.constant.GenConstants;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import lombok.Data; import lombok.Data;

View File

@ -6,13 +6,11 @@ import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.JdbcType; import org.apache.ibatis.type.JdbcType;
import jakarta.validation.constraints.NotBlank;
/** /**
* gen_table_column * gen_table_column
* *

View File

@ -1,9 +1,8 @@
package cc.iotkit.generator.mapper; package cc.iotkit.generator.mapper;
import cc.iotkit.generator.core.BaseMapperPlus; import cc.iotkit.generator.core.BaseMapperPlus;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import cc.iotkit.generator.domain.GenTableColumn; import cc.iotkit.generator.domain.GenTableColumn;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import java.util.List; import java.util.List;

View File

@ -1,10 +1,9 @@
package cc.iotkit.generator.mapper; package cc.iotkit.generator.mapper;
import cc.iotkit.generator.core.BaseMapperPlus; import cc.iotkit.generator.core.BaseMapperPlus;
import cc.iotkit.generator.domain.GenTable;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cc.iotkit.generator.domain.GenTable;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;

View File

@ -4,13 +4,21 @@ import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.common.constant.Constants; import cc.iotkit.common.constant.Constants;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.satoken.utils.LoginHelper;
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.StringUtils; import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.common.utils.file.FileUtils; import cc.iotkit.common.utils.file.FileUtils;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.generator.core.DbIdGenerator; import cc.iotkit.generator.core.DbIdGenerator;
import cc.iotkit.generator.core.PageBuilder; import cc.iotkit.generator.core.PageBuilder;
import cc.iotkit.generator.core.PageQuery; import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn;
import cc.iotkit.generator.mapper.GenTableColumnMapper;
import cc.iotkit.generator.mapper.GenTableMapper;
import cc.iotkit.generator.util.GenUtils;
import cc.iotkit.generator.util.VelocityInitializer;
import cc.iotkit.generator.util.VelocityUtils;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
@ -20,17 +28,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.common.satoken.utils.LoginHelper;
import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn;
import cc.iotkit.generator.mapper.GenTableColumnMapper;
import cc.iotkit.generator.mapper.GenTableMapper;
import cc.iotkit.generator.util.GenUtils;
import cc.iotkit.generator.util.VelocityInitializer;
import cc.iotkit.generator.util.VelocityUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.velocity.Template; import org.apache.velocity.Template;

View File

@ -1,10 +1,8 @@
package cc.iotkit.generator.service; package cc.iotkit.generator.service;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.generator.core.PageQuery;
import cc.iotkit.generator.domain.GenTable; import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn; import cc.iotkit.generator.domain.GenTableColumn;

View File

@ -1,17 +1,14 @@
package cc.iotkit.generator.util; package cc.iotkit.generator.util;
import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.common.satoken.utils.LoginHelper; import cc.iotkit.common.satoken.utils.LoginHelper;
import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.generator.config.GenConfig; import cc.iotkit.generator.config.GenConfig;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.generator.domain.GenTable; import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn; import cc.iotkit.generator.domain.GenTableColumn;
import cn.hutool.core.util.ReUtil;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import cn.hutool.core.util.ReUtil;
import java.util.Arrays; import java.util.Arrays;

View File

@ -3,14 +3,13 @@ package cc.iotkit.generator.util;
import cc.iotkit.common.utils.DateUtils; import cc.iotkit.common.utils.DateUtils;
import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.common.utils.JsonUtils;
import cc.iotkit.common.utils.StringUtils; import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.generator.core.DataBaseHelper; import cc.iotkit.generator.core.DataBaseHelper;
import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Dict; import cn.hutool.core.lang.Dict;
import cc.iotkit.generator.constant.GenConstants;
import cc.iotkit.generator.domain.GenTable;
import cc.iotkit.generator.domain.GenTableColumn;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.velocity.VelocityContext; import org.apache.velocity.VelocityContext;
@ -225,7 +224,7 @@ public class VelocityUtils {
*/ */
public static HashSet<String> getImportList(GenTable genTable) { public static HashSet<String> getImportList(GenTable genTable) {
List<GenTableColumn> columns = genTable.getColumns(); List<GenTableColumn> columns = genTable.getColumns();
HashSet<String> importList = new HashSet<String>(); HashSet<String> importList = new HashSet<>();
for (GenTableColumn column : columns) { for (GenTableColumn column : columns) {
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) { if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
importList.add("java.util.Date"); importList.add("java.util.Date");

View File

@ -1,48 +1,48 @@
import request from '@/utils/request'; import request from '@/utils/request';
import { AxiosPromise } from 'axios'; import {AxiosPromise} from 'axios';
import { ${BusinessName}VO, ${BusinessName}Form, ${BusinessName}Query } from './types'; import {${BusinessName}Form, ${BusinessName}Query, ${BusinessName}VO} from './types';
// 查询${functionName}列表 // 查询${functionName}列表
export const list${BusinessName}(query: ${BusinessName}Query): AxiosPromise<${BusinessName}VO[]> { export const list${BusinessName}(query: ${BusinessName}Query): AxiosPromise<${BusinessName}VO[]> {
return request({ return request({
url: '/${moduleName}/${businessName}/list', url: '/${moduleName}/${businessName}/list',
method: 'post', method: 'post',
params: query params: query
}) })
} }
// 查询${functionName}详细 // 查询${functionName}详细
export const get${BusinessName}(${pkColumn.javaField}: string | number) : AxiosPromise<${BusinessName}VO> { export const get${BusinessName}(${pkColumn.javaField}: string | number): AxiosPromise<${BusinessName}VO> {
return request({ return request({
url: '/${moduleName}/${businessName}/getDetail', url: '/${moduleName}/${businessName}/getDetail',
method: 'post', method: 'post',
data: ${pkColumn.javaField} data: ${pkColumn.javaField}
}) })
} }
// 新增${functionName} // 新增${functionName}
export const add${BusinessName}(data: ${BusinessName}Form) { export const add${BusinessName}(data: ${BusinessName}Form) {
return request({ return request({
url: '/${moduleName}/${businessName}/add', url: '/${moduleName}/${businessName}/add',
method: 'post', method: 'post',
data data
}) })
} }
// 修改${functionName} // 修改${functionName}
export const update${BusinessName}(data: ${BusinessName}Form) { export const update${BusinessName}(data: ${BusinessName}Form) {
return request({ return request({
url: '/${moduleName}/${businessName}/edit', url: '/${moduleName}/${businessName}/edit',
method: 'post', method: 'post',
data: data data: data
}) })
} }
// 删除${functionName} // 删除${functionName}
export const del${BusinessName}(${pkColumn.javaField}: Array<string | number>) { export const del${BusinessName}(${pkColumn.javaField}: Array<string | number>) {
return request({ return request({
url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField},
method: 'post', method: 'post',
data: ${pkColumn.javaField} data: ${pkColumn.javaField}
}) })
} }

View File

@ -266,13 +266,12 @@
</template> </template>
<script setup name="${BusinessName}" lang="ts"> <script setup name="${BusinessName}" lang="ts">
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; import {add${BusinessName}, ${BusinessName}Form, get${BusinessName}, list${BusinessName}, ${BusinessName}Query, update${BusinessName}, ${BusinessName}VO} from "@/api/";
import { ${BusinessName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types'; import {ComponentInternalInstance} from 'vue';
import { ComponentInternalInstance } from 'vue'; import {ElForm, ElTable} from 'element-plus';
import { ElForm, ElTable } from 'element-plus';
type ${BusinessName}Option = { type ${BusinessName}Option = {
${treeCode}: number; ${treeCode}: number;
${treeName}: string; ${treeName}: string;
children?: ${BusinessName}Option[]; children?: ${BusinessName}Option[];

View File

@ -258,12 +258,11 @@
</template> </template>
<script setup name="${BusinessName}" lang="ts"> <script setup name="${BusinessName}" lang="ts">
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from '@/api/${moduleName}/${businessName}'; import {add${BusinessName}, ${BusinessName}Form, get${BusinessName}, list${BusinessName}, ${BusinessName}Query, update${BusinessName}, ${BusinessName}VO} from '@/api/';
import { ${BusinessName}VO, ${BusinessName}Query, ${BusinessName}Form } from '@/api/${moduleName}/${businessName}/types'; import {ComponentInternalInstance} from 'vue';
import { ComponentInternalInstance } from 'vue'; import {ElForm} from 'element-plus';
import { ElForm } from 'element-plus';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
#if(${dicts} != '') #if(${dicts} != '')
#set($dictsNoSymbol=$dicts.replace("'", "")) #set($dictsNoSymbol=$dicts.replace("'", ""))
const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts})); const { ${dictsNoSymbol} } = toRefs<any>(proxy?.useDict(${dicts}));

View File

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

View File

@ -10,9 +10,9 @@
package cc.iotkit.manager.controller; package cc.iotkit.manager.controller;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request; import cc.iotkit.common.api.Request;
import cc.iotkit.manager.service.AlertService; import cc.iotkit.manager.service.AlertService;
import cc.iotkit.common.api.Paging;
import cc.iotkit.model.alert.AlertConfig; import cc.iotkit.model.alert.AlertConfig;
import cc.iotkit.model.alert.AlertRecord; import cc.iotkit.model.alert.AlertRecord;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;

View File

@ -48,7 +48,7 @@ public class OtaController extends BaseController {
@ApiOperation("新增升级包") @ApiOperation("新增升级包")
@PostMapping("/package/add") @PostMapping("/package/add")
public OtaPackage packageAdd(@RequestBody @Valid Request<OtaPackageBo> request) throws Exception { public OtaPackage packageAdd(@RequestBody @Valid Request<OtaPackageBo> request) {
return otaService.addOtaPackage(request.getData()); return otaService.addOtaPackage(request.getData());
} }

View File

@ -74,8 +74,7 @@ public class ProductController {
@ApiOperation("查看详情") @ApiOperation("查看详情")
@PostMapping(value = "/getDetail") @PostMapping(value = "/getDetail")
public ProductVo getDetail(@RequestBody @Validated Request<String> request) { public ProductVo getDetail(@RequestBody @Validated Request<String> request) {
ProductVo dto = productService.getDetail(request.getData()); return productService.getDetail(request.getData());
return dto;
} }

View File

@ -78,7 +78,7 @@ public class ScreenController {
@ApiOperation(value = "预览接口") @ApiOperation(value = "预览接口")
@PostMapping("/previewApis") @PostMapping("/previewApis")
public void previewApis(@RequestBody @Validated Request<List<ScreenApi>> screenApis) { public void previewApis(@RequestBody @Validated Request<List<ScreenApi>> screenApis) {
if (ObjectUtil.isNull(screenApis.getData())||screenApis.getData().size()==0) { if (ObjectUtil.isNull(screenApis.getData()) || screenApis.getData().isEmpty()) {
throw new BizException(ErrCode.API_LIST_BLANK); throw new BizException(ErrCode.API_LIST_BLANK);
} }
screenService.previewApis(screenApis.getData()); screenService.previewApis(screenApis.getData());
@ -87,7 +87,7 @@ public class ScreenController {
@ApiOperation(value = "保存大屏接口") @ApiOperation(value = "保存大屏接口")
@PostMapping("/saveScreenApis") @PostMapping("/saveScreenApis")
public void saveScreenApis(@RequestBody @Validated Request<List<ScreenApi>> screenApis) { public void saveScreenApis(@RequestBody @Validated Request<List<ScreenApi>> screenApis) {
if (ObjectUtil.isNull(screenApis.getData())||screenApis.getData().size()==0) { if (ObjectUtil.isNull(screenApis.getData()) || screenApis.getData().isEmpty()) {
throw new BizException(ErrCode.API_LIST_BLANK); throw new BizException(ErrCode.API_LIST_BLANK);
} }
screenService.saveScreenApis(screenApis.getData()); screenService.saveScreenApis(screenApis.getData());

View File

@ -20,7 +20,10 @@ import cc.iotkit.model.space.Space;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;

View File

@ -1,18 +1,14 @@
package cc.iotkit.manager.dto.bo; package cc.iotkit.manager.dto.bo;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.protocol.ProtocolComponent;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.Size;
@ApiModel(value = "ChangeStateBo") @ApiModel(value = "ChangeStateBo")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -1,25 +1,11 @@
package cc.iotkit.manager.dto.bo.category; package cc.iotkit.manager.dto.bo.category;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Category;
import com.fasterxml.jackson.annotation.JsonInclude; import io.github.linpeilie.annotations.AutoMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -11,14 +11,11 @@ package cc.iotkit.manager.dto.bo.device;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.manager.model.vo.DeviceLog; import cc.iotkit.manager.model.vo.DeviceLog;
import cc.iotkit.model.device.DeviceInfo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.web.bind.annotation.PathVariable;
@ApiModel(value = "DeviceLogQueryBo") @ApiModel(value = "DeviceLogQueryBo")
@Data @Data

View File

@ -11,7 +11,6 @@ package cc.iotkit.manager.dto.bo.device;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.model.product.Category;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.AutoMapping;
import io.github.linpeilie.annotations.ReverseAutoMapping; import io.github.linpeilie.annotations.ReverseAutoMapping;

View File

@ -1,12 +1,9 @@
package cc.iotkit.manager.dto.bo.device; package cc.iotkit.manager.dto.bo.device;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import io.github.linpeilie.annotations.AutoMapping;
import io.github.linpeilie.annotations.ReverseAutoMapping;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,24 +1,11 @@
package cc.iotkit.manager.dto.bo.deviceconfig; package cc.iotkit.manager.dto.bo.deviceconfig;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.device.DeviceConfig; import cc.iotkit.model.device.DeviceConfig;
import com.fasterxml.jackson.annotation.JsonInclude; import io.github.linpeilie.annotations.AutoMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.Size;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,16 +1,10 @@
package cc.iotkit.manager.dto.bo.devicegroup; package cc.iotkit.manager.dto.bo.devicegroup;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.device.DeviceGroup;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;

View File

@ -1,25 +1,12 @@
package cc.iotkit.manager.dto.bo.devicegroup; package cc.iotkit.manager.dto.bo.devicegroup;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.device.DeviceGroup; import cc.iotkit.model.device.DeviceGroup;
import com.fasterxml.jackson.annotation.JsonInclude; import io.github.linpeilie.annotations.AutoMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.Size;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotNull;
import java.io.Serializable; import jakarta.validation.constraints.Size;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,7 +1,6 @@
package cc.iotkit.manager.dto.bo.ota; package cc.iotkit.manager.dto.bo.ota;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,25 +1,11 @@
package cc.iotkit.manager.dto.bo.productmodel; package cc.iotkit.manager.dto.bo.productmodel;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.product.ProductModel; import cc.iotkit.model.product.ProductModel;
import com.fasterxml.jackson.annotation.JsonInclude; import io.github.linpeilie.annotations.AutoMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,25 +1,11 @@
package cc.iotkit.manager.dto.bo.protocolcomponent; package cc.iotkit.manager.dto.bo.protocolcomponent;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.protocol.ProtocolComponent; import cc.iotkit.model.protocol.ProtocolComponent;
import com.fasterxml.jackson.annotation.JsonInclude; import io.github.linpeilie.annotations.AutoMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,27 +1,14 @@
package cc.iotkit.manager.dto.bo.protocolconverter; package cc.iotkit.manager.dto.bo.protocolconverter;
import cc.iotkit.model.protocol.ProtocolConverter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup; import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup; import cc.iotkit.common.validate.EditGroup;
import cc.iotkit.model.protocol.ProtocolConverter;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -1,7 +1,6 @@
package cc.iotkit.manager.dto.bo.ruleinfo; package cc.iotkit.manager.dto.bo.ruleinfo;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.rule.RuleInfo;
import cc.iotkit.model.rule.RuleLog; import cc.iotkit.model.rule.RuleLog;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -9,8 +8,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.Size;
@ApiModel(value = "RuleLogBo") @ApiModel(value = "RuleLogBo")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -10,11 +10,11 @@
package cc.iotkit.manager.dto.bo.taskinfo; package cc.iotkit.manager.dto.bo.taskinfo;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.rule.TaskInfo;
import cc.iotkit.model.rule.TaskLog; import cc.iotkit.model.rule.TaskLog;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.*; import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel(value = "TaskLogBo") @ApiModel(value = "TaskLogBo")
@Data @Data

View File

@ -1,27 +1,13 @@
package cc.iotkit.manager.dto.bo.thingmodel; package cc.iotkit.manager.dto.bo.thingmodel;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.product.ThingModel; import cc.iotkit.model.product.ThingModel;
import com.fasterxml.jackson.annotation.JsonInclude; import io.github.linpeilie.annotations.AutoMapper;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.AutoMapping;
import io.github.linpeilie.annotations.ReverseAutoMapping; import io.github.linpeilie.annotations.ReverseAutoMapping;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import cc.iotkit.common.api.BaseDto;
import cc.iotkit.common.validate.AddGroup;
import cc.iotkit.common.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;

View File

@ -11,7 +11,6 @@ package cc.iotkit.manager.dto.bo.thingmodel;
import cc.iotkit.common.api.BaseDto; import cc.iotkit.common.api.BaseDto;
import cc.iotkit.model.device.message.ThingModelMessage; import cc.iotkit.model.device.message.ThingModelMessage;
import cc.iotkit.model.product.ThingModel;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View File

@ -1,17 +1,14 @@
package cc.iotkit.manager.dto.vo.category; package cc.iotkit.manager.dto.vo.category;
import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Category;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "CategoryVo") @ApiModel(value = "CategoryVo")

View File

@ -1,19 +1,14 @@
package cc.iotkit.manager.dto.vo.deviceconfig; package cc.iotkit.manager.dto.vo.deviceconfig;
import cc.iotkit.model.device.DeviceConfig; import cc.iotkit.model.device.DeviceConfig;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "DeviceConfigVo") @ApiModel(value = "DeviceConfigVo")

View File

@ -1,19 +1,14 @@
package cc.iotkit.manager.dto.vo.devicegroup; package cc.iotkit.manager.dto.vo.devicegroup;
import cc.iotkit.model.device.DeviceGroup; import cc.iotkit.model.device.DeviceGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "DeviceGroupVo") @ApiModel(value = "DeviceGroupVo")

View File

@ -1,17 +1,14 @@
package cc.iotkit.manager.dto.vo.productmodel; package cc.iotkit.manager.dto.vo.productmodel;
import cc.iotkit.model.product.ProductModel; import cc.iotkit.model.product.ProductModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "ProductModelVo") @ApiModel(value = "ProductModelVo")

View File

@ -1,17 +1,14 @@
package cc.iotkit.manager.dto.vo.protocolcomponent; package cc.iotkit.manager.dto.vo.protocolcomponent;
import cc.iotkit.model.protocol.ProtocolComponent; import cc.iotkit.model.protocol.ProtocolComponent;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "ProtocolComponentVo") @ApiModel(value = "ProtocolComponentVo")

View File

@ -1,19 +1,14 @@
package cc.iotkit.manager.dto.vo.protocolconverter; package cc.iotkit.manager.dto.vo.protocolconverter;
import cc.iotkit.model.protocol.ProtocolConverter; import cc.iotkit.model.protocol.ProtocolConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "ProtocolConverterVo") @ApiModel(value = "ProtocolConverterVo")

View File

@ -3,22 +3,15 @@ package cc.iotkit.manager.dto.vo.ruleinfo;
import cc.iotkit.model.rule.FilterConfig; import cc.iotkit.model.rule.FilterConfig;
import cc.iotkit.model.rule.RuleAction; import cc.iotkit.model.rule.RuleAction;
import cc.iotkit.model.rule.RuleInfo; import cc.iotkit.model.rule.RuleInfo;
import io.github.linpeilie.annotations.AutoMapping;
import io.github.linpeilie.annotations.ReverseAutoMapping;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@ApiModel(value = "RuleInfoVo") @ApiModel(value = "RuleInfoVo")

View File

@ -2,22 +2,15 @@ package cc.iotkit.manager.dto.vo.taskinfo;
import cc.iotkit.model.rule.RuleAction; import cc.iotkit.model.rule.RuleAction;
import cc.iotkit.model.rule.TaskInfo; import cc.iotkit.model.rule.TaskInfo;
import io.github.linpeilie.annotations.AutoMapping;
import io.github.linpeilie.annotations.ReverseAutoMapping;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@ApiModel(value = "TaskInfoVo") @ApiModel(value = "TaskInfoVo")

View File

@ -10,10 +10,10 @@
package cc.iotkit.manager.service; package cc.iotkit.manager.service;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request; import cc.iotkit.common.api.Request;
import cc.iotkit.data.manager.IAlertConfigData; import cc.iotkit.data.manager.IAlertConfigData;
import cc.iotkit.data.manager.IAlertRecordData; import cc.iotkit.data.manager.IAlertRecordData;
import cc.iotkit.common.api.Paging;
import cc.iotkit.model.alert.AlertConfig; import cc.iotkit.model.alert.AlertConfig;
import cc.iotkit.model.alert.AlertRecord; import cc.iotkit.model.alert.AlertRecord;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@ -45,7 +45,7 @@ public class DeferredDataConsumer implements ConsumerHandler<ThingModelMessage>,
@PostConstruct @PostConstruct
public void init() { public void init() {
thingModelMessageConsumer.consume(Constants.THING_MODEL_MESSAGE_TOPIC,this); thingModelMessageConsumer.consume(Constants.THING_MODEL_MESSAGE_TOPIC, this);
Executors.newCachedThreadPool().submit(this); Executors.newCachedThreadPool().submit(this);
} }
@ -169,7 +169,10 @@ public class DeferredDataConsumer implements ConsumerHandler<ThingModelMessage>,
@Override @Override
public int compareTo(Delayed o) { public int compareTo(Delayed o) {
long diff = o.getDelay(TimeUnit.NANOSECONDS) - getDelay(TimeUnit.NANOSECONDS); long diff = o.getDelay(TimeUnit.NANOSECONDS) - getDelay(TimeUnit.NANOSECONDS);
return diff == 0 ? 0 : (diff > 0 ? 1 : -1); if (diff == 0) {
return 0;
}
return diff > 0 ? 1 : -1;
} }
} }

View File

@ -13,7 +13,6 @@ import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.thing.ThingService; import cc.iotkit.common.thing.ThingService;
import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.common.utils.JsonUtils;
import cc.iotkit.common.utils.UniqueIdUtil; import cc.iotkit.common.utils.UniqueIdUtil;
import cc.iotkit.comps.ApiTool;
import cc.iotkit.comps.DeviceComponentManager; import cc.iotkit.comps.DeviceComponentManager;
import cc.iotkit.data.manager.IDeviceConfigData; import cc.iotkit.data.manager.IDeviceConfigData;
import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IDeviceInfoData;
@ -22,7 +21,6 @@ import cc.iotkit.model.device.DeviceInfo;
import cc.iotkit.model.device.message.ThingModelMessage; import cc.iotkit.model.device.message.ThingModelMessage;
import cc.iotkit.temporal.IThingModelMessageData; import cc.iotkit.temporal.IThingModelMessageData;
import cc.iotkit.virtualdevice.VirtualManager; import cc.iotkit.virtualdevice.VirtualManager;
import io.vertx.core.http.HttpMethod;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;

View File

@ -37,7 +37,6 @@ import cc.iotkit.model.space.SpaceDevice;
import cc.iotkit.model.system.*; import cc.iotkit.model.system.*;
import cc.iotkit.temporal.IDbStructureData; import cc.iotkit.temporal.IDbStructureData;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.google.common.base.Charsets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.SmartInitializingSingleton;
@ -47,6 +46,7 @@ import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@ -218,7 +218,7 @@ public class ExampleDataInit implements SmartInitializingSingleton {
log.info("init data finished."); log.info("init data finished.");
FileUtils.write(initFile, "", Charsets.UTF_8); FileUtils.write(initFile, "", StandardCharsets.UTF_8);
} catch ( } catch (
Throwable e) { Throwable e) {
log.error("init error", e); log.error("init error", e);
@ -293,7 +293,7 @@ public class ExampleDataInit implements SmartInitializingSingleton {
private <T> T initData(String name, ICommonData service, TypeReference<T> type) throws IOException { private <T> T initData(String name, ICommonData service, TypeReference<T> type) throws IOException {
log.info("init {} data...", name); log.info("init {} data...", name);
String json = FileUtils.readFileToString(new File("./data/init/" + name + ".json"), Charsets.UTF_8); String json = FileUtils.readFileToString(new File("./data/init/" + name + ".json"), StandardCharsets.UTF_8);
List list = (List) JsonUtils.parseObject(json, type); List list = (List) JsonUtils.parseObject(json, type);
for (Object obj : list) { for (Object obj : list) {
service.save((Id) obj); service.save((Id) obj);

View File

@ -7,8 +7,6 @@ import cc.iotkit.manager.dto.bo.protocolcomponent.ProtocolComponentBo;
import cc.iotkit.manager.dto.bo.protocolconverter.ProtocolConverterBo; import cc.iotkit.manager.dto.bo.protocolconverter.ProtocolConverterBo;
import cc.iotkit.manager.dto.vo.protocolcomponent.ProtocolComponentVo; import cc.iotkit.manager.dto.vo.protocolcomponent.ProtocolComponentVo;
import cc.iotkit.manager.dto.vo.protocolconverter.ProtocolConverterVo; import cc.iotkit.manager.dto.vo.protocolconverter.ProtocolConverterVo;
import cc.iotkit.model.protocol.ProtocolComponent;
import cc.iotkit.model.protocol.ProtocolConverter;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
/** /**

View File

@ -125,9 +125,7 @@ public class OtaService {
*/ */
public void startUpgrade(Long otaId, List<String> deviceIds) { public void startUpgrade(Long otaId, List<String> deviceIds) {
OtaPackage otaPackage = iOtaPackageData.findById(otaId); OtaPackage otaPackage = iOtaPackageData.findById(otaId);
deviceIds.forEach(deviceId -> { deviceIds.forEach(deviceId -> deviceService.otaUpgrade(deviceId, true, otaPackage));
deviceService.otaUpgrade(deviceId, true, otaPackage);
});
} }
public Paging<DeviceOtaInfoVo> otaResult(PageRequest<DeviceOtaInfoBo> request) { public Paging<DeviceOtaInfoVo> otaResult(PageRequest<DeviceOtaInfoBo> request) {

View File

@ -165,8 +165,8 @@ public class DeviceServiceImpl implements IDeviceService {
uid = AuthUtil.getUserId(); uid = AuthUtil.getUserId();
} }
List<DeviceInfo> ret=deviceInfoData.findByProductNodeType(uid); List<DeviceInfo> ret=deviceInfoData.findByProductNodeType(uid);
if(ret.size()>0){ if (!ret.isEmpty()) {
pdv=ret.stream().map(r->ParentDeviceVo.builder().id(r.getId()).deviceName(r.getDeviceName()).build()).collect(Collectors.toList()); pdv = ret.stream().map(r -> ParentDeviceVo.builder().id(r.getId()).deviceName(r.getDeviceName()).build()).collect(Collectors.toList());
} }
return pdv; return pdv;
} }

View File

@ -24,15 +24,14 @@ import cc.iotkit.model.product.ProductModel;
import cc.iotkit.model.product.ThingModel; import cc.iotkit.model.product.ThingModel;
import cc.iotkit.temporal.IDbStructureData; import cc.iotkit.temporal.IDbStructureData;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.UUID;
import cn.hutool.crypto.digest.MD5;
import com.aliyun.oss.OSS; import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.PutObjectResult; import com.aliyun.oss.model.PutObjectResult;
import com.amazonaws.util.Md5Utils;
import com.github.yitter.idgen.YitIdHelper; import com.github.yitter.idgen.YitIdHelper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -177,6 +176,9 @@ public class ProductServiceImpl implements IProductService {
public String uploadImg(String productKey, MultipartFile file) { public String uploadImg(String productKey, MultipartFile file) {
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
if (StringUtils.isBlank(fileName)) {
throw new BizException(ErrCode.FILE_NAME_IS_NULL);
}
String end = fileName.substring(fileName.lastIndexOf(".")); String end = fileName.substring(fileName.lastIndexOf("."));
if (ossClient == null) { if (ossClient == null) {
// 创建OSSClient实例。 // 创建OSSClient实例。

View File

@ -31,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.*; import java.nio.file.*;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
@ -145,7 +146,7 @@ public class ProtocolServiceImpl implements IProtocolService {
if (!StringUtils.hasText(script)) { if (!StringUtils.hasText(script)) {
try { try {
File file = getComponentScriptFile(id); File file = getComponentScriptFile(id);
script = FileUtils.readFileToString(file, "UTF-8"); script = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
} catch (Throwable e) { } catch (Throwable e) {
log.error("read converter script file error", e); log.error("read converter script file error", e);
script = ""; script = "";
@ -163,7 +164,7 @@ public class ProtocolServiceImpl implements IProtocolService {
// 保存到文件 // 保存到文件
File file = getComponentScriptFile(id); File file = getComponentScriptFile(id);
String script = upReq.getScript(); String script = upReq.getScript();
FileUtils.writeStringToFile(file, script, "UTF-8", false); FileUtils.writeStringToFile(file, script, StandardCharsets.UTF_8, false);
// 保存到数据库,后续加版本号 // 保存到数据库,后续加版本号
old.setScript(upReq.getScript()); old.setScript(upReq.getScript());
@ -253,7 +254,7 @@ public class ProtocolServiceImpl implements IProtocolService {
try { try {
Path path = componentConfig.getConverterFilePath(id); Path path = componentConfig.getConverterFilePath(id);
File file = path.resolve(ProtocolConverter.SCRIPT_FILE_NAME).toFile(); File file = path.resolve(ProtocolConverter.SCRIPT_FILE_NAME).toFile();
script = FileUtils.readFileToString(file, "UTF-8"); script = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
} catch (Throwable e) { } catch (Throwable e) {
log.error("read converter script file error", e); log.error("read converter script file error", e);
script = ""; script = "";
@ -273,7 +274,7 @@ public class ProtocolServiceImpl implements IProtocolService {
Path path = componentConfig.getConverterFilePath(id); Path path = componentConfig.getConverterFilePath(id);
File file = path.resolve(ProtocolConverter.SCRIPT_FILE_NAME).toFile(); File file = path.resolve(ProtocolConverter.SCRIPT_FILE_NAME).toFile();
String script = converter.getScript(); String script = converter.getScript();
FileUtils.writeStringToFile(file, script, "UTF-8", false); FileUtils.writeStringToFile(file, script, StandardCharsets.UTF_8, false);
// 再存数据库 // 再存数据库
protocolConverterData.save(converter); protocolConverterData.save(converter);

View File

@ -9,9 +9,9 @@
*/ */
package cc.iotkit.ruleengine.action.device; package cc.iotkit.ruleengine.action.device;
import cc.iotkit.common.thing.ThingService;
import cc.iotkit.common.utils.UniqueIdUtil; import cc.iotkit.common.utils.UniqueIdUtil;
import cc.iotkit.comps.DeviceComponentManager; import cc.iotkit.comps.DeviceComponentManager;
import cc.iotkit.common.thing.ThingService;
import cc.iotkit.model.device.message.ThingModelMessage; import cc.iotkit.model.device.message.ThingModelMessage;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@ -73,6 +73,7 @@ public class KafkaLink implements BaseSinkLink {
); );
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("kafka,topic[{}],发送异常:{}", msg.get(TOPIC), msg.get(PAYLOAD).toString(), e);
consumer.accept(String.format("kafka,topic[%s],发送异常:%s", msg.get(TOPIC), msg.get(PAYLOAD).toString())); consumer.accept(String.format("kafka,topic[%s],发送异常:%s", msg.get(TOPIC), msg.get(PAYLOAD).toString()));
} }

View File

@ -10,15 +10,15 @@
package cc.iotkit.ruleengine.rule; package cc.iotkit.ruleengine.rule;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.utils.JsonUtils; import cc.iotkit.common.utils.JsonUtils;
import cc.iotkit.common.utils.StringUtils; import cc.iotkit.common.utils.StringUtils;
import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IDeviceInfoData;
import cc.iotkit.data.manager.IRuleInfoData; import cc.iotkit.data.manager.IRuleInfoData;
import cc.iotkit.common.api.Paging;
import cc.iotkit.model.rule.FilterConfig; import cc.iotkit.model.rule.FilterConfig;
import cc.iotkit.model.rule.RuleAction; import cc.iotkit.model.rule.RuleAction;
import cc.iotkit.model.rule.RuleInfo; import cc.iotkit.model.rule.RuleInfo;
import cc.iotkit.ruleengine.action.*; import cc.iotkit.ruleengine.action.Action;
import cc.iotkit.ruleengine.action.device.DeviceAction; import cc.iotkit.ruleengine.action.device.DeviceAction;
import cc.iotkit.ruleengine.action.device.DeviceActionService; import cc.iotkit.ruleengine.action.device.DeviceActionService;
import cc.iotkit.ruleengine.action.http.HttpAction; import cc.iotkit.ruleengine.action.http.HttpAction;

View File

@ -52,7 +52,7 @@ public class RuleMessageHandler implements DeviceMessageHandler {
//找出相同场景ID的规则删除 //找出相同场景ID的规则删除
entry.getValue().removeIf(s -> s != null && s.getId().equals(ruleId)); entry.getValue().removeIf(s -> s != null && s.getId().equals(ruleId));
//删除空的规则列表 //删除空的规则列表
if (entry.getValue().size() == 0) { if (entry.getValue().isEmpty()) {
iterator.remove(); iterator.remove();
deviceRuleMap.remove(device); deviceRuleMap.remove(device);
} }

View File

@ -45,11 +45,7 @@ public class DeviceActionExecutor implements ActionExecutor<DeviceAction> {
} }
//将执行的数据转换为动作配置 //将执行的数据转换为动作配置
Integer code = config.hashCode(); Integer code = config.hashCode();
DeviceAction action = actionMap.get(code); DeviceAction action = actionMap.computeIfAbsent(code, k -> JsonUtils.parseObject(config, DeviceAction.class));
if (action == null) {
action = JsonUtils.parseObject(config, DeviceAction.class);
actionMap.put(code, action);
}
log.info("start device service invoke,{}", JsonUtils.toJsonString(action)); log.info("start device service invoke,{}", JsonUtils.toJsonString(action));
for (DeviceActionService.Service service : action.getServices()) { for (DeviceActionService.Service service : action.getServices()) {

View File

@ -10,10 +10,10 @@
package cc.iotkit.ruleengine.task; package cc.iotkit.ruleengine.task;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.enums.ErrCode; import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException; import cc.iotkit.common.exception.BizException;
import cc.iotkit.data.manager.ITaskInfoData; import cc.iotkit.data.manager.ITaskInfoData;
import cc.iotkit.common.api.Paging;
import cc.iotkit.model.rule.TaskInfo; import cc.iotkit.model.rule.TaskInfo;
import cc.iotkit.model.rule.TaskLog; import cc.iotkit.model.rule.TaskLog;
import cc.iotkit.temporal.ITaskLogData; import cc.iotkit.temporal.ITaskLogData;
@ -27,7 +27,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;

View File

@ -31,16 +31,16 @@ public class ScreenComponent {
} }
public void debugMode(boolean state) { public void debugMode(boolean state) {
apiHandle.debugMode=state; apiHandle.debugMode = state;
} }
public void create(int port, String packageName, ScreenConfig screenConfig) { public void create(int port, String packageName, ScreenConfig screenConfig) {
vertx = Vertx.vertx(); vertx = Vertx.vertx();
screenVerticle = new ScreenVerticle(port,packageName,screenConfig); screenVerticle = new ScreenVerticle(port, packageName, screenConfig);
} }
public void setApiHandle(ScreenApiHandle screenApiHandle) { public void setApiHandle(ScreenApiHandle screenApiHandle) {
this.apiHandle=screenApiHandle; this.apiHandle = screenApiHandle;
} }
public void previewApis(List<ScreenApi> screenApis) { public void previewApis(List<ScreenApi> screenApis) {
@ -56,7 +56,7 @@ public class ScreenComponent {
deployedId = s; deployedId = s;
countDownLatch.countDown(); countDownLatch.countDown();
})); }));
future.onFailure((e) -> { future.onFailure(e -> {
countDownLatch.countDown(); countDownLatch.countDown();
log.error("publish screen failed", e); log.error("publish screen failed", e);
}); });

View File

@ -15,7 +15,10 @@ import cn.hutool.core.convert.Convert;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;

Some files were not shown because too many files have changed in this diff Show More