diff --git a/iot-dao/iot-data-model/pom.xml b/iot-dao/iot-data-model/pom.xml
index 8b287a3d..d29914c1 100644
--- a/iot-dao/iot-data-model/pom.xml
+++ b/iot-dao/iot-data-model/pom.xml
@@ -5,9 +5,9 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
iot-data-model
diff --git a/iot-dao/iot-data-service/pom.xml b/iot-dao/iot-data-service/pom.xml
index 2de342e0..c6c8d438 100644
--- a/iot-dao/iot-data-service/pom.xml
+++ b/iot-dao/iot-data-service/pom.xml
@@ -5,10 +5,10 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
iot-data-service
diff --git a/iot-dao/iot-data-serviceImpl-cache/pom.xml b/iot-dao/iot-data-serviceImpl-cache/pom.xml
index e8907de6..19af94b2 100644
--- a/iot-dao/iot-data-serviceImpl-cache/pom.xml
+++ b/iot-dao/iot-data-serviceImpl-cache/pom.xml
@@ -5,10 +5,10 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
iot-data-serviceImpl-cache
diff --git a/iot-dao/iot-data-serviceImpl-rdb/pom.xml b/iot-dao/iot-data-serviceImpl-rdb/pom.xml
index bc27179f..540f21d6 100644
--- a/iot-dao/iot-data-serviceImpl-rdb/pom.xml
+++ b/iot-dao/iot-data-serviceImpl-rdb/pom.xml
@@ -5,9 +5,9 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
iot-data-serviceImpl-rdb
diff --git a/iot-dao/iot-temporal-service/pom.xml b/iot-dao/iot-temporal-service/pom.xml
index 506dbb3a..134fa043 100644
--- a/iot-dao/iot-temporal-service/pom.xml
+++ b/iot-dao/iot-temporal-service/pom.xml
@@ -5,10 +5,10 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
iot-temporal-service
diff --git a/iot-dao/iot-temporal-serviceImpl-es/pom.xml b/iot-dao/iot-temporal-serviceImpl-es/pom.xml
index bdbbb71e..1a05990a 100644
--- a/iot-dao/iot-temporal-serviceImpl-es/pom.xml
+++ b/iot-dao/iot-temporal-serviceImpl-es/pom.xml
@@ -5,7 +5,7 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-dao/iot-temporal-serviceImpl-iotdb/pom.xml b/iot-dao/iot-temporal-serviceImpl-iotdb/pom.xml
index 2c342d2a..cd29df04 100644
--- a/iot-dao/iot-temporal-serviceImpl-iotdb/pom.xml
+++ b/iot-dao/iot-temporal-serviceImpl-iotdb/pom.xml
@@ -5,7 +5,7 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-dao/iot-temporal-serviceImpl-td/pom.xml b/iot-dao/iot-temporal-serviceImpl-td/pom.xml
index 788f9a0e..801adf75 100644
--- a/iot-dao/iot-temporal-serviceImpl-td/pom.xml
+++ b/iot-dao/iot-temporal-serviceImpl-td/pom.xml
@@ -5,10 +5,10 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
iot-temporal-serviceImpl-td
diff --git a/iot-dao/iot-temporal-serviceImpl-ts/pom.xml b/iot-dao/iot-temporal-serviceImpl-ts/pom.xml
index b9678089..d50b97d1 100644
--- a/iot-dao/iot-temporal-serviceImpl-ts/pom.xml
+++ b/iot-dao/iot-temporal-serviceImpl-ts/pom.xml
@@ -6,9 +6,9 @@
iot-dao
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
iot-temporal-serviceImpl-ts
diff --git a/iot-dao/pom.xml b/iot-dao/pom.xml
index 8b4902d1..1700c51a 100644
--- a/iot-dao/pom.xml
+++ b/iot-dao/pom.xml
@@ -5,7 +5,7 @@
iotkit-parent
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
pom
diff --git a/iot-module/iot-manager/pom.xml b/iot-module/iot-manager/pom.xml
index 168219c1..72d98e8e 100644
--- a/iot-module/iot-manager/pom.xml
+++ b/iot-module/iot-manager/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java
index 00764256..b95ebaf1 100644
--- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java
+++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/PluginServiceImpl.java
@@ -6,7 +6,6 @@ import cc.iotkit.common.enums.ErrCode;
import cc.iotkit.common.exception.BizException;
import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.common.utils.StringUtils;
-import cc.iotkit.common.utils.file.FileUtils;
import cc.iotkit.data.manager.IPluginInfoData;
import cc.iotkit.manager.dto.bo.plugin.PluginInfoBo;
import cc.iotkit.manager.dto.vo.plugin.PluginInfoVo;
@@ -20,14 +19,11 @@ import com.gitee.starblues.integration.operator.PluginOperator;
import com.gitee.starblues.integration.operator.upload.UploadParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
-import java.io.File;
import java.nio.charset.Charset;
-import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.jar.JarEntry;
@@ -53,11 +49,15 @@ public class PluginServiceImpl implements IPluginService {
public void upload(MultipartFile file, Long id) {
try {
PluginInfo plugin = pluginInfoData.findById(id);
- if (plugin == null) {
+ if (file == null || plugin == null) {
throw new BizException(ErrCode.DATA_NOT_EXIST);
}
String pluginId = plugin.getPluginId();
+ if (!file.getName().contains(pluginId)) {
+ throw new BizException(ErrCode.PLUGIN_INSTALL_FAILED, "文件名与原插件id不匹配");
+ }
+
if (StringUtils.isNotBlank(pluginId)) {
//停止卸载旧的插件
com.gitee.starblues.core.PluginInfo pluginInfo = pluginOperator.getPluginInfo(pluginId);
@@ -78,26 +78,27 @@ public class PluginServiceImpl implements IPluginService {
throw new BizException(ErrCode.PLUGIN_INSTALL_FAILED);
}
- JarFile jarFile = new JarFile(pluginInfo.getPluginPath());
- // 获取config文件在jar包中的路径
- String configFile = "classes/config.json";
- JarEntry configEntry = jarFile.getJarEntry(configFile);
String configJson = "";
-
- if (configEntry != null) {
- //读取配置文件
- configJson = IoUtil.read(jarFile.getInputStream(configEntry), Charset.defaultCharset());
- log.info("configJson:{}", configJson);
- }
-
- //读取script.js脚本
- String scriptFile = "classes/script.js";
- JarEntry scriptEntity = jarFile.getJarEntry(scriptFile);
String script = "";
- if (scriptEntity != null) {
- //读取脚本文件
- script = IoUtil.read(jarFile.getInputStream(scriptEntity), Charset.defaultCharset());
- log.info("script:{}", script);
+ try (JarFile jarFile = new JarFile(pluginInfo.getPluginPath())) {
+ // 获取config文件在jar包中的路径
+ String configFile = "classes/config.json";
+ JarEntry configEntry = jarFile.getJarEntry(configFile);
+
+ if (configEntry != null) {
+ //读取配置文件
+ configJson = IoUtil.read(jarFile.getInputStream(configEntry), Charset.defaultCharset());
+ log.info("configJson:{}", configJson);
+ }
+
+ //读取script.js脚本
+ String scriptFile = "classes/script.js";
+ JarEntry scriptEntity = jarFile.getJarEntry(scriptFile);
+ if (scriptEntity != null) {
+ //读取脚本文件
+ script = IoUtil.read(jarFile.getInputStream(scriptEntity), Charset.defaultCharset());
+ log.info("script:{}", script);
+ }
}
PluginState pluginState = pluginInfo.getPluginState();
@@ -113,6 +114,8 @@ public class PluginServiceImpl implements IPluginService {
plugin.setVersion(pluginDescriptor.getPluginVersion());
plugin.setDescription(pluginDescriptor.getDescription());
pluginInfoData.save(plugin);
+ } catch (BizException e) {
+ throw e;
} catch (Exception e) {
throw new BizException(ErrCode.PLUGIN_INSTALL_FAILED, e);
}
diff --git a/iot-module/iot-message-notify/pom.xml b/iot-module/iot-message-notify/pom.xml
index 7a09ee13..a7f1920d 100644
--- a/iot-module/iot-message-notify/pom.xml
+++ b/iot-module/iot-message-notify/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/DingTalkEventListener.java b/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/DingTalkEventListener.java
index 1f42412d..74e53da2 100644
--- a/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/DingTalkEventListener.java
+++ b/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/DingTalkEventListener.java
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
public class DingTalkEventListener implements MessageEventListener {
+ WebClient client = WebClient.create(VertxManager.INSTANCE.getVertx());
@Override
@EventListener(classes = MessageEvent.class, condition = "#event.message.channel=='DingTalk'")
@@ -27,13 +28,14 @@ public class DingTalkEventListener implements MessageEventListener {
String channelConfig = message.getChannelConfig();
DingTalkConfig dingTalkConfig = JsonUtils.parse(channelConfig, DingTalkConfig.class);
- WebClient client = WebClient.create(VertxManager.INSTANCE.getVertx());
DingTalkMessage qyWechatMessage = DingTalkMessage.builder()
.msgtype("text")
.text(DingTalkMessage.MessageContent.builder().content(message.getFormatContent()).build())
.build();
- client.post(dingTalkConfig.getDingTalkWebhook()).sendJson(qyWechatMessage)
+
+ client.getAbs(dingTalkConfig.getDingTalkWebhook()).sendJson(qyWechatMessage)
.onSuccess(response -> log.info("Received response with status code" + response.statusCode()))
.onFailure(err -> log.error("Something went wrong " + err.getMessage()));
}
+
}
diff --git a/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/QyWechatEventListener.java b/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/QyWechatEventListener.java
index 83d3da0e..b75d2801 100644
--- a/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/QyWechatEventListener.java
+++ b/iot-module/iot-message-notify/src/main/java/cc/iotkit/message/listener/QyWechatEventListener.java
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component
public class QyWechatEventListener implements MessageEventListener {
+ WebClient client = WebClient.create(VertxManager.INSTANCE.getVertx());
@Override
@EventListener(classes = MessageEvent.class, condition = "#event.message.channel=='QyWechat'")
@@ -27,12 +28,12 @@ public class QyWechatEventListener implements MessageEventListener {
String channelConfig = message.getChannelConfig();
QyWechatConfig qyWechatConfig = JsonUtils.parse(channelConfig, QyWechatConfig.class);
- WebClient client = WebClient.create(VertxManager.INSTANCE.getVertx());
QyWechatMessage qyWechatMessage = QyWechatMessage.builder()
.msgtype("text")
.text(QyWechatMessage.MessageContent.builder().content(message.getFormatContent()).build())
.build();
- client.post(qyWechatConfig.getQyWechatWebhook()).sendJson(qyWechatMessage)
+
+ client.getAbs(qyWechatConfig.getQyWechatWebhook()).sendJson(qyWechatMessage)
.onSuccess(response -> log.info("Received response with status code" + response.statusCode()))
.onFailure(err -> log.error("Something went wrong " + err.getMessage()));
}
diff --git a/iot-module/iot-openapi/pom.xml b/iot-module/iot-openapi/pom.xml
index abc9694c..fac9bf85 100644
--- a/iot-module/iot-openapi/pom.xml
+++ b/iot-module/iot-openapi/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-module/iot-plugin/iot-plugin-core/pom.xml b/iot-module/iot-plugin/iot-plugin-core/pom.xml
deleted file mode 100644
index 5b11f3f9..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/pom.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- iot-plugin
- cc.iotkit
- 0.5.1-SNAPSHOT
-
- 4.0.0
-
- iot-plugin-core
-
-
-
-
- cc.iotkit
- iot-common-core
-
-
-
- cc.iotkit
- iot-script-engine
-
-
-
- cc.iotkit
- iot-message-core
-
-
-
- cc.iotkit
- iot-data-service
-
-
-
-
-
- com.gitee.starblues
- spring-brick
-
-
-
-
-
\ No newline at end of file
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPlugin.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPlugin.java
deleted file mode 100644
index 6dd24a74..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPlugin.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package cc.iotkit.plugin.core;
-
-
-import java.util.Map;
-
-/**
- * 插件接口
- *
- * @author sjg
- */
-public interface IPlugin {
-
- /**
- * 获取设备连接信息,如连接mqtt的ip、端口、账号、密码。。。
- *
- * @param pk 产品key
- * @param dn 设备dn
- * @return 连接配置项
- */
- Map getLinkInfo(String pk, String dn);
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPluginConfig.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPluginConfig.java
deleted file mode 100644
index 77c964f8..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPluginConfig.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cc.iotkit.plugin.core;
-
-
-import java.util.Map;
-
-/**
- * 插件配置接口
- *
- * @author sjg
- */
-public interface IPluginConfig {
-
- /**
- * 获取系统中配置的插件配置项
- *
- * @param pluginId 插件id
- * @return config
- */
- Map getConfig(String pluginId);
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPluginScript.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPluginScript.java
deleted file mode 100644
index 3859bfd2..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/IPluginScript.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package cc.iotkit.plugin.core;
-
-import cc.iotkit.script.IScriptEngine;
-
-/**
- * 插件宿主接口
- *
- * @author sjg
- */
-public interface IPluginScript {
-
- /**
- * 获取插件对应的脚本引擎
- *
- * @param pluginId 插件id
- * @return IScriptEngine
- */
- IScriptEngine getScriptEngine(String pluginId);
-
- /**
- * 重新加载脚本
- *
- * @param pluginId 插件id
- */
- void reloadScript(String pluginId);
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/LocalPluginConfig.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/LocalPluginConfig.java
deleted file mode 100644
index a8703a3d..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/LocalPluginConfig.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package cc.iotkit.plugin.core;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 本地独立运行的插件配置
- *
- * @author sjg
- */
-public class LocalPluginConfig implements IPluginConfig {
- @Override
- public Map getConfig(String pluginId) {
- //本地的直接用程序中默认值
- return new HashMap<>(0);
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/LocalPluginScript.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/LocalPluginScript.java
deleted file mode 100644
index da82eb3e..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/LocalPluginScript.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package cc.iotkit.plugin.core;
-
-import cc.iotkit.common.utils.StringUtils;
-import cc.iotkit.common.utils.file.FileUtils;
-import cc.iotkit.script.IScriptEngine;
-import cc.iotkit.script.ScriptEngineFactory;
-
-import java.net.URL;
-import java.nio.charset.Charset;
-
-/**
- * 本地独立运行的插件脚本实现
- *
- * @author sjg
- */
-public class LocalPluginScript implements IPluginScript {
-
- private IScriptEngine scriptEngine;
-
- public LocalPluginScript(String scriptPath) {
- if (StringUtils.isBlank(scriptPath)) {
- return;
- }
- URL resource = LocalPluginScript.class.getClassLoader().getResource(scriptPath);
- if (resource == null) {
- return;
- }
-
- String script = FileUtils.readString(resource.getFile(), Charset.defaultCharset());
- initScriptEngine(script);
- }
-
- public IScriptEngine initScriptEngine(String script) {
- if (StringUtils.isBlank(script)) {
- return null;
- }
-
- scriptEngine = ScriptEngineFactory.getJsEngine(script);
- return scriptEngine;
- }
-
- @Override
- public IScriptEngine getScriptEngine(String pluginId) {
- return scriptEngine;
- }
-
- @Override
- public void reloadScript(String pluginId) {
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/IDevice.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/IDevice.java
deleted file mode 100644
index d97e6a61..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/IDevice.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package cc.iotkit.plugin.core.thing;
-
-import cc.iotkit.plugin.core.thing.actions.ActionResult;
-import cc.iotkit.plugin.core.thing.actions.down.DeviceConfig;
-import cc.iotkit.plugin.core.thing.actions.down.PropertyGet;
-import cc.iotkit.plugin.core.thing.actions.down.PropertySet;
-import cc.iotkit.plugin.core.thing.actions.down.ServiceInvoke;
-
-
-/**
- * 设备接口
- *
- * @author sjg
- */
-public interface IDevice {
-
- /**
- * 执行设备配置动作
- *
- * @param action 动作
- * @return result
- */
- ActionResult config(DeviceConfig action);
-
- /**
- * 执行设备属性获取动作
- *
- * @param action 动作
- * @return result
- */
- ActionResult propertyGet(PropertyGet action);
-
- /**
- * 执行设备属性设置动作
- *
- * @param action 动作
- * @return result
- */
- ActionResult propertySet(PropertySet action);
-
- /**
- * 执行设备服务调用动作
- *
- * @param action 动作
- * @return result
- */
- ActionResult serviceInvoke(ServiceInvoke action);
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/IThingService.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/IThingService.java
deleted file mode 100644
index 4739600d..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/IThingService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package cc.iotkit.plugin.core.thing;
-
-import cc.iotkit.model.device.DeviceInfo;
-import cc.iotkit.model.product.Product;
-import cc.iotkit.plugin.core.thing.actions.ActionResult;
-import cc.iotkit.plugin.core.thing.actions.IDeviceAction;
-
-import java.util.Map;
-
-/**
- * 设备服务接口
- *
- * @author sjg
- */
-public interface IThingService {
-
- /**
- * 提交设备行为
- *
- * @param action IDeviceAction
- * @return result
- */
- ActionResult post(String pluginId, IDeviceAction action);
-
- /**
- * 获取产品信息
- *
- * @param pk 产品key
- * @return Product
- */
- Product getProduct(String pk);
-
- /**
- * 获取设备信息
- *
- * @param deviceName 设备dn
- * @return DeviceInfo
- */
- DeviceInfo getDevice(String deviceName);
-
- /**
- * 获取设备当前属性数据
- *
- * @param deviceName 设备dn
- * @return 当前属性
- */
- Map getProperty(String deviceName);
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/AbstractAction.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/AbstractAction.java
deleted file mode 100644
index dafe9170..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/AbstractAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions;
-
-import lombok.Data;
-import lombok.ToString;
-import lombok.experimental.SuperBuilder;
-
-/**
- * @author sjg
- */
-@Data
-@SuperBuilder
-@ToString(callSuper = true)
-public abstract class AbstractAction implements IDeviceAction {
-
- protected String id;
-
- protected ActionType type;
-
- protected String productKey;
-
- protected String deviceName;
-
- protected Long time;
-
- public AbstractAction() {
- }
-
- public AbstractAction(ActionType type) {
- this.type = type;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionResult.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionResult.java
deleted file mode 100644
index ec6c2d49..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionResult.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * 动作执行结果
- *
- * @author sjg
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@Builder
-public class ActionResult {
-
- /**
- * 状态码,0:成功,x:其它错误码
- */
- private int code;
-
- /**
- * 失败原因
- */
- private String reason;
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java
deleted file mode 100644
index 011aa006..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/ActionType.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 设备物行为类型
- *
- * @author sjg
- */
-@Getter
-@AllArgsConstructor
-public enum ActionType {
-
- //注册
- REGISTER("register"),
- //设备拓扑更新
- TOPOLOGY("topology"),
- //在离线状态变更
- STATE_CHANGE("state_change"),
- //属性上报
- PROPERTY_REPORT("property_report"),
- //事件上报
- EVENT_REPORT("event_report"),
- //服务回复
- SERVICE_REPLY("service_reply"),
-
- //属性设置
- PROPERTY_SET("property_set"),
- //属性获取
- PROPERTY_GET("property_get"),
- //服务调用
- SERVICE_INVOKE("service_invoke"),
- //配置
- CONFIG("config");
-
- private final String type;
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/DeviceState.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/DeviceState.java
deleted file mode 100644
index 1e107a93..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/DeviceState.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 设备状态
- * @author sjg
- */
-@Getter
-@AllArgsConstructor
-public enum DeviceState {
-
- //在线
- ONLINE("online"),
- //离线
- OFFLINE("offline");
-
- private final String state;
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/EventLevel.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/EventLevel.java
deleted file mode 100644
index 13e004b4..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/EventLevel.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * 事件级别
- *
- * @author sjg
- */
-@Getter
-@AllArgsConstructor
-public enum EventLevel {
-
- //信息
- INFO("info"),
- //告警
- WARN("warn"),
- //错误
- ERROR("error");
-
- private final String type;
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/IDeviceAction.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/IDeviceAction.java
deleted file mode 100644
index 35219b44..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/IDeviceAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions;
-
-/**
- * 设备行为
- *
- * @author sjg
- */
-public interface IDeviceAction {
-
- /**
- * 获取唯一标识id
- *
- * @return id
- */
- String getId();
-
- /**
- * 设置id
- *
- * @param id id
- */
- void setId(String id);
-
- /**
- * 获取类型
- *
- * @return ActionType
- */
- ActionType getType();
-
- /**
- * 设备类型
- *
- * @param type type
- */
- void setType(ActionType type);
-
- /**
- * 获取产品key
- *
- * @return ProductKey
- */
- String getProductKey();
-
- /**
- * 设置产品key
- *
- * @param productKey pk
- */
- void setProductKey(String productKey);
-
- /**
- * 获取设备DN
- *
- * @return DN
- */
- String getDeviceName();
-
- /**
- * 设置设备DN
- *
- * @param deviceName dn
- */
- void setDeviceName(String deviceName);
-
- /**
- * 获取时间
- *
- * @return timespan
- */
- Long getTime();
-
- /**
- * 设置时间
- *
- * @param time timestamp
- */
- void setTime(Long time);
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/DeviceConfig.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/DeviceConfig.java
deleted file mode 100644
index 5af69661..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/DeviceConfig.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.down;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-import java.util.Map;
-
-/**
- * 设备配置
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-public class DeviceConfig extends AbstractAction {
-
- /**
- * 配置模块
- */
- private String module;
-
- /**
- * 配置信息
- */
- private Map config;
-
- @Override
- public ActionType getType() {
- return ActionType.CONFIG;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/PropertyGet.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/PropertyGet.java
deleted file mode 100644
index 080ee240..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/PropertyGet.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.down;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-import java.util.List;
-
-/**
- * 属性获取
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-public class PropertyGet extends AbstractAction {
-
- /**
- * 属性列表
- */
- private List keys;
-
- @Override
- public ActionType getType() {
- return ActionType.PROPERTY_GET;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/PropertySet.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/PropertySet.java
deleted file mode 100644
index fc74efb1..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/PropertySet.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.down;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-import java.util.Map;
-
-/**
- * 属性设置
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-public class PropertySet extends AbstractAction {
-
- /**
- * 属性参数
- */
- private Map params;
-
- @Override
- public ActionType getType() {
- return ActionType.PROPERTY_SET;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/ServiceInvoke.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/ServiceInvoke.java
deleted file mode 100644
index f76394e6..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/down/ServiceInvoke.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.down;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-
-import java.util.Map;
-
-/**
- * 服务调用
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-public class ServiceInvoke extends AbstractAction {
-
- /**
- * 服务名
- */
- private String name;
-
- /**
- * 服务参数
- */
- private Map params;
-
- /**
- * 配置信息
- */
- private Map config;
-
- @Override
- public ActionType getType() {
- return ActionType.SERVICE_INVOKE;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceRegister.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceRegister.java
deleted file mode 100644
index ec1e448e..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceRegister.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.up;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
-/**
- * 设备注册动作
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-@ToString(callSuper = true)
-public class DeviceRegister extends AbstractAction {
-
- /**
- * 型号
- */
- private String model;
-
- /**
- * 版本号
- */
- private String version;
-
- @Override
- public ActionType getType() {
- return ActionType.REGISTER;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceStateChange.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceStateChange.java
deleted file mode 100644
index 17579528..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceStateChange.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.up;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import cc.iotkit.plugin.core.thing.actions.DeviceState;
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
-/**
- * 设备在线状态变更
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-@ToString(callSuper = true)
-public class DeviceStateChange extends AbstractAction {
-
- private DeviceState state;
-
- @Override
- public ActionType getType() {
- return ActionType.STATE_CHANGE;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceTopology.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceTopology.java
deleted file mode 100644
index b483bdd0..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/DeviceTopology.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.up;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
-import java.util.List;
-
-/**
- * 设备拓扑更新
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-@ToString(callSuper = true)
-public class DeviceTopology extends AbstractAction {
-
- /**
- * 父设备下的子设备列表
- */
- private List subDevices;
-
- @Override
- public ActionType getType() {
- return ActionType.TOPOLOGY;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/EventReport.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/EventReport.java
deleted file mode 100644
index 60d804f7..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/EventReport.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.up;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import cc.iotkit.plugin.core.thing.actions.EventLevel;
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
-import java.util.Map;
-
-/**
- * 事件上报
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-@ToString(callSuper = true)
-public class EventReport extends AbstractAction {
-
- /**
- * 事件名
- */
- private String name;
-
- /**
- * 事件级别
- */
- private EventLevel level;
-
- /**
- * 事件参数
- */
- private Map params;
-
- @Override
- public ActionType getType() {
- return ActionType.EVENT_REPORT;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/PropertyReport.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/PropertyReport.java
deleted file mode 100644
index d06a2a1b..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/PropertyReport.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.up;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
-import java.util.Map;
-
-/**
- * 属性上报
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-@ToString(callSuper = true)
-public class PropertyReport extends AbstractAction {
-
- /**
- * 属性参数
- */
- private Map params;
-
- @Override
- public ActionType getType() {
- return ActionType.PROPERTY_REPORT;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/ServiceReply.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/ServiceReply.java
deleted file mode 100644
index a186b9b7..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/actions/up/ServiceReply.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cc.iotkit.plugin.core.thing.actions.up;
-
-
-import cc.iotkit.plugin.core.thing.actions.AbstractAction;
-import cc.iotkit.plugin.core.thing.actions.ActionType;
-import lombok.*;
-import lombok.experimental.SuperBuilder;
-
-import java.util.Map;
-
-/**
- * 服务回复
- *
- * @author sjg
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder
-@ToString(callSuper = true)
-public class ServiceReply extends AbstractAction {
-
- /**
- * 服务名
- */
- private String name;
-
- /**
- * 回复服务id
- */
- private String replyId;
-
- /**
- * 状态码,0:成功,x:失败错误码
- */
- private int code;
-
- /**
- * 服务回复参数
- */
- private Map params;
-
- @Override
- public ActionType getType() {
- return ActionType.SERVICE_REPLY;
- }
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/model/ThingDevice.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/model/ThingDevice.java
deleted file mode 100644
index 4638a913..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/model/ThingDevice.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package cc.iotkit.plugin.core.thing.model;
-
-import lombok.Data;
-
-/**
- * 设备信息
- *
- * @author sjg
- */
-@Data
-public class ThingDevice {
-
- private String deviceId;
-
- /**
- * 产品key
- */
- private String productKey;
-
- /**
- * 设备dn
- */
- private String deviceName;
-
- /**
- * 设备型号
- */
- private String model;
-
- /**
- * 设备密钥
- */
- private String secret;
-}
diff --git a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/model/ThingProduct.java b/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/model/ThingProduct.java
deleted file mode 100644
index cbd456d5..00000000
--- a/iot-module/iot-plugin/iot-plugin-core/src/main/java/cc/iotkit/plugin/core/thing/model/ThingProduct.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package cc.iotkit.plugin.core.thing.model;
-
-import lombok.Data;
-
-/**
- * 产品信息
- *
- * @author sjg
- */
-@Data
-public class ThingProduct {
-
- private String productKey;
-
- private String productSecret;
-
- private String name;
-
- private String category;
-
- private Integer nodeType;
-
-}
diff --git a/iot-module/iot-plugin/iot-plugin-main/pom.xml b/iot-module/iot-plugin/iot-plugin-main/pom.xml
index 43489ebe..2b5ecaf4 100644
--- a/iot-module/iot-plugin/iot-plugin-main/pom.xml
+++ b/iot-module/iot-plugin/iot-plugin-main/pom.xml
@@ -5,7 +5,7 @@
iot-plugin
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
@@ -13,11 +13,6 @@
-
- cc.iotkit
- iot-common-thing
-
-
cc.iotkit
iot-plugin-core
@@ -28,6 +23,11 @@
iot-common-redis
+
+ cc.iotkit
+ iot-data-service
+
+
cc.iotkit
iot-temporal-service
diff --git a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginInitListener.java b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginInitListener.java
index d1f64a31..daa56cfe 100644
--- a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginInitListener.java
+++ b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginInitListener.java
@@ -13,7 +13,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
-import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
diff --git a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java
index 22db6d7e..cdd58a7a 100644
--- a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java
+++ b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/PluginMainImpl.java
@@ -29,7 +29,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
diff --git a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java
index 96b53b8c..4a57fa8d 100644
--- a/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java
+++ b/iot-module/iot-plugin/iot-plugin-main/src/main/java/cc/iotkit/plugin/main/ThingServiceImpl.java
@@ -16,6 +16,8 @@ import cc.iotkit.mq.MqProducer;
import cc.iotkit.plugin.core.thing.IThingService;
import cc.iotkit.plugin.core.thing.actions.*;
import cc.iotkit.plugin.core.thing.actions.up.*;
+import cc.iotkit.plugin.core.thing.model.ThingDevice;
+import cc.iotkit.plugin.core.thing.model.ThingProduct;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,7 +58,7 @@ public class ThingServiceImpl implements IThingService {
//添加设备路由
deviceRouter.putRouter(deviceName, new PluginRouter(IPluginMain.MAIN_ID, pluginId));
- DeviceInfo device = getDevice(deviceName);
+ DeviceInfo device = getDeviceInfo(deviceName);
if (device == null) {
log.warn("device:{} is not found.", deviceName);
}
@@ -121,17 +123,26 @@ public class ThingServiceImpl implements IThingService {
}
@Override
- public Product getProduct(String pk) {
+ public ThingProduct getProduct(String pk) {
try {
- return productData.findByProductKey(pk);
+ Product product = productData.findByProductKey(pk);
+ if(product==null){
+ return null;
+ }
+ return ThingProduct.builder()
+ .category(product.getCategory())
+ .productKey(product.getProductKey())
+ .name(product.getName())
+ .nodeType(product.getNodeType())
+ .productSecret(product.getProductSecret())
+ .build();
} catch (Throwable e) {
log.error("get product error", e);
return null;
}
}
- @Override
- public DeviceInfo getDevice(String dn) {
+ public DeviceInfo getDeviceInfo(String dn) {
try {
return deviceInfoData.findByDeviceName(dn);
} catch (Throwable e) {
@@ -140,9 +151,24 @@ public class ThingServiceImpl implements IThingService {
}
}
+ @Override
+ public ThingDevice getDevice(String dn) {
+ DeviceInfo deviceInfo = getDeviceInfo(dn);
+ if(deviceInfo==null){
+ return null;
+ }
+ return ThingDevice.builder()
+ .deviceId(deviceInfo.getDeviceId())
+ .deviceName(deviceInfo.getDeviceName())
+ .model(deviceInfo.getModel())
+ .productKey(deviceInfo.getProductKey())
+ .secret(deviceInfo.getSecret())
+ .build();
+ }
+
@Override
public Map getProperty(String deviceName) {
- DeviceInfo device = getDevice(deviceName);
+ DeviceInfo device = getDeviceInfo(deviceName);
if (device == null) {
return new HashMap<>(0);
}
@@ -153,7 +179,7 @@ public class ThingServiceImpl implements IThingService {
String productKey = register.getProductKey();
//指定了pk需验证
if (StringUtils.isNotBlank(productKey)) {
- Product product = getProduct(productKey);
+ ThingProduct product = getProduct(productKey);
if (product == null) {
throw new BizException(ErrCode.PRODUCT_NOT_FOUND);
}
@@ -163,21 +189,21 @@ public class ThingServiceImpl implements IThingService {
log.info("device already registered");
} else {
//不存在,注册新设备
- device = new DeviceInfo();
- device.setId(DeviceUtil.newDeviceId(register.getDeviceName()));
- device.setDeviceId(device.getId());
- device.setProductKey(productKey);
- device.setDeviceName(register.getDeviceName());
- device.setModel(register.getModel());
- device.setSecret(RandomStringUtils.randomAlphabetic(16));
+ DeviceInfo deviceInfo = new DeviceInfo();
+ deviceInfo.setId(DeviceUtil.newDeviceId(register.getDeviceName()));
+ deviceInfo.setDeviceId(deviceInfo.getId());
+ deviceInfo.setProductKey(productKey);
+ deviceInfo.setDeviceName(register.getDeviceName());
+ deviceInfo.setModel(register.getModel());
+ deviceInfo.setSecret(RandomStringUtils.randomAlphabetic(16));
//默认离线
- device.setState(new DeviceInfo.State(false, null, null));
- device.setCreateAt(System.currentTimeMillis());
- deviceInfoData.save(device);
+ deviceInfo.setState(new DeviceInfo.State(false, null, null));
+ deviceInfo.setCreateAt(System.currentTimeMillis());
+ deviceInfoData.save(deviceInfo);
log.info("device registered:{}", JsonUtils.toJsonString(device));
publishMsg(
- device,
+ deviceInfo,
register,
ThingModelMessage.builder()
.type(ThingModelMessage.TYPE_LIFETIME)
@@ -210,7 +236,7 @@ public class ThingServiceImpl implements IThingService {
private void deviceTopologyUpdate(DeviceInfo device, DeviceTopology topology) {
//设备拓扑关系更新
for (String deviceName : topology.getSubDevices()) {
- DeviceInfo subDevice = getDevice(deviceName);
+ DeviceInfo subDevice = getDeviceInfo(deviceName);
subDevice.setParentId(device.getDeviceId());
deviceInfoData.save(subDevice);
}
diff --git a/iot-module/iot-plugin/pom.xml b/iot-module/iot-plugin/pom.xml
index c8234346..59aa4cf3 100644
--- a/iot-module/iot-plugin/pom.xml
+++ b/iot-module/iot-plugin/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
@@ -13,7 +13,6 @@
pom
- iot-plugin-core
iot-plugin-main
diff --git a/iot-module/iot-rule-engine/pom.xml b/iot-module/iot-rule-engine/pom.xml
index 176967ef..068276c6 100644
--- a/iot-module/iot-rule-engine/pom.xml
+++ b/iot-module/iot-rule-engine/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-module/iot-screen/pom.xml b/iot-module/iot-screen/pom.xml
index 19e36cbf..6eaec0b4 100644
--- a/iot-module/iot-screen/pom.xml
+++ b/iot-module/iot-screen/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-module/iot-system/pom.xml b/iot-module/iot-system/pom.xml
index bcdacdc5..1f405dde 100644
--- a/iot-module/iot-system/pom.xml
+++ b/iot-module/iot-system/pom.xml
@@ -5,7 +5,7 @@
iot-module
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-module/pom.xml b/iot-module/pom.xml
index 60f44b1b..074907d3 100644
--- a/iot-module/pom.xml
+++ b/iot-module/pom.xml
@@ -5,7 +5,7 @@
iotkit-parent
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-starter/pom.xml b/iot-starter/pom.xml
index 0e0261f5..fdc66309 100644
--- a/iot-starter/pom.xml
+++ b/iot-starter/pom.xml
@@ -5,7 +5,7 @@
iotkit-parent
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
@@ -13,6 +13,16 @@
jar
+
+ io.vertx
+ vertx-core
+
+
+
+ io.vertx
+ vertx-web-client
+
+
cc.iotkit
iot-common-tenant
diff --git a/iot-test-tool/iot-virtual-device/pom.xml b/iot-test-tool/iot-virtual-device/pom.xml
index 6f5835d2..2f88212b 100644
--- a/iot-test-tool/iot-virtual-device/pom.xml
+++ b/iot-test-tool/iot-virtual-device/pom.xml
@@ -5,7 +5,7 @@
iot-test-tool
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
diff --git a/iot-test-tool/pom.xml b/iot-test-tool/pom.xml
index 82b9aa03..865335b7 100755
--- a/iot-test-tool/pom.xml
+++ b/iot-test-tool/pom.xml
@@ -5,7 +5,7 @@
iotkit-parent
cc.iotkit
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
4.0.0
pom
diff --git a/pom.xml b/pom.xml
index 77a9f030..9fe0b1a3 100755
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
cc.iotkit
iotkit-parent
- 0.5.1-SNAPSHOT
+ 0.5.2-SNAPSHOT
${project.artifactId}
奇特物联是一个开源的物联网基础开发平台,提供了物联网及相关业务开发的常见基础功能,
能帮助你快速搭建自己的物联网相关业务平台。
@@ -29,7 +29,7 @@
11
- 1.0.1
+ 1.0.2
2.7.11
4.2.2
1.34.0
@@ -37,7 +37,7 @@
3.7
5.8.18
1.3.1
- 3.1.3
+ 3.1.4
@@ -391,7 +391,7 @@
cc.iotkit
iot-plugin-core
- ${project.version}
+ ${iot-iita-core.version}