From def1852011501bcf8011faa71ff334558bf2ce45 Mon Sep 17 00:00:00 2001 From: xiwa Date: Sun, 13 Aug 2023 09:01:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:td3.0=E6=94=AF=E6=8C=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 8196 -> 0 bytes .gitignore | 3 + .../cc/iotkit/model/device/DeviceInfo.java | 2 +- .../device/message/DevicePropertyCache.java | 8 +- .../iotkit/data/manager/IDeviceInfoData.java | 5 +- .../data/service/DeviceInfoDataCache.java | 11 +- .../service/DeviceInfoPropertyDataCache.java | 5 +- .../data/service/DeviceInfoDataImpl.java | 11 +- .../iotkit/temporal/IDevicePropertyData.java | 6 +- .../es/service/DevicePropertyDataImpl.java | 9 +- .../temporal/ts/service/RuleLogDataImpl.java | 2 +- .../temporal/ts/service/TaskLogDataImpl.java | 2 +- .../iot-temproal-serviceImpl-td/pom.xml | 6 +- .../td/service/DbStructureDataImpl.java | 2 + .../td/service/DevicePropertyDataImpl.java | 19 ++-- .../temporal/td/service/RuleLogDataImpl.java | 2 +- .../temporal/td/service/TaskLogDataImpl.java | 2 +- .../dependency-reduced-pom.xml | 72 ------------- .../main/java/cc/iotkit/converter/Device.java | 4 +- .../comps/service/DevicePropertyConsumer.java | 4 +- .../dependency-reduced-pom.xml | 99 ------------------ .../dependency-reduced-pom.xml | 92 ---------------- .../dependency-reduced-pom.xml | 66 ------------ .../dependency-reduced-pom.xml | 84 --------------- .../dependency-reduced-pom.xml | 84 --------------- .../dependency-reduced-pom.xml | 70 ------------- .../manager/controller/DeviceController.java | 10 +- .../manager/model/vo/SpaceDeviceVo.java | 2 +- .../manager/service/ExampleDataInit.java | 28 ++--- .../manager/service/IDeviceService.java | 2 +- .../service/impl/DeviceServiceImpl.java | 14 +-- .../service/impl/OpenDeviceServiceImpl.java | 2 +- .../ruleengine/filter/DeviceCondition.java | 2 +- iot-starter/.DS_Store | Bin 6148 -> 0 bytes iot-starter/pom.xml | 2 +- .../src/main/resources/application.yml | 27 +++-- 36 files changed, 102 insertions(+), 657 deletions(-) delete mode 100755 .DS_Store delete mode 100644 iot-components/iot-DLT645-component/dependency-reduced-pom.xml delete mode 100644 iot-components/iot-component-tcp/dependency-reduced-pom.xml delete mode 100644 iot-components/iot-emqx-component/dependency-reduced-pom.xml delete mode 100644 iot-components/iot-http-biz-component/dependency-reduced-pom.xml delete mode 100644 iot-components/iot-mqtt-component/dependency-reduced-pom.xml delete mode 100644 iot-components/iot-nb-component/dependency-reduced-pom.xml delete mode 100644 iot-components/iot-websocket-component/dependency-reduced-pom.xml delete mode 100644 iot-starter/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100755 index 54ee152c93b5829bb776a6b1ea78f26469e639c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeI1Yitx%6vxk53d~Hgz2#vU!s0@)P-yEGtdy5*U(iBH30>Oq>N2}?X-B6sWoLGa zB1sirF$Uu!ArUnOQ9nT9Cyf%n_{L~VjEzwf{h(j`XnZAp(sSodi$IZ>5G7%5GWXoM z=bSrt{`WUCxw`;>Ed{dyU_JmSbO_5zshXk)zc?-{v9PCvEK)vz2R<0!fJt>!A_XD^ zA_XD^A_XD^u15vvn=OiRh3~%fMs=h>q`(cSfOtP7=nys)+A(Q^R|i$W7J#hS0tAKH zv=0b!5}{3nc1+qJmBy622Mkj&++v_iCx1eOlTC$oOj?-^DANJMD`U7r!QkqYmk7cE zQ_@Ctq(G#=e2VQgB-^cgc1 zRV!6X%Suc4_YAqCJ-*==ycQ#$VGDaKlV^>5pJn<(Y3{V!yvUvIe3#+#{9X~9c3qnS zWZTI0T6{Fa=C-5jIz1;_M)_;B!`y~FT_XdI;~b=QI5?o>t1 zu*xGx8X6mG6Un2si6afkhE=tRrZsDh9#vIEU$%MYK;ePo&z?N}@++^t^KOs?7`|4Z zLY`07?@{X?^|8HTtJEiUVk&*~&aGNkhRrV09d?iSmg{)EJnxasuyT)-=*+p!jyxCs zzMN|ph8-`%DsqOME7&Agvu*cS_j0e_=ZAgK+T*!-zcmQVFjnyRPEK)Fk+)H_*Kg5q zB8;JWX4bs;lIoSo#&w(8#&0SsXPP!=ZeP*ztgOv<8(xk(rsWLo8WpRwhtzg_>!8K+ zs#<|3(vC6A$8WBj&-4ZQ!ig*ydm&e0RZ4#$YaJ?B{yp*4qt%}0V4~T1b8J^!g!X3JNaCZrPi=ylno@UeJ zCXuvUu703^T9rzMFesoyJ$;TkU>|T8fn)GE9ET_1B%Fq`@CLjMAHjL}7(Rv1;T!lK zeuSUl7x)c+hd)t46*ZiNIxfK~T#89ti|cSbZp0SchF!QFyD^RXaR4)D;2@6RA=o+&+rQzm-CBFAiO=CZ)osaYFrKB@DYy< zOoec~eY4i_{~-MJEWvHX>^XDiEvi~xw`$FX=EkC4guGl3+ajd)gr;Cd|? zXVVE?>0PZgYOI9Vmfj|9U7XDziluj>wn<|ko<8YTNgydRI@gT&>d_#{3>Y(7J5p2C+dA+hrk63T diff --git a/.gitignore b/.gitignore index 2e551104..4e2ac050 100755 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ data/elasticsearch .init *.db .flattened-pom.xml + +.DS_Store +dependency-reduced-pom.xml diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java index 0785b824..d4492611 100644 --- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java +++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java @@ -72,7 +72,7 @@ public class DeviceInfo implements Owned { /** * 设备属性 */ - private Map property = new HashMap<>(); + private Map property = new HashMap<>(); /** * 设备标签 diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/message/DevicePropertyCache.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/message/DevicePropertyCache.java index 641c0a73..7fda7d7f 100644 --- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/message/DevicePropertyCache.java +++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/message/DevicePropertyCache.java @@ -21,10 +21,14 @@ import java.util.Map; public class DevicePropertyCache { - // 属性值 + /** + * 属性值 + */ private Object value; - // 属性值时间: 设备上报时间 + /** + * 属性值时间: 设备上报时间 + */ private Long occurred; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java index f4b77d59..c60a9e22 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java @@ -12,6 +12,7 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.Paging; import cc.iotkit.data.IOwnedData; import cc.iotkit.model.device.DeviceInfo; +import cc.iotkit.model.device.message.DevicePropertyCache; import cc.iotkit.model.stats.DataItem; import java.util.List; @@ -25,14 +26,14 @@ public interface IDeviceInfoData extends IOwnedData { * @param deviceId 设备id * @param properties 设备属性map */ - void saveProperties(String deviceId, Map properties); + void saveProperties(String deviceId, Map properties); /** * 获取设备属性map * * @param deviceId 设备id */ - Map getProperties(String deviceId); + Map getProperties(String deviceId); /** * 根据设备ID取设备信息 diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java b/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java index 6766566c..3a62fec7 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoDataCache.java @@ -17,7 +17,9 @@ import cc.iotkit.data.cache.DeviceInfoCacheEvict; import cc.iotkit.data.cache.DeviceInfoCachePut; import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.model.device.DeviceInfo; +import cc.iotkit.model.device.message.DevicePropertyCache; import cc.iotkit.model.stats.DataItem; +import com.fasterxml.jackson.core.type.TypeReference; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.beans.factory.annotation.Autowired; @@ -91,8 +93,8 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi } @Override - public void saveProperties(String deviceId, Map properties) { - Map old = getProperties(deviceId); + public void saveProperties(String deviceId, Map properties) { + Map old = getProperties(deviceId); old.putAll(properties); redisTemplate.opsForValue().set(getPropertyCacheKey(deviceId), JsonUtils.toJsonString(old)); } @@ -105,12 +107,13 @@ public class DeviceInfoDataCache implements IDeviceInfoData, SmartInitializingSi } @Override - public Map getProperties(String deviceId) { + public Map getProperties(String deviceId) { String json = redisTemplate.opsForValue().get(getPropertyCacheKey(deviceId)); if (StringUtils.isBlank(json)) { return new HashMap<>(); } - return JsonUtils.parseObject(json, Map.class); + return JsonUtils.parseObject(json, new TypeReference<>() { + }); } @Override diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java b/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java index 2c7b7467..db7fb557 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-cache/src/main/java/cc/iotkit/data/service/DeviceInfoPropertyDataCache.java @@ -13,6 +13,7 @@ import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.Paging; import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.model.device.DeviceInfo; +import cc.iotkit.model.device.message.DevicePropertyCache; import cc.iotkit.model.stats.DataItem; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -90,12 +91,12 @@ public class DeviceInfoPropertyDataCache implements IDeviceInfoData { } @Override - public void saveProperties(String deviceId, Map properties) { + public void saveProperties(String deviceId, Map properties) { deviceInfoData.saveProperties(deviceId, properties); } @Override - public Map getProperties(String deviceId) { + public Map getProperties(String deviceId) { return deviceInfoData.getProperties(deviceId); } diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java index 0e441578..03175da1 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java @@ -10,13 +10,11 @@ import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IProductData; import cc.iotkit.data.model.*; import cc.iotkit.data.util.PageBuilder; -import cc.iotkit.data.util.PredicateBuilder; import cc.iotkit.model.device.DeviceInfo; +import cc.iotkit.model.device.message.DevicePropertyCache; import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Product; import cc.iotkit.model.stats.DataItem; -import cn.hutool.core.collection.CollectionUtil; -import com.querydsl.core.types.Predicate; import com.querydsl.core.types.Projections; import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -26,15 +24,12 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Primary; import org.springframework.data.domain.Page; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.jdbc.core.BeanPropertyRowMapper; -import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; import java.util.stream.Collectors; -import static cc.iotkit.data.model.QTbDeviceGroup.tbDeviceGroup; import static cc.iotkit.data.model.QTbDeviceGroupMapping.tbDeviceGroupMapping; import static cc.iotkit.data.model.QTbDeviceInfo.tbDeviceInfo; import static cc.iotkit.data.model.QTbDeviceSubUser.tbDeviceSubUser; @@ -81,11 +76,11 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData properties) { + public void saveProperties(String deviceId, Map properties) { } @Override - public Map getProperties(String deviceId) { + public Map getProperties(String deviceId) { return new HashMap<>(); } diff --git a/iot-common/iot-common-dao/iot-temporal-service/src/main/java/cc/iotkit/temporal/IDevicePropertyData.java b/iot-common/iot-common-dao/iot-temporal-service/src/main/java/cc/iotkit/temporal/IDevicePropertyData.java index e55cd830..f1933da9 100644 --- a/iot-common/iot-common-dao/iot-temporal-service/src/main/java/cc/iotkit/temporal/IDevicePropertyData.java +++ b/iot-common/iot-common-dao/iot-temporal-service/src/main/java/cc/iotkit/temporal/IDevicePropertyData.java @@ -11,6 +11,7 @@ package cc.iotkit.temporal; import cc.iotkit.model.device.message.DeviceProperty; +import cc.iotkit.model.device.message.DevicePropertyCache; import java.util.List; import java.util.Map; @@ -27,8 +28,9 @@ public interface IDevicePropertyData { * @param name 属性名称 * @param start 开始时间戳 * @param end 结束时间戳 + * @param size 取时间范围内的数量 */ - List findDevicePropertyHistory(String deviceId, String name, long start, long end); + List findDevicePropertyHistory(String deviceId, String name, long start, long end, int size); /** * 添加多个属性 @@ -37,6 +39,6 @@ public interface IDevicePropertyData { * @param properties 属性 * @param time 属性上报时间 */ - void addProperties(String deviceId, Map properties, long time); + void addProperties(String deviceId, Map properties, long time); } diff --git a/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/DevicePropertyDataImpl.java b/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/DevicePropertyDataImpl.java index 988beb81..7568e9fc 100644 --- a/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/DevicePropertyDataImpl.java +++ b/iot-common/iot-common-dao/iot-temporal-serviceImpl-es/src/main/java/cc/iotkit/temporal/es/service/DevicePropertyDataImpl.java @@ -21,6 +21,7 @@ import org.elasticsearch.search.sort.FieldSortBuilder; import org.elasticsearch.search.sort.SortOrder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; import org.springframework.data.elasticsearch.core.SearchHits; import org.springframework.data.elasticsearch.core.document.Document; @@ -44,7 +45,8 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { private final Set indexSet = new HashSet<>(); - public List findDevicePropertyHistory(String deviceId, String name, long start, long end) { + @Override + public List findDevicePropertyHistory(String deviceId, String name, long start, long end, int size) { String index = getIndex(deviceId, name); NativeSearchQuery query = new NativeSearchQueryBuilder() .withQuery( @@ -54,6 +56,7 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { .from(start, true).to(end, true)) ) .withSorts(new FieldSortBuilder("time").order(SortOrder.ASC)) + .withPageable(Pageable.ofSize(size)) .build(); SearchHits result = template.search(query, DocDeviceProperty.class, IndexCoordinates.of(index)); return result.getSearchHits().stream() @@ -62,11 +65,11 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { } @Override - public void addProperties(String deviceId, Map properties, long time) { + public void addProperties(String deviceId, Map properties, long time) { properties.forEach((key, val) -> { DevicePropertyCache propertyCache = (DevicePropertyCache) val; String index = getIndex(deviceId, key); - long occurred = Objects.nonNull( propertyCache.getOccurred() )? propertyCache.getOccurred() : time; + long occurred = Objects.nonNull(propertyCache.getOccurred()) ? propertyCache.getOccurred() : time; template.save( new DocDeviceProperty(UUID.randomUUID().toString(), deviceId, key, propertyCache.getValue(), occurred), IndexCoordinates.of(index) diff --git a/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/RuleLogDataImpl.java b/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/RuleLogDataImpl.java index c7f5249d..84969f57 100644 --- a/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/RuleLogDataImpl.java +++ b/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/RuleLogDataImpl.java @@ -40,7 +40,7 @@ public class RuleLogDataImpl implements IRuleLogData { @Override public void deleteByRuleId(String ruleId) { - tsTemplate.update("delete from rule_log where rule_id=?", ruleId); + tsTemplate.update("delete from rule_log where rule_id=? and time<=NOW()", ruleId); } @Override diff --git a/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/TaskLogDataImpl.java b/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/TaskLogDataImpl.java index a6b1ca22..b81f7ead 100644 --- a/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/TaskLogDataImpl.java +++ b/iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/src/main/java/cc/iotkit/temporal/ts/service/TaskLogDataImpl.java @@ -39,7 +39,7 @@ public class TaskLogDataImpl implements ITaskLogData { @Override public void deleteByTaskId(String taskId) { - tsTemplate.update("delete from task_log where task_id=?", taskId); + tsTemplate.update("delete from task_log where task_id=? and time<=NOW()", taskId); } @Override diff --git a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/pom.xml b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/pom.xml index a8ac9c0b..d5bf70a3 100644 --- a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/pom.xml +++ b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/pom.xml @@ -13,11 +13,9 @@ 时序数据库服务接口的TDengine实现 - 支持版本:v0.4.1 - TDengine版本:2.6.0.12 + TDengine版本:3.x - @@ -45,7 +43,7 @@ com.taosdata.jdbc taos-jdbcdriver - 2.0.40 + 3.2.4 diff --git a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DbStructureDataImpl.java b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DbStructureDataImpl.java index 3a8748db..18dbfbff 100644 --- a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DbStructureDataImpl.java +++ b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DbStructureDataImpl.java @@ -128,6 +128,8 @@ public class DbStructureDataImpl implements IDbStructureData { @Override @PostConstruct public void initDbStructure() { + tdRestApi.execSql("CREATE DATABASEIF NOT EXISTS iotkit KEEP 365 DURATION 10 BUFFER 16 WAL_LEVEL 1;"); + //创建规则日志超级表 String sql = TableManager.getCreateSTableSql("rule_log", List.of( new TdField("state1", "NCHAR", 32), diff --git a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DevicePropertyDataImpl.java b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DevicePropertyDataImpl.java index 38bb0130..34bacdf0 100644 --- a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DevicePropertyDataImpl.java +++ b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/DevicePropertyDataImpl.java @@ -36,7 +36,8 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { @Qualifier("deviceInfoDataCache") private IDeviceInfoData deviceInfoData; - public List findDevicePropertyHistory(String deviceId, String name, long start, long end) { + @Override + public List findDevicePropertyHistory(String deviceId, String name, long start, long end, int size) { DeviceInfo device = deviceInfoData.findByDeviceId(deviceId); if (device == null) { return new ArrayList<>(); @@ -44,7 +45,8 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { String tbName = Constants.getProductPropertySTableName(device.getProductKey()); List deviceProperties = tdTemplate.query(String.format( - "select time,%s as value,device_id from %s where device_id=? and time>=? and time<=?", + "select time,%s as `value`,device_id from %s where device_id=? and time>=? and time<=? " + + "order by time asc limit 0," + size, name.toLowerCase(), tbName), new BeanPropertyRowMapper<>(TbDeviceProperty.class), deviceId, start, end @@ -59,20 +61,15 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { } @Override - public void addProperties(String deviceId, Map properties, long time) { + public void addProperties(String deviceId, Map properties, long time) { DeviceInfo device = deviceInfoData.findByDeviceId(deviceId); if (device == null) { return; } - Map propertiesMap = new HashMap<>(); - properties.forEach((key, val) -> { - DevicePropertyCache propertyCache = (DevicePropertyCache) val; - propertiesMap.put(key, propertyCache.getValue()); - }); //获取设备旧属性 - Map oldProperties = deviceInfoData.getProperties(deviceId); + Map oldProperties = deviceInfoData.getProperties(deviceId); //用新属性覆盖 - oldProperties.putAll(propertiesMap); + oldProperties.putAll(properties); StringBuilder sbFieldNames = new StringBuilder(); StringBuilder sbFieldPlaces = new StringBuilder(); @@ -84,7 +81,7 @@ public class DevicePropertyDataImpl implements IDevicePropertyData { sbFieldNames.append(key) .append(","); sbFieldPlaces.append("?,"); - args.add(val); + args.add(val.getValue()); }); sbFieldNames.deleteCharAt(sbFieldNames.length() - 1); sbFieldPlaces.deleteCharAt(sbFieldPlaces.length() - 1); diff --git a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/RuleLogDataImpl.java b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/RuleLogDataImpl.java index d2cc30ec..df4b39ae 100644 --- a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/RuleLogDataImpl.java +++ b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/RuleLogDataImpl.java @@ -30,7 +30,7 @@ public class RuleLogDataImpl implements IRuleLogData { @Override public void deleteByRuleId(String ruleId) { - tdTemplate.update("delete from rule_log where rule_id=?", ruleId); + tdTemplate.update("delete from rule_log where rule_id=? and time<=NOW()", ruleId); } @Override diff --git a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/TaskLogDataImpl.java b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/TaskLogDataImpl.java index a754011f..1a46f334 100644 --- a/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/TaskLogDataImpl.java +++ b/iot-common/iot-common-dao/iot-temproal-serviceImpl-td/src/main/java/cc/iotkit/temporal/td/service/TaskLogDataImpl.java @@ -30,7 +30,7 @@ public class TaskLogDataImpl implements ITaskLogData { @Override public void deleteByTaskId(String taskId) { - tdTemplate.update("delete from task_log where task_id=?", taskId); + tdTemplate.update("delete from task_log where task_id=? and time<=NOW()", taskId); } @Override diff --git a/iot-components/iot-DLT645-component/dependency-reduced-pom.xml b/iot-components/iot-DLT645-component/dependency-reduced-pom.xml deleted file mode 100644 index 06f8e6a3..00000000 --- a/iot-components/iot-DLT645-component/dependency-reduced-pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-DLT645-component - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-web-proxy - io.vertx:vertx-web - io.vertx:vertx-bridge-common - io.vertx:vertx-http-proxy - io.vertx:vertx-core - io.netty:netty-codec-http2 - - - - - - maven-compiler-plugin - - 11 - 11 - utf8 - - - - - - - org.projectlombok - lombok - 1.18.26 - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-common-core - 0.4.5-SNAPSHOT - compile - - - cn.hutool - hutool-core - 5.8.3 - compile - - - diff --git a/iot-components/iot-component-converter/src/main/java/cc/iotkit/converter/Device.java b/iot-components/iot-component-converter/src/main/java/cc/iotkit/converter/Device.java index e5d30661..7f817cca 100755 --- a/iot-components/iot-component-converter/src/main/java/cc/iotkit/converter/Device.java +++ b/iot-components/iot-component-converter/src/main/java/cc/iotkit/converter/Device.java @@ -25,9 +25,9 @@ public class Device { private String model; - private Map property = new HashMap<>(); + private Map property = new HashMap<>(); - private Map tag = new HashMap<>(); + private Map tag = new HashMap<>(); /** * 是否透传 diff --git a/iot-components/iot-component-server/src/main/java/cc/iotkit/comps/service/DevicePropertyConsumer.java b/iot-components/iot-component-server/src/main/java/cc/iotkit/comps/service/DevicePropertyConsumer.java index 13c6c651..90596012 100755 --- a/iot-components/iot-component-server/src/main/java/cc/iotkit/comps/service/DevicePropertyConsumer.java +++ b/iot-components/iot-component-server/src/main/java/cc/iotkit/comps/service/DevicePropertyConsumer.java @@ -78,7 +78,7 @@ public class DevicePropertyConsumer implements ConsumerHandler addProperties = new HashMap<>(); + Map addProperties = new HashMap<>(); Long occurred = msg.getOccurred(); //删除非属性字段 properties.forEach((key,val)->{ @@ -131,7 +131,7 @@ public class DevicePropertyConsumer implements ConsumerHandler properties) { + private void updateDeviceCurrentProperties(String deviceId, Map properties) { try { log.info("save device property,deviceId:{},property:{}", deviceId, JsonUtils.toJsonString(properties)); deviceInfoData.saveProperties(deviceId, properties); diff --git a/iot-components/iot-component-tcp/dependency-reduced-pom.xml b/iot-components/iot-component-tcp/dependency-reduced-pom.xml deleted file mode 100644 index 3c05ad14..00000000 --- a/iot-components/iot-component-tcp/dependency-reduced-pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-component-tcp - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-core - - - - - - maven-compiler-plugin - - ${java.version} - ${java.version} - true - false - utf8 - - - - - - - junit - junit - 4.13.2 - test - - - hamcrest-core - org.hamcrest - - - - - io.projectreactor - reactor-core - 3.4.29 - compile - - - org.projectlombok - lombok - 1.18.26 - compile - - - org.slf4j - slf4j-api - 1.7.36 - compile - - - cc.iotkit - iot-common-core - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-data-service - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-script-engine - 0.4.5-SNAPSHOT - compile - - - diff --git a/iot-components/iot-emqx-component/dependency-reduced-pom.xml b/iot-components/iot-emqx-component/dependency-reduced-pom.xml deleted file mode 100644 index 83f08d38..00000000 --- a/iot-components/iot-emqx-component/dependency-reduced-pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-emqx-component - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-core - io.vertx:vertx-web-proxy - io.vertx:vertx-mqtt - io.vertx:vertx-web - io.vertx:vertx-http-proxy - org.luaj:luaj-jse - io.netty:netty-common - io.netty:netty-transport - io.netty:netty-handler - io.netty:netty-resolver - io.netty:netty-buffer - io.netty:netty-handler - io.netty:netty-proxy - io.netty:netty-codec - io.netty:netty-codec-mqtt - io.netty:netty-codec-dns - io.netty:netty-resolver-dns - io.netty:netty-tcnative-boringssl-static - - - - - - maven-compiler-plugin - - ${java.version} - ${java.version} - true - false - utf8 - - - - - - - cc.iotkit - iot-common-model - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-common-core - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-data-service - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-script-engine - 0.4.5-SNAPSHOT - compile - - - diff --git a/iot-components/iot-http-biz-component/dependency-reduced-pom.xml b/iot-components/iot-http-biz-component/dependency-reduced-pom.xml deleted file mode 100644 index f15be121..00000000 --- a/iot-components/iot-http-biz-component/dependency-reduced-pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-http-biz-component - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-web-proxy - io.vertx:vertx-web - io.vertx:vertx-bridge-common - io.vertx:vertx-http-proxy - io.vertx:vertx-core - io.netty:netty-codec-http2 - - - - - - maven-compiler-plugin - - ${java.version} - ${java.version} - utf8 - - - - - - - org.projectlombok - lombok - 1.18.26 - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-script-engine - 0.4.5-SNAPSHOT - compile - - - diff --git a/iot-components/iot-mqtt-component/dependency-reduced-pom.xml b/iot-components/iot-mqtt-component/dependency-reduced-pom.xml deleted file mode 100644 index 1c659172..00000000 --- a/iot-components/iot-mqtt-component/dependency-reduced-pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-mqtt-component - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-core - io.vertx:vertx-mqtt - io.netty:netty-codec-mqtt - org.luaj:luaj-jse - - - - - - maven-compiler-plugin - - ${java.version} - ${java.version} - true - false - utf8 - - - - - - - org.projectlombok - lombok - 1.18.26 - compile - - - org.slf4j - slf4j-api - 1.7.36 - compile - - - cc.iotkit - iot-common-core - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-data-service - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-script-engine - 0.4.5-SNAPSHOT - compile - - - diff --git a/iot-components/iot-nb-component/dependency-reduced-pom.xml b/iot-components/iot-nb-component/dependency-reduced-pom.xml deleted file mode 100644 index 18b3391a..00000000 --- a/iot-components/iot-nb-component/dependency-reduced-pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-nb-component - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-core - io.vertx:vertx-mqtt - io.netty:netty-codec-mqtt - org.luaj:luaj-jse - - - - - - maven-compiler-plugin - - ${java.version} - ${java.version} - true - false - utf8 - - - - - - - org.projectlombok - lombok - 1.18.26 - compile - - - org.slf4j - slf4j-api - 1.7.36 - compile - - - cc.iotkit - iot-common-core - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-data-service - 0.4.5-SNAPSHOT - compile - - - cc.iotkit - iot-script-engine - 0.4.5-SNAPSHOT - compile - - - diff --git a/iot-components/iot-websocket-component/dependency-reduced-pom.xml b/iot-components/iot-websocket-component/dependency-reduced-pom.xml deleted file mode 100644 index e336169d..00000000 --- a/iot-components/iot-websocket-component/dependency-reduced-pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - iot-components - cc.iotkit - ${revision} - - 4.0.0 - iot-websocket-component - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - io.vertx:vertx-core - org.luaj:luaj-jse - - - - - - maven-compiler-plugin - - ${java.version} - ${java.version} - true - false - utf8 - - - - - - - org.projectlombok - lombok - 1.18.26 - compile - - - cc.iotkit - iot-common-core - 0.4.5-SNAPSHOT - compile - - - org.slf4j - slf4j-api - 1.7.36 - compile - - - cc.iotkit - iot-component-base - 0.4.5-SNAPSHOT - compile - - - diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java index cf4c22bf..8bf18f07 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/DeviceController.java @@ -71,7 +71,7 @@ public class DeviceController { @ApiOperation(value = "属性获取", notes = "属性获取", httpMethod = "POST") @SaCheckPermission("iot:device:ctrl") @PostMapping("/service/property/get") - public InvokeResult invokeServicePropertySet(@RequestBody @Validated Request request) { + public InvokeResult invokeServicePropertySet(@RequestBody @Validated Request request) { return new InvokeResult(deviceService.getProperty(request.getData().getDeviceId(), request.getData().getPropertyNames(), true)); } @@ -153,17 +153,17 @@ public class DeviceController { return deviceServiceImpl.logs(request); } - @ApiOperation("设备属性日志") + @ApiOperation("获取设备属性历史数据") @SaCheckPermission("iot:deviceLog:query") @PostMapping("/deviceProperty/log/list") public List getPropertyHistory(@Validated @RequestBody - Request query) { + Request query) { DevicePropertyLogQueryBo data = query.getData(); String deviceId = data.getDeviceId(); String name = data.getName(); long start = data.getStart(); long end = data.getEnd(); - return deviceServiceImpl.getPropertyHistory(deviceId, name, start, end); + return deviceServiceImpl.getPropertyHistory(deviceId, name, start, end, 10000); } @ApiOperation("设备解绑") @@ -283,7 +283,7 @@ public class DeviceController { @PostMapping("/group/removeDevices") public boolean removeDevices(@Validated @RequestBody Request bo) { DeviceAddGroupBo data = bo.getData(); - return deviceServiceImpl.removeDevices(data.getGroup(), data.getDevices()); + return deviceServiceImpl.removeDevices(data.getGroup(), data.getDevices()); } /** diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java index 62784654..c7e32439 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/model/vo/SpaceDeviceVo.java @@ -68,7 +68,7 @@ public class SpaceDeviceVo { /** * 设备属性 */ - private Map property = new HashMap<>(); + private Map property = new HashMap<>(); /** * 产品key diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java index 58318ccc..4e45493f 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/ExampleDataInit.java @@ -260,7 +260,6 @@ public class ExampleDataInit implements SmartInitializingSingleton { initData("sys_oper_log", sysOperLogData, new TypeReference>() { }); - initData("sys_oss", sysOssData, new TypeReference>() { }); @@ -294,18 +293,23 @@ public class ExampleDataInit implements SmartInitializingSingleton { }); } - private T initData(String name, ICommonData service, TypeReference type) throws IOException { - log.info("init {} data...", name); - if (service.count() > 0) { - new RuntimeException("原数据库已存在" + name + "的旧数据,请清除后再重新初始化!").printStackTrace(); - System.exit(0); + private T initData(String name, ICommonData service, TypeReference type) { + try { + log.info("init {} data...", name); + if (service.count() > 0) { + new RuntimeException("原数据库已存在" + name + "的旧数据,请清除后再重新初始化!").printStackTrace(); + System.exit(0); + } + String json = FileUtils.readFileToString(new File("./data/init/" + name + ".json"), StandardCharsets.UTF_8); + List list = (List) JsonUtils.parseObject(json, type); + for (Object obj : list) { + service.save((Id) obj); + } + return (T) list; + } catch (Exception e) { + log.error("initData error", e); + return null; } - String json = FileUtils.readFileToString(new File("./data/init/" + name + ".json"), StandardCharsets.UTF_8); - List list = (List) JsonUtils.parseObject(json, type); - for (Object obj : list) { - service.save((Id) obj); - } - return (T) list; } } diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/IDeviceService.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/IDeviceService.java index 3c868acc..a132b7f7 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/IDeviceService.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/IDeviceService.java @@ -46,7 +46,7 @@ public interface IDeviceService { Paging logs(PageRequest request); - List getPropertyHistory(String deviceId, String name, long start, long end); + List getPropertyHistory(String deviceId, String name, long start, long end,int size); boolean unbindDevice(String data); diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java index d137129b..059c7be5 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java @@ -141,7 +141,7 @@ public class DeviceServiceImpl implements IDeviceService { device.setDeviceName(deviceName); device.setSecret(secret.toString()); device.setState(new DeviceInfo.State(false, null, null)); - device.setLocate(new DeviceInfo.Locate(deviceInfo.getLongitude(),deviceInfo.getLatitude())); + device.setLocate(new DeviceInfo.Locate(deviceInfo.getLongitude(), deviceInfo.getLatitude())); device.setCreateAt(System.currentTimeMillis()); if (StringUtils.isNotBlank(parentId)) { device.setParentId(parentId); @@ -168,7 +168,7 @@ public class DeviceServiceImpl implements IDeviceService { if (!AuthUtil.isAdmin()) { uid = AuthUtil.getUserId(); } - List ret=deviceInfoData.findByProductNodeType(uid); + List ret = deviceInfoData.findByProductNodeType(uid); if (!ret.isEmpty()) { pdv = ret.stream().map(r -> ParentDeviceVo.builder().id(r.getId()).deviceName(r.getDeviceName()).build()).collect(Collectors.toList()); } @@ -211,8 +211,8 @@ public class DeviceServiceImpl implements IDeviceService { } @Override - public List getPropertyHistory(String deviceId, String name, long start, long end) { - return devicePropertyData.findDevicePropertyHistory(deviceId, name, start, end); + public List getPropertyHistory(String deviceId, String name, long start, long end, int size) { + return devicePropertyData.findDevicePropertyHistory(deviceId, name, start, end, size); } @Override @@ -412,15 +412,15 @@ public class DeviceServiceImpl implements IDeviceService { @Override public boolean saveDevice(DeviceInfoBo data) { - DeviceInfo di=data.to(DeviceInfo.class); - di.setLocate(new DeviceInfo.Locate(data.getLongitude(),data.getLatitude())); + DeviceInfo di = data.to(DeviceInfo.class); + di.setLocate(new DeviceInfo.Locate(data.getLongitude(), data.getLatitude())); di.setState(data.getState()); //同产品不可重复设备名 DeviceInfo deviceRepetition = deviceInfoData.findByProductKeyAndDeviceName(data.getProductKey(), data.getDeviceName()); if (deviceRepetition != null && !deviceRepetition.getDeviceId().equals(di.getDeviceId())) { throw new BizException(ErrCode.MODEL_DEVICE_ALREADY); } - return deviceInfoData.save(di)!=null; + return deviceInfoData.save(di) != null; } diff --git a/iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/service/impl/OpenDeviceServiceImpl.java b/iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/service/impl/OpenDeviceServiceImpl.java index 39831979..4c500cfb 100644 --- a/iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/service/impl/OpenDeviceServiceImpl.java +++ b/iot-module/iot-openapi/src/main/java/cc/iotkit/openapi/service/impl/OpenDeviceServiceImpl.java @@ -118,7 +118,7 @@ public class OpenDeviceServiceImpl implements OpenDeviceService { DeviceInfo deviceInfo = deviceInfoData.findByProductKeyAndDeviceName(bo.getProductKey(), bo.getDeviceName()); List openPropertyVos = new ArrayList<>(); if (propertyVo != null){ - Map properties = deviceInfoData.getProperties(deviceInfo.getDeviceId()); + Map properties = deviceInfoData.getProperties(deviceInfo.getDeviceId()); for (ThingModel.Property property : propertyVo.getModel().getProperties()) { OpenPropertyVo openPropertyVo = new OpenPropertyVo(property.getIdentifier(), property.getDataType(), property.getName(), property.getAccessMode(), property.getDescription(), property.getUnit()); Map map = (Map) properties.get(openPropertyVo.getIdentifier()); diff --git a/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java b/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java index 5fc155de..e9590406 100644 --- a/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java +++ b/iot-module/iot-rule-engine/src/main/java/cc/iotkit/ruleengine/filter/DeviceCondition.java @@ -54,7 +54,7 @@ public class DeviceCondition { } Object left = null; if ("property".equals(type)) { - Map properties = deviceInfo.getProperty(); + Map properties = deviceInfo.getProperty(); left = properties.get(identifier); } else if ("state".equals(type)) { DeviceInfo.State state = deviceInfo.getState(); diff --git a/iot-starter/.DS_Store b/iot-starter/.DS_Store deleted file mode 100644 index ee771938787a1bb39cadddab0eb4f7463f2ead2b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKI|>3Z5S>vG!N$@uSMUZw^aOhW1;s`bM6I{-TprCgpGH?ZZR8D1UNV`NkXP*N zh=|TFo0-T&L`HB!x!KS)+c)o6FCz+si0p zwti-h{ zq5pp-aYY5Fz+Wk#gGIBL<4IXtJCCzkTi`3W<=o+Bm^%f7mt&xpV=Sy3PdzE}ip{ZK V6Wc(iBkpt{e+En!8Ws4p0uNe26{i3I diff --git a/iot-starter/pom.xml b/iot-starter/pom.xml index 85d9503a..bcdd3522 100644 --- a/iot-starter/pom.xml +++ b/iot-starter/pom.xml @@ -92,7 +92,7 @@ - + diff --git a/iot-starter/src/main/resources/application.yml b/iot-starter/src/main/resources/application.yml index df9bf71c..42e32e47 100644 --- a/iot-starter/src/main/resources/application.yml +++ b/iot-starter/src/main/resources/application.yml @@ -88,25 +88,24 @@ spring: # ============mysql配置结束============>> #<<================es时序数据配置开始=============== - elasticsearch: - rest: - #使用内置es的配置 - #uris: http://elasticsearch:9200 - uris: http://127.0.0.1:9200 - username: - password: - connection-timeout: 10s +# elasticsearch: +# rest: +# #使用内置es的配置 +# #uris: http://elasticsearch:9200 +# uris: http://127.0.0.1:9200 +# username: +# password: +# connection-timeout: 10s #================es时序数据配置结束===============>> #<<===========tdengine时序数据库配置开始============ - # td-datasource: - # url: jdbc:TAOS-RS://127.0.0.1:6041/iotkit?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 - # username: root - # password: taosdata - # driverClassName: com.taosdata.jdbc.rs.RestfulDriver + td-datasource: + url: jdbc:TAOS-RS://127.0.0.1:6041/iotkit?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 + username: root + password: taosdata + driverClassName: com.taosdata.jdbc.rs.RestfulDriver #===========tdengine时序数据库配置开始============>> - redis: #使用内置redis的配置 #host: redis