From 58a633dbe0c548af91c398a92a0e5d8a92654299 Mon Sep 17 00:00:00 2001 From: xiwa Date: Tue, 21 Jun 2022 17:00:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E7=94=A8es=E4=BD=9C=E4=B8=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AD=98=E5=82=A8=EF=BC=8C=E5=A4=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9D=83?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + common/pom.xml | 2 +- .../iotkit/common/ComponentClassLoader.java | 9 + .../main/java/cc/iotkit/common/Constants.java | 9 + .../iotkit/common/exception/BizException.java | 9 + .../common/exception/NotFoundException.java | 9 + .../common/exception/OfflineException.java | 9 + .../cc/iotkit/common/thing/ThingService.java | 9 + .../cc/iotkit/common/utils/CodecUtil.java | 9 + .../cc/iotkit/common/utils/DeviceUtil.java | 9 + .../java/cc/iotkit/common/utils/HexUtil.java | 9 + .../java/cc/iotkit/common/utils/JsonUtil.java | 9 + .../cc/iotkit/common/utils/ReflectUtil.java | 10 +- .../cc/iotkit/common/utils/ThreadUtil.java | 9 + .../cc/iotkit/common/utils/UniqueIdUtil.java | 9 + dao/pom.xml | 15 +- .../iotkit/dao/AligenieDeviceRepository.java | 15 +- .../iotkit/dao/AligenieProductRepository.java | 15 +- .../cc/iotkit/dao/AppDesignRepository.java | 22 +- .../java/cc/iotkit/dao/AppInfoRepository.java | 15 +- .../java/cc/iotkit/dao/CategoryCache.java | 10 + .../cc/iotkit/dao/CategoryRepository.java | 16 +- .../main/java/cc/iotkit/dao/CommonDao.java | 61 + dao/src/main/java/cc/iotkit/dao/DaoTool.java | 53 - .../main/java/cc/iotkit/dao/DeviceCache.java | 15 +- .../main/java/cc/iotkit/dao/DeviceDao.java | 204 +- .../cc/iotkit/dao/DeviceGroupRepository.java | 15 +- .../cc/iotkit/dao/DeviceInfoRepository.java | 31 + .../java/cc/iotkit/dao/DevicePropertyDao.java | 9 + .../iotkit/dao/DevicePropertyRepository.java | 11 +- .../java/cc/iotkit/dao/DeviceReportDao.java | 9 + .../cc/iotkit/dao/DeviceReportRepository.java | 11 +- .../java/cc/iotkit/dao/DeviceRepository.java | 22 - .../java/cc/iotkit/dao/HomeRepository.java | 20 +- .../java/cc/iotkit/dao/OauthClientCache.java | 9 + .../cc/iotkit/dao/OauthClientRepository.java | 15 +- .../main/java/cc/iotkit/dao/ProductCache.java | 9 + .../cc/iotkit/dao/ProductModelRepository.java | 15 +- .../java/cc/iotkit/dao/ProductRepository.java | 18 +- .../dao/ProtocolComponentRepository.java | 15 +- .../dao/ProtocolConverterRepository.java | 15 +- .../iotkit/dao/ProtocolGatewayRepository.java | 11 - .../cc/iotkit/dao/RuleInfoRepository.java | 21 +- .../java/cc/iotkit/dao/RuleLogRepository.java | 11 +- .../cc/iotkit/dao/SpaceDeviceRepository.java | 19 +- .../java/cc/iotkit/dao/SpaceRepository.java | 17 +- .../cc/iotkit/dao/TaskInfoRepository.java | 20 +- .../java/cc/iotkit/dao/TaskLogRepository.java | 11 +- .../dao/ThingModelMessageRepository.java | 11 +- .../cc/iotkit/dao/ThingModelRepository.java | 15 +- .../dao/ThirdUserSessionRepository.java | 6 +- .../iotkit/dao/UserActionLogRepository.java | 15 +- .../cc/iotkit/dao/UserInfoRepository.java | 15 +- .../dao/VirtualDeviceLogRepository.java | 11 +- .../iotkit/dao/VirtualDeviceRepository.java | 15 +- .../config/ElasticsearchConfiguration.java | 10 + .../iotkit/dao/config/RepositoryConfig.java | 48 - ....jar => mqtt-component-0.3.0-SNAPSHOT.jar} | Bin 2038748 -> 2038748 bytes data/init/category.json | 42 + data/init/deviceGroup.json | 26 + data/init/deviceInfo.json | 1655 +++++++++++++++++ data/init/home.json | 54 + data/init/oauthClient.json | 16 + data/init/product.json | 133 ++ data/init/productModel.json | 11 + data/init/protocolComponent.json | 62 + data/init/protocolConverter.json | 23 + data/init/ruleInfo.json | 95 + data/init/space.json | 65 + data/init/spaceDevice.json | 101 + data/init/taskInfo.json | 35 + data/init/thingModel.json | 980 ++++++++++ data/init/userInfo.json | 140 ++ data/init/virtualDevice.json | 137 ++ manager/pom.xml | 4 +- .../java/cc/iotkit/manager/Application.java | 9 + .../iotkit/manager/config/AliyunConfig.java | 9 + .../cc/iotkit/manager/config/CacheConfig.java | 9 + .../cc/iotkit/manager/config/CrossConfig.java | 9 + .../config/EmbeddedElasticSearchConfig.java | 9 + .../manager/controller/AppController.java | 25 +- .../manager/controller/DeviceController.java | 57 +- .../manager/controller/ProductController.java | 44 +- .../controller/ProtocolController.java | 2 - .../controller/RuleEngineController.java | 27 +- .../controller/SpaceDeviceController.java | 32 +- .../manager/controller/StatsController.java | 15 +- .../controller/VirtualDeviceController.java | 9 + .../aligenie/AligenieDeviceController.java | 13 +- .../aligenie/AligenieProductController.java | 9 + .../controller/api/AccountController.java | 17 +- .../controller/api/DeviceController.java | 26 +- .../controller/api/HomeController.java | 22 +- .../controller/api/ProductController.java | 14 +- .../controller/api/SpaceController.java | 58 +- .../model/aligenie/AligenieProductVo.java | 9 + .../iotkit/manager/model/vo/AppDesignVo.java | 9 + .../iotkit/manager/model/vo/AppPageNode.java | 9 + .../cc/iotkit/manager/model/vo/DeviceLog.java | 9 + .../iotkit/manager/model/vo/LoginResult.java | 9 + .../cc/iotkit/manager/model/vo/MessageVo.java | 9 + .../manager/model/vo/SpaceDeviceVo.java | 11 +- .../cc/iotkit/manager/model/vo/SpaceInfo.java | 9 + .../manager/service/AppDesignService.java | 15 +- .../manager/service/DataOwnerService.java | 15 +- .../iotkit/manager/service/DeviceService.java | 17 +- .../manager/service/DeviceStateCheckTask.java | 9 + .../manager/service/ExampleDataInit.java | 105 ++ .../manager/service/SpaceDeviceService.java | 15 +- .../manager/service/ThingModelService.java | 9 + .../iotkit/manager/service/WeChatService.java | 9 + .../cc/iotkit/manager/utils/WeChatUtil.java | 9 + .../src/main/resources/application-dev.yml | 6 - manager/src/main/resources/application.yml | 6 - message-bus/pom.xml | 2 +- .../main/java/cc/iotkit/mq/MqConsumer.java | 9 + .../main/java/cc/iotkit/mq/MqProducer.java | 9 + .../cc/iotkit/mq/vertx/VertxMqConsumer.java | 9 + model/pom.xml | 9 +- .../main/java/cc/iotkit/model/AppInfo.java | 17 +- .../java/cc/iotkit/model/InvokeResult.java | 9 + .../java/cc/iotkit/model/OauthClient.java | 7 +- .../src/main/java/cc/iotkit/model/Owned.java | 9 + .../src/main/java/cc/iotkit/model/Paging.java | 9 + model/src/main/java/cc/iotkit/model/Role.java | 13 +- .../main/java/cc/iotkit/model/SendCmd.java | 9 + .../cc/iotkit/model/ThirdUserSession.java | 7 +- .../java/cc/iotkit/model/UserAccount.java | 24 - .../java/cc/iotkit/model/UserActionLog.java | 20 +- .../main/java/cc/iotkit/model/UserInfo.java | 16 +- .../cc/iotkit/model/alert/AlertConfig.java | 16 +- .../iotkit/model/aligenie/AligenieDevice.java | 13 +- .../model/aligenie/AligenieProduct.java | 16 +- .../cc/iotkit/model/device/DeviceGroup.java | 7 +- .../cc/iotkit/model/device/DeviceInfo.java | 16 +- .../cc/iotkit/model/device/VirtualDevice.java | 7 +- .../iotkit/model/device/VirtualDeviceLog.java | 12 + .../model/device/message/DeviceProperty.java | 9 + .../device/message/ThingModelMessage.java | 9 + .../main/java/cc/iotkit/model/mq/Request.java | 20 - .../java/cc/iotkit/model/mq/Response.java | 25 - .../cc/iotkit/model/product/AppDesign.java | 18 +- .../cc/iotkit/model/product/Category.java | 16 +- .../java/cc/iotkit/model/product/Product.java | 16 +- .../cc/iotkit/model/product/ProductModel.java | 8 +- .../cc/iotkit/model/product/ThingModel.java | 19 +- .../model/protocol/ProtocolComponent.java | 16 +- .../model/protocol/ProtocolConverter.java | 16 +- .../java/cc/iotkit/model/rule/RuleAction.java | 9 + .../java/cc/iotkit/model/rule/RuleInfo.java | 7 +- .../java/cc/iotkit/model/rule/TaskInfo.java | 16 +- .../java/cc/iotkit/model/rule/TaskLog.java | 9 + .../main/java/cc/iotkit/model/space/Home.java | 13 +- .../java/cc/iotkit/model/space/Space.java | 16 +- .../cc/iotkit/model/space/SpaceDevice.java | 17 +- oauth2-server/pom.xml | 2 +- .../main/java/cc/iotkit/utils/AuthUtil.java | 9 + pom.xml | 10 +- protocol-gateway/component-server/pom.xml | 2 +- .../iotkit/comps/DeviceComponentManager.java | 9 + .../comps/service/DeviceBehaviourService.java | 14 +- protocol-gateway/component/pom.xml | 2 +- .../main/java/cc/iotkit/comp/CompConfig.java | 9 + .../main/java/cc/iotkit/comp/IComponent.java | 9 + .../java/cc/iotkit/comp/IMessageHandler.java | 9 + .../java/cc/iotkit/comp/model/AuthInfo.java | 9 + .../cc/iotkit/comp/model/DeviceState.java | 9 + .../cc/iotkit/comp/model/ReceiveResult.java | 9 + .../cc/iotkit/comp/model/RegisterInfo.java | 9 + protocol-gateway/converter/pom.xml | 2 +- .../java/cc/iotkit/converter/IConverter.java | 9 + .../dependency-reduced-pom.xml | 4 +- protocol-gateway/ctwing-component/pom.xml | 2 +- .../cc/iotkit/comp/http/CtwingConfig.java | 9 + .../emqx-component/dependency-reduced-pom.xml | 10 +- protocol-gateway/emqx-component/pom.xml | 2 +- .../cc/iotkit/comp/emqx/AuthVerticle.java | 9 + .../java/cc/iotkit/comp/emqx/EmqxConfig.java | 9 + .../iotkit/comp/emqx/EmqxDeviceComponent.java | 17 +- .../dependency-reduced-pom.xml | 4 +- protocol-gateway/http-biz-component/pom.xml | 2 +- .../mqtt-client-simulator/pom.xml | 2 +- .../java/cc/iotkit/simulator/Application.java | 10 +- .../java/cc/iotkit/simulator/config/Mqtt.java | 9 + .../cc/iotkit/simulator/service/Device.java | 9 + .../cc/iotkit/simulator/service/Gateway.java | 9 + .../mqtt-component/dependency-reduced-pom.xml | 8 +- protocol-gateway/mqtt-component/pom.xml | 2 +- .../java/cc/iotkit/comp/mqtt/IScripter.java | 9 + .../java/cc/iotkit/comp/mqtt/JsScripter.java | 9 + .../java/cc/iotkit/comp/mqtt/LuaScripter.java | 9 + protocol-gateway/pom.xml | 2 +- rule-engine/pom.xml | 2 +- .../cc/iotkit/ruleengine/action/Action.java | 9 + .../iotkit/ruleengine/action/AlertAction.java | 9 + .../ruleengine/action/AlertService.java | 9 + .../ruleengine/action/DeviceAction.java | 9 + .../action/DeviceActionService.java | 9 + .../iotkit/ruleengine/action/HttpService.java | 9 + .../ruleengine/action/ScriptService.java | 9 + .../cc/iotkit/ruleengine/alert/Alerter.java | 9 + .../ruleengine/alert/DingdRobotAlerter.java | 9 + .../iotkit/ruleengine/alert/EmailAlerter.java | 9 + .../iotkit/ruleengine/config/JobFactory.java | 9 + .../config/QuartzConfiguration.java | 9 + .../ruleengine/config/RuleConfiguration.java | 9 + .../ruleengine/expression/BaseComparator.java | 9 + .../ruleengine/expression/Comparator.java | 9 + .../ruleengine/expression/EqComparator.java | 9 + .../ruleengine/expression/Expression.java | 9 + .../ruleengine/expression/GtComparator.java | 9 + .../ruleengine/expression/LtComparator.java | 9 + .../ruleengine/filter/DeviceCondition.java | 9 + .../ruleengine/filter/DeviceFilter.java | 9 + .../cc/iotkit/ruleengine/filter/Filter.java | 9 + .../ruleengine/listener/DeviceCondition.java | 9 + .../ruleengine/listener/DeviceListener.java | 9 + .../iotkit/ruleengine/listener/Listener.java | 10 +- .../java/cc/iotkit/ruleengine/rule/Rule.java | 9 + .../iotkit/ruleengine/rule/RuleExecutor.java | 9 + .../iotkit/ruleengine/rule/RuleManager.java | 9 + .../ruleengine/rule/RuleMessageHandler.java | 9 + .../ruleengine/task/ActionExecutor.java | 9 + .../task/ActionExecutorManager.java | 9 + .../cc/iotkit/ruleengine/task/CommonJob.java | 9 + .../ruleengine/task/DeviceActionExecutor.java | 9 + standalone-package/pom.xml | 2 +- virtual-device/pom.xml | 2 +- .../iotkit/virtualdevice/VirtualExecutor.java | 9 + .../iotkit/virtualdevice/VirtualManager.java | 9 + .../virtualdevice/config/VirtualConfig.java | 9 + .../trigger/RandomScheduleBuilder.java | 9 + .../virtualdevice/trigger/RandomTrigger.java | 9 + 233 files changed, 5836 insertions(+), 630 deletions(-) create mode 100644 dao/src/main/java/cc/iotkit/dao/CommonDao.java delete mode 100755 dao/src/main/java/cc/iotkit/dao/DaoTool.java create mode 100644 dao/src/main/java/cc/iotkit/dao/DeviceInfoRepository.java delete mode 100755 dao/src/main/java/cc/iotkit/dao/DeviceRepository.java delete mode 100755 dao/src/main/java/cc/iotkit/dao/ProtocolGatewayRepository.java delete mode 100755 dao/src/main/java/cc/iotkit/dao/config/RepositoryConfig.java rename data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/{mqtt-component-0.2.2-SNAPSHOT.jar => mqtt-component-0.3.0-SNAPSHOT.jar} (99%) create mode 100644 data/init/category.json create mode 100644 data/init/deviceGroup.json create mode 100644 data/init/deviceInfo.json create mode 100644 data/init/home.json create mode 100644 data/init/oauthClient.json create mode 100644 data/init/product.json create mode 100644 data/init/productModel.json create mode 100644 data/init/protocolComponent.json create mode 100644 data/init/protocolConverter.json create mode 100644 data/init/ruleInfo.json create mode 100644 data/init/space.json create mode 100644 data/init/spaceDevice.json create mode 100644 data/init/taskInfo.json create mode 100644 data/init/thingModel.json create mode 100644 data/init/userInfo.json create mode 100644 data/init/virtualDevice.json create mode 100644 manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java delete mode 100755 model/src/main/java/cc/iotkit/model/UserAccount.java delete mode 100755 model/src/main/java/cc/iotkit/model/mq/Request.java delete mode 100755 model/src/main/java/cc/iotkit/model/mq/Response.java diff --git a/.gitignore b/.gitignore index 7afb203d..56586457 100755 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ target *.yml log data/elasticsearch +.init diff --git a/common/pom.xml b/common/pom.xml index 1a02cec1..8c5debc0 100755 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/common/src/main/java/cc/iotkit/common/ComponentClassLoader.java b/common/src/main/java/cc/iotkit/common/ComponentClassLoader.java index 4e557a1b..dd715ed5 100755 --- a/common/src/main/java/cc/iotkit/common/ComponentClassLoader.java +++ b/common/src/main/java/cc/iotkit/common/ComponentClassLoader.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common; import java.io.File; diff --git a/common/src/main/java/cc/iotkit/common/Constants.java b/common/src/main/java/cc/iotkit/common/Constants.java index 695eed54..a48292f4 100755 --- a/common/src/main/java/cc/iotkit/common/Constants.java +++ b/common/src/main/java/cc/iotkit/common/Constants.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common; public interface Constants { diff --git a/common/src/main/java/cc/iotkit/common/exception/BizException.java b/common/src/main/java/cc/iotkit/common/exception/BizException.java index f1d0e77b..bc3e545c 100755 --- a/common/src/main/java/cc/iotkit/common/exception/BizException.java +++ b/common/src/main/java/cc/iotkit/common/exception/BizException.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.exception; public class BizException extends RuntimeException{ diff --git a/common/src/main/java/cc/iotkit/common/exception/NotFoundException.java b/common/src/main/java/cc/iotkit/common/exception/NotFoundException.java index a3c34b7a..adddcb7a 100755 --- a/common/src/main/java/cc/iotkit/common/exception/NotFoundException.java +++ b/common/src/main/java/cc/iotkit/common/exception/NotFoundException.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.exception; diff --git a/common/src/main/java/cc/iotkit/common/exception/OfflineException.java b/common/src/main/java/cc/iotkit/common/exception/OfflineException.java index 8a97a92a..393a2a5d 100755 --- a/common/src/main/java/cc/iotkit/common/exception/OfflineException.java +++ b/common/src/main/java/cc/iotkit/common/exception/OfflineException.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.exception; diff --git a/common/src/main/java/cc/iotkit/common/thing/ThingService.java b/common/src/main/java/cc/iotkit/common/thing/ThingService.java index c1a94234..454f3707 100644 --- a/common/src/main/java/cc/iotkit/common/thing/ThingService.java +++ b/common/src/main/java/cc/iotkit/common/thing/ThingService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.thing; import lombok.AllArgsConstructor; diff --git a/common/src/main/java/cc/iotkit/common/utils/CodecUtil.java b/common/src/main/java/cc/iotkit/common/utils/CodecUtil.java index 810fd8b0..c4ace539 100755 --- a/common/src/main/java/cc/iotkit/common/utils/CodecUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/CodecUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; import org.apache.commons.codec.binary.Base64; diff --git a/common/src/main/java/cc/iotkit/common/utils/DeviceUtil.java b/common/src/main/java/cc/iotkit/common/utils/DeviceUtil.java index 435acb59..0e33b8c0 100755 --- a/common/src/main/java/cc/iotkit/common/utils/DeviceUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/DeviceUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; import org.apache.commons.lang3.RandomUtils; diff --git a/common/src/main/java/cc/iotkit/common/utils/HexUtil.java b/common/src/main/java/cc/iotkit/common/utils/HexUtil.java index 5cedb890..3f048740 100755 --- a/common/src/main/java/cc/iotkit/common/utils/HexUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/HexUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; diff --git a/common/src/main/java/cc/iotkit/common/utils/JsonUtil.java b/common/src/main/java/cc/iotkit/common/utils/JsonUtil.java index a2802ec1..ba0e7f55 100755 --- a/common/src/main/java/cc/iotkit/common/utils/JsonUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/JsonUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/common/src/main/java/cc/iotkit/common/utils/ReflectUtil.java b/common/src/main/java/cc/iotkit/common/utils/ReflectUtil.java index 2ce923f6..7150952e 100755 --- a/common/src/main/java/cc/iotkit/common/utils/ReflectUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/ReflectUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; @@ -29,5 +38,4 @@ public class ReflectUtil { BeanUtils.populate(to, map); return to; } - } diff --git a/common/src/main/java/cc/iotkit/common/utils/ThreadUtil.java b/common/src/main/java/cc/iotkit/common/utils/ThreadUtil.java index bbe481d5..3a4908cf 100755 --- a/common/src/main/java/cc/iotkit/common/utils/ThreadUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/ThreadUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; import java.util.concurrent.ScheduledThreadPoolExecutor; diff --git a/common/src/main/java/cc/iotkit/common/utils/UniqueIdUtil.java b/common/src/main/java/cc/iotkit/common/utils/UniqueIdUtil.java index cce1d3ef..b157d292 100755 --- a/common/src/main/java/cc/iotkit/common/utils/UniqueIdUtil.java +++ b/common/src/main/java/cc/iotkit/common/utils/UniqueIdUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.common.utils; import org.apache.commons.lang3.RandomUtils; diff --git a/dao/pom.xml b/dao/pom.xml index 5919eda3..779e1960 100755 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -5,27 +5,22 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 dao - - 8 - 8 - - - org.springframework.boot - spring-boot-starter-data-mongodb + jakarta.annotation + jakarta.annotation-api - commons-beanutils - commons-beanutils + cn.hutool + hutool-core diff --git a/dao/src/main/java/cc/iotkit/dao/AligenieDeviceRepository.java b/dao/src/main/java/cc/iotkit/dao/AligenieDeviceRepository.java index 44e2f25b..b6612c6c 100755 --- a/dao/src/main/java/cc/iotkit/dao/AligenieDeviceRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/AligenieDeviceRepository.java @@ -1,13 +1,20 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.aligenie.AligenieDevice; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface AligenieDeviceRepository extends MongoRepository { +public interface AligenieDeviceRepository extends ElasticsearchRepository { void deleteByUid(String uid); diff --git a/dao/src/main/java/cc/iotkit/dao/AligenieProductRepository.java b/dao/src/main/java/cc/iotkit/dao/AligenieProductRepository.java index 00965923..85336158 100755 --- a/dao/src/main/java/cc/iotkit/dao/AligenieProductRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/AligenieProductRepository.java @@ -1,13 +1,20 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.aligenie.AligenieProduct; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface AligenieProductRepository extends MongoRepository { +public interface AligenieProductRepository extends ElasticsearchRepository { List findByUid(String uid); diff --git a/dao/src/main/java/cc/iotkit/dao/AppDesignRepository.java b/dao/src/main/java/cc/iotkit/dao/AppDesignRepository.java index 5136bc86..8993fe80 100755 --- a/dao/src/main/java/cc/iotkit/dao/AppDesignRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/AppDesignRepository.java @@ -1,9 +1,23 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.product.AppDesign; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; + +import java.util.List; + +public interface AppDesignRepository extends ElasticsearchRepository { + + AppDesign findByProductKey(String productKey); + + List findByUid(String uid); -@Repository -public interface AppDesignRepository extends MongoRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/AppInfoRepository.java b/dao/src/main/java/cc/iotkit/dao/AppInfoRepository.java index ea9f1e25..8947bcc0 100755 --- a/dao/src/main/java/cc/iotkit/dao/AppInfoRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/AppInfoRepository.java @@ -1,9 +1,16 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.AppInfo; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface AppInfoRepository extends MongoRepository { +public interface AppInfoRepository extends ElasticsearchRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/CategoryCache.java b/dao/src/main/java/cc/iotkit/dao/CategoryCache.java index dfee4d10..7be74f38 100755 --- a/dao/src/main/java/cc/iotkit/dao/CategoryCache.java +++ b/dao/src/main/java/cc/iotkit/dao/CategoryCache.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.common.Constants; @@ -8,6 +17,7 @@ import org.springframework.stereotype.Repository; import javax.annotation.PostConstruct; + @Repository public class CategoryCache { diff --git a/dao/src/main/java/cc/iotkit/dao/CategoryRepository.java b/dao/src/main/java/cc/iotkit/dao/CategoryRepository.java index e01d471a..d0f9834f 100755 --- a/dao/src/main/java/cc/iotkit/dao/CategoryRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/CategoryRepository.java @@ -1,13 +1,19 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.product.Category; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface CategoryRepository extends MongoRepository { +public interface CategoryRepository extends ElasticsearchRepository { int countBy(); - } diff --git a/dao/src/main/java/cc/iotkit/dao/CommonDao.java b/dao/src/main/java/cc/iotkit/dao/CommonDao.java new file mode 100644 index 00000000..8110188e --- /dev/null +++ b/dao/src/main/java/cc/iotkit/dao/CommonDao.java @@ -0,0 +1,61 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ +package cc.iotkit.dao; + +import cc.iotkit.model.Paging; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; +import org.springframework.data.elasticsearch.core.SearchHit; +import org.springframework.data.elasticsearch.core.SearchHits; +import org.springframework.data.elasticsearch.core.query.Criteria; +import org.springframework.data.elasticsearch.core.query.CriteriaQuery; +import org.springframework.data.elasticsearch.core.query.Query; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.List; + +@Repository +public class CommonDao { + + @Autowired + private ElasticsearchRestTemplate elasticsearchRestTemplate; + + /** + * 通用按条件分页查找 + */ + public Paging pagedFind(Class cls, Criteria condition, Sort.Order order, int size, int page) { + Query query = new CriteriaQuery(condition); + long total = elasticsearchRestTemplate.count(query, cls); + query = query.setPageable(PageRequest.of(page - 1, size, Sort.by(order))); + SearchHits searchHits = elasticsearchRestTemplate.search(query, cls); + List list = new ArrayList<>(); + for (SearchHit searchHit : searchHits) { + list.add(searchHit.getContent()); + } + return new Paging<>(total, list); + } + + /** + * 通用按条件查询 + */ + public List find(Class cls, Criteria condition) { + Query query = new CriteriaQuery(condition); + SearchHits searchHits = elasticsearchRestTemplate.search(query, cls); + List list = new ArrayList<>(); + for (SearchHit searchHit : searchHits) { + list.add(searchHit.getContent()); + } + return list; + } + +} diff --git a/dao/src/main/java/cc/iotkit/dao/DaoTool.java b/dao/src/main/java/cc/iotkit/dao/DaoTool.java deleted file mode 100755 index 756f4ca6..00000000 --- a/dao/src/main/java/cc/iotkit/dao/DaoTool.java +++ /dev/null @@ -1,53 +0,0 @@ -package cc.iotkit.dao; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.SneakyThrows; -import org.apache.commons.beanutils.BeanMap; -import org.springframework.data.mongodb.core.query.Update; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class DaoTool { - - public static void update(Update update, List props) { - for (Prop pro : props) { - update.set(pro.getName(), pro.getValue()); - } - } - - public static List getProp(String key, Object value) { - List props = new ArrayList<>(); - if (value instanceof Map) { - Set> entrySet = ((Map) value).entrySet(); - for (Map.Entry entry : entrySet) { - props.addAll(getProp(key + "." + entry.getKey(), entry.getValue())); - } - } else if (value != null && !(value instanceof Class)) { - props.add(new Prop(key, value)); - } - return props; - } - - @SneakyThrows - public static Update update(T obj) { - Map pros = new BeanMap(obj); - Update update = new Update(); - for (Map.Entry entry : pros.entrySet()) { - update(update, DaoTool.getProp(entry.getKey().toString(), entry.getValue())); - } - return update; - } - - @Data - @AllArgsConstructor - @NoArgsConstructor - static class Prop { - private String name; - private Object value; - } -} diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceCache.java b/dao/src/main/java/cc/iotkit/dao/DeviceCache.java index 431619ee..517843a1 100755 --- a/dao/src/main/java/cc/iotkit/dao/DeviceCache.java +++ b/dao/src/main/java/cc/iotkit/dao/DeviceCache.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.common.Constants; @@ -14,7 +23,7 @@ import java.util.List; public class DeviceCache { @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private DeviceDao deviceDao; @@ -31,12 +40,12 @@ public class DeviceCache { @Cacheable(value = Constants.DEVICE_CACHE, key = "#pk+'_'+#dn") public DeviceInfo getDeviceInfo(String pk, String dn) { - return deviceRepository.findByProductKeyAndDeviceName(pk, dn); + return deviceInfoRepository.findByProductKeyAndDeviceName(pk, dn); } @Cacheable(value = Constants.DEVICE_CACHE, key = "#deviceId") public DeviceInfo get(String deviceId) { - return deviceRepository.findById(deviceId).orElse(null); + return deviceInfoRepository.findById(deviceId).orElse(null); } @Cacheable(value = Constants.DEVICE_STATS_CACHE, key = "#uid") diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceDao.java b/dao/src/main/java/cc/iotkit/dao/DeviceDao.java index 361610dd..2d722896 100755 --- a/dao/src/main/java/cc/iotkit/dao/DeviceDao.java +++ b/dao/src/main/java/cc/iotkit/dao/DeviceDao.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.Paging; @@ -5,16 +14,23 @@ import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Product; import cc.iotkit.model.stats.DataItem; +import cn.hutool.core.bean.BeanUtil; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; +import org.elasticsearch.index.query.BoolQueryBuilder; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.search.aggregations.AggregationBuilders; +import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms; +import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.data.mongodb.core.aggregation.*; -import org.springframework.data.mongodb.core.query.Criteria; -import org.springframework.data.mongodb.core.query.Query; -import org.springframework.data.mongodb.core.query.Update; +import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; +import org.springframework.data.elasticsearch.core.ScriptType; +import org.springframework.data.elasticsearch.core.SearchHit; +import org.springframework.data.elasticsearch.core.SearchHits; +import org.springframework.data.elasticsearch.core.clients.elasticsearch7.ElasticsearchAggregations; +import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; +import org.springframework.data.elasticsearch.core.query.*; import org.springframework.stereotype.Repository; import java.util.ArrayList; @@ -27,20 +43,25 @@ import java.util.stream.Collectors; public class DeviceDao { @Autowired - private MongoTemplate mongoTemplate; + private ElasticsearchRestTemplate elasticsearchRestTemplate; + + @Autowired + private DeviceInfoRepository deviceInfoRepository; @Autowired private ProductRepository productRepository; @Autowired private CategoryRepository categoryRepository; public Paging find(Criteria condition, int size, int page) { - Query query = Query.query(condition); - return new Paging<>( - mongoTemplate.count(query, DeviceInfo.class), - mongoTemplate.find( - query.with(PageRequest.of(page - 1, size, Sort.by(Sort.Order.desc("createAt")))) - , DeviceInfo.class) - ); + Query query = new CriteriaQuery(condition); + long total = elasticsearchRestTemplate.count(query, DeviceInfo.class); + query = query.setPageable(PageRequest.of(page - 1, size, Sort.by(Sort.Order.desc("createAt")))); + SearchHits searchHits = elasticsearchRestTemplate.search(query, DeviceInfo.class); + List list = new ArrayList<>(); + for (SearchHit searchHit : searchHits) { + list.add(searchHit.getContent()); + } + return new Paging<>(total, list); } /** @@ -50,80 +71,101 @@ public class DeviceDao { if (properties == null) { return; } - Query query = Query.query(new Criteria().and("deviceId").is(deviceId)); - Update update = new Update(); - for (String key : properties.keySet()) { - update.set("property." + key, properties.get(key)); - } - mongoTemplate.updateFirst(query, update, DeviceInfo.class); + + Map param = new HashMap<>(); + param.put("property", BeanUtil.beanToMap(properties)); + param.put("keys", properties.keySet()); + + UpdateQuery updateQuery = UpdateQuery.builder(new CriteriaQuery(new Criteria() + .and("deviceId").is(deviceId))) + .withParams(param) + .withScript("for(key in params.keys){ctx._source.property[key]=params.property[key];}") + .withScriptType(ScriptType.INLINE) + .build(); + elasticsearchRestTemplate.updateByQuery(updateQuery, IndexCoordinates.of("device_info")); } /** * 更新设备标签 */ public void updateTag(String deviceId, DeviceInfo.Tag tag) { - Query query = Query.query(new Criteria().and("deviceId").is(deviceId)); - Update update = new Update(); - update.set("tag." + tag.getId(), tag); - mongoTemplate.updateFirst(query, update, DeviceInfo.class); + Map param = new HashMap<>(); + param.put("tag", BeanUtil.beanToMap(tag)); + + UpdateQuery updateQuery = UpdateQuery.builder(new CriteriaQuery(new Criteria() + .and("deviceId").is(deviceId))) + .withParams(param) + .withScript(String.format("ctx._source.tag.%s=params.tag", tag.getId())) + .withScriptType(ScriptType.INLINE) + .build(); + elasticsearchRestTemplate.updateByQuery(updateQuery, IndexCoordinates.of("device_info")); } /** * 设置设备标签值为空 */ public void setTagNull(String deviceId, String tagId) { - Query query = Query.query(new Criteria().and("deviceId").is(deviceId)); - Update update = new Update(); - update.set("tag." + tagId, null); - mongoTemplate.updateFirst(query, update, DeviceInfo.class); +// Query query = Query.query(new Criteria().and("deviceId").is(deviceId)); +// Update update = new Update(); +// update.set("tag." + tagId, null); +// mongoTemplate.updateFirst(query, update, DeviceInfo.class); } /** * 获取按品类统计的用户设备数 */ public List getDeviceStatsByCategory(String uid) { - MatchOperation matchOperation; - if (StringUtils.isBlank(uid)) { - matchOperation = Aggregation.match(new Criteria()); - } else { - matchOperation = Aggregation.match(Criteria.where("uid").is(uid)); + BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery(); + if (StringUtils.isNotBlank(uid)) { + queryBuilder = + queryBuilder.must(QueryBuilders.termQuery("uid.keyword", uid)); } //先按产品分组统计 - GroupOperation groupOperation = Aggregation.group("productKey").count().as("total"); - ProjectionOperation projectionOperation = Aggregation.project("productKey", "uid"); - Aggregation aggregation = Aggregation.newAggregation(projectionOperation, groupOperation, matchOperation); - AggregationResults result = mongoTemplate.aggregate(aggregation, DeviceInfo.class, Map.class); - List stats = result.getMappedResults(); + NativeSearchQuery query = new NativeSearchQueryBuilder() + .withQuery(queryBuilder) + .withAggregations( + AggregationBuilders.terms("countByPk").field("productKey.keyword") + .size(1000) + .subAggregation(AggregationBuilders.count("count").field("productKey.keyword")) + ) + .build(); - //取用户产品列表 - List products; - if (StringUtils.isBlank(uid)) { - products = productRepository.findAll(); - } else { + ElasticsearchAggregations result = (ElasticsearchAggregations) elasticsearchRestTemplate + .search(query, DeviceInfo.class).getAggregations(); + ParsedStringTerms terms = result.aggregations().get("countByPk"); + List buckets = terms.getBuckets(); + Map productCount = new HashMap<>(); + for (Terms.Bucket bucket : buckets) { + productCount.put(bucket.getKeyAsString(), bucket.getDocCount()); + } + + //取用户下产品列表 + Iterable products; + if (StringUtils.isNotBlank(uid)) { products = productRepository.findByUid(uid); + } else { + products = productRepository.findAll(); } Map pkCateMap = new HashMap<>(); for (Product product : products) { pkCateMap.put(product.getId(), product.getCategory()); } - //取品类 - List categories = categoryRepository.findAll(); + //取品类列表 Map cateNames = new HashMap<>(); - for (Category category : categories) { + for (Category category : categoryRepository.findAll()) { cateNames.put(category.getId(), category.getName()); } Map cateStats = new HashMap<>(); - for (Map stat : stats) { - String productKey = stat.get("_id").toString(); - String cateName = cateNames.get(pkCateMap.get(productKey)); + productCount.forEach((key, val) -> { + String cateName = cateNames.get(pkCateMap.get(key)); //按品类汇总 long total = cateStats.getOrDefault(cateName, 0L); - total += (Integer) stat.get("total"); + total += val; cateStats.put(cateName, total); - } + }); List items = new ArrayList<>(); cateStats.forEach((key, val) -> { @@ -144,55 +186,75 @@ public class DeviceDao { * 根据分组id查询分组下所有设备 */ public List findByGroupId(String groupId) { - Query query = Query.query(new Criteria().and("group." + groupId).exists(true)); - return mongoTemplate.find(query, DeviceInfo.class); + Query query = new CriteriaQuery(new Criteria().and("group." + groupId).exists()); + SearchHits searchHits = elasticsearchRestTemplate.search(query, DeviceInfo.class); + return searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList()); } /** * 按分组id统计设备数量 */ public long countByGroupId(String groupId) { - Query query = Query.query(new Criteria().and("group." + groupId).exists(true)); - return mongoTemplate.count(query, DeviceInfo.class); + Query query = new CriteriaQuery(new Criteria().and("group." + groupId).exists()); + return elasticsearchRestTemplate.count(query, DeviceInfo.class); } /** * 按设备id更新设备分组 */ public void updateGroupByDeviceId(String deviceId, DeviceInfo.Group group) { - Query query = Query.query(new Criteria().and("deviceId").is(deviceId)); - Update update = new Update(); - update.set("group." + group.getId(), group); - mongoTemplate.updateFirst(query, update, DeviceInfo.class); + Map param = new HashMap<>(); + param.put("group", BeanUtil.beanToMap(group)); + + UpdateQuery updateQuery = UpdateQuery.builder(new CriteriaQuery(new Criteria() + .and("deviceId").is(deviceId))) + .withParams(param) + .withScript(String.format("ctx._source.group.%s=params.group", group.getId())) + .withScriptType(ScriptType.INLINE) + .build(); + elasticsearchRestTemplate.updateByQuery(updateQuery, IndexCoordinates.of("device_info")); } /** * 按组id更新设备分组 */ public void updateGroup(String groupId, DeviceInfo.Group group) { - Query query = Query.query(new Criteria().and("group." + groupId).exists(true)); - Update update = new Update(); - update.set("group." + group.getId(), group); - mongoTemplate.updateMulti(query, update, DeviceInfo.class); + Map param = new HashMap<>(); + param.put("group", BeanUtil.beanToMap(group)); + + UpdateQuery updateQuery = UpdateQuery.builder(new CriteriaQuery(new Criteria() + .and("group." + groupId).exists())) + .withParams(param) + .withScript(String.format("ctx._source.group.%s=params.group", groupId)) + .withScriptType(ScriptType.INLINE) + .build(); + + elasticsearchRestTemplate.update(updateQuery, IndexCoordinates.of("device_info")); } /** * 移除指定设备信息中的分组 */ public void removeGroup(String deviceId, String groupId) { - Query query = Query.query(new Criteria().and("deviceId").is(deviceId).and("group." + groupId).exists(true)); - Update update = new Update(); - update.unset("group." + groupId); - mongoTemplate.updateFirst(query, update, DeviceInfo.class); + UpdateQuery updateQuery = UpdateQuery.builder(new CriteriaQuery( + Criteria.where("deviceId").is(deviceId))) + .withScript(String.format("ctx._source.group.remove('%s')", groupId)) + .withScriptType(ScriptType.INLINE) + .build(); + + elasticsearchRestTemplate.updateByQuery(updateQuery, IndexCoordinates.of("device_info")); } /** * 移除设备信息中的分组 */ public void removeGroup(String groupId) { - Query query = Query.query(new Criteria().and("group." + groupId).exists(true)); - Update update = new Update(); - update.unset("group." + groupId); - mongoTemplate.updateMulti(query, update, DeviceInfo.class); + UpdateQuery updateQuery = UpdateQuery.builder(new CriteriaQuery(new Criteria() + .and("group." + groupId).exists())) + .withScript(String.format("ctx._source.group.remove('%s')", groupId)) + .withScriptType(ScriptType.INLINE) + .build(); + + elasticsearchRestTemplate.update(updateQuery, IndexCoordinates.of("device_info")); } } diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceGroupRepository.java b/dao/src/main/java/cc/iotkit/dao/DeviceGroupRepository.java index 34adc535..164b1225 100644 --- a/dao/src/main/java/cc/iotkit/dao/DeviceGroupRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/DeviceGroupRepository.java @@ -1,13 +1,20 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.DeviceGroup; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface DeviceGroupRepository extends MongoRepository { +public interface DeviceGroupRepository extends ElasticsearchRepository { Page findByNameLike(String name, Pageable pageable); diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceInfoRepository.java b/dao/src/main/java/cc/iotkit/dao/DeviceInfoRepository.java new file mode 100644 index 00000000..b5e00f48 --- /dev/null +++ b/dao/src/main/java/cc/iotkit/dao/DeviceInfoRepository.java @@ -0,0 +1,31 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ +package cc.iotkit.dao; + +import cc.iotkit.model.device.DeviceInfo; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; + +import java.util.List; + +public interface DeviceInfoRepository extends ElasticsearchRepository { + + DeviceInfo findByProductKeyAndDeviceName(String productKey, String deviceName); + + DeviceInfo findByDeviceId(String deviceId); + + List findByParentId(String parentId); + + List findByParentIdAndUid(String parentId, String uid); + + List findByDeviceName(String deviceName); + + long countByUid(String uid); + +} diff --git a/dao/src/main/java/cc/iotkit/dao/DevicePropertyDao.java b/dao/src/main/java/cc/iotkit/dao/DevicePropertyDao.java index 7db9cc80..86ebc31a 100755 --- a/dao/src/main/java/cc/iotkit/dao/DevicePropertyDao.java +++ b/dao/src/main/java/cc/iotkit/dao/DevicePropertyDao.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.message.DeviceProperty; diff --git a/dao/src/main/java/cc/iotkit/dao/DevicePropertyRepository.java b/dao/src/main/java/cc/iotkit/dao/DevicePropertyRepository.java index 3300b370..235a67ba 100755 --- a/dao/src/main/java/cc/iotkit/dao/DevicePropertyRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/DevicePropertyRepository.java @@ -1,10 +1,17 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.message.DeviceProperty; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -import org.springframework.stereotype.Repository; -@Repository public interface DevicePropertyRepository extends ElasticsearchRepository { diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceReportDao.java b/dao/src/main/java/cc/iotkit/dao/DeviceReportDao.java index e3020dc8..5e8ff5ff 100644 --- a/dao/src/main/java/cc/iotkit/dao/DeviceReportDao.java +++ b/dao/src/main/java/cc/iotkit/dao/DeviceReportDao.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.message.DeviceReport; diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceReportRepository.java b/dao/src/main/java/cc/iotkit/dao/DeviceReportRepository.java index 6d8648fb..8021bbfd 100644 --- a/dao/src/main/java/cc/iotkit/dao/DeviceReportRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/DeviceReportRepository.java @@ -1,10 +1,17 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.message.DeviceReport; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -import org.springframework.stereotype.Repository; -@Repository public interface DeviceReportRepository extends ElasticsearchRepository { long countByUid(String uid); diff --git a/dao/src/main/java/cc/iotkit/dao/DeviceRepository.java b/dao/src/main/java/cc/iotkit/dao/DeviceRepository.java deleted file mode 100755 index b94f98d3..00000000 --- a/dao/src/main/java/cc/iotkit/dao/DeviceRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package cc.iotkit.dao; - -import cc.iotkit.model.device.DeviceInfo; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface DeviceRepository extends MongoRepository { - - DeviceInfo findByProductKeyAndDeviceName(String productKey, String deviceName); - - DeviceInfo findByDeviceId(String deviceId); - - List findByParentId(String parentId); - - List findByDeviceName(String deviceName); - - long countByUid(String uid); - -} diff --git a/dao/src/main/java/cc/iotkit/dao/HomeRepository.java b/dao/src/main/java/cc/iotkit/dao/HomeRepository.java index 83c25721..2f9376bc 100755 --- a/dao/src/main/java/cc/iotkit/dao/HomeRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/HomeRepository.java @@ -1,15 +1,25 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.space.Home; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface HomeRepository extends MongoRepository { +public interface HomeRepository extends ElasticsearchRepository { List findByUid(String uid); - Home findByUidAndCurrent(String uid,boolean current); + Home findByUidAndCurrent(String uid, boolean current); + + Home findByUidAndId(String uid, String id); + } diff --git a/dao/src/main/java/cc/iotkit/dao/OauthClientCache.java b/dao/src/main/java/cc/iotkit/dao/OauthClientCache.java index b444509e..7ad431dd 100755 --- a/dao/src/main/java/cc/iotkit/dao/OauthClientCache.java +++ b/dao/src/main/java/cc/iotkit/dao/OauthClientCache.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.common.Constants; diff --git a/dao/src/main/java/cc/iotkit/dao/OauthClientRepository.java b/dao/src/main/java/cc/iotkit/dao/OauthClientRepository.java index 788fffaa..71dd5224 100755 --- a/dao/src/main/java/cc/iotkit/dao/OauthClientRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/OauthClientRepository.java @@ -1,11 +1,18 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.OauthClient; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface OauthClientRepository extends MongoRepository { +public interface OauthClientRepository extends ElasticsearchRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/ProductCache.java b/dao/src/main/java/cc/iotkit/dao/ProductCache.java index ce71c113..bbd633fd 100755 --- a/dao/src/main/java/cc/iotkit/dao/ProductCache.java +++ b/dao/src/main/java/cc/iotkit/dao/ProductCache.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.common.Constants; diff --git a/dao/src/main/java/cc/iotkit/dao/ProductModelRepository.java b/dao/src/main/java/cc/iotkit/dao/ProductModelRepository.java index 095dad80..9498d277 100755 --- a/dao/src/main/java/cc/iotkit/dao/ProductModelRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ProductModelRepository.java @@ -1,13 +1,20 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.product.ProductModel; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface ProductModelRepository extends MongoRepository { +public interface ProductModelRepository extends ElasticsearchRepository { ProductModel findByModel(String model); diff --git a/dao/src/main/java/cc/iotkit/dao/ProductRepository.java b/dao/src/main/java/cc/iotkit/dao/ProductRepository.java index ba68602c..a9dab9d9 100755 --- a/dao/src/main/java/cc/iotkit/dao/ProductRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ProductRepository.java @@ -1,15 +1,25 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.product.Product; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface ProductRepository extends MongoRepository { +public interface ProductRepository extends ElasticsearchRepository { long countByUid(String uid); List findByUid(String uid); + + List findByCategory(String category); + } diff --git a/dao/src/main/java/cc/iotkit/dao/ProtocolComponentRepository.java b/dao/src/main/java/cc/iotkit/dao/ProtocolComponentRepository.java index b8d881e3..51a83d5f 100755 --- a/dao/src/main/java/cc/iotkit/dao/ProtocolComponentRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ProtocolComponentRepository.java @@ -1,13 +1,20 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.protocol.ProtocolComponent; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface ProtocolComponentRepository extends MongoRepository { +public interface ProtocolComponentRepository extends ElasticsearchRepository { List findByState(String state); diff --git a/dao/src/main/java/cc/iotkit/dao/ProtocolConverterRepository.java b/dao/src/main/java/cc/iotkit/dao/ProtocolConverterRepository.java index 336d2aaf..f98b098c 100755 --- a/dao/src/main/java/cc/iotkit/dao/ProtocolConverterRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ProtocolConverterRepository.java @@ -1,9 +1,16 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.protocol.ProtocolConverter; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface ProtocolConverterRepository extends MongoRepository { +public interface ProtocolConverterRepository extends ElasticsearchRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/ProtocolGatewayRepository.java b/dao/src/main/java/cc/iotkit/dao/ProtocolGatewayRepository.java deleted file mode 100755 index 8248a283..00000000 --- a/dao/src/main/java/cc/iotkit/dao/ProtocolGatewayRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package cc.iotkit.dao; - -import cc.iotkit.model.protocol.ProtocolComponent; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface ProtocolGatewayRepository extends MongoRepository { - - -} diff --git a/dao/src/main/java/cc/iotkit/dao/RuleInfoRepository.java b/dao/src/main/java/cc/iotkit/dao/RuleInfoRepository.java index de4e6020..f3c0208a 100755 --- a/dao/src/main/java/cc/iotkit/dao/RuleInfoRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/RuleInfoRepository.java @@ -1,14 +1,27 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.rule.RuleInfo; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface RuleInfoRepository extends MongoRepository { +public interface RuleInfoRepository extends ElasticsearchRepository { List findByUidAndType(String uid, String type); + Page findByUidAndType(String uid, String type, Pageable pageable); + + Page findByType(String type, Pageable pageable); + } diff --git a/dao/src/main/java/cc/iotkit/dao/RuleLogRepository.java b/dao/src/main/java/cc/iotkit/dao/RuleLogRepository.java index 2ada4aaa..70987735 100755 --- a/dao/src/main/java/cc/iotkit/dao/RuleLogRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/RuleLogRepository.java @@ -1,12 +1,19 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.rule.RuleLog; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -import org.springframework.stereotype.Repository; -@Repository public interface RuleLogRepository extends ElasticsearchRepository { void deleteByRuleId(String ruleId); diff --git a/dao/src/main/java/cc/iotkit/dao/SpaceDeviceRepository.java b/dao/src/main/java/cc/iotkit/dao/SpaceDeviceRepository.java index 3e300aac..17be8897 100755 --- a/dao/src/main/java/cc/iotkit/dao/SpaceDeviceRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/SpaceDeviceRepository.java @@ -1,18 +1,29 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.space.SpaceDevice; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface SpaceDeviceRepository extends MongoRepository { +public interface SpaceDeviceRepository extends ElasticsearchRepository { List findByUidOrderByUseAtDesc(String uid); List findByUidOrderByAddAtDesc(String uid); + List findByUid(String uid); + + List findBySpaceIdOrderByAddAtDesc(String spaceId); + List findByUidAndSpaceIdOrderByAddAtDesc(String uid, String spaceId); SpaceDevice findByDeviceId(String deviceId); diff --git a/dao/src/main/java/cc/iotkit/dao/SpaceRepository.java b/dao/src/main/java/cc/iotkit/dao/SpaceRepository.java index 39789754..687e00bc 100755 --- a/dao/src/main/java/cc/iotkit/dao/SpaceRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/SpaceRepository.java @@ -1,16 +1,25 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.space.Space; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface SpaceRepository extends MongoRepository { +public interface SpaceRepository extends ElasticsearchRepository { List findByUidOrderByCreateAtDesc(String uid); List findByUidAndHomeIdOrderByCreateAtDesc(String uid, String homeId); + List findByHomeId(String homeId); + } diff --git a/dao/src/main/java/cc/iotkit/dao/TaskInfoRepository.java b/dao/src/main/java/cc/iotkit/dao/TaskInfoRepository.java index 7de159fd..53705f29 100755 --- a/dao/src/main/java/cc/iotkit/dao/TaskInfoRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/TaskInfoRepository.java @@ -1,9 +1,21 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.rule.TaskInfo; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; + +import java.util.List; + +public interface TaskInfoRepository extends ElasticsearchRepository { + + List findByUid(String uid); -@Repository -public interface TaskInfoRepository extends MongoRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/TaskLogRepository.java b/dao/src/main/java/cc/iotkit/dao/TaskLogRepository.java index ddf2bbab..570b21d9 100755 --- a/dao/src/main/java/cc/iotkit/dao/TaskLogRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/TaskLogRepository.java @@ -1,12 +1,19 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.rule.TaskLog; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -import org.springframework.stereotype.Repository; -@Repository public interface TaskLogRepository extends ElasticsearchRepository { void deleteByTaskId(String taskId); diff --git a/dao/src/main/java/cc/iotkit/dao/ThingModelMessageRepository.java b/dao/src/main/java/cc/iotkit/dao/ThingModelMessageRepository.java index 5e95e53d..073d0d78 100755 --- a/dao/src/main/java/cc/iotkit/dao/ThingModelMessageRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ThingModelMessageRepository.java @@ -1,12 +1,19 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.message.ThingModelMessage; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -import org.springframework.stereotype.Repository; -@Repository public interface ThingModelMessageRepository extends ElasticsearchRepository { Page findByTypeAndIdentifier(String type, String identifier, Pageable pageable); diff --git a/dao/src/main/java/cc/iotkit/dao/ThingModelRepository.java b/dao/src/main/java/cc/iotkit/dao/ThingModelRepository.java index 880adb47..e1071d4b 100755 --- a/dao/src/main/java/cc/iotkit/dao/ThingModelRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ThingModelRepository.java @@ -1,11 +1,18 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.product.ThingModel; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface ThingModelRepository extends MongoRepository { +public interface ThingModelRepository extends ElasticsearchRepository { ThingModel findByProductKey(String productKey); diff --git a/dao/src/main/java/cc/iotkit/dao/ThirdUserSessionRepository.java b/dao/src/main/java/cc/iotkit/dao/ThirdUserSessionRepository.java index 3e538140..602f57b0 100755 --- a/dao/src/main/java/cc/iotkit/dao/ThirdUserSessionRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/ThirdUserSessionRepository.java @@ -1,11 +1,9 @@ package cc.iotkit.dao; import cc.iotkit.model.ThirdUserSession; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface ThirdUserSessionRepository extends MongoRepository { +public interface ThirdUserSessionRepository extends ElasticsearchRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/UserActionLogRepository.java b/dao/src/main/java/cc/iotkit/dao/UserActionLogRepository.java index ffa99fc1..1bf60cf8 100755 --- a/dao/src/main/java/cc/iotkit/dao/UserActionLogRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/UserActionLogRepository.java @@ -1,10 +1,17 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.UserActionLog; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -@Repository -public interface UserActionLogRepository extends MongoRepository { +public interface UserActionLogRepository extends ElasticsearchRepository { } diff --git a/dao/src/main/java/cc/iotkit/dao/UserInfoRepository.java b/dao/src/main/java/cc/iotkit/dao/UserInfoRepository.java index dd1769dd..a8195ea8 100755 --- a/dao/src/main/java/cc/iotkit/dao/UserInfoRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/UserInfoRepository.java @@ -1,13 +1,20 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.UserInfo; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface UserInfoRepository extends MongoRepository { +public interface UserInfoRepository extends ElasticsearchRepository { UserInfo findByUid(String uid); diff --git a/dao/src/main/java/cc/iotkit/dao/VirtualDeviceLogRepository.java b/dao/src/main/java/cc/iotkit/dao/VirtualDeviceLogRepository.java index 646407d1..89853aa0 100644 --- a/dao/src/main/java/cc/iotkit/dao/VirtualDeviceLogRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/VirtualDeviceLogRepository.java @@ -1,12 +1,19 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.VirtualDeviceLog; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; -import org.springframework.stereotype.Repository; -@Repository public interface VirtualDeviceLogRepository extends ElasticsearchRepository { Page findByVirtualDeviceId(String virtualDeviceId, Pageable pageable); diff --git a/dao/src/main/java/cc/iotkit/dao/VirtualDeviceRepository.java b/dao/src/main/java/cc/iotkit/dao/VirtualDeviceRepository.java index 3844f8a4..8a275fc9 100644 --- a/dao/src/main/java/cc/iotkit/dao/VirtualDeviceRepository.java +++ b/dao/src/main/java/cc/iotkit/dao/VirtualDeviceRepository.java @@ -1,15 +1,22 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.dao; import cc.iotkit.model.device.VirtualDevice; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; -@Repository -public interface VirtualDeviceRepository extends MongoRepository { +public interface VirtualDeviceRepository extends ElasticsearchRepository { Page findByUid(String uid, Pageable pageable); diff --git a/dao/src/main/java/cc/iotkit/dao/config/ElasticsearchConfiguration.java b/dao/src/main/java/cc/iotkit/dao/config/ElasticsearchConfiguration.java index 3c87b0b7..76967e5c 100755 --- a/dao/src/main/java/cc/iotkit/dao/config/ElasticsearchConfiguration.java +++ b/dao/src/main/java/cc/iotkit/dao/config/ElasticsearchConfiguration.java @@ -1,3 +1,13 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ + package cc.iotkit.dao.config; import org.springframework.context.annotation.ComponentScan; diff --git a/dao/src/main/java/cc/iotkit/dao/config/RepositoryConfig.java b/dao/src/main/java/cc/iotkit/dao/config/RepositoryConfig.java deleted file mode 100755 index c7a636be..00000000 --- a/dao/src/main/java/cc/iotkit/dao/config/RepositoryConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -package cc.iotkit.dao.config; - -import org.springframework.beans.factory.BeanFactory; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; -import org.springframework.context.annotation.*; -import org.springframework.data.convert.CustomConversions; -import org.springframework.data.mongodb.MongoDatabaseFactory; -import org.springframework.data.mongodb.core.MongoOperations; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.data.mongodb.core.convert.*; -import org.springframework.data.mongodb.core.mapping.MongoMappingContext; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; - -import java.util.Collections; - -@Configuration -@Import(value = MongoAutoConfiguration.class) -@EnableMongoRepositories(basePackages = "cc.iotkit.dao", includeFilters = @ComponentScan.Filter( - type = FilterType.ASSIGNABLE_TYPE, value = MongoRepository.class)) -public class RepositoryConfig { - - @Bean - public MappingMongoConverter mappingMongoConverter( - MongoDatabaseFactory factory, - MongoMappingContext context, - BeanFactory beanFactory) { - DbRefResolver dbRefResolver = new DefaultDbRefResolver(factory); - MappingMongoConverter mappingMongoConverter = new MappingMongoConverter(dbRefResolver, context); - mappingMongoConverter.setCustomConversions(beanFactory.getBean(CustomConversions.class)); - mappingMongoConverter.setTypeMapper(new DefaultMongoTypeMapper(null)); - return mappingMongoConverter; - } - - @Bean - @ConditionalOnMissingBean({MongoOperations.class}) - MongoTemplate mongoTemplate(MongoDatabaseFactory factory, MongoConverter converter) { - return new MongoTemplate(factory, converter); - } - - @Bean - @Primary - MongoCustomConversions mongoCustomConversions() { - return new MongoCustomConversions(Collections.emptyList()); - } - -} diff --git a/data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/mqtt-component-0.2.2-SNAPSHOT.jar b/data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/mqtt-component-0.3.0-SNAPSHOT.jar similarity index 99% rename from data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/mqtt-component-0.2.2-SNAPSHOT.jar rename to data/components/eabb131d-8fd1-43a8-88d9-a198abfd3d42/mqtt-component-0.3.0-SNAPSHOT.jar index dfed45fc328767fa017624e794e2e6203b568613..ccb0a63d330d6258d1c882b6631499769b9e0d1b 100644 GIT binary patch delta 5472 zcmZXY2UJr{w}vSJ30(-C00E>+l`b`)6p`MWbdZizDG_NBnvn1X2!b@FccchN@6thf zZ;BvAnxNbe*ZThd-h0-1)}Ax(?42`{eP*563-uuj^&wHhh-A)x=Z|Fcv7$)QvTg z$OIEJDwF&+j~#0khPQ)6F820wcQ*ESf1;0R2`_Qpco*3W&hpwP;c_q(+X>4a6{-YM zwWlaQuF6%|4Or}ZEb(^aQk_*u%qf#K6h}w%7Ex7s$=e7V9Gq+n|N9ZAB=G4Yr)tP? zo$+rPh#-I!wqp*kNQ{q}1EPsS7;E<^B(av8@;=r&QYzipnqtb*TiAvveGmawk&(QE z_ywkdX?jj5QfAfZqobAC3V19D1dkjQv!BsiZn`qilUS60PJDIWI} zO=o^Dv`#9G5V`kuy!E%#WPAo?SbY%kf?I=qWYjE~{Rf$P@viJ*wQ{wMqduW_@c{w? zn=Hto*d}#o+#0SyF#;Kdnpbv+=VtynCe1R+br>}ZDf3*PpexyMg`Kr2nC9x;UFf3x zUMX6>#yy1yvE^*lT{5uyz&G-Hu%eAhh4e%D5}#S@Y(~g;*1Y_w*=Ew?eGr~3<>;S@ zweb<1JT)2L9;7!serE33$P+U+0k;UB? zW!2IIzvi`aIj^&Zxm$giGW0(fBZCy%TC?+9KaUYO`Qr93q>q)+`nukurS$Lo~EPH8hJ(~tB)o-vyvg&x(G`Ro9zsWJHZ)&99aB*;K0e^E0`0smAL(RrX zhs_Zg$xi@mj$Fygz(B?ff2{m##Ad-%Gq2lx#KRR4S{*)wL?AOgK3??~(Rrx5o%^o^ zzTZAwshl=)ca4Y1V8peGvgeKu6up8`#*G=acxtE=VPCl%BMvl>E&z@xkIDLvid2CF}CiVHTa-8nDXS**{mqm?sZ-g*3b> z=(2n8WyXCD-$uu5#E$GVSS4mp9Y{-`ev{hh>o9cK+$or~_|Ot8sW!GeaZtLU9@;8YAiu48E9~uhjL%ha;8{~hQI*?WW9o%>x zQM;eS_-CU#`!FT?lXIYH8;zzv@O(a{s9Z9b&G;}9zz@MG0r(VP#Zvqg?2lOj~kxA`;UO?bnBP~Jda1jAslm{EuHx+$%eir8S0 zvil+zZUBij39>HP_@PAWl!m)-eUCta`AodKsJ?Eazg3gi;#jSspSct>oJ&kLH(f`H z;Rmogz!7$IPu~%lUl!j2DlBxL_t+POiinNTd>hKojV&+G3oPPH>?u{-Uor6W&>o)t z2QqJ8?3uvDp8uFac8($8tgAG2SR#qI*gTor9~!{dXl@39JeEDW>O7&MpGX(!l%4y` z(z{c&XY@{%!PM#9P=o3^&w?FP&@0GYiAN%TNCno^`^Yr*QE{m1P6G}F%MmxM zx%4=Hb|y8@b>*nuB2`)ISK;AkoEMcTLxS!DQfjL9k_+F*Jb$`3y=P<+9igpMJ1o5h zN5kaee+CXa-*q2MNx#RK3gCp!8-66FF(ACqMF!~9C#SV~orh`l~My~^X)J64YXf~kT5!) zIKuL_RJ`>!DHaZz#npO6_8Ofo5h4)c1AnS~6GIv(2#A6#}Jp_vY+<%It1Vzab~>G z_*CS2WL!nCUcZ_|rYVP5m+Rm@>`8%Sq_xM#wXs)_fz89i+?S9_(e$BwG2WWqR@!j~ z7F}thM?4cFt_` z>=%PSADFgvuA)i{oa%GPAM{D_*tGf@6t0sKUEtou$(;lwV5E~3zsH>i*vdlhRwg3SgKeOpubxAD!W2Dr!j|GkB($Hs;1VaoLKFqvCj{Rgcy`%x=k1YzI=6A&) zP#&;Z|Lg&+{wzhu`Rk%U)aeCC4QV#*f0vvjl>KSl$E>JGej$qHkR)7JsdEKrAk4B|ByYd5xw4o!(vFag;(l z+N-k@G`{V)73Ue7{q#<+mj3%MASb7;apX>Y?yG)D~nr|Jb1G` zGk(;VT0-6+h0jF@qksY~b$z>S8m{)`L98*`BF-@&2b05R$I=NSd`P`DK;rFI5x3_i zGd;R*Nfz^8H*2TV=eq#qiOc@*{A8~^%ZsFH29qU(9=MZB{7R6Imrfk-)#>S;S+HGD zLe?q7`&^$#=M{RbzNQjo)iUTTm`snNlHXl{Qf?ML#32iTed!Z>7WhVXyAuSkl-0jIr1D!jp5tudJdXe7(qHxZ+ozK^FO{Oe1+s9x?ypH5E@| z0yk`U@z`qkz(lE-gaJf1HcT5e=o6?Gz)(G-8l0gMu{Z;52hv2+Gc{G#2XdK9rX4*_v29AsoOl+(emWFnwfUB5ay~M))LCywH@xsb)%`YnE9Y zJve)RSZe5pS08#Yfm^4Ab)5 z7V%uYhISN>1z6{ZKYt%Eb7qqbKdu~z_mMZ&KQn6mh-@o|RJxN^_$$vVy`J_70B7%} zYrg?F!0;h6YJ-xiv>l;LHQub2Ct)376k@t~Vd4=+y=CMp{Axk?9-Q(e7iVQ5+gvd& zz8&JE#k;)M?!GZG3(bMDxL^8QN5QuU7rb#KR~^5>1{Ea+B!74@-y>6fU#SW$i2fXs z~^~)ksR?X*bbu#6^&r#56X(=5SLE_Ikj`J0b3Lc`ZyBxR^QwN7kWRDCK` zluZIU6Rll|oGf^K?a~tUDuXmZct00k0oKvhn4S6+GX3tM2`X{4oqK1E&eYXv>zw$_ zIisj8UNw7{H{|qH_t0kxsg^$B#splu*H3{o@ zCl=;hh9YuuOD1PWbv_rad(}r%5EE{fq@84t_UqM!(VV>J?G#sp_B>Wu%E?X6Mi2W{ zqw`3wntoC5%uuj~emW(ZKJjS`Q_%Q&aT40_ok%A5jow&E2UqFPYt>(O?_CfgMJD*t zO{YjNUfJa~tNF|tJZzVgXT zv(UhzA`-BNz*p8VY$6f=n6L(){LW%X>f58T|GeDD=>^qw568?;q5+DcZ!&#hd_Z!Z zWYz+bb`40EZPg=z)u{7YeTvp@v5}Sez%AI#`DD$gB+Qr;2ZxIB|D8|r)w0R3=aUCU z-niICld&}Rpi*;c?gIeqM@$)@a_k8h5K&Lq@iBLZ;wKNV_V|e*)@s^3f^j6z#E^0z z`U?<4oLY{V{?82~;~gSYl3(q?tReEG0AZIsB=z^!#n6vtdoMlCbfrSy$J)OXD&=1> z(I1FCV4$F#PWs|`n&7vqrIY!J?9S8TF$=-cI=w0qo5*F}TT(stTH$JV=SNq7?Y1#1 zu8AWNu6?WO0k``3@Wml|3z+OM&DF`zhDjE7H!(q)t;p%mcb*lD$rHa!%?T2{s->tx zg$dS@k?(j8inZ&+QxBvXt3Hs@b&HC9ejxXzl}aVj{{_wBD*j9H%`tX06-HMeQ>{d9yFGbB4v*CC%qD0Pepm@XKXRHw<}GW?s;E@0 z%xNRM$WL7!HCAY&bxr#+jyjY5IOMoqaFv{bXX{MqGv6hTW~H=0uhsPF`{o@+p2_D& z-`>9B3l7l`Y*(q5;3;?J$(5`ED-{8<-n=3;KK@LEN9eSkX88h|wubm^OGnm>g!yB{Zt-3D_M@V`7+n!_byThvc+oYxLBkicF1b^o{cKa&$* z-M!xi%U^$wxrG-ax5`LA!da?`Y&rWFf&Yh+dBs}aKaGR^98Tc!^0KC4*jarF2il{a z_Uos?FhS{@l1J!Z>cA(Tl2w+l1T``&z6zE(O)&qw?!kBG>bvphx< zcYmn{NTJ~Zm=AW>`|k(})TotPm;iD09%&uwZ#4^Sy5~R9mLdC&MylyksmuCc49yBR zIVzQSA?1&UgF}eP)Bn_IZt60u_MuF>3_FCE(u9EE^B6B&Y+VPDDkP$Usp&uwHV)v3 zN&A>ddt3~781OLwFc4rM#Bd7(5e6UzVhki0NHLIMAjd#~ffB=Q3{)7XF@P}8V4%f7 zhk+gg0|rJ6O!brY%%?LzOby5YTV6s<$bsbmH@7HeRWKuNKT1d*On*~MLTSi@nPl-W zwE;U%4}S+AUk4w-r_XdWaq&Pne~Sc|K?WnbMUS~KbK%B7hT%V#JL;`Gm>C=C6DAVw zFlruS{{Gai3Yd|$oB|WtPUycQVx9xVrvPRGum06sJbhhVeE;7NZ73!l6Dmvr%yRSI zqp~qBcxIHSN<}a&#s7`BdLw526;WP_U=kFoBA5y5Cx>a^Y0+c-ZX`C=n}zuAk_hL2 z=7VYVqbd}^V%R~Wx%7Dxv^Y4QC2??W=Kr6I0EMdr7RSbyR>H&=ko+5;4GIRJyp+K7 z*u}^0Yp7%;Fb&?m?B4;cN?P3>PdY80n3nCfptWsD?a^jC7j++cg*H@)S? z|2lwBW6EF#th9F{eKY@861ds;P}l{uM!7=4EPuDjaAVAWpN0AX1v69r_X1+~(3WeA vxP2o^0&hC7`Hm7&!92Ty4e9_2=0ka@fT@XY^5G`8W8zf6^>HdJx?lbWGT-z< delta 5472 zcmZXY2Q-}B)`0asT69JiEn4&%45GIXjLzt7FlsOnqDC*H1W^)Ql<1K!K^R7KqDKv) zMo$oT%=i8Oz4!m$wVt)ld-mD;ly|>pt-Tjo!xmb@0ERlacr;iI?T65E3O_)*d{=!on&-^WQ6+mcm6Zw21=S75BE0 z5sGJn>6ph`B*AoaQix*YK7}+!@=+>aqzk3Wt!%2MtRciSzziYy7>%qnPsSyX8jkXw zP^M9IESCZZxjmXYa(4^SEGBiv^#lh*MF(@^4;Xz8Tz&D9zX9lcH|s*soTFhG_kyn% zDDRctVzRU#f9^ZnKHc@_`24F6mdIfnIU5CNH+lx}Gmb;XFt;(5EMjL?473-pgdj_5 z8C)Ne+0$C2?c#9C+f$(HaV*YCg!2yM0r`6BCz2iO{4UikSU0!h%57^m4)ka|BpZzn z#P2b=p;GO;rj)44pHZl1A0pkecrNwjMKfZ)Z^-p%Kb%upy5WAO$&;4uJ&N!Z+uxkd zx&v!Q4r#jP&L(pt<-W;;f|d~F0@(^#eQ|0>`%lZ{>c;uSxp&I%+6NmyhZhl~TgZ;a zlH$G&>8o`Vk>so_I9yQsIvVq4*CiMnpKb3LVfjtNg}GYd>!+n+ON+8}-I<2FGe%BU zpAD)W{xa`BO7a6qz9~Oi@QNTNC1PlK`w+hG_h}A0T^(Dq%xJp5n9_(eWyu zcRVMUrG2=Gg8-}hcb_G25+2T+lfqEquqD}oSjmOL@mgBg&g6G`n9t_c6=TQL&8XKZ z`P4xnyb-mKPvV*0X*fvdU);D&(H1!7 z9@Q<)!lt_p>Vnf%>ho2_I!`sIsscWNcZ{oBro(OB7s1ufHoI;zbdh)tI-7ez@&`+o z`y<=pDMeWInl(obg8Ng4Vj_Ofx5<}~8(%;Xvd0-7HXeKFYu;1-9@*1n6UIcbr8zhd z#l)JV$x&+992j}Lcp!bvMr1aBo=gcqJVeQnfJ^!`HJ zX8e#IAVS*4`BNVouA?x~4U%^O#mtEO0J+uQw{I zkcKqBE|st8z3cz5*SO>P5Ry)uD%;;>tl$R;Fa97{wb)Lka1N-C5BljEB-+87Rh$dI z&n4padbd*9NF62I)K8`{WbRV0m_^hthtOI1l`g~5AV)y1|7i0JFf%9PnXh{aTrnrC z%-~9Hi7j2Es{S$=xkt{fLDjQ+42mD7v;#iN zOXU!YyN}6`oX@0^S{bF$Cg>51XYWeE?>xRYl~-2F7+X@7h$mlD2t|@;)I!F0-&L@v zw+h+ z*m!U??z5EK$d>ou$NuI8~bhYH?XrN6-HR}%r(ltmsYZK8@@e; zUD{kGq@yuzZbHq+x_^AxNq7~ZD^*(oZnx^O-Tu9|GMtmE&8s;p1~LovZ&#)(JsNR9hDLh&to1_NfG9Y%Bwr#o=8XSAO%ffFOnvL)Id`ge@Gv&tQRE?VQE4rqp|fajQQ| z%9QV9kWo=)0L0XFv)Fa-mCW%Z; zq29~d)6KXwQ=$I%oC35ZHs_v29mPnkYOPZu(N@ zPzl?BeEH-UszBb;jykYH*w#Qn%9xAxGF z=e2|X@Q6fd*okJca~!3AJy_As`@=UHQJ<53UkTnEA?YD+@kuAyh%B=G`k@?HF{D1S z^oyUGe8<}2c3f_{fdd`c2><7@!nKN}m>1mQ!m@rJLPZZ|HuK?x{#jm2cTWjW1w$Dm zkx)V%a{lhhsF>27iVa%Q&n5mJ6-PkG6uJiUY24ye9^l^KZh*J*z=Oda%Uo>aFzj9? ziMRuEcT%r3(A1V>ZaCNh;Oo*+)ArFm-dRuThGC=S_58pOo;Rc8ojD|X2f&Cc2~o|RJZ#pCy2;NO!P9x zdFv>AkpI&0$u;?NO*FML)kgV!Q|QI40W5=YC(eApFJDyWK4X$0!Q#&RJN3e%7Qc0G zt|qf5GEP+d*@aDgkd%)n$3-AUDM!JJ1`_GJsQVO8ZL<-({t%0b-yWuKk6CoUE%GuR zQHfl3##2V{xT=VCs}LIDzd9+}c~?Tn=BU&ejjt9w6KAs7*)nFbUquPV=uwc$&yvDQ z5^2)U-Hx&)l1x)ntCh$V32U#BrFcG;dR}Z{meuap8f<+9YJVL0mLXRkA>H;g@04Ds z-t^|J@%gR9Q8!WsnDo4!%uP~gd7TQ+=kF!M6V32|ZzzbzmOI-My8tQ-1%y?FM@-pY zSew+Qnsice6!BOkarQ|HY%{Pw^o2cIVojD@KXE<0OkIwa^s&m#Q5%#p3LfA=cvxTa zy|L!0mHeYM6;5$`wdD z&vFzRw8x(b?Ck~PnA1WZ=wCuv68#O=-ja^`A}H60sn>olR4La1U|r>GI$B*dHl(iD zDbe7j$XYgn-AkzQuMkaj4UT!!$!mu?YgIdDB2TVjYrTtUsEbe@lz+NuF&RZPD5nY^ zRYh6)l2-bx4P$$LylkL4e`SpwAzARazm|Nty3HTgn_Efm>iltC`+&Wi$O@C()M@68 zluc~x!uw!(?5{|VEje<4O+Uv%bbjTHP}CTo+0u&DC~W=Zr$E4Grj|xUog3s>y+tV# z=h~dN!?`}~?!jtGk#9@v=5DdTiKr2LM8|vyJdyoq(|M~d*pMV!w7sZp^_TM*O8-G; zIL@U&T&JzWw{_Y2E4MRCk87W;p1~;dttx*u4X;{wR$g}J1}wDp#z9hOFl*u&_=d;* z$Ir?3#084fKUy<4?HBod-^e!2)WexVXC+vBek?`Qten=>j?^l}uZ9|YoQTzd@4VyO zqnth|jko-A+F|v+MoAX`Od!uxZ3XZE+q)>lhJTc+3sPX}Cqir;0xe)Xq! zi)6yio9gj#8#ADKN_*CjFI{ya&&wg4xd<@vv6hs zg_wP4DlUFu)4%TxV55Nzn~7aYZm0ip|07T}VjSa<8uJ2}@*Whz^+38{6C(0t`yy+q zd^C_!Y3cg6miZkaN*h)gpgXA+L= z1X>41w%+oButTB35Q1-g;(uo+wvIn;Ov$jYsG0sJ2PXU{O>cUwSp>jjCl4R{Vq+Se zX0n(xrRm(#4-c<9_lpUl7=q835o5=Ri+;DP&MjTo8=GRL7nGN5U^5T z@1oA*+`T|~mmn`P`1ht++TW)a^^>fe4&uVJD>Og8r?-#0vf=Rzjw&!l%*D>=JfNQ= z*xd3#iGPCXQZElyb2_H;wQ!n*A1fAopf-sPRHoTQVwdI}xl(a+CN)PJ#}YR?k(3(4 z@Mu4uIS()7&Z7>_M^JAKL>RJ;UIMBnKBXOUTv=d|`M+RlbR8(ull@(rsi#guT6Zl$ zylKbgu>3*Ei=Z)8awC>&ME7E+4|80VD?XWpe8A1xqu~`Yej7rz<10dlFjVLSX*1jUp#80bX$0&HZ3FI%Os#QfJaM z4#L60B0vY~e-&yn*dXD|+l<=;m$C$SPcCAi*qHHOPp96gp^G}840|VF)FdQ!5`v8e z2MsP7JT&-d2+$CsAwolph6D{M8ZtBhG~{R~&`_eGLPL$_4jLLXv}owi(4%2M!-$3n z4Rh-xgyn387+nN1!PJ)!6N*4ZyxUgV?snc0J38I7okmXEGRQL*y+%f zv;SHkV&zs>fYD`)QZgZwVL&pBk)kqMq04YEux=0G-wy!-TLmbInMYOyJ&%wy+L{RgRRJpF{TP+#3=S|72B5oC|D56AoSkRHz5LZfHnvZ5Rmondot1t{p|}72OuB|<$s\",\"value\":\"0\"}]}]}" + } + ], + "filters": [ + { + "type": "device", + "config": "{\"id\":\"24b4b975-d8ac-431d-881d-8c8b40e92861\",\"type\":\"device\",\"conditions\":[{\"id\":0.08981222614734863,\"device\":\"hdX3PCMcFrCYpesJ/ABD12300002\",\"identifier\":\"powerSwitch\",\"type\":\"property\",\"comparator\":\"==\",\"value\":\"0\"}]}" + } + ], + "actions": [ + { + "type": "device", + "config": "{\"id\":\"fde024b5-5105-4639-8602-d04300613af9\",\"type\":\"device\",\"services\":[{\"device\":\"hdX3PCMcFrCYpesJ/ABD12300002\",\"identifier\":\"set\",\"inputData\":[{\"identifier\":\"powerSwitch\",\"value\":\"1\"}]},{\"device\":\"hdX3PCMcFrCYpesJ/ABD12300002\",\"identifier\":\"set\",\"inputData\":[{\"identifier\":\"windSpeed\",\"value\":\"20\"}]}]}" + } + ], + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "state": "stopped", + "desc": "test", + "createAt": 1649167998895 + } +] \ No newline at end of file diff --git a/data/init/space.json b/data/init/space.json new file mode 100644 index 00000000..a1d0e4eb --- /dev/null +++ b/data/init/space.json @@ -0,0 +1,65 @@ +[ + { + "id": "62a6a897f60ef7500d1a916b", + "homeId": "6238a49fecf37861bed7ad11", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "name": "123", + "createAt": 1655089303228 + }, + { + "id": "62a6a894f60ef7500d1a916a", + "homeId": "6238a49fecf37861bed7ad11", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "name": "123", + "createAt": 1655089300741 + }, + { + "id": "629e233be0dc6d4171e1a023", + "homeId": "629e1d80a176d816952f1e82", + "uid": "629e1d7fa176d816952f1e81", + "name": "客厅", + "createAt": 1654530875839 + }, + { + "id": "629e18fee0dc6d4171e1a021", + "homeId": "629e18e96b16ad6a3e158645", + "uid": "629daa3de5a005209d182876", + "name": "卧室", + "createAt": 1654528254438 + }, + { + "id": "629e18f3e0dc6d4171e1a020", + "homeId": "629e18e96b16ad6a3e158645", + "uid": "629daa3de5a005209d182876", + "name": "客厅", + "createAt": 1654528243058 + }, + { + "id": "62794a820b0776663635e636", + "homeId": "6238a49fecf37861bed7ad11", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "name": "阳台", + "createAt": 1652116098020 + }, + { + "id": "62794a7d0b0776663635e635", + "homeId": "6238a49fecf37861bed7ad11", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "name": "厨房", + "createAt": 1652116093323 + }, + { + "id": "62794a740b0776663635e634", + "homeId": "6238a49fecf37861bed7ad11", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "name": "卧室", + "createAt": 1652116084721 + }, + { + "id": "62794a5c0b0776663635e633", + "homeId": "6238a49fecf37861bed7ad11", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "name": "客厅", + "createAt": 1652116060926 + } +] \ No newline at end of file diff --git a/data/init/spaceDevice.json b/data/init/spaceDevice.json new file mode 100644 index 00000000..f6b242ab --- /dev/null +++ b/data/init/spaceDevice.json @@ -0,0 +1,101 @@ +[ + { + "id": "629f5821e0dc6d4171e1a029", + "uid": "629daa3de5a005209d182876", + "deviceId": "164785263238900cefafcfeeab0000125", + "name": "卧室的ZGW01", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654609953349 + }, + { + "id": "629f581ee0dc6d4171e1a028", + "uid": "629daa3de5a005209d182876", + "deviceId": "164776322117404acb9f03008d1500168", + "name": "卧室的插座", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654609950464, + "useAt": 1655653227177 + }, + { + "id": "629f581ce0dc6d4171e1a027", + "uid": "629daa3de5a005209d182876", + "deviceId": "1647763221972019a89f03008d1500163", + "name": "卧室的插座", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654609948550, + "useAt": 1655653294372 + }, + { + "id": "629f581ae0dc6d4171e1a026", + "uid": "629daa3de5a005209d182876", + "deviceId": "164776322227201472a803008d150016e", + "name": "卧室的插座", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654609946750, + "useAt": 1655653552172 + }, + { + "id": "629f5818e0dc6d4171e1a025", + "uid": "629daa3de5a005209d182876", + "deviceId": "16477632226720c2cc9f03008d1500166", + "name": "卧室的插座", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654609944061, + "useAt": 1655653548172 + }, + { + "id": "629f5734e0dc6d4171e1a024", + "uid": "629daa3de5a005209d182876", + "deviceId": "16477632215720c11b1602008d1500160", + "name": "卧室的插座", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654609716856, + "useAt": 1655653590474 + }, + { + "id": "629e1a1de0dc6d4171e1a022", + "uid": "629daa3de5a005209d182876", + "deviceId": "1647690908735019dd9f03008d1500163", + "name": "卧室的插座", + "homeId": "629e18e96b16ad6a3e158645", + "spaceId": "629e18fee0dc6d4171e1a021", + "addAt": 1654528541149, + "useAt": 1655653255089 + }, + { + "id": "629db2e1e5a005209d182877", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "deviceId": "16538390924670pulg0a001006000012a", + "name": "阳台的插座", + "homeId": "6238a49fecf37861bed7ad11", + "spaceId": "62794a820b0776663635e636", + "addAt": 1654502113734, + "useAt": 1655653724374 + }, + { + "id": "6280d7cd7e234141ee9d1fd2", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "deviceId": "16501806313260000833feffac33bc16c", + "name": "灯的插座", + "homeId": "6238a49fecf37861bed7ad11", + "spaceId": "62794a5c0b0776663635e633", + "addAt": 1652611021619, + "useAt": 1655181137254 + }, + { + "id": "6280b17d7e234141ee9d1fcf", + "uid": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "deviceId": "165017126122400cefafcfee61000012b", + "name": "客厅网关", + "homeId": "6238a49fecf37861bed7ad11", + "spaceId": "62794a5c0b0776663635e633", + "addAt": 1652601213676, + "useAt": 1655189186348 + } +] \ No newline at end of file diff --git a/data/init/taskInfo.json b/data/init/taskInfo.json new file mode 100644 index 00000000..59a1b9bc --- /dev/null +++ b/data/init/taskInfo.json @@ -0,0 +1,35 @@ +[ + { + "id": "97f79dde-bf3c-4d5b-bfd8-8102539002ad", + "name": "测试111", + "type": "timer", + "expression": "*/25 * * * * ? *", + "desc": "sss入网", + "actions": [ + { + "type": "device", + "config": "{\"id\":\"f8de6282-771d-4cdb-9929-299db46f361d\",\"type\":\"device\",\"services\":[{\"device\":\"hbtgIA0SuVw9lxjB/AA:BB:CC:DD:11\",\"identifier\":\"allowJoin\",\"inputData\":[]}]}" + } + ], + "state": "stopped", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "createAt": 1645928016031, + "reason": "stop by fa1c5eaa-de6e-48b6-805e-8f091c7bb831" + }, + { + "id": "667bbfa1-a7ed-4ce8-9ce0-cfa8cac90e6c", + "name": "2222", + "type": "delay", + "expression": "22", + "desc": "2222", + "actions": [ + { + "type": "device", + "config": "{\"id\":\"24fd7df7-5c7d-4964-83af-a83d04b4db58\",\"type\":\"device\",\"services\":[{\"device\":\"Rf4QSjbm65X45753/ABC12300001\",\"identifier\":\"set\",\"inputData\":[{\"identifier\":\"powerstate\",\"value\":\"1\"}]}]}" + } + ], + "state": "stopped", + "createAt": 1645871966035, + "reason": "stop by 6286886077b91b031115e6a6" + } +] \ No newline at end of file diff --git a/data/init/thingModel.json b/data/init/thingModel.json new file mode 100644 index 00000000..65c8ec97 --- /dev/null +++ b/data/init/thingModel.json @@ -0,0 +1,980 @@ +[ + { + "id": "xpsYHExTKPFaQMS7", + "productKey": "xpsYHExTKPFaQMS7", + "model": { + "properties": [ + { + "identifier": "powerstate", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关", + "accessMode": "rw" + }, + { + "identifier": "brightness", + "dataType": { + "type": "int32", + "specs": { + "min": "1", + "max": "100" + } + }, + "name": "亮度", + "accessMode": "rw" + } + ], + "services": [], + "events": [] + } + }, + { + "id": "hdX3PCMcFrCYpesJ", + "productKey": "hdX3PCMcFrCYpesJ", + "model": { + "properties": [ + { + "identifier": "windSpeed", + "dataType": { + "type": "int32", + "specs": { + "min": "1", + "max": "10" + } + }, + "name": "风速", + "accessMode": "rw" + }, + { + "identifier": "powerSwitch", + "dataType": { + "type": "bool", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "电源开关", + "accessMode": "rw" + }, + { + "identifier": "workMode", + "dataType": { + "type": "enum", + "specs": { + "1": "正常风", + "2": "自然风", + "3": "睡眠风", + "4": "静音风" + } + }, + "name": "工作模式", + "accessMode": "rw" + } + ], + "services": [], + "events": [] + } + }, + { + "id": "hbtgIA0SuVw9lxjB", + "productKey": "hbtgIA0SuVw9lxjB", + "model": { + "properties": [], + "services": [ + { + "identifier": "allowJoin", + "inputData": [], + "outputData": [], + "name": "开启入网" + }, + { + "identifier": "rawSend", + "inputData": [ + { + "identifier": "data", + "dataType": { + "type": "text", + "specs": { + "length": "10240" + } + }, + "name": "数据" + }, + { + "identifier": "mac", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备mac" + }, + { + "identifier": "model", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备型号" + } + ], + "outputData": [], + "name": "透传下发" + } + ], + "events": [ + { + "identifier": "rawReport", + "outputData": [ + { + "identifier": "data", + "dataType": { + "type": "text", + "specs": { + "length": "10240" + } + }, + "name": "数据" + }, + { + "identifier": "mac", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备mac" + }, + { + "identifier": "model", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备型号" + } + ], + "name": "透传上报" + } + ] + } + }, + { + "id": "eDhXKwEzwFybM5R7", + "productKey": "eDhXKwEzwFybM5R7", + "model": { + "properties": [ + { + "identifier": "powerstate", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "全开关", + "accessMode": "rw" + }, + { + "identifier": "powerstate_1", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关1", + "accessMode": "rw" + }, + { + "identifier": "powerstate_2", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关2", + "accessMode": "rw" + }, + { + "identifier": "powerstate_3", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关3", + "accessMode": "rw" + }, + { + "identifier": "DeviceType", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "型号", + "accessMode": "r" + }, + { + "identifier": "rssi", + "dataType": { + "type": "int32", + "specs": { + "min": "-127", + "max": "127" + } + }, + "name": "信号强度", + "accessMode": "r" + } + ], + "services": [], + "events": [ + { + "identifier": "faultReportEvent", + "outputData": [ + { + "identifier": "code", + "dataType": { + "type": "int32", + "specs": {} + }, + "name": "错误代码" + } + ], + "name": "故障上报" + } + ] + } + }, + { + "id": "cGCrkK7Ex4FESAwe", + "productKey": "cGCrkK7Ex4FESAwe", + "model": { + "properties": [ + { + "identifier": "rssi", + "dataType": { + "type": "int32", + "specs": { + "min": "-127", + "max": "127" + } + }, + "name": "信号强度", + "accessMode": "r" + }, + { + "identifier": "DeviceType", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备型号", + "accessMode": "r" + }, + { + "identifier": "powerstate", + "dataType": { + "type": "bool", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关", + "accessMode": "rw" + } + ], + "services": [ + { + "identifier": "Toggle", + "inputData": [], + "outputData": [], + "name": "开关切换" + } + ], + "events": [ + { + "identifier": "faultReportEvent", + "outputData": [ + { + "identifier": "code", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "255" + } + }, + "name": "错误代码" + } + ], + "name": "故障上报" + } + ] + } + }, + { + "id": "Rf4QSjbm65X45753", + "productKey": "Rf4QSjbm65X45753", + "model": { + "properties": [ + { + "identifier": "powerstate", + "dataType": { + "type": "bool", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关状态", + "accessMode": "rw" + }, + { + "identifier": "volt", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "100" + } + }, + "name": "电压", + "accessMode": "r" + } + ], + "services": [ + { + "identifier": "service1", + "inputData": [ + { + "identifier": "p1", + "dataType": { + "type": "int32", + "specs": { + "min": "1", + "max": "100" + } + }, + "name": "参数1" + }, + { + "identifier": "p2", + "dataType": { + "type": "text", + "specs": { + "length": "90" + } + }, + "name": "参数2" + } + ], + "outputData": [], + "name": "服务1" + } + ], + "events": [ + { + "identifier": "event1", + "outputData": [ + { + "identifier": "p1", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "100" + } + }, + "name": "参数p1" + }, + { + "identifier": "p2", + "dataType": { + "type": "text", + "specs": { + "length": "100" + } + }, + "name": "参数p2" + } + ], + "name": "测试event1" + } + ] + }, + "_class": "cc.iotkit.model.ThingModel" + }, + { + "id": "PN3EDmkBZDD8whDd", + "productKey": "PN3EDmkBZDD8whDd", + "model": { + "properties": [ + { + "identifier": "power", + "dataType": { + "type": "int32", + "specs": {} + }, + "name": "电量", + "accessMode": "r" + }, + { + "identifier": "DeviceType", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备型号", + "accessMode": "r" + }, + { + "identifier": "rssi", + "dataType": { + "type": "int32", + "specs": { + "min": "-127", + "max": "127" + } + }, + "name": "信号强度", + "accessMode": "r" + }, + { + "identifier": "doorStatus", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "门状态", + "accessMode": "r" + } + ], + "services": [], + "events": [ + { + "identifier": "prylockEvent", + "outputData": [], + "name": "防撬报警事件" + } + ] + } + }, + { + "id": "N523nWsCiG3CAn6X", + "productKey": "N523nWsCiG3CAn6X", + "model": { + "properties": [ + { + "identifier": "DeviceType", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备型号", + "accessMode": "r" + }, + { + "identifier": "UnbindAndDelete", + "dataType": { + "type": "bool", + "specs": { + "0": "否", + "1": "是" + } + }, + "name": "解绑并删除设备", + "accessMode": "rw" + } + ], + "services": [ + { + "identifier": "Reboot", + "inputData": [], + "outputData": [], + "name": "重启" + }, + { + "identifier": "AllowJoin", + "inputData": [], + "outputData": [], + "name": "开启组网" + }, + { + "identifier": "OpenTrace", + "inputData": [ + { + "identifier": "enable", + "dataType": { + "type": "bool", + "specs": { + "0": "Close", + "1": "Open" + } + }, + "name": "值" + } + ], + "outputData": [], + "name": "打开调试" + }, + { + "identifier": "ShowDesc", + "inputData": [ + { + "identifier": "ieee", + "dataType": { + "type": "text", + "specs": { + "length": "32" + } + }, + "name": "设备地址" + } + ], + "outputData": [], + "name": "显示设备信息" + }, + { + "identifier": "rawSend", + "inputData": [ + { + "identifier": "model", + "dataType": { + "type": "text", + "specs": {} + }, + "name": "设备型号" + }, + { + "identifier": "mac", + "dataType": { + "type": "text", + "specs": {} + }, + "name": "设备mac" + }, + { + "identifier": "data", + "dataType": { + "type": "text", + "specs": {} + }, + "name": "数据" + } + ], + "outputData": [], + "name": "透传下发" + } + ], + "events": [ + { + "identifier": "faultReport", + "outputData": [ + { + "identifier": "code", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "255" + } + }, + "name": "错误码" + } + ], + "name": "故障上报" + }, + { + "identifier": "rawReport", + "outputData": [ + { + "identifier": "model", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "设备型号" + }, + { + "identifier": "mac", + "dataType": { + "type": "text", + "specs": {} + }, + "name": "设备mac" + }, + { + "identifier": "data", + "dataType": { + "type": "text", + "specs": {} + }, + "name": "数据" + } + ], + "name": "透传上报" + } + ] + } + }, + { + "id": "KdJYpTp5ywNhmrmC", + "productKey": "KdJYpTp5ywNhmrmC", + "model": { + "properties": [], + "services": [], + "events": [ + { + "identifier": "userDevicesChange", + "outputData": [ + { + "identifier": "uid", + "dataType": { + "type": "text", + "specs": { + "length": "100" + } + }, + "name": "用户Id" + } + ], + "name": "用户设备列表变更" + } + ] + } + }, + { + "id": "Eit3kmGJtxSHfCKT", + "productKey": "Eit3kmGJtxSHfCKT", + "model": { + "properties": [ + { + "identifier": "flow", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "100000" + } + }, + "name": "用量", + "accessMode": "r" + }, + { + "identifier": "fee", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "100000" + } + }, + "name": "费用", + "accessMode": "rw" + } + ], + "services": [], + "events": [] + } + }, + { + "id": "D8c5pXFmt2KJDxNm", + "productKey": "D8c5pXFmt2KJDxNm", + "model": { + "properties": [ + { + "identifier": "powerstate_1", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关1", + "accessMode": "r" + }, + { + "identifier": "powerstate_2", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关2", + "accessMode": "r" + }, + { + "identifier": "powerstate_3", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关3", + "accessMode": "r" + }, + { + "identifier": "powerstate_4", + "dataType": { + "type": "enum", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关4", + "accessMode": "r" + }, + { + "identifier": "DeviceType", + "dataType": { + "type": "text", + "specs": { + "length": "128" + } + }, + "name": "型号", + "accessMode": "r" + }, + { + "identifier": "rssi", + "dataType": { + "type": "int32", + "specs": { + "min": "-127", + "max": "127" + } + }, + "name": "信号强度", + "accessMode": "r" + } + ], + "services": [], + "events": [ + { + "identifier": "faultReportEvent", + "outputData": [ + { + "identifier": "code", + "dataType": { + "type": "int32", + "specs": {} + }, + "name": "错误代码" + } + ], + "name": "故障上报" + } + ] + } + }, + { + "id": "AWcJnf7ymGSkaz5M", + "productKey": "AWcJnf7ymGSkaz5M", + "model": { + "properties": [ + { + "identifier": "rssi", + "dataType": { + "type": "int32", + "specs": { + "min": "-128", + "max": "128" + } + }, + "name": "信号强度", + "accessMode": "r" + }, + { + "identifier": "switch", + "dataType": { + "type": "bool", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "开关", + "accessMode": "rw" + }, + { + "identifier": "voltage", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "1000" + } + }, + "name": "电压", + "accessMode": "r" + }, + { + "identifier": "current", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "1000" + } + }, + "name": "电流", + "accessMode": "r" + }, + { + "identifier": "power", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "1000000" + } + }, + "name": "功率", + "accessMode": "r" + }, + { + "identifier": "electricty", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "1000000000" + } + }, + "name": "电量", + "accessMode": "r" + }, + { + "identifier": "back_light", + "dataType": { + "type": "bool", + "specs": { + "0": "关", + "1": "开" + } + }, + "name": "背光灯", + "accessMode": "rw" + }, + { + "identifier": "start_onoff", + "dataType": { + "type": "enum", + "specs": { + "0": "off", + "1": "onoff with swithc", + "2": "on" + } + }, + "name": "上电启动配置", + "accessMode": "rw" + }, + { + "identifier": "cycle_timer", + "dataType": { + "type": "text", + "specs": { + "length": "64" + } + }, + "name": "循环定时", + "accessMode": "rw" + }, + { + "identifier": "countdown", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "1000000" + } + }, + "name": "倒计时", + "accessMode": "rw" + } + ], + "services": [], + "events": [] + } + }, + { + "id": "6kYp6jszrDns2yh4", + "productKey": "6kYp6jszrDns2yh4", + "model": { + "properties": [ + { + "identifier": "humidity", + "dataType": { + "type": "int32", + "specs": { + "min": "0", + "max": "100" + } + }, + "name": "湿度\t", + "accessMode": "r" + }, + { + "identifier": "temperature", + "dataType": { + "type": "int32", + "specs": { + "min": "-38", + "max": "656" + } + }, + "name": "温度\t", + "accessMode": "r" + } + ], + "services": [], + "events": [ + { + "identifier": "temperatureTooLowEvent", + "outputData": [], + "name": "温度过低事件" + } + ] + } + } +] \ No newline at end of file diff --git a/data/init/userInfo.json b/data/init/userInfo.json new file mode 100644 index 00000000..bad10b7f --- /dev/null +++ b/data/init/userInfo.json @@ -0,0 +1,140 @@ +[ + { + "id": "629e1d7fa176d816952f1e81", + "uid": "13480802157", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "secret": "483752384B473759556E685768796B6F644E48634F76486C51646A41576B545A2B396C34474244414F334F78574F4778613764564338594E666770595A376177", + "nickName": "song2", + "type": 1, + "roles": [ + "iot_client" + ], + "permissions": [], + "usePlatforms": [ + "dueros" + ], + "createAt": 1654529407977 + }, + { + "id": "629daa3de5a005209d182876", + "uid": "13510470342", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "secret": "483752384B473759556E685768796B6F644E48634F76486C51646A41576B545A2B396C34474244414F335066526F6E3331625374634F663249335661756B7049", + "nickName": "涛", + "type": 1, + "roles": [ + "iot_client" + ], + "permissions": [], + "usePlatforms": [ + "dueros" + ], + "createAt": 1654499901296 + }, + { + "id": "6286886077b91b031115e6a6", + "uid": "guest1", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "演示账户", + "secret": "48774861346645676F51324A4D6E6639306E6474437741634C4333746C4575666C316F76503455542B5836763065315A2F676244695056557356704D49513569", + "type": 0, + "roles": [ + "iot_system", + "iot_admin" + ], + "permissions": [], + "usePlatforms": [], + "createAt": 1647592821770 + }, + { + "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "uid": "iotkit", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "管理员", + "secret": "326F3251526A7A3364496136384A737A584A734B366546547458654F734E514D57706762324361576646753377634B745542494A762F32317535786939742F33", + "type": 0, + "roles": [ + "iot_system", + "iot_admin" + ], + "permissions": [ + "write" + ], + "usePlatforms": [], + "createAt": 1647592821770 + }, + { + "id": "a1051e81-f4fc-4182-a750-1a53a27f4c71", + "uid": "du2", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "小度接入2", + "type": 1, + "roles": [ + "iot_client" + ], + "usePlatforms": [ + "dueros" + ], + "createAt": 1651230139460 + }, + { + "id": "5c0bea53-a318-42ed-a7c5-6e05e6db4ef2", + "uid": "tm3", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "天猫精灵test3", + "type": 1, + "roles": [ + "iot_client" + ], + "usePlatforms": [ + "aligenie" + ], + "createAt": 1647982036151 + }, + { + "id": "2bb3e6f1-17ba-4bf5-9d5e-85fdffd8b85d", + "uid": "du1", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "小度接入1", + "secret": "483752384B473759556E685768796B6F644E48634F76486C51646A41576B545A2B396C34474244414F334F517674507547437A72627A7154302B724441734C5A", + "type": 1, + "roles": [ + "iot_client" + ], + "usePlatforms": [ + "dueros", + "aligenie" + ], + "createAt": 1651226639006 + }, + { + "id": "0ca377e2-66ff-49f3-90c3-108a86bc90eb", + "uid": "tm1", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "天猫精灵1", + "type": 1, + "roles": [ + "iot_client" + ], + "usePlatforms": [ + "aligenie" + ], + "createAt": 1648486563107 + }, + { + "id": "04c6722f-9a6d-40f3-ac9b-cd791b4c8933", + "uid": "18126045687", + "ownerId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "nickName": "song", + "secret": "483752384B473759556E685768796B6F644E48634F76486C51646A41576B545A2B396C34474244414F334F517674507547437A72627A7154302B724441734C5A", + "type": 1, + "roles": [ + "iot_client" + ], + "usePlatforms": [ + "aligenie", + "dueros" + ], + "createAt": 1652115298592 + } +] \ No newline at end of file diff --git a/data/init/virtualDevice.json b/data/init/virtualDevice.json new file mode 100644 index 00000000..974a733f --- /dev/null +++ b/data/init/virtualDevice.json @@ -0,0 +1,137 @@ +[ + { + "id":"6293953092084e2df303ba3e", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "name": "三路开关", + "productKey": "eDhXKwEzwFybM5R7", + "devices": [ + "16538390097670switch0300100500143", + "16538390048670switch0300100400141", + "16538390008670switch0300100300145", + "16538389971670switch0300100200140", + "16538389915670switch030010010014c" + ], + "type": "thingModel", + "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n\t \"rssi\":127-parseInt(Math.random()*127),\n\t \"powerstate_1\":Math.random()>0.5?1:0,\n\t \"powerstate_2\":Math.random()>0.5?1:0,\n\t \"powerstate_3\":Math.random()>0.5?1:0\n }\n }\n}", + "trigger": "random", + "triggerExpression": "second", + "state": "running", + "createAt": 1653839152090 + }, + { + "id":"629391ae92084e2df303ba3d", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "name": "温湿度传感器", + "productKey": "6kYp6jszrDns2yh4", + "devices": [ + "16538383943670wenshidu01008000139", + "16538383910670wenshidu01007000136", + "16538383880670wenshidu0100600013b", + "16538383850710wenshidu01005000134", + "16538383810690wenshidu01004000132", + "16537594784840wenshidu0100300013a", + "16537594752710wenshidu0100200013d", + "16537594707840wenshidu0100100013c", + "16514626218250abe124000010000011a" + ], + "type": "thingModel", + "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"humidity\":parseInt(Math.random()*100),\n\t \"temperature\":parseInt(Math.random()*500)-38\n }\n }\n}", + "trigger": "random", + "triggerExpression": "second", + "state": "running", + "createAt": 1653838254989 + }, + { + "id": "629390f492084e2df303ba3c", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "name": "调光灯", + "productKey": "xpsYHExTKPFaQMS7", + "devices": [ + "16537595658790linght0010030000128", + "16537595624750linght001002000012c", + "16537595591780linght0010010000121", + "16552594933210linght001007000012f", + "16552594898210linght0010060000129", + "16552594863210linght001005000012c", + "16552594812210linght001004000012d" + ], + "type": "thingModel", + "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"brightness\":parseInt(Math.random()*100),\n\t \"powerstate\":Math.random()>0.5?1:0\n }\n }\n}", + "trigger": "random", + "triggerExpression": "second", + "state": "running", + "createAt": 1653838068860 + }, + { + "id": "62925cb72002b44c15caeb1c", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "name": "虚拟门磁1", + "productKey": "PN3EDmkBZDD8whDd", + "devices": [ + "16537591055800menci0001003000012e", + "16537590838150menci00010020000128", + "16537590780810menci0001001000012b", + "16552595723210menci0001008000012f", + "16552595685220menci00010070000127", + "16552595656210menci0001006000012d", + "16552595626260menci0001005000012b", + "16552595580220menci0001004000012a", + "16501898583770f4cce4feffbd1bec164" + ], + "type": "thingModel", + "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"rssi\":127-parseInt(Math.random()*127),\n \"power\":parseInt(Math.random()*100),\n\t \"doorStatus\":Math.random()>0.5?1:0\n }\n }\n}", + "trigger": "random", + "triggerExpression": "minute", + "state": "running", + "createAt": 1653759159567 + }, + { + "id": "628fd800fba69e633a972e12", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "name": "开关1", + "productKey": "Rf4QSjbm65X45753", + "devices": [ + "16465723451670abc123000030000011a", + "16465723448670abc1230000200000115" + ], + "type": "thingModel", + "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [{\n \"productKey\":service.productKey,\n \"deviceName\":service.deviceName,\n \"mid\":service.mid,\n \"type\":\"service\",\n \"identifier\":\"reboot_reply\",\n \"data\":{},\n \"code\":0\n },{\n \"mid\":getRequestId(),\n \"productKey\":service.productKey, \n \"deviceName\":service.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\n \"time\":new Date().getTime(),\n \"data\":{\n \"volt\":parseInt(Math.random()*100),\n\t \"powerstate\":Math.random()>0.5?1:0\n }\n }]\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"volt\":parseInt(Math.random()*100)\n }\n }\n}", + "trigger": "cron", + "triggerExpression": "0 * * * * ? ", + "state": "running", + "createAt": 1653594112764 + }, + { + "id": "628fa6bc1b735b73cb260042", + "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831", + "name": "虚拟插座12", + "productKey": "cGCrkK7Ex4FESAwe", + "devices": [ + "16534030209640test001230100000118", + "16514626216250abe1230000200000114", + "16514626214280abe1230000100000116", + "16538390924670pulg0a001006000012a", + "16538390885690pulg0a0010050000126", + "16538390853670pulg0a0010040000121", + "16538390820760pulg0a0010030000127", + "16538390787670pulg0a0010020000124", + "16538390738670pulg0a0010010000125", + "16552594646210pulg0a0010160000122", + "16552594604220pulg0a0010150000127", + "16552594572370pulg0a001014000012e", + "16552594542310pulg0a0010130000123", + "16552594511210pulg0a001012000012c", + "16552594475270pulg0a0010110000125", + "16552594444210pulg0a0010100000128", + "16552594405220pulg0a0010090000124", + "16552594368340pulg0a0010080000126", + "16552594320310pulg0a0010070000126" + ], + "type": "thingModel", + "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n var identifier=service.identifier;\n var result= [{\n \"productKey\":service.productKey,\n \"deviceName\":service.deviceName,\n \"mid\":service.mid,\n \"type\":\"service\",\n \"identifier\":identifier+\"_reply\",\n \"data\":{},\n \"code\":0\n }]\n \n if(service.type==\"property\" && (identifier==\"get\" || identifier==\"set\")){\n\tresult.push({\n\t \"mid\":getRequestId(),\n\t \"productKey\":device.productKey, \n\t \"deviceName\":device.deviceName,\n\t \"type\":\"property\",\n\t \"identifier\":\"report\",\n\t \"occurred\":new Date().getTime(),\n\t \"time\":new Date().getTime(),\n\t \"data\":service.params\n\t});\n }\n \n return result;\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"rssi\":127-parseInt(Math.random()*127),\n\t \"powerstate\":Math.random()>0.5?1:0\n }\n }\n}", + "trigger": "random", + "triggerExpression": "second", + "state": "running", + "createAt": 1653581500076 + } +] \ No newline at end of file diff --git a/manager/pom.xml b/manager/pom.xml index 54488a17..9099f1ec 100755 --- a/manager/pom.xml +++ b/manager/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 @@ -15,7 +15,7 @@ org.springframework.boot - spring-boot-starter-data-mongodb + spring-boot-starter-data-elasticsearch diff --git a/manager/src/main/java/cc/iotkit/manager/Application.java b/manager/src/main/java/cc/iotkit/manager/Application.java index b7edecf8..ebc926c4 100755 --- a/manager/src/main/java/cc/iotkit/manager/Application.java +++ b/manager/src/main/java/cc/iotkit/manager/Application.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager; import cc.iotkit.manager.config.EmbeddedElasticSearchConfig; diff --git a/manager/src/main/java/cc/iotkit/manager/config/AliyunConfig.java b/manager/src/main/java/cc/iotkit/manager/config/AliyunConfig.java index 4946ec51..8e2d4de4 100755 --- a/manager/src/main/java/cc/iotkit/manager/config/AliyunConfig.java +++ b/manager/src/main/java/cc/iotkit/manager/config/AliyunConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.config; diff --git a/manager/src/main/java/cc/iotkit/manager/config/CacheConfig.java b/manager/src/main/java/cc/iotkit/manager/config/CacheConfig.java index 0f5d02e5..a9b74895 100755 --- a/manager/src/main/java/cc/iotkit/manager/config/CacheConfig.java +++ b/manager/src/main/java/cc/iotkit/manager/config/CacheConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.config; import cc.iotkit.common.Constants; diff --git a/manager/src/main/java/cc/iotkit/manager/config/CrossConfig.java b/manager/src/main/java/cc/iotkit/manager/config/CrossConfig.java index a1224d5e..1f1d0f4d 100755 --- a/manager/src/main/java/cc/iotkit/manager/config/CrossConfig.java +++ b/manager/src/main/java/cc/iotkit/manager/config/CrossConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.config; diff --git a/manager/src/main/java/cc/iotkit/manager/config/EmbeddedElasticSearchConfig.java b/manager/src/main/java/cc/iotkit/manager/config/EmbeddedElasticSearchConfig.java index 955ac1e9..2a092ff6 100755 --- a/manager/src/main/java/cc/iotkit/manager/config/EmbeddedElasticSearchConfig.java +++ b/manager/src/main/java/cc/iotkit/manager/config/EmbeddedElasticSearchConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.config; import lombok.SneakyThrows; diff --git a/manager/src/main/java/cc/iotkit/manager/controller/AppController.java b/manager/src/main/java/cc/iotkit/manager/controller/AppController.java index c54d5d98..011734f9 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/AppController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/AppController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.dao.AppDesignRepository; @@ -9,10 +18,10 @@ import cc.iotkit.model.Paging; import cc.iotkit.model.product.AppDesign; import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Product; +import cc.iotkit.utils.AuthUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Example; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -40,11 +49,15 @@ public class AppController { public Paging getDesigns() { List appDesignVos = new ArrayList<>(); - List products = productRepository.findAll(Example - .of(dataOwnerService.wrapExample(new Product()))); - - List appDesigns = appDesignRepository.findAll(Example - .of(dataOwnerService.wrapExample(new AppDesign()))); + Iterable products; + Iterable appDesigns; + if (AuthUtil.isAdmin()) { + products = productRepository.findAll(); + appDesigns = appDesignRepository.findAll(); + } else { + products = productRepository.findByUid(AuthUtil.getUserId()); + appDesigns = appDesignRepository.findByUid(AuthUtil.getUserId()); + } products.forEach(product -> { Category category = categoryRepository.findById(product.getCategory()).orElse(new Category()); diff --git a/manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java b/manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java index d9185ace..bf2cd6c6 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.common.Constants; @@ -24,18 +33,16 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; -import org.springframework.data.domain.Example; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; -import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.elasticsearch.core.query.Criteria; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.async.DeferredResult; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.regex.Pattern; @Slf4j @RestController @@ -45,7 +52,7 @@ public class DeviceController { @Autowired private DeviceService deviceService; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private ProductRepository productRepository; @Autowired @@ -96,32 +103,30 @@ public class DeviceController { if (!AuthUtil.isAdmin()) { //客户端用户使用绑定子用户查询 if (AuthUtil.isClientUser()) { - condition.and("subUid").elemMatch(new Criteria().is(uid)); + condition = condition.and("subUid").matches(uid); } else { - condition.and("uid").is(uid); + condition = condition.and("uid").is(uid); } } String pk = query.getProductKey(); if (StringUtils.isNotBlank(pk)) { - condition.and("productKey").is(pk); + condition = condition.and("productKey").is(pk); } //关键字查询 String keyword = query.getKeyword(); if (StringUtils.isNotBlank(keyword)) { - Pattern pattern = Pattern.compile("^.*" + keyword + ".*$", Pattern.CASE_INSENSITIVE); - condition.orOperator( - Criteria.where("deviceName").regex(pattern), - Criteria.where("deviceId").regex(pattern) + condition = condition.and( + Criteria.where("deviceName").contains(keyword).and("deviceId").contains(keyword) ); } String group = query.getGroup(); if (StringUtils.isNotBlank(group)) { - condition.and("group." + group).exists(true); + condition = condition.and("group." + group).exists(); } String state = query.getState(); if (StringUtils.isNotBlank(state)) { - condition.and("state.online").is(state.equals("online")); + condition = condition.and("state.online").is(state.equals("online")); } return deviceDao.find(condition, size, page); @@ -152,37 +157,33 @@ public class DeviceController { device.setState(new DeviceInfo.State(false, null, null)); device.setCreateAt(System.currentTimeMillis()); - deviceRepository.save(device); + deviceInfoRepository.save(device); } @GetMapping("/{deviceId}/children") public List getChildren(@PathVariable("deviceId") String deviceId) { - return deviceRepository.findAll(Example.of( - dataOwnerService.wrapExample( - DeviceInfo.builder() - .parentId(deviceId) - .build()))); + if (AuthUtil.isAdmin()) { + return deviceInfoRepository.findByParentId(deviceId); + } + return deviceInfoRepository.findByParentIdAndUid(deviceId, AuthUtil.getUserId()); } @GetMapping(Constants.API_DEVICE.DETAIL) public DeviceInfo getDetail(@PathVariable("deviceId") String deviceId) { - return dataOwnerService.checkOwner(deviceRepository.findById(deviceId).orElse(new DeviceInfo())); + return dataOwnerService.checkOwner(deviceInfoRepository.findById(deviceId).orElse(new DeviceInfo())); } @GetMapping("/{pk}/{dn}") public DeviceInfo getByPkDn(@PathVariable("pk") String pk, @PathVariable("dn") String dn) { return dataOwnerService.checkOwner( - deviceRepository.findOne(Example.of(DeviceInfo.builder() - .productKey(pk) - .deviceName(dn) - .build())).orElse(new DeviceInfo())); + deviceInfoRepository.findByProductKeyAndDeviceName(pk, dn)); } @PostMapping("/{deviceId}/delete") public void deleteDevice(@PathVariable("deviceId") String deviceId) { deviceId = getDetail(deviceId).getDeviceId(); - deviceRepository.deleteById(deviceId); + deviceInfoRepository.deleteById(deviceId); } @PostMapping("/{deviceId}/logs/{size}/{page}") @@ -218,7 +219,7 @@ public class DeviceController { @PostMapping("/{deviceId}/tag/add") public void addTag(@PathVariable("deviceId") String deviceId, DeviceInfo.Tag tag) { - DeviceInfo device = deviceRepository.findByDeviceId(deviceId); + DeviceInfo device = deviceInfoRepository.findByDeviceId(deviceId); dataOwnerService.checkOwner(device); deviceDao.updateTag(deviceId, tag); } @@ -227,7 +228,7 @@ public class DeviceController { public void simulateSend( @PathVariable("deviceId") String deviceId, @RequestBody ThingModelMessage message) { - DeviceInfo device = deviceRepository.findByDeviceId(deviceId); + DeviceInfo device = deviceInfoRepository.findByDeviceId(deviceId); dataOwnerService.checkOwner(device); message.setMid(UniqueIdUtil.newRequestId()); @@ -245,7 +246,7 @@ public class DeviceController { @PathVariable("clientId") String clientId ) { String uid = AuthUtil.getUserId(); - DeviceInfo deviceInfo = deviceRepository.findByDeviceId(deviceId); + DeviceInfo deviceInfo = deviceInfoRepository.findByDeviceId(deviceId); dataOwnerService.checkOwner(deviceInfo); //按用户+客户端ID订阅 diff --git a/manager/src/main/java/cc/iotkit/manager/controller/ProductController.java b/manager/src/main/java/cc/iotkit/manager/controller/ProductController.java index fc3dc336..65acc4c2 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/ProductController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/ProductController.java @@ -1,11 +1,17 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.common.exception.BizException; import cc.iotkit.common.utils.JsonUtil; -import cc.iotkit.dao.CategoryRepository; -import cc.iotkit.dao.ProductRepository; -import cc.iotkit.dao.ProductModelRepository; -import cc.iotkit.dao.ThingModelRepository; +import cc.iotkit.dao.*; import cc.iotkit.manager.config.AliyunConfig; import cc.iotkit.manager.service.DataOwnerService; import cc.iotkit.model.Paging; @@ -13,20 +19,21 @@ import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Product; import cc.iotkit.model.product.ProductModel; import cc.iotkit.model.product.ThingModel; +import cc.iotkit.utils.AuthUtil; import cn.dev33.satoken.annotation.SaCheckRole; import com.aliyun.oss.OSS; import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.model.PutObjectResult; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; +import org.springframework.data.elasticsearch.core.query.Criteria; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Optional; @@ -48,6 +55,9 @@ public class ProductController { private AliyunConfig aliyunConfig; @Autowired private ProductModelRepository productModelRepository; + @Autowired + private CommonDao commonDao; + private OSS ossClient; @@ -55,12 +65,16 @@ public class ProductController { public Paging getProducts( @PathVariable("size") int size, @PathVariable("page") int page, - Product form) { - form = dataOwnerService.wrapExample(form); - Page products = productRepository.findAll(Example.of(form), - PageRequest.of(page - 1, size, Sort.by(Sort.Order.desc("createAt"))) - ); - return new Paging<>(products.getTotalElements(), products.getContent()); + String id) { + Criteria criteria = new Criteria(); + + if (StringUtils.isNotBlank(id)) { + criteria = criteria.and("id").is(id); + } + if (!AuthUtil.isAdmin()) { + criteria = criteria.and("uid").is(AuthUtil.getUserId()); + } + return commonDao.pagedFind(Product.class, criteria, Sort.Order.desc("createAt"), size, page); } @PostMapping("/save") @@ -98,7 +112,9 @@ public class ProductController { @GetMapping("/categories") public List getCategories() { - return categoryRepository.findAll(); + List list = new ArrayList<>(); + categoryRepository.findAll().forEach(list::add); + return list; } @SaCheckRole("iot_admin") diff --git a/manager/src/main/java/cc/iotkit/manager/controller/ProtocolController.java b/manager/src/main/java/cc/iotkit/manager/controller/ProtocolController.java index a83a8fb3..79a785b7 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/ProtocolController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/ProtocolController.java @@ -204,8 +204,6 @@ public class ProtocolController { public Paging getConverters( @PathVariable("size") int size, @PathVariable("page") int page) { - protocolConverterRepository.deleteById(""); - protocolConverterRepository.deleteById("null"); Page converters = protocolConverterRepository.findAll( PageRequest.of(page - 1, size, Sort.by(Sort.Order.desc("createAt")))); return new Paging<>(converters.getTotalElements(), converters.getContent()); diff --git a/manager/src/main/java/cc/iotkit/manager/controller/RuleEngineController.java b/manager/src/main/java/cc/iotkit/manager/controller/RuleEngineController.java index c8e6a407..1e90784b 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/RuleEngineController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/RuleEngineController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.common.exception.BizException; @@ -20,6 +29,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.*; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.UUID; @@ -60,8 +70,12 @@ public class RuleEngineController { ) { RuleInfo ruleInfo = new RuleInfo(); ruleInfo.setType(type); - Page rules = ruleInfoRepository.findAll(Example.of(dataOwnerService - .wrapExample(ruleInfo)), Pageable.ofSize(size).withPage(page - 1)); + Page rules; + if (AuthUtil.isAdmin()) { + rules = ruleInfoRepository.findByType(type, Pageable.ofSize(size).withPage(page - 1)); + } else { + rules = ruleInfoRepository.findByUidAndType(AuthUtil.getUserId(), type, Pageable.ofSize(size).withPage(page - 1)); + } return new Paging<>(rules.getTotalElements(), rules.getContent()); } @@ -155,9 +169,12 @@ public class RuleEngineController { @PostMapping("/tasks") public List tasks() { - return taskInfoRepository.findAll(Example.of(dataOwnerService - .wrapExample(new TaskInfo())) - ); + List list = new ArrayList<>(); + if (AuthUtil.isAdmin()) { + taskInfoRepository.findAll().forEach(list::add); + return list; + } + return taskInfoRepository.findByUid(AuthUtil.getUserId()); } @PostMapping("/saveTask") diff --git a/manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java b/manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java index 5c8f12b3..697da87b 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/SpaceDeviceController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.common.Constants; @@ -15,7 +24,6 @@ import cc.iotkit.model.space.Space; import cc.iotkit.model.space.SpaceDevice; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Example; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; @@ -32,7 +40,7 @@ public class SpaceDeviceController { @Autowired private SpaceDeviceRepository spaceDeviceRepository; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private DeviceCache deviceCache; @Autowired @@ -78,7 +86,7 @@ public class SpaceDeviceController { } private SpaceDeviceVo parseSpaceDevice(SpaceDevice sd) { - DeviceInfo device = deviceRepository.findByDeviceId(sd.getDeviceId()); + DeviceInfo device = deviceInfoRepository.findByDeviceId(sd.getDeviceId()); Space space = spaceCache.getSpace(sd.getSpaceId()); Product product = productCache.findById(device.getProductKey()); Category category = categoryCache.getById(product.getCategory()); @@ -107,7 +115,7 @@ public class SpaceDeviceController { */ @GetMapping("/{userId}/devices") public List getDevices(@PathVariable("userId") String userId) { - List spaceDevices = spaceDeviceRepository.findAll(Example.of(SpaceDevice.builder().uid(userId).build())); + List spaceDevices = spaceDeviceRepository.findByUid(userId); return spaceDevices.stream().map((this::parseSpaceDevice)).collect(Collectors.toList()); } @@ -121,7 +129,7 @@ public class SpaceDeviceController { } List findDeviceVos = new ArrayList<>(); - List devices = deviceRepository.findByDeviceName(mac); + List devices = deviceInfoRepository.findByDeviceName(mac); if (devices == null) { return findDeviceVos; } @@ -130,7 +138,7 @@ public class SpaceDeviceController { List subDevices = new ArrayList<>(); for (DeviceInfo device : devices) { if (device.getParentId() == null) { - subDevices = deviceRepository.findByParentId(device.getDeviceId()); + subDevices = deviceInfoRepository.findByParentId(device.getDeviceId()); } } devices.addAll(subDevices); @@ -167,7 +175,7 @@ public class SpaceDeviceController { @PostMapping(Constants.API_SPACE.ADD_DEVICE) public void addDevice(SpaceDevice device) { String deviceId = device.getDeviceId(); - DeviceInfo deviceInfo = deviceRepository.findByDeviceId(deviceId); + DeviceInfo deviceInfo = deviceInfoRepository.findByDeviceId(deviceId); if (deviceInfo == null) { throw new BizException("device does not exist"); } @@ -219,7 +227,7 @@ public class SpaceDeviceController { tags.put(platform, new DeviceInfo.Tag(platform, thirdPlatform.desc, "是")); } - deviceRepository.save(deviceInfo); + deviceInfoRepository.save(deviceInfo); } /** @@ -235,7 +243,7 @@ public class SpaceDeviceController { dataOwnerService.checkOwner(spaceDevice); spaceDeviceRepository.deleteById(spaceDevice.getId()); - DeviceInfo deviceInfo = deviceRepository.findByDeviceId(deviceId); + DeviceInfo deviceInfo = deviceInfoRepository.findByDeviceId(deviceId); Optional optUser = userInfoRepository.findById(uid); if (optUser.isEmpty()) { throw new BizException("user does not exist"); @@ -249,7 +257,7 @@ public class SpaceDeviceController { deviceInfo.getTag().remove(platform); } - deviceRepository.save(deviceInfo); + deviceInfoRepository.save(deviceInfo); } /** @@ -296,12 +304,12 @@ public class SpaceDeviceController { dataOwnerService.checkOwner(spaceDevice); //找到设备 - DeviceInfo deviceInfo = deviceRepository.findByDeviceId(deviceId); + DeviceInfo deviceInfo = deviceInfoRepository.findByDeviceId(deviceId); Map tags = deviceInfo.getTag(); String openUidName = platform + "OpenUid"; //给设备添加对应平台openUid的设备标签 Constants.ThirdOpenUid thirdOpenUid = Constants.ThirdOpenUid.valueOf(openUidName); tags.put(openUidName, new DeviceInfo.Tag(openUidName, thirdOpenUid.desc, openUid)); - deviceRepository.save(deviceInfo); + deviceInfoRepository.save(deviceInfo); } } diff --git a/manager/src/main/java/cc/iotkit/manager/controller/StatsController.java b/manager/src/main/java/cc/iotkit/manager/controller/StatsController.java index d4ebed2a..0ca07431 100644 --- a/manager/src/main/java/cc/iotkit/manager/controller/StatsController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/StatsController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.dao.*; @@ -19,7 +28,7 @@ public class StatsController { @Autowired private ProductRepository productRepository; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private DeviceReportRepository deviceReportRepository; @Autowired @@ -36,7 +45,7 @@ public class StatsController { if (AuthUtil.isAdmin()) { mainStats.setCategoryTotal(categoryRepository.count()); mainStats.setProductTotal(productRepository.count()); - mainStats.setDeviceTotal(deviceRepository.count()); + mainStats.setDeviceTotal(deviceInfoRepository.count()); mainStats.setReportTotal(deviceReportRepository.count()); //上报数据统计 mainStats.setReportDataStats(deviceReportDao.getDeviceMessageStats(now - 48 * 3600 * 1000, now)); @@ -45,7 +54,7 @@ public class StatsController { } else { mainStats.setCategoryTotal(categoryRepository.count()); mainStats.setProductTotal(productRepository.countByUid(uid)); - mainStats.setDeviceTotal(deviceRepository.countByUid(uid)); + mainStats.setDeviceTotal(deviceInfoRepository.countByUid(uid)); mainStats.setReportTotal(deviceReportRepository.countByUid(uid)); //上报数据统计 mainStats.setReportDataStats(deviceReportDao.getDeviceMessageStatsWithUid(uid, now - 48 * 3600 * 1000, now)); diff --git a/manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java b/manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java index ba491398..6e51344b 100644 --- a/manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/VirtualDeviceController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller; import cc.iotkit.common.exception.BizException; diff --git a/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieDeviceController.java b/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieDeviceController.java index 257edeb7..92e4263a 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieDeviceController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieDeviceController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.aligenie; import cc.iotkit.common.exception.BizException; @@ -29,7 +38,7 @@ public class AligenieDeviceController { @Autowired private DataOwnerService ownerService; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private AligenieProductRepository aligenieProductRepository; @Autowired @@ -66,7 +75,7 @@ public class AligenieDeviceController { aligenieDeviceRepository.deleteByUid(uid); for (Device device : devices) { - DeviceInfo deviceInfo = deviceRepository.findById(device.getDeviceId()).get(); + DeviceInfo deviceInfo = deviceInfoRepository.findById(device.getDeviceId()).get(); AligenieProduct product = aligenieProductRepository.findByProductKey(deviceInfo.getProductKey()); aligenieDeviceRepository.save(AligenieDevice.builder() .uid(user.getId()) diff --git a/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieProductController.java b/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieProductController.java index 7ec64982..7d10d3b5 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieProductController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/aligenie/AligenieProductController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.aligenie; import cc.iotkit.dao.AligenieProductRepository; diff --git a/manager/src/main/java/cc/iotkit/manager/controller/api/AccountController.java b/manager/src/main/java/cc/iotkit/manager/controller/api/AccountController.java index af9e41db..78161f3f 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/api/AccountController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/api/AccountController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.api; import cc.iotkit.dao.AppInfoRepository; @@ -37,8 +46,10 @@ public class AccountController { throw new RuntimeException("用户不属于该家庭"); } - UserInfo userInfo = userInfoRepository.findOne(Example.of(UserInfo.builder().uid(uid).build())) - .orElseThrow(() -> new RuntimeException(("用户信息不存在"))); + UserInfo userInfo = userInfoRepository.findByUid(uid); + if (userInfo == null) { + throw new RuntimeException("用户信息不存在"); + } userInfo.setCurrHomeId(homeId); userInfoRepository.save(userInfo); } @@ -52,6 +63,6 @@ public class AccountController { @GetMapping("/getAppInfo") public AppInfo getAppInfo() { - return appInfoRepository.findAll().get(0); + return appInfoRepository.findAll().iterator().next(); } } diff --git a/manager/src/main/java/cc/iotkit/manager/controller/api/DeviceController.java b/manager/src/main/java/cc/iotkit/manager/controller/api/DeviceController.java index 08754455..a42648a0 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/api/DeviceController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/api/DeviceController.java @@ -1,7 +1,16 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.api; import cc.iotkit.dao.AppDesignRepository; -import cc.iotkit.dao.DeviceRepository; +import cc.iotkit.dao.DeviceInfoRepository; import cc.iotkit.dao.SpaceDeviceRepository; import cc.iotkit.manager.model.vo.AppPageNode; import cc.iotkit.manager.service.AppDesignService; @@ -12,12 +21,12 @@ import cc.iotkit.utils.AuthUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Example; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -29,7 +38,7 @@ public class DeviceController { @Autowired private DeviceService deviceService; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private SpaceDeviceRepository spaceDeviceRepository; @Autowired @@ -39,7 +48,9 @@ public class DeviceController { @GetMapping("/list") public List list() { - return deviceRepository.findAll(); + List list = new ArrayList<>(); + deviceInfoRepository.findAll().forEach(list::add); + return list; } @GetMapping("/{deviceId}") @@ -47,13 +58,12 @@ public class DeviceController { if (StringUtils.isBlank(deviceId)) { throw new RuntimeException("deviceId is blank."); } - return deviceRepository.findById(deviceId).orElseThrow(() -> new RuntimeException("device not found.")); + return deviceInfoRepository.findById(deviceId).orElseThrow(() -> new RuntimeException("device not found.")); } @GetMapping("/getAllDeviceIds") public List getAllDeviceIds() { - List spaceDevices = spaceDeviceRepository.findAll( - Example.of(SpaceDevice.builder().uid(AuthUtil.getUserId()).build())); + List spaceDevices = spaceDeviceRepository.findByUid(AuthUtil.getUserId()); return spaceDevices.stream() .map(SpaceDevice::getDeviceId) .collect(Collectors.toList()); @@ -61,7 +71,7 @@ public class DeviceController { @GetMapping("/detailPage/{deviceId}") public List deviceDetailPage(@PathVariable("deviceId") String deviceId) { - DeviceInfo device = deviceRepository.findById(deviceId).orElseThrow(() -> new RuntimeException("device not found")); + DeviceInfo device = deviceInfoRepository.findById(deviceId).orElseThrow(() -> new RuntimeException("device not found")); return appDesignService.getAppPageNodes(device.getProductKey()); } diff --git a/manager/src/main/java/cc/iotkit/manager/controller/api/HomeController.java b/manager/src/main/java/cc/iotkit/manager/controller/api/HomeController.java index cb5a52a1..c423fa99 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/api/HomeController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/api/HomeController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.api; import cc.iotkit.dao.HomeRepository; @@ -51,9 +60,7 @@ public class HomeController { @GetMapping("/list") public List list() { -// return homeRepository.findAll(); - return homeRepository.findAll(Example.of(Home.builder() - .uid(AuthUtil.getUserId()).build())); + return homeRepository.findByUid(AuthUtil.getUserId()); } @PostMapping("/addSpace") @@ -62,8 +69,10 @@ public class HomeController { throw new RuntimeException("name/homeId is blank."); } String uid = AuthUtil.getUserId(); - Home home = homeRepository.findOne(Example.of(Home.builder().uid(uid).id(homeId).build())) - .orElseThrow(() -> new RuntimeException("用户家庭不存在")); + Home home = homeRepository.findByUidAndId(uid, homeId); + if (home == null) { + throw new RuntimeException("用户家庭不存在"); + } Space s = spaceRepository.save(Space.builder() .name(name) @@ -96,8 +105,7 @@ public class HomeController { if (StringUtils.isBlank(homeId)) { throw new RuntimeException("homeId is blank."); } -// return spaceRepository.findAll(); - return spaceRepository.findAll(Example.of(Space.builder().homeId(homeId).build())); + return spaceRepository.findByHomeId(homeId); } @GetMapping("/getCurrentHome") diff --git a/manager/src/main/java/cc/iotkit/manager/controller/api/ProductController.java b/manager/src/main/java/cc/iotkit/manager/controller/api/ProductController.java index 0a8f1b5a..fc5dbc5d 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/api/ProductController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/api/ProductController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.api; import cc.iotkit.dao.ProductRepository; @@ -10,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.ArrayList; import java.util.List; @RestController("api-product") @@ -23,7 +33,9 @@ public class ProductController { @GetMapping("/list") public List list() { - return productRepository.findAll(); + List list = new ArrayList<>(); + productRepository.findAll().forEach(list::add); + return list; } @GetMapping("/{pk}") diff --git a/manager/src/main/java/cc/iotkit/manager/controller/api/SpaceController.java b/manager/src/main/java/cc/iotkit/manager/controller/api/SpaceController.java index 3a4e8f2b..e1af346b 100755 --- a/manager/src/main/java/cc/iotkit/manager/controller/api/SpaceController.java +++ b/manager/src/main/java/cc/iotkit/manager/controller/api/SpaceController.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.controller.api; import cc.iotkit.dao.*; @@ -10,7 +19,7 @@ import cc.iotkit.model.space.SpaceDevice; import cc.iotkit.utils.AuthUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Example; +import org.springframework.data.elasticsearch.core.query.Criteria; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -28,7 +37,7 @@ public class SpaceController { @Autowired private SpaceDeviceRepository spaceDeviceRepository; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private CategoryRepository categoryRepository; @Autowired @@ -41,6 +50,8 @@ public class SpaceController { private DeviceCache deviceCache; @Autowired private SpaceDeviceService spaceDeviceService; + @Autowired + private CommonDao commonDao; @PostMapping("/addGateway") public void addGateway(String pk, String mac, String name, String spaceId) { @@ -48,14 +59,12 @@ public class SpaceController { throw new RuntimeException("pk/name/mac/spaceId is blank."); } mac = mac.toUpperCase(); - DeviceInfo device = deviceRepository.findOne(Example.of(DeviceInfo.builder() - .productKey(pk) - .deviceName(mac).build())).orElseThrow(() -> new RuntimeException("未找到该设备")); + DeviceInfo device = deviceInfoRepository.findByProductKeyAndDeviceName(pk, mac); + if (device == null) { + throw new RuntimeException("未找到该设备"); + } Space space = spaceRepository.findById(spaceId).orElseThrow(() -> new RuntimeException("未找到空间")); addSpaceDevice(name, device, space); -// -// List addDevices = deviceRepository.findAll(Example.of(DeviceInfo.builder().parentId(device.getDeviceId()).build())); -// addDevices.forEach((d -> addSpaceDevice(null, d, space))); } @PostMapping("/add") @@ -63,7 +72,7 @@ public class SpaceController { if (StringUtils.isBlank(deviceId) || StringUtils.isBlank(name) || StringUtils.isBlank(spaceId)) { throw new RuntimeException("deviceId/name/spaceId is blank."); } - DeviceInfo device = deviceRepository.findById(deviceId) + DeviceInfo device = deviceInfoRepository.findById(deviceId) .orElseThrow(() -> new RuntimeException("device not found.")); Space space = spaceRepository.findById(spaceId) .orElseThrow(() -> new RuntimeException("space not found.")); @@ -73,8 +82,7 @@ public class SpaceController { @PostMapping("/scan") public List scan() { //找到网关产品id - List gateways = productRepository.findAll(Example - .of(Product.builder().category("gateway").build())) + List gateways = productRepository.findByCategory("gateway") .stream().map(Product::getId).collect(Collectors.toList()); //找到用户已添加的所有设备 List spaceDeviceVos = spaceDeviceService.getUserDevices(AuthUtil.getUserId(), ""); @@ -84,8 +92,8 @@ public class SpaceController { List foundDevices = new ArrayList<>(); //找到网关下的所有设备 - userGateways.forEach((g) -> foundDevices.addAll(deviceRepository.findAll(Example.of(DeviceInfo.builder() - .parentId(g.getDeviceId()).build())))); + userGateways.forEach((g) -> foundDevices.addAll( + deviceInfoRepository.findByParentId(g.getDeviceId()))); //过滤已添加的设备 return foundDevices.stream().filter((d) -> { @@ -105,15 +113,16 @@ public class SpaceController { @GetMapping("/devices") public List devices(String homeId, String spaceId) { + Criteria criteria = new Criteria(); + SpaceDevice device = new SpaceDevice(); device.setUid(AuthUtil.getUserId()); if (StringUtils.isNotBlank(spaceId)) { - device.setSpaceId(spaceId); + criteria = criteria.and("spaceId").is(spaceId); } else { - device.setHomeId(homeId); + criteria = criteria.and("homeId").is(homeId); } - - List spaceDevices = spaceDeviceRepository.findAll(Example.of(device)); + List spaceDevices = commonDao.find(SpaceDevice.class, criteria); List spaceDeviceVos = new ArrayList<>(); spaceDevices.forEach(sd -> spaceDeviceVos.add(buildSpaceDeviceVo( sd.getId(), sd.getDeviceId(), @@ -128,15 +137,17 @@ public class SpaceController { return buildSpaceDeviceVo(device.getId(), device.getDeviceId(), AuthUtil.getUserId(), device.getName(), - ""); + ""); } @GetMapping("/getDeviceByMac") public SpaceDeviceVo getDeviceByMac(String mac) { - DeviceInfo device = deviceRepository.findOne(Example.of(DeviceInfo.builder().deviceName(mac).build())) - .orElseThrow(() -> new RuntimeException("device not found by mac")); + List devices = deviceInfoRepository.findByDeviceName(mac); + if (devices.size() == 0) { + throw new RuntimeException("device not found by mac"); + } - return buildSpaceDeviceVo("", device.getDeviceId(), + return buildSpaceDeviceVo("", devices.get(0).getDeviceId(), AuthUtil.getUserId(), "", ""); } @@ -170,10 +181,7 @@ public class SpaceController { private void addSpaceDevice(String name, DeviceInfo device, Space space) { String uid = AuthUtil.getUserId(); - SpaceDevice sd = spaceDeviceRepository.findOne(Example.of(SpaceDevice - .builder() - .deviceId(device.getDeviceId()).build()) - ).orElse(null); + SpaceDevice sd = spaceDeviceRepository.findByDeviceId(device.getDeviceId()); String id = null; //重复添加,更新 diff --git a/manager/src/main/java/cc/iotkit/manager/model/aligenie/AligenieProductVo.java b/manager/src/main/java/cc/iotkit/manager/model/aligenie/AligenieProductVo.java index bce973a5..95c45ceb 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/aligenie/AligenieProductVo.java +++ b/manager/src/main/java/cc/iotkit/manager/model/aligenie/AligenieProductVo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.aligenie; import cc.iotkit.model.aligenie.AligenieProduct; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/AppDesignVo.java b/manager/src/main/java/cc/iotkit/manager/model/vo/AppDesignVo.java index f156dbd6..2bb2acde 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/AppDesignVo.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/AppDesignVo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.AllArgsConstructor; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/AppPageNode.java b/manager/src/main/java/cc/iotkit/manager/model/vo/AppPageNode.java index 42e9df46..4aaac105 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/AppPageNode.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/AppPageNode.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.AllArgsConstructor; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/DeviceLog.java b/manager/src/main/java/cc/iotkit/manager/model/vo/DeviceLog.java index 82a0b7cf..5cb864de 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/DeviceLog.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/DeviceLog.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.Data; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/LoginResult.java b/manager/src/main/java/cc/iotkit/manager/model/vo/LoginResult.java index 456b2652..2d00a671 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/LoginResult.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/LoginResult.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.AllArgsConstructor; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/MessageVo.java b/manager/src/main/java/cc/iotkit/manager/model/vo/MessageVo.java index e73e4ad6..5f1dced4 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/MessageVo.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/MessageVo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.AllArgsConstructor; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java b/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java index 292f2b3e..f6a84ddd 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java @@ -1,10 +1,18 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.data.mongodb.core.mapping.Document; import java.util.HashMap; import java.util.Map; @@ -13,7 +21,6 @@ import java.util.Map; @Builder @NoArgsConstructor @AllArgsConstructor -@Document public class SpaceDeviceVo { private String id; diff --git a/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceInfo.java b/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceInfo.java index 91da9991..075009c0 100755 --- a/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceInfo.java +++ b/manager/src/main/java/cc/iotkit/manager/model/vo/SpaceInfo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.model.vo; import lombok.AllArgsConstructor; diff --git a/manager/src/main/java/cc/iotkit/manager/service/AppDesignService.java b/manager/src/main/java/cc/iotkit/manager/service/AppDesignService.java index 91ee3191..8a534498 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/AppDesignService.java +++ b/manager/src/main/java/cc/iotkit/manager/service/AppDesignService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import cc.iotkit.common.Constants; @@ -23,14 +32,12 @@ public class AppDesignService { private AppDesignRepository appDesignRepository; public AppDesign getDesignDetail(String pk) { - return appDesignRepository.findOne(Example.of(AppDesign.builder() - .productKey(pk).build())).orElse(null); + return appDesignRepository.findByProductKey(pk); } @Cacheable(value = Constants.APP_DESIGN_CACHE, key = "#pk") public List getAppPageNodes(String pk) { - AppDesign design = appDesignRepository.findOne(Example.of(AppDesign.builder() - .productKey(pk).build())).orElse(null); + AppDesign design = appDesignRepository.findByProductKey(pk); if (design == null) { return new ArrayList<>(); } diff --git a/manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java b/manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java index 140ce7e5..7db39af1 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java +++ b/manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import cc.iotkit.common.exception.BizException; @@ -5,7 +14,7 @@ import cc.iotkit.utils.AuthUtil; import cc.iotkit.model.Owned; import cc.iotkit.model.device.DeviceInfo; import org.apache.commons.lang3.StringUtils; -import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import org.springframework.stereotype.Service; import java.util.List; @@ -57,7 +66,7 @@ public class DataOwnerService { /** * 从库中取对应数据Id的数据中的uid是否与当前登录用户一致 */ - public void checkOwner(MongoRepository repository, String id) { + public void checkOwner(ElasticsearchRepository repository, String id) { //管理员不限制 if (AuthUtil.isAdmin()) { return; @@ -85,7 +94,7 @@ public class DataOwnerService { /** * 从库中取对应数据Id的数据中的uid是否与当前登录用户一致,并把当前用户id设置到数据中 */ - public void checkOwnerSave(MongoRepository repository, T data) { + public void checkOwnerSave(ElasticsearchRepository repository, T data) { checkOwner(repository, data.getId()); data.setUid(AuthUtil.getUserId()); } diff --git a/manager/src/main/java/cc/iotkit/manager/service/DeviceService.java b/manager/src/main/java/cc/iotkit/manager/service/DeviceService.java index 988f0131..c234edcf 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/DeviceService.java +++ b/manager/src/main/java/cc/iotkit/manager/service/DeviceService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import cc.iotkit.common.exception.NotFoundException; @@ -5,7 +14,7 @@ import cc.iotkit.common.exception.OfflineException; import cc.iotkit.common.utils.UniqueIdUtil; import cc.iotkit.comps.DeviceComponentManager; import cc.iotkit.common.thing.ThingService; -import cc.iotkit.dao.DeviceRepository; +import cc.iotkit.dao.DeviceInfoRepository; import cc.iotkit.dao.ThingModelMessageRepository; import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.message.ThingModelMessage; @@ -21,7 +30,7 @@ import java.util.Map; public class DeviceService { @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private DataOwnerService dataOwnerService; @Autowired @@ -40,7 +49,7 @@ public class DeviceService { public String invokeService(String deviceId, String service, Map args, boolean checkOwner) { - DeviceInfo device = deviceRepository.findById(deviceId) + DeviceInfo device = deviceInfoRepository.findById(deviceId) .orElseThrow(() -> new NotFoundException("device not found by deviceId")); if (checkOwner) { @@ -86,7 +95,7 @@ public class DeviceService { public String setProperty(String deviceId, Map properties, boolean checkOwner) { - DeviceInfo device = deviceRepository.findById(deviceId) + DeviceInfo device = deviceInfoRepository.findById(deviceId) .orElseThrow(() -> new NotFoundException("device not found by deviceId")); if (checkOwner) { diff --git a/manager/src/main/java/cc/iotkit/manager/service/DeviceStateCheckTask.java b/manager/src/main/java/cc/iotkit/manager/service/DeviceStateCheckTask.java index fcbd1804..da5b1afa 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/DeviceStateCheckTask.java +++ b/manager/src/main/java/cc/iotkit/manager/service/DeviceStateCheckTask.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import org.springframework.stereotype.Component; diff --git a/manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java b/manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java new file mode 100644 index 00000000..9aad76e0 --- /dev/null +++ b/manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java @@ -0,0 +1,105 @@ +package cc.iotkit.manager.service; + +import cc.iotkit.common.utils.JsonUtil; +import cc.iotkit.dao.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.google.common.base.Charsets; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.io.File; +import java.io.IOException; +import java.util.List; + +@Slf4j +@Service +public class ExampleDataInit { + + @Autowired + private OauthClientRepository oauthClientRepository; + @Autowired + private CategoryRepository categoryRepository; + @Autowired + private DeviceGroupRepository deviceGroupRepository; + @Autowired + private DeviceInfoRepository deviceInfoRepository; + @Autowired + private HomeRepository homeRepository; + @Autowired + private ProductRepository productRepository; + @Autowired + private ProductModelRepository productModelRepository; + @Autowired + private ProtocolComponentRepository protocolComponentRepository; + @Autowired + private ProtocolConverterRepository protocolConverterRepository; + @Autowired + private RuleInfoRepository ruleInfoRepository; + @Autowired + private SpaceRepository spaceRepository; + @Autowired + private SpaceDeviceRepository spaceDeviceRepository; + @Autowired + private TaskInfoRepository taskInfoRepository; + @Autowired + private ThingModelRepository thingModelRepository; + @Autowired + private UserInfoRepository userInfoRepository; + @Autowired + private VirtualDeviceRepository virtualDeviceRepository; + + @Autowired + private DeviceDao deviceDao; + + @Autowired + private ElasticsearchRestTemplate restTemplate; + + @PostConstruct + public void init() { + try { + File initFile = new File(".init"); + if (initFile.exists()) { + return; + } + + initData("category", categoryRepository); + initData("deviceGroup", deviceGroupRepository); + initData("deviceInfo", deviceInfoRepository); + initData("home", homeRepository); + initData("oauthClient", oauthClientRepository); + initData("product", productRepository); + initData("productModel", productModelRepository); + initData("protocolComponent", protocolComponentRepository); + initData("protocolConverter", protocolConverterRepository); + initData("ruleInfo", ruleInfoRepository); + initData("space", spaceRepository); + initData("spaceDevice", spaceDeviceRepository); + initData("taskInfo", taskInfoRepository); + initData("thingModel", thingModelRepository); + initData("userInfo", userInfoRepository); + initData("virtualDevice", virtualDeviceRepository); + + log.info("init data finished."); + + FileUtils.write(initFile, "", Charsets.UTF_8); + } catch (Throwable e) { + log.error("init error", e); + } + } + + private void initData(String name, ElasticsearchRepository repository) throws IOException { + log.info("init {} data...", name); + String json = FileUtils.readFileToString(new File("./data/init/" + name + ".json"), Charsets.UTF_8); + List list = JsonUtil.parse(json, new TypeReference<>() { + }); + for (T obj : list) { + repository.save(obj); + } + } + +} diff --git a/manager/src/main/java/cc/iotkit/manager/service/SpaceDeviceService.java b/manager/src/main/java/cc/iotkit/manager/service/SpaceDeviceService.java index 51775bfb..a7efe3d4 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/SpaceDeviceService.java +++ b/manager/src/main/java/cc/iotkit/manager/service/SpaceDeviceService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import cc.iotkit.dao.DeviceCache; @@ -27,10 +36,14 @@ public class SpaceDeviceService { public List getUserDevices(String uid, String spaceId) { SpaceDevice device = new SpaceDevice(); device.setUid(uid); + List spaceDevices; if (StringUtils.isNotBlank(spaceId)) { device.setSpaceId(spaceId); + spaceDevices = spaceDeviceRepository.findByUidAndSpaceIdOrderByAddAtDesc(uid, spaceId); + } else { + spaceDevices = spaceDeviceRepository.findBySpaceIdOrderByAddAtDesc(spaceId); } - List spaceDevices = spaceDeviceRepository.findAll(Example.of(device)); + List spaceDeviceVos = new ArrayList<>(); spaceDevices.forEach(sd -> { DeviceInfo deviceInfo = deviceCache.get(sd.getDeviceId()); diff --git a/manager/src/main/java/cc/iotkit/manager/service/ThingModelService.java b/manager/src/main/java/cc/iotkit/manager/service/ThingModelService.java index cf648a3e..1d4d78f4 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/ThingModelService.java +++ b/manager/src/main/java/cc/iotkit/manager/service/ThingModelService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import cc.iotkit.common.thing.ThingService; diff --git a/manager/src/main/java/cc/iotkit/manager/service/WeChatService.java b/manager/src/main/java/cc/iotkit/manager/service/WeChatService.java index eff3d73a..80afd8aa 100755 --- a/manager/src/main/java/cc/iotkit/manager/service/WeChatService.java +++ b/manager/src/main/java/cc/iotkit/manager/service/WeChatService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.service; import cc.iotkit.common.Constants; diff --git a/manager/src/main/java/cc/iotkit/manager/utils/WeChatUtil.java b/manager/src/main/java/cc/iotkit/manager/utils/WeChatUtil.java index 152a4ba7..cdc5eb45 100755 --- a/manager/src/main/java/cc/iotkit/manager/utils/WeChatUtil.java +++ b/manager/src/main/java/cc/iotkit/manager/utils/WeChatUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.manager.utils; import lombok.extern.slf4j.Slf4j; diff --git a/manager/src/main/resources/application-dev.yml b/manager/src/main/resources/application-dev.yml index 491d9f7d..b901f7da 100755 --- a/manager/src/main/resources/application-dev.yml +++ b/manager/src/main/resources/application-dev.yml @@ -8,12 +8,6 @@ spring: max-file-size: 10MB max-request-size: 12MB - #mongodb数据库配置 - data: - mongodb: - uri: mongodb://填写mongodb地址 - database: iotkit - elasticsearch: rest: #使用内置es的配置 diff --git a/manager/src/main/resources/application.yml b/manager/src/main/resources/application.yml index 491d9f7d..b901f7da 100755 --- a/manager/src/main/resources/application.yml +++ b/manager/src/main/resources/application.yml @@ -8,12 +8,6 @@ spring: max-file-size: 10MB max-request-size: 12MB - #mongodb数据库配置 - data: - mongodb: - uri: mongodb://填写mongodb地址 - database: iotkit - elasticsearch: rest: #使用内置es的配置 diff --git a/message-bus/pom.xml b/message-bus/pom.xml index f61c9da5..151329a1 100644 --- a/message-bus/pom.xml +++ b/message-bus/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/message-bus/src/main/java/cc/iotkit/mq/MqConsumer.java b/message-bus/src/main/java/cc/iotkit/mq/MqConsumer.java index cf3cf24b..c3678d06 100644 --- a/message-bus/src/main/java/cc/iotkit/mq/MqConsumer.java +++ b/message-bus/src/main/java/cc/iotkit/mq/MqConsumer.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.mq; public interface MqConsumer { diff --git a/message-bus/src/main/java/cc/iotkit/mq/MqProducer.java b/message-bus/src/main/java/cc/iotkit/mq/MqProducer.java index d44d6bc8..f1e8bf46 100644 --- a/message-bus/src/main/java/cc/iotkit/mq/MqProducer.java +++ b/message-bus/src/main/java/cc/iotkit/mq/MqProducer.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.mq; public interface MqProducer { diff --git a/message-bus/src/main/java/cc/iotkit/mq/vertx/VertxMqConsumer.java b/message-bus/src/main/java/cc/iotkit/mq/vertx/VertxMqConsumer.java index 50d584fd..f02e19eb 100644 --- a/message-bus/src/main/java/cc/iotkit/mq/vertx/VertxMqConsumer.java +++ b/message-bus/src/main/java/cc/iotkit/mq/vertx/VertxMqConsumer.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.mq.vertx; import cc.iotkit.mq.ConsumerHandler; diff --git a/model/pom.xml b/model/pom.xml index d5c9d058..610d60fb 100755 --- a/model/pom.xml +++ b/model/pom.xml @@ -5,9 +5,9 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 model @@ -20,11 +20,6 @@ provided - - org.springframework.data - spring-data-mongodb - - org.springframework.data spring-data-elasticsearch diff --git a/model/src/main/java/cc/iotkit/model/AppInfo.java b/model/src/main/java/cc/iotkit/model/AppInfo.java index cfde0fe7..9b6ef1f2 100755 --- a/model/src/main/java/cc/iotkit/model/AppInfo.java +++ b/model/src/main/java/cc/iotkit/model/AppInfo.java @@ -1,18 +1,33 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.stereotype.Component; -@Component + @Data @Builder @NoArgsConstructor @AllArgsConstructor +@Document(indexName = "category") public class AppInfo { + @Id + private String id; + private String appName; private String packageName; diff --git a/model/src/main/java/cc/iotkit/model/InvokeResult.java b/model/src/main/java/cc/iotkit/model/InvokeResult.java index 3bb1c829..86fadd93 100755 --- a/model/src/main/java/cc/iotkit/model/InvokeResult.java +++ b/model/src/main/java/cc/iotkit/model/InvokeResult.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import lombok.AllArgsConstructor; diff --git a/model/src/main/java/cc/iotkit/model/OauthClient.java b/model/src/main/java/cc/iotkit/model/OauthClient.java index 2b892a3f..eee2151d 100755 --- a/model/src/main/java/cc/iotkit/model/OauthClient.java +++ b/model/src/main/java/cc/iotkit/model/OauthClient.java @@ -2,13 +2,15 @@ package cc.iotkit.model; import lombok.Data; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** * oauth2的client */ @Data -@Document +@Document(indexName = "oauth_client") public class OauthClient { @Id @@ -20,6 +22,7 @@ public class OauthClient { private String allowUrl; + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/Owned.java b/model/src/main/java/cc/iotkit/model/Owned.java index 124bc955..dbcf9e73 100755 --- a/model/src/main/java/cc/iotkit/model/Owned.java +++ b/model/src/main/java/cc/iotkit/model/Owned.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; public interface Owned { diff --git a/model/src/main/java/cc/iotkit/model/Paging.java b/model/src/main/java/cc/iotkit/model/Paging.java index 12b26d00..1d82de2d 100755 --- a/model/src/main/java/cc/iotkit/model/Paging.java +++ b/model/src/main/java/cc/iotkit/model/Paging.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import lombok.AllArgsConstructor; diff --git a/model/src/main/java/cc/iotkit/model/Role.java b/model/src/main/java/cc/iotkit/model/Role.java index 0d4bdf7f..642dc07b 100755 --- a/model/src/main/java/cc/iotkit/model/Role.java +++ b/model/src/main/java/cc/iotkit/model/Role.java @@ -1,10 +1,19 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import lombok.Data; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; @Data -@Document +@Document(indexName = "role") public class Role { private String id; diff --git a/model/src/main/java/cc/iotkit/model/SendCmd.java b/model/src/main/java/cc/iotkit/model/SendCmd.java index d2582076..61b54f85 100755 --- a/model/src/main/java/cc/iotkit/model/SendCmd.java +++ b/model/src/main/java/cc/iotkit/model/SendCmd.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import lombok.Data; diff --git a/model/src/main/java/cc/iotkit/model/ThirdUserSession.java b/model/src/main/java/cc/iotkit/model/ThirdUserSession.java index fd3fab67..1c6e0ddd 100755 --- a/model/src/main/java/cc/iotkit/model/ThirdUserSession.java +++ b/model/src/main/java/cc/iotkit/model/ThirdUserSession.java @@ -5,13 +5,15 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** * 第三方接入用户会话 */ @Data -@Document +@Document(indexName = "third_user_session") @Builder @NoArgsConstructor @AllArgsConstructor @@ -36,5 +38,6 @@ public class ThirdUserSession { /** * 授权时间 */ + @Field(type = FieldType.Date) private Long authAt; } diff --git a/model/src/main/java/cc/iotkit/model/UserAccount.java b/model/src/main/java/cc/iotkit/model/UserAccount.java deleted file mode 100755 index f5eceeee..00000000 --- a/model/src/main/java/cc/iotkit/model/UserAccount.java +++ /dev/null @@ -1,24 +0,0 @@ -package cc.iotkit.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -@Data -@Document -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class UserAccount { - - @Id - private String id; - - private String uid; - - private String pwd; - -} diff --git a/model/src/main/java/cc/iotkit/model/UserActionLog.java b/model/src/main/java/cc/iotkit/model/UserActionLog.java index 978fe855..af576a1e 100755 --- a/model/src/main/java/cc/iotkit/model/UserActionLog.java +++ b/model/src/main/java/cc/iotkit/model/UserActionLog.java @@ -1,21 +1,36 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.annotation.Id; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** * 用户操作日志 */ -@Document +@Document(indexName = "user_action_log") @Data @Builder @NoArgsConstructor @AllArgsConstructor public class UserActionLog { + @Id + private String id; + private String uid; /** @@ -43,6 +58,7 @@ public class UserActionLog { */ private String result; + @Field(type = FieldType.Date) private Long createAt; public enum Type { diff --git a/model/src/main/java/cc/iotkit/model/UserInfo.java b/model/src/main/java/cc/iotkit/model/UserInfo.java index 5fb22e59..7c02768b 100755 --- a/model/src/main/java/cc/iotkit/model/UserInfo.java +++ b/model/src/main/java/cc/iotkit/model/UserInfo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -6,7 +15,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.ArrayList; import java.util.List; @@ -16,7 +27,7 @@ import java.util.List; @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "user_info") public class UserInfo implements Owned { public static final int USER_TYPE_PLATFORM = 0; @@ -87,6 +98,7 @@ public class UserInfo implements Owned { */ private List usePlatforms = new ArrayList<>(); + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/alert/AlertConfig.java b/model/src/main/java/cc/iotkit/model/alert/AlertConfig.java index 9bbc23f6..89c59191 100755 --- a/model/src/main/java/cc/iotkit/model/alert/AlertConfig.java +++ b/model/src/main/java/cc/iotkit/model/alert/AlertConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.alert; import cc.iotkit.model.Owned; @@ -6,7 +15,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** * 告警配置 @@ -15,7 +26,7 @@ import org.springframework.data.mongodb.core.mapping.Document; @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "alert_config") public class AlertConfig implements Owned { public static final String TYPE_EMAIL="email"; public static final String TYPE_DINGDING_ROBOT="dingding_robot"; @@ -53,6 +64,7 @@ public class AlertConfig implements Owned { */ private boolean enable; + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/aligenie/AligenieDevice.java b/model/src/main/java/cc/iotkit/model/aligenie/AligenieDevice.java index 4a9c0963..0d6f1839 100755 --- a/model/src/main/java/cc/iotkit/model/aligenie/AligenieDevice.java +++ b/model/src/main/java/cc/iotkit/model/aligenie/AligenieDevice.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.aligenie; import lombok.AllArgsConstructor; @@ -5,7 +14,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; import java.util.Map; @@ -13,7 +22,7 @@ import java.util.Map; @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "aligenie_device") public class AligenieDevice { @Id private String id; diff --git a/model/src/main/java/cc/iotkit/model/aligenie/AligenieProduct.java b/model/src/main/java/cc/iotkit/model/aligenie/AligenieProduct.java index 1831eeb5..79575e43 100755 --- a/model/src/main/java/cc/iotkit/model/aligenie/AligenieProduct.java +++ b/model/src/main/java/cc/iotkit/model/aligenie/AligenieProduct.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.aligenie; import cc.iotkit.model.Owned; @@ -6,7 +15,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.List; @@ -17,7 +28,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder -@Document +@Document(indexName = "aligenie_product") public class AligenieProduct implements Owned { @Id @@ -43,6 +54,7 @@ public class AligenieProduct implements Owned { */ private String uid; + @Field(type = FieldType.Date) private Long createAt; @Override diff --git a/model/src/main/java/cc/iotkit/model/device/DeviceGroup.java b/model/src/main/java/cc/iotkit/model/device/DeviceGroup.java index 91934eed..9df0a2cc 100644 --- a/model/src/main/java/cc/iotkit/model/device/DeviceGroup.java +++ b/model/src/main/java/cc/iotkit/model/device/DeviceGroup.java @@ -3,13 +3,15 @@ package cc.iotkit.model.device; import cc.iotkit.model.Owned; import lombok.Data; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** * 设备分组 */ @Data -@Document +@Document(indexName = "device_group") public class DeviceGroup implements Owned { /** @@ -41,6 +43,7 @@ public class DeviceGroup implements Owned { /** * 创建时间 */ + @Field(type = FieldType.Date) private long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/device/DeviceInfo.java b/model/src/main/java/cc/iotkit/model/device/DeviceInfo.java index 47c3f7d0..394d22d2 100755 --- a/model/src/main/java/cc/iotkit/model/device/DeviceInfo.java +++ b/model/src/main/java/cc/iotkit/model/device/DeviceInfo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.device; import cc.iotkit.model.Owned; @@ -6,7 +15,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.ArrayList; import java.util.HashMap; @@ -14,7 +25,7 @@ import java.util.List; import java.util.Map; @Data -@Document +@Document(indexName = "device_info") @Builder @NoArgsConstructor @AllArgsConstructor @@ -74,6 +85,7 @@ public class DeviceInfo implements Owned { */ private Map group = new HashMap<>(); + @Field(type = FieldType.Date) private Long createAt; @Data diff --git a/model/src/main/java/cc/iotkit/model/device/VirtualDevice.java b/model/src/main/java/cc/iotkit/model/device/VirtualDevice.java index 2481877b..e1b0d834 100644 --- a/model/src/main/java/cc/iotkit/model/device/VirtualDevice.java +++ b/model/src/main/java/cc/iotkit/model/device/VirtualDevice.java @@ -6,7 +6,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.ArrayList; import java.util.List; @@ -15,7 +17,7 @@ import java.util.List; * 虚拟设备 */ @Data -@Document +@Document(indexName = "virtual_device") @Builder @NoArgsConstructor @AllArgsConstructor @@ -97,6 +99,7 @@ public class VirtualDevice implements Owned { /** * 创建时间 */ + @Field(type = FieldType.Date) private Long createAt = System.currentTimeMillis(); } diff --git a/model/src/main/java/cc/iotkit/model/device/VirtualDeviceLog.java b/model/src/main/java/cc/iotkit/model/device/VirtualDeviceLog.java index ff231f0e..e9d4afe2 100644 --- a/model/src/main/java/cc/iotkit/model/device/VirtualDeviceLog.java +++ b/model/src/main/java/cc/iotkit/model/device/VirtualDeviceLog.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.device; import lombok.AllArgsConstructor; @@ -6,6 +15,8 @@ import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; /** @@ -44,5 +55,6 @@ public class VirtualDeviceLog { /** * 创建时间 */ + @Field(type = FieldType.Date) private Long logAt = System.currentTimeMillis(); } diff --git a/model/src/main/java/cc/iotkit/model/device/message/DeviceProperty.java b/model/src/main/java/cc/iotkit/model/device/message/DeviceProperty.java index 53acacf8..acfc58fd 100755 --- a/model/src/main/java/cc/iotkit/model/device/message/DeviceProperty.java +++ b/model/src/main/java/cc/iotkit/model/device/message/DeviceProperty.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.device.message; import lombok.AllArgsConstructor; diff --git a/model/src/main/java/cc/iotkit/model/device/message/ThingModelMessage.java b/model/src/main/java/cc/iotkit/model/device/message/ThingModelMessage.java index a493ff94..eb6e3914 100755 --- a/model/src/main/java/cc/iotkit/model/device/message/ThingModelMessage.java +++ b/model/src/main/java/cc/iotkit/model/device/message/ThingModelMessage.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.device.message; import lombok.AllArgsConstructor; diff --git a/model/src/main/java/cc/iotkit/model/mq/Request.java b/model/src/main/java/cc/iotkit/model/mq/Request.java deleted file mode 100755 index c479b2cd..00000000 --- a/model/src/main/java/cc/iotkit/model/mq/Request.java +++ /dev/null @@ -1,20 +0,0 @@ -package cc.iotkit.model.mq; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.data.mongodb.core.mapping.Field; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@JsonIgnoreProperties(ignoreUnknown = true) -public class Request { - - @Field("id") - private String id; - - private T params; - -} diff --git a/model/src/main/java/cc/iotkit/model/mq/Response.java b/model/src/main/java/cc/iotkit/model/mq/Response.java deleted file mode 100755 index 2bdbf15b..00000000 --- a/model/src/main/java/cc/iotkit/model/mq/Response.java +++ /dev/null @@ -1,25 +0,0 @@ -package cc.iotkit.model.mq; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class Response { - - private String id; - - private int code; - - private T data; - - public static Empty empty() { - return new Empty(); - } - - @Data - public static class Empty { - } -} diff --git a/model/src/main/java/cc/iotkit/model/product/AppDesign.java b/model/src/main/java/cc/iotkit/model/product/AppDesign.java index 8f096579..551473cd 100755 --- a/model/src/main/java/cc/iotkit/model/product/AppDesign.java +++ b/model/src/main/java/cc/iotkit/model/product/AppDesign.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.product; import cc.iotkit.model.Owned; @@ -5,15 +14,19 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.annotation.Id; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "app_design") public class AppDesign implements Owned { + @Id private String id; private String productKey; @@ -24,6 +37,7 @@ public class AppDesign implements Owned { private Boolean state; + @Field(type = FieldType.Date) private Long modifyAt; } diff --git a/model/src/main/java/cc/iotkit/model/product/Category.java b/model/src/main/java/cc/iotkit/model/product/Category.java index af70c5c4..c0bed285 100755 --- a/model/src/main/java/cc/iotkit/model/product/Category.java +++ b/model/src/main/java/cc/iotkit/model/product/Category.java @@ -1,16 +1,28 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.product; import lombok.Data; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data -@Document +@Document(indexName = "category") public class Category { @Id private String id; private String name; + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/product/Product.java b/model/src/main/java/cc/iotkit/model/product/Product.java index 5bf673e2..a4a090e9 100755 --- a/model/src/main/java/cc/iotkit/model/product/Product.java +++ b/model/src/main/java/cc/iotkit/model/product/Product.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.product; import cc.iotkit.model.Owned; @@ -6,13 +15,15 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "product") public class Product implements Owned { @Id @@ -36,6 +47,7 @@ public class Product implements Owned { */ private Boolean transparent; + @Field(type = FieldType.Date) private Long createAt; public boolean isTransparent() { diff --git a/model/src/main/java/cc/iotkit/model/product/ProductModel.java b/model/src/main/java/cc/iotkit/model/product/ProductModel.java index b4f126ee..261754ad 100755 --- a/model/src/main/java/cc/iotkit/model/product/ProductModel.java +++ b/model/src/main/java/cc/iotkit/model/product/ProductModel.java @@ -1,18 +1,19 @@ package cc.iotkit.model.product; -import cc.iotkit.model.Owned; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "product_model") public class ProductModel { public static final String TYPE_JS = "JavaScript"; @@ -40,6 +41,7 @@ public class ProductModel { */ private String state; + @Field(type = FieldType.Date) private Long modifyAt; } diff --git a/model/src/main/java/cc/iotkit/model/product/ThingModel.java b/model/src/main/java/cc/iotkit/model/product/ThingModel.java index 481b302f..bba3276d 100755 --- a/model/src/main/java/cc/iotkit/model/product/ThingModel.java +++ b/model/src/main/java/cc/iotkit/model/product/ThingModel.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.product; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -6,7 +15,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; import java.util.HashMap; import java.util.List; @@ -14,7 +23,7 @@ import java.util.Map; import java.util.stream.Collectors; @Data -@Document +@Document(indexName = "thing_model") @Builder @NoArgsConstructor @AllArgsConstructor @@ -51,7 +60,7 @@ public class ThingModel { private String identifier; private DataType dataType; private String name; - private String accessMode; + private String accessMode = "rw"; } @Data @@ -60,7 +69,7 @@ public class ThingModel { private String identifier; private DataType dataType; private String name; - private Boolean required; + private Boolean required = false; } @Data @@ -81,7 +90,7 @@ public class ThingModel { @Data public static class DataType { private String type; - private Map specs; + private Object specs; public Object parse(T value) { if (value == null) { diff --git a/model/src/main/java/cc/iotkit/model/protocol/ProtocolComponent.java b/model/src/main/java/cc/iotkit/model/protocol/ProtocolComponent.java index eb0f84e6..285482bb 100755 --- a/model/src/main/java/cc/iotkit/model/protocol/ProtocolComponent.java +++ b/model/src/main/java/cc/iotkit/model/protocol/ProtocolComponent.java @@ -1,12 +1,23 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.protocol; import cc.iotkit.model.Owned; import lombok.Data; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data -@Document +@Document(indexName = "protocol_component") public class ProtocolComponent implements Owned { public static final String STATE_STOPPED = "stopped"; @@ -38,6 +49,7 @@ public class ProtocolComponent implements Owned { private String state; + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/protocol/ProtocolConverter.java b/model/src/main/java/cc/iotkit/model/protocol/ProtocolConverter.java index 8aaec0f0..cb4ff98e 100755 --- a/model/src/main/java/cc/iotkit/model/protocol/ProtocolConverter.java +++ b/model/src/main/java/cc/iotkit/model/protocol/ProtocolConverter.java @@ -1,11 +1,22 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.protocol; import cc.iotkit.model.Owned; import lombok.Data; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; -@Document +@Document(indexName = "protocol_converter") @Data public class ProtocolConverter implements Owned { @@ -23,5 +34,6 @@ public class ProtocolConverter implements Owned { private String desc; + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/rule/RuleAction.java b/model/src/main/java/cc/iotkit/model/rule/RuleAction.java index 38431c37..045a84e1 100755 --- a/model/src/main/java/cc/iotkit/model/rule/RuleAction.java +++ b/model/src/main/java/cc/iotkit/model/rule/RuleAction.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.rule; import lombok.Data; diff --git a/model/src/main/java/cc/iotkit/model/rule/RuleInfo.java b/model/src/main/java/cc/iotkit/model/rule/RuleInfo.java index 841bd6e0..f87c5e00 100755 --- a/model/src/main/java/cc/iotkit/model/rule/RuleInfo.java +++ b/model/src/main/java/cc/iotkit/model/rule/RuleInfo.java @@ -5,14 +5,16 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.List; @Data @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "rule_info") public class RuleInfo implements Owned { public static final String STATE_STOPPED = "stopped"; @@ -40,6 +42,7 @@ public class RuleInfo implements Owned { private String desc; + @Field(type = FieldType.Date) private Long createAt; @Data diff --git a/model/src/main/java/cc/iotkit/model/rule/TaskInfo.java b/model/src/main/java/cc/iotkit/model/rule/TaskInfo.java index ed7708c3..910c76ca 100755 --- a/model/src/main/java/cc/iotkit/model/rule/TaskInfo.java +++ b/model/src/main/java/cc/iotkit/model/rule/TaskInfo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.rule; import cc.iotkit.model.Owned; @@ -6,7 +15,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.List; @@ -15,7 +26,7 @@ import java.util.List; @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "task_info") public class TaskInfo implements Owned { public static String TYPE_TIMER = "timer"; @@ -63,6 +74,7 @@ public class TaskInfo implements Owned { */ private String uid; + @Field(type = FieldType.Date) private Long createAt; /** diff --git a/model/src/main/java/cc/iotkit/model/rule/TaskLog.java b/model/src/main/java/cc/iotkit/model/rule/TaskLog.java index 317d6aef..258fa147 100755 --- a/model/src/main/java/cc/iotkit/model/rule/TaskLog.java +++ b/model/src/main/java/cc/iotkit/model/rule/TaskLog.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.rule; import lombok.AllArgsConstructor; diff --git a/model/src/main/java/cc/iotkit/model/space/Home.java b/model/src/main/java/cc/iotkit/model/space/Home.java index 34459a7a..85001de0 100755 --- a/model/src/main/java/cc/iotkit/model/space/Home.java +++ b/model/src/main/java/cc/iotkit/model/space/Home.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.space; import cc.iotkit.model.Owned; @@ -6,13 +15,13 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; @Data @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "home") public class Home implements Owned { @Id diff --git a/model/src/main/java/cc/iotkit/model/space/Space.java b/model/src/main/java/cc/iotkit/model/space/Space.java index 6671bd0c..e023ce57 100755 --- a/model/src/main/java/cc/iotkit/model/space/Space.java +++ b/model/src/main/java/cc/iotkit/model/space/Space.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.space; import cc.iotkit.model.Owned; @@ -6,13 +15,15 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "space") public class Space implements Owned { @Id @@ -38,5 +49,6 @@ public class Space implements Owned { */ private Integer deviceNum; + @Field(type = FieldType.Date) private Long createAt; } diff --git a/model/src/main/java/cc/iotkit/model/space/SpaceDevice.java b/model/src/main/java/cc/iotkit/model/space/SpaceDevice.java index 0c8b120e..f9ec9322 100755 --- a/model/src/main/java/cc/iotkit/model/space/SpaceDevice.java +++ b/model/src/main/java/cc/iotkit/model/space/SpaceDevice.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.model.space; import cc.iotkit.model.Owned; @@ -6,13 +15,15 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldType; @Data @Builder @NoArgsConstructor @AllArgsConstructor -@Document +@Document(indexName = "space_device") public class SpaceDevice implements Owned { @Id @@ -51,11 +62,13 @@ public class SpaceDevice implements Owned { /** * 添加时间 */ + @Field(type = FieldType.Date) private Long addAt; /** * 使用时间 */ + @Field(type = FieldType.Date) private Long useAt; } diff --git a/oauth2-server/pom.xml b/oauth2-server/pom.xml index ef791bfa..61b33095 100755 --- a/oauth2-server/pom.xml +++ b/oauth2-server/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/oauth2-server/src/main/java/cc/iotkit/utils/AuthUtil.java b/oauth2-server/src/main/java/cc/iotkit/utils/AuthUtil.java index 6dc97927..7fe916ae 100755 --- a/oauth2-server/src/main/java/cc/iotkit/utils/AuthUtil.java +++ b/oauth2-server/src/main/java/cc/iotkit/utils/AuthUtil.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.utils; import cc.iotkit.common.Constants; diff --git a/pom.xml b/pom.xml index 36845e55..8d5ea488 100755 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ cc.iotkit iotkit-parent - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT iotkit-parent iotkit parent @@ -188,6 +188,14 @@ 3.1.1 + + cn.hutool + hutool-bom + 5.8.2 + pom + import + + io.vertx vertx-core diff --git a/protocol-gateway/component-server/pom.xml b/protocol-gateway/component-server/pom.xml index f85840b1..a51cb786 100755 --- a/protocol-gateway/component-server/pom.xml +++ b/protocol-gateway/component-server/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/DeviceComponentManager.java b/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/DeviceComponentManager.java index 249fd8fc..991a9d53 100755 --- a/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/DeviceComponentManager.java +++ b/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/DeviceComponentManager.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comps; diff --git a/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/service/DeviceBehaviourService.java b/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/service/DeviceBehaviourService.java index b41e0d0f..268d0e26 100755 --- a/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/service/DeviceBehaviourService.java +++ b/protocol-gateway/component-server/src/main/java/cc/iotkit/comps/service/DeviceBehaviourService.java @@ -33,7 +33,7 @@ public class DeviceBehaviourService { @Autowired private ProductCache productCache; @Autowired - private DeviceRepository deviceRepository; + private DeviceInfoRepository deviceInfoRepository; @Autowired private DeviceCache deviceCache; @Autowired @@ -85,7 +85,7 @@ public class DeviceBehaviourService { } Product product = optProduct.get(); String uid = product.getUid(); - DeviceInfo device = deviceRepository.findByProductKeyAndDeviceName(pk, info.getDeviceName()); + DeviceInfo device = deviceInfoRepository.findByProductKeyAndDeviceName(pk, info.getDeviceName()); boolean reportMsg = false; if (device != null) { @@ -121,7 +121,7 @@ public class DeviceBehaviourService { device.setParentId(parentId); reportMsg = true; } - deviceRepository.save(device); + deviceInfoRepository.save(device); //新设备或更换网关需要产生注册消息 if (reportMsg) { @@ -145,7 +145,7 @@ public class DeviceBehaviourService { String deviceName, String productSecret, String deviceSecret) { - DeviceInfo deviceInfo = deviceRepository.findByProductKeyAndDeviceName(productKey, deviceName); + DeviceInfo deviceInfo = deviceInfoRepository.findByProductKeyAndDeviceName(productKey, deviceName); if (deviceInfo == null) { throw new BizException("device does not exist"); } @@ -168,7 +168,7 @@ public class DeviceBehaviourService { public void deviceStateChange(String productKey, String deviceName, boolean online) { - DeviceInfo device = deviceRepository.findByProductKeyAndDeviceName(productKey, deviceName); + DeviceInfo device = deviceInfoRepository.findByProductKeyAndDeviceName(productKey, deviceName); if (device == null) { log.warn(String.format("productKey: %s,device: %s,online: %s", productKey, device, online)); throw new BizException("device does not exist"); @@ -179,7 +179,7 @@ public class DeviceBehaviourService { return; } - List subDevices = deviceRepository.findByParentId(device.getDeviceId()); + List subDevices = deviceInfoRepository.findByParentId(device.getDeviceId()); for (DeviceInfo subDevice : subDevices) { Product product = productCache.findById(subDevice.getProductKey()); Boolean transparent = product.getTransparent(); @@ -200,7 +200,7 @@ public class DeviceBehaviourService { device.getState().setOfflineTime(System.currentTimeMillis()); // deviceStateHolder.offline(device.getDeviceId()); } - deviceRepository.save(device); + deviceInfoRepository.save(device); //设备状态变更消息 ThingModelMessage modelMessage = new ThingModelMessage( diff --git a/protocol-gateway/component/pom.xml b/protocol-gateway/component/pom.xml index ad731191..aa43b9f3 100755 --- a/protocol-gateway/component/pom.xml +++ b/protocol-gateway/component/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/CompConfig.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/CompConfig.java index 724c7a85..449ab2c9 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/CompConfig.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/CompConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp; import lombok.AllArgsConstructor; diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/IComponent.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/IComponent.java index ec737d46..5b0a4450 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/IComponent.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/IComponent.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp; public interface IComponent { diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/IMessageHandler.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/IMessageHandler.java index 75e29fcd..24085bc5 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/IMessageHandler.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/IMessageHandler.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp; import cc.iotkit.comp.model.ReceiveResult; diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/AuthInfo.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/AuthInfo.java index 29a61d53..c8686c20 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/AuthInfo.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/AuthInfo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.model; import lombok.Data; diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/DeviceState.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/DeviceState.java index bff86846..a88d69ff 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/DeviceState.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/DeviceState.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.model; import cc.iotkit.common.utils.JsonUtil; diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/ReceiveResult.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/ReceiveResult.java index 3119ff7c..c00b4fb8 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/ReceiveResult.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/ReceiveResult.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.model; import lombok.AllArgsConstructor; diff --git a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/RegisterInfo.java b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/RegisterInfo.java index 4decb820..daf6f859 100755 --- a/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/RegisterInfo.java +++ b/protocol-gateway/component/src/main/java/cc/iotkit/comp/model/RegisterInfo.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.model; import lombok.AllArgsConstructor; diff --git a/protocol-gateway/converter/pom.xml b/protocol-gateway/converter/pom.xml index 9086b673..4e09d878 100755 --- a/protocol-gateway/converter/pom.xml +++ b/protocol-gateway/converter/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/converter/src/main/java/cc/iotkit/converter/IConverter.java b/protocol-gateway/converter/src/main/java/cc/iotkit/converter/IConverter.java index 1f1392fb..dd6b4e1c 100755 --- a/protocol-gateway/converter/src/main/java/cc/iotkit/converter/IConverter.java +++ b/protocol-gateway/converter/src/main/java/cc/iotkit/converter/IConverter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.converter; import cc.iotkit.common.thing.ThingService; diff --git a/protocol-gateway/ctwing-component/dependency-reduced-pom.xml b/protocol-gateway/ctwing-component/dependency-reduced-pom.xml index 33f302ba..088f2b7d 100644 --- a/protocol-gateway/ctwing-component/dependency-reduced-pom.xml +++ b/protocol-gateway/ctwing-component/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 ctwing-component @@ -61,7 +61,7 @@ cc.iotkit component - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile diff --git a/protocol-gateway/ctwing-component/pom.xml b/protocol-gateway/ctwing-component/pom.xml index c6e19ad5..62d3b79b 100644 --- a/protocol-gateway/ctwing-component/pom.xml +++ b/protocol-gateway/ctwing-component/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/ctwing-component/src/main/java/cc/iotkit/comp/http/CtwingConfig.java b/protocol-gateway/ctwing-component/src/main/java/cc/iotkit/comp/http/CtwingConfig.java index 81b534be..aca06a73 100644 --- a/protocol-gateway/ctwing-component/src/main/java/cc/iotkit/comp/http/CtwingConfig.java +++ b/protocol-gateway/ctwing-component/src/main/java/cc/iotkit/comp/http/CtwingConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.http; import lombok.Data; diff --git a/protocol-gateway/emqx-component/dependency-reduced-pom.xml b/protocol-gateway/emqx-component/dependency-reduced-pom.xml index f5a8ee6c..63478637 100644 --- a/protocol-gateway/emqx-component/dependency-reduced-pom.xml +++ b/protocol-gateway/emqx-component/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 emqx-component @@ -76,19 +76,19 @@ cc.iotkit model - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile cc.iotkit common - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile cc.iotkit component - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile @@ -100,7 +100,7 @@ cc.iotkit dao - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile diff --git a/protocol-gateway/emqx-component/pom.xml b/protocol-gateway/emqx-component/pom.xml index 2fad58ac..5e58fdc7 100755 --- a/protocol-gateway/emqx-component/pom.xml +++ b/protocol-gateway/emqx-component/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/AuthVerticle.java b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/AuthVerticle.java index 10bc8d48..c4591238 100755 --- a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/AuthVerticle.java +++ b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/AuthVerticle.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.emqx; import cc.iotkit.comp.IMessageHandler; diff --git a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxConfig.java b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxConfig.java index 4c3cf453..371be668 100755 --- a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxConfig.java +++ b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.emqx; import lombok.Data; diff --git a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java index 33bfc931..d956404a 100755 --- a/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java +++ b/protocol-gateway/emqx-component/src/main/java/cc/iotkit/comp/emqx/EmqxDeviceComponent.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.emqx; import cc.iotkit.common.exception.BizException; @@ -9,7 +18,7 @@ import cc.iotkit.comp.model.DeviceState; import cc.iotkit.comp.utils.SpringUtils; import cc.iotkit.converter.DeviceMessage; import cc.iotkit.common.thing.ThingService; -import cc.iotkit.dao.DeviceRepository; +import cc.iotkit.dao.DeviceInfoRepository; import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.message.ThingModelMessage; import io.netty.handler.codec.mqtt.MqttQoS; @@ -164,9 +173,9 @@ public class EmqxDeviceComponent extends AbstractDeviceComponent { if (parent == null) { return; } - DeviceRepository deviceRepository = SpringUtils.getBean(DeviceRepository.class); + DeviceInfoRepository deviceInfoRepository = SpringUtils.getBean(DeviceInfoRepository.class); - DeviceInfo deviceInfo = deviceRepository.findByProductKeyAndDeviceName(state.getProductKey(), state.getDeviceName()); + DeviceInfo deviceInfo = deviceInfoRepository.findByProductKeyAndDeviceName(state.getProductKey(), state.getDeviceName()); if (deviceInfo != null) { boolean isOnline = DeviceState.STATE_ONLINE.equals(state.getState()); deviceInfo.getState().setOnline(isOnline); @@ -176,7 +185,7 @@ public class EmqxDeviceComponent extends AbstractDeviceComponent { if (isOnline) { deviceInfo.getState().setOnlineTime(System.currentTimeMillis()); } - deviceRepository.save(deviceInfo); + deviceInfoRepository.save(deviceInfo); } } diff --git a/protocol-gateway/http-biz-component/dependency-reduced-pom.xml b/protocol-gateway/http-biz-component/dependency-reduced-pom.xml index c6aae34f..4ad03fef 100644 --- a/protocol-gateway/http-biz-component/dependency-reduced-pom.xml +++ b/protocol-gateway/http-biz-component/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 http-biz-component @@ -58,7 +58,7 @@ cc.iotkit component - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile diff --git a/protocol-gateway/http-biz-component/pom.xml b/protocol-gateway/http-biz-component/pom.xml index 12651561..56230461 100755 --- a/protocol-gateway/http-biz-component/pom.xml +++ b/protocol-gateway/http-biz-component/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/mqtt-client-simulator/pom.xml b/protocol-gateway/mqtt-client-simulator/pom.xml index 71d2545c..17ca676e 100755 --- a/protocol-gateway/mqtt-client-simulator/pom.xml +++ b/protocol-gateway/mqtt-client-simulator/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 mqtt客户端模拟器 diff --git a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/Application.java b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/Application.java index b683752f..eb225d75 100755 --- a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/Application.java +++ b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/Application.java @@ -1,8 +1,16 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.simulator; import cc.iotkit.simulator.config.Mqtt; import cc.iotkit.simulator.service.Gateway; -import org.apache.commons.lang3.StringUtils; import java.io.IOException; diff --git a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/config/Mqtt.java b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/config/Mqtt.java index 5167bf50..0c7f3af9 100755 --- a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/config/Mqtt.java +++ b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/config/Mqtt.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.simulator.config; public class Mqtt { diff --git a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Device.java b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Device.java index 208361a9..cf964df0 100755 --- a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Device.java +++ b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Device.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.simulator.service; import lombok.AllArgsConstructor; diff --git a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Gateway.java b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Gateway.java index c6f5c2e4..2ce5647c 100755 --- a/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Gateway.java +++ b/protocol-gateway/mqtt-client-simulator/src/main/java/cc/iotkit/simulator/service/Gateway.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.simulator.service; import cc.iotkit.common.Constants; diff --git a/protocol-gateway/mqtt-component/dependency-reduced-pom.xml b/protocol-gateway/mqtt-component/dependency-reduced-pom.xml index 82062c2b..0f6512e6 100644 --- a/protocol-gateway/mqtt-component/dependency-reduced-pom.xml +++ b/protocol-gateway/mqtt-component/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 mqtt-component @@ -80,19 +80,19 @@ cc.iotkit common - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile cc.iotkit component - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile cc.iotkit dao - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT compile diff --git a/protocol-gateway/mqtt-component/pom.xml b/protocol-gateway/mqtt-component/pom.xml index 62c955e5..17f77486 100755 --- a/protocol-gateway/mqtt-component/pom.xml +++ b/protocol-gateway/mqtt-component/pom.xml @@ -5,7 +5,7 @@ protocol-gateway cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/IScripter.java b/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/IScripter.java index 7bb6d05d..9821f4cf 100755 --- a/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/IScripter.java +++ b/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/IScripter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.mqtt; import cc.iotkit.common.thing.ThingService; diff --git a/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/JsScripter.java b/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/JsScripter.java index a1582478..80487a24 100755 --- a/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/JsScripter.java +++ b/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/JsScripter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.mqtt; import cc.iotkit.common.thing.ThingService; diff --git a/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/LuaScripter.java b/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/LuaScripter.java index 3e00e932..66640e06 100755 --- a/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/LuaScripter.java +++ b/protocol-gateway/mqtt-component/src/main/java/cc/iotkit/comp/mqtt/LuaScripter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.comp.mqtt; import cc.iotkit.common.thing.ThingService; diff --git a/protocol-gateway/pom.xml b/protocol-gateway/pom.xml index fb3da7ca..5e5f4d65 100755 --- a/protocol-gateway/pom.xml +++ b/protocol-gateway/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index 59fb3e7d..6d84b369 100755 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/Action.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/Action.java index 94443473..c199f6b5 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/Action.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/Action.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertAction.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertAction.java index 8b29717a..1b5e8e78 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertAction.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertAction.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertService.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertService.java index 66815a2a..0704f08e 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertService.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/AlertService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceAction.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceAction.java index bfa148a8..3b50dd67 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceAction.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceAction.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.common.utils.JsonUtil; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceActionService.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceActionService.java index b09a8ffd..95492410 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceActionService.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/DeviceActionService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.common.utils.UniqueIdUtil; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/HttpService.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/HttpService.java index 952a6da1..ff0d6ca7 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/HttpService.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/HttpService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.common.utils.JsonUtil; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/ScriptService.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/ScriptService.java index fb2cea27..1dd0be57 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/action/ScriptService.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/action/ScriptService.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.action; import cc.iotkit.common.utils.JsonUtil; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/Alerter.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/Alerter.java index a0574abe..5c1d1323 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/Alerter.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/Alerter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.alert; import java.util.Map; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/DingdRobotAlerter.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/DingdRobotAlerter.java index 0bc4b8cf..9cf97c3d 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/DingdRobotAlerter.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/DingdRobotAlerter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.alert; import java.util.Map; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/EmailAlerter.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/EmailAlerter.java index d7dc8c11..942dc977 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/EmailAlerter.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/alert/EmailAlerter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.alert; import lombok.Data; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/config/JobFactory.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/config/JobFactory.java index dd502de3..bf5c873c 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/config/JobFactory.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/config/JobFactory.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.config; import cc.iotkit.model.rule.TaskInfo; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/config/QuartzConfiguration.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/config/QuartzConfiguration.java index 4aa75579..33126876 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/config/QuartzConfiguration.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/config/QuartzConfiguration.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.config; import org.quartz.Scheduler; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/config/RuleConfiguration.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/config/RuleConfiguration.java index 399db95d..4cd9f70a 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/config/RuleConfiguration.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/config/RuleConfiguration.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.config; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/BaseComparator.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/BaseComparator.java index cf6a24d6..c3278087 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/BaseComparator.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/BaseComparator.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.expression; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Comparator.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Comparator.java index 3120e560..daa4f170 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Comparator.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Comparator.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.expression; import java.util.Map; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/EqComparator.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/EqComparator.java index aa3c2d55..c5194393 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/EqComparator.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/EqComparator.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.expression; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Expression.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Expression.java index a3d485a0..b85d0e7f 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Expression.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/Expression.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.expression; import jdk.nashorn.api.scripting.NashornScriptEngine; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/GtComparator.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/GtComparator.java index a715356c..0f902f67 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/GtComparator.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/GtComparator.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.expression; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/LtComparator.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/LtComparator.java index f3874df9..79593512 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/LtComparator.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/expression/LtComparator.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.expression; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java index f2645845..43056cde 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.filter; import cc.iotkit.dao.DeviceCache; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceFilter.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceFilter.java index db3d446b..698dcfed 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceFilter.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceFilter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.filter; import cc.iotkit.dao.DeviceCache; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/Filter.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/Filter.java index d9440106..6aed4eff 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/Filter.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/filter/Filter.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.filter; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceCondition.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceCondition.java index babc85a5..2780ebe3 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceCondition.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceCondition.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.listener; import cc.iotkit.ruleengine.expression.Expression; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceListener.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceListener.java index c04f695e..eca4c02f 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceListener.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/DeviceListener.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.listener; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/Listener.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/Listener.java index 67208f30..8ed88ee9 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/Listener.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/listener/Listener.java @@ -1,9 +1,17 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.listener; import cc.iotkit.model.device.message.ThingModelMessage; import java.util.List; -import java.util.Map; public interface Listener { diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/Rule.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/Rule.java index 1b213c39..0e9e7e4c 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/Rule.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/Rule.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.rule; import cc.iotkit.ruleengine.action.Action; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleExecutor.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleExecutor.java index 992cc5b4..96251a2c 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleExecutor.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleExecutor.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.rule; import cc.iotkit.common.utils.JsonUtil; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleManager.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleManager.java index c1e05f02..06967c9d 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleManager.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleManager.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.rule; import cc.iotkit.common.utils.JsonUtil; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleMessageHandler.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleMessageHandler.java index 1608bb50..e32e87a2 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleMessageHandler.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleMessageHandler.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.rule; import cc.iotkit.model.device.message.ThingModelMessage; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutor.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutor.java index fc235ca1..2a9611e2 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutor.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutor.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.task; /** diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutorManager.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutorManager.java index a5cc98b2..b82533be 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutorManager.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/ActionExecutorManager.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.task; import lombok.extern.slf4j.Slf4j; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/CommonJob.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/CommonJob.java index 21e8a3f9..4c91b983 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/CommonJob.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/CommonJob.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.task; import cc.iotkit.model.rule.RuleAction; diff --git a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/DeviceActionExecutor.java b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/DeviceActionExecutor.java index 80cc7478..81a45dd3 100755 --- a/rule-engine/src/main/java/cc/iotkit/ruleengine/task/DeviceActionExecutor.java +++ b/rule-engine/src/main/java/cc/iotkit/ruleengine/task/DeviceActionExecutor.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.ruleengine.task; import cc.iotkit.common.utils.JsonUtil; diff --git a/standalone-package/pom.xml b/standalone-package/pom.xml index 62b5da92..36a457f3 100755 --- a/standalone-package/pom.xml +++ b/standalone-package/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/virtual-device/pom.xml b/virtual-device/pom.xml index c8bee796..00170656 100644 --- a/virtual-device/pom.xml +++ b/virtual-device/pom.xml @@ -5,7 +5,7 @@ iotkit-parent cc.iotkit - 0.2.2-SNAPSHOT + 0.3.0-SNAPSHOT 4.0.0 diff --git a/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualExecutor.java b/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualExecutor.java index b7b36b8e..df625b91 100644 --- a/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualExecutor.java +++ b/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualExecutor.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.virtualdevice; import cc.iotkit.model.device.DeviceInfo; diff --git a/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualManager.java b/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualManager.java index fc711547..e4701bac 100644 --- a/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualManager.java +++ b/virtual-device/src/main/java/cc/iotkit/virtualdevice/VirtualManager.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.virtualdevice; import cc.iotkit.common.thing.ThingService; diff --git a/virtual-device/src/main/java/cc/iotkit/virtualdevice/config/VirtualConfig.java b/virtual-device/src/main/java/cc/iotkit/virtualdevice/config/VirtualConfig.java index 19d513c9..4ab9fe87 100644 --- a/virtual-device/src/main/java/cc/iotkit/virtualdevice/config/VirtualConfig.java +++ b/virtual-device/src/main/java/cc/iotkit/virtualdevice/config/VirtualConfig.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.virtualdevice.config; import cc.iotkit.virtualdevice.VirtualManager; diff --git a/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomScheduleBuilder.java b/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomScheduleBuilder.java index 4177e883..06883c41 100644 --- a/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomScheduleBuilder.java +++ b/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomScheduleBuilder.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.virtualdevice.trigger; import org.quartz.ScheduleBuilder; diff --git a/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomTrigger.java b/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomTrigger.java index 47ae84d1..a7d87442 100644 --- a/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomTrigger.java +++ b/virtual-device/src/main/java/cc/iotkit/virtualdevice/trigger/RandomTrigger.java @@ -1,3 +1,12 @@ +/* + * +---------------------------------------------------------------------- + * | Copyright (c) 奇特物联 2021-2022 All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed 未经许可不能去掉「奇特物联」相关版权 + * +---------------------------------------------------------------------- + * | Author: xw2sy@163.com + * +---------------------------------------------------------------------- + */ package cc.iotkit.virtualdevice.trigger; import org.apache.commons.lang3.RandomUtils;