浏览代码

增加设备属性数据服务

songjg 2 年之前
父节点
当前提交
9e0a7db0fe

+ 0 - 5
iot-components/iot-component-base/pom.xml

@@ -11,11 +11,6 @@
 
     <artifactId>iot-component-base</artifactId>
 
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-    </properties>
-
     <dependencies>
 
         <dependency>

+ 0 - 5
iot-components/iot-component-converter/pom.xml

@@ -11,11 +11,6 @@
 
     <artifactId>iot-component-converter</artifactId>
 
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-    </properties>
-
     <dependencies>
 
         <dependency>

+ 0 - 6
iot-components/iot-ctwing-component/pom.xml

@@ -11,12 +11,6 @@
 
     <artifactId>iot-ctwing-component</artifactId>
 
-
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-    </properties>
-
     <dependencies>
 
         <dependency>

+ 0 - 5
iot-components/iot-http-biz-component/pom.xml

@@ -11,11 +11,6 @@
 
     <artifactId>iot-http-biz-component</artifactId>
 
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-    </properties>
-
     <dependencies>
 
         <dependency>

+ 166 - 0
iot-data/iot-data-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java

@@ -0,0 +1,166 @@
+/*
+ * +----------------------------------------------------------------------
+ * | Copyright (c) 奇特物联 2021-2022 All rights reserved.
+ * +----------------------------------------------------------------------
+ * | Licensed 未经许可不能去掉「奇特物联」相关版权
+ * +----------------------------------------------------------------------
+ * | Author: xw2sy@163.com
+ * +----------------------------------------------------------------------
+ */
+package cc.iotkit.data.service;
+
+import cc.iotkit.data.IDeviceInfoData;
+import cc.iotkit.model.Paging;
+import cc.iotkit.model.device.DeviceInfo;
+import cc.iotkit.model.stats.DataItem;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 包含设备属性的设备信息缓存服务
+ */
+@Service
+@Qualifier("deviceInfoPropertyDataCache")
+public class DeviceInfoPropertyDataCache implements IDeviceInfoData {
+
+    @Autowired
+    @Qualifier("deviceInfoDataCache")
+    private IDeviceInfoData deviceInfoData;
+
+
+    @Override
+    public DeviceInfo findById(String s) {
+        return deviceInfoData.findById(s);
+    }
+
+    @Override
+    public DeviceInfo save(DeviceInfo data) {
+        return deviceInfoData.save(data);
+    }
+
+    @Override
+    public DeviceInfo add(DeviceInfo data) {
+        return deviceInfoData.add(data);
+    }
+
+    @Override
+    public void deleteById(String s) {
+        deviceInfoData.deleteById(s);
+    }
+
+    @Override
+    public long count() {
+        return deviceInfoData.count();
+    }
+
+    @Override
+    public List<DeviceInfo> findAll() {
+        return deviceInfoData.findAll();
+    }
+
+    @Override
+    public Paging<DeviceInfo> findAll(int page, int size) {
+        return deviceInfoData.findAll(page, size);
+    }
+
+    @Override
+    public void saveProperties(String deviceId, Map<String, Object> properties) {
+        deviceInfoData.saveProperties(deviceId, properties);
+    }
+
+    @Override
+    public Map<String, Object> getProperties(String deviceId) {
+        return deviceInfoData.getProperties(deviceId);
+    }
+
+    @Override
+    public DeviceInfo findByDeviceId(String deviceId) {
+        DeviceInfo deviceInfo = deviceInfoData.findByDeviceId(deviceId);
+        deviceInfo.setProperty(getProperties(deviceId));
+        return deviceInfo;
+    }
+
+    @Override
+    public DeviceInfo findByProductKeyAndDeviceName(String productKey, String deviceName) {
+        DeviceInfo deviceInfo = deviceInfoData.findByProductKeyAndDeviceName(productKey, deviceName);
+        if (deviceInfo == null) {
+            return null;
+        }
+        deviceInfo.setProperty(getProperties(deviceInfo.getDeviceId()));
+        return deviceInfo;
+    }
+
+    @Override
+    public List<DeviceInfo> findByParentId(String parentId) {
+        return deviceInfoData.findByParentId(parentId);
+    }
+
+    @Override
+    public List<String> findSubDeviceIds(String parentId) {
+        return deviceInfoData.findSubDeviceIds(parentId);
+    }
+
+    @Override
+    public List<DeviceInfo> findByDeviceName(String deviceName) {
+        return deviceInfoData.findByDeviceName(deviceName);
+    }
+
+    @Override
+    public Paging<DeviceInfo> findByConditions(String uid, String subUid, String productKey, String groupId, String state, String keyword, int page, int size) {
+        return deviceInfoData.findByConditions(uid, subUid, productKey, groupId, state, keyword, page, size);
+    }
+
+    @Override
+    public void updateTag(String deviceId, DeviceInfo.Tag tag) {
+        deviceInfoData.updateTag(deviceId, tag);
+    }
+
+    @Override
+    public List<DataItem> getDeviceStatsByCategory(String uid) {
+        return deviceInfoData.getDeviceStatsByCategory(uid);
+    }
+
+    @Override
+    public long countByGroupId(String groupId) {
+        return deviceInfoData.countByGroupId(groupId);
+    }
+
+    @Override
+    public void addToGroup(String deviceId, DeviceInfo.Group group) {
+        deviceInfoData.addToGroup(deviceId, group);
+    }
+
+    @Override
+    public void updateGroup(String groupId, DeviceInfo.Group group) {
+        deviceInfoData.updateGroup(groupId, group);
+    }
+
+    @Override
+    public void removeGroup(String deviceId, String groupId) {
+        deviceInfoData.removeGroup(deviceId, groupId);
+    }
+
+    @Override
+    public void removeGroup(String groupId) {
+        deviceInfoData.removeGroup(groupId);
+    }
+
+    @Override
+    public List<DeviceInfo> findByUid(String uid) {
+        return deviceInfoData.findByUid(uid);
+    }
+
+    @Override
+    public Paging<DeviceInfo> findByUid(String uid, int page, int size) {
+        return deviceInfoData.findByUid(uid, page, size);
+    }
+
+    @Override
+    public long countByUid(String uid) {
+        return deviceInfoData.countByUid(uid);
+    }
+}

+ 0 - 5
iot-rule-engine/pom.xml

@@ -73,9 +73,4 @@
 
     </dependencies>
 
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-    </properties>
-
 </project>

+ 1 - 1
iot-rule-engine/src/main/java/cc/iotkit/ruleengine/rule/RuleManager.java

@@ -47,7 +47,7 @@ public class RuleManager {
     private IRuleInfoData ruleInfoData;
 
     @Autowired
-    @Qualifier("deviceInfoDataCache")
+    @Qualifier("deviceInfoPropertyDataCache")
     private IDeviceInfoData deviceInfoData;
 
     @Autowired