Merge branch 'dev-V0.4.5' into dev-V0.4.5-postgre
# Conflicts: # iot-starter/src/main/resources/application.ymlV0.5.x
commit
5f68b99c90
|
@ -28,3 +28,6 @@ data/elasticsearch
|
|||
.init
|
||||
*.db
|
||||
.flattened-pom.xml
|
||||
|
||||
.DS_Store
|
||||
dependency-reduced-pom.xml
|
||||
|
|
14
README.md
14
README.md
|
@ -73,17 +73,19 @@ Vertx event-bus(内置)、RocketMQ,通过扩展模块可接入其它任意
|
|||
|
||||
**注:** es版本为7.15.2,mysql版本为8.0+
|
||||
|
||||
##### 关系数据库切换为mysql方法(其它数据库同理)
|
||||
##### H2数据库切换为mysql方法(其它数据库同理)
|
||||
1、删掉.init、iotkit.mv.db、iotkit.trace.db文件
|
||||
|
||||
1、将iot-data-serviceImpl-rdb/pom.xml中的mysql驱动注释放开
|
||||
2、将iot-data-serviceImpl-rdb/pom.xml中的mysql驱动注释放开
|
||||
|
||||
2、启动时指定active: --spring.profiles.active=mysql
|
||||
3、application.yml 注释掉内置H2数据库,打开mysql配置注释
|
||||
|
||||
##### 时序数据库切换为TDengin(版本:2.6x)方法
|
||||
##### es切换为TDengine(版本:3.x)方法
|
||||
1、删掉.init和关系数据库数据
|
||||
|
||||
1、注释掉iot-starter/pom.xml中的 iot-temporal-serviceImpl-es,并打开iot-td-temporal-service的注释
|
||||
2、注释掉iot-starter/pom.xml中的 iot-temporal-serviceImpl-es,并打开iot-td-temporal-service的注释
|
||||
|
||||
2、application.xml中注释掉elasticsearch配置,并打开td-datasource配置
|
||||
3、注解掉iot-starter下application.xml中的elasticsearch配置,并打开td-datasource配置
|
||||
|
||||
##### 消息总线切换为RocketMq方法
|
||||
|
||||
|
|
|
@ -1562,17 +1562,7 @@
|
|||
"name": "水温度",
|
||||
"accessMode": "r"
|
||||
},
|
||||
{
|
||||
"identifier": "query",
|
||||
"dataType": {
|
||||
"type": "text",
|
||||
"specs": {
|
||||
"length": "255"
|
||||
}
|
||||
},
|
||||
"name": "查询",
|
||||
"accessMode": "rw"
|
||||
},
|
||||
|
||||
{
|
||||
"identifier": "McuStatus",
|
||||
"dataType": {
|
||||
|
@ -1838,17 +1828,7 @@
|
|||
"name": "实时运行状态",
|
||||
"accessMode": "rw"
|
||||
},
|
||||
{
|
||||
"identifier": "Time",
|
||||
"dataType": {
|
||||
"type": "text",
|
||||
"specs": {
|
||||
"length": "255"
|
||||
}
|
||||
},
|
||||
"name": "时间戳",
|
||||
"accessMode": "rw"
|
||||
},
|
||||
|
||||
{
|
||||
"identifier": "TimeModeSet",
|
||||
"dataType": {
|
||||
|
|
|
@ -72,7 +72,7 @@ public class DeviceInfo implements Owned<String> {
|
|||
/**
|
||||
* 设备属性
|
||||
*/
|
||||
private Map<String, Object> property = new HashMap<>();
|
||||
private Map<String, ?> property = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 设备标签
|
||||
|
|
|
@ -21,10 +21,14 @@ import java.util.Map;
|
|||
public class DevicePropertyCache {
|
||||
|
||||
|
||||
// 属性值
|
||||
/**
|
||||
* 属性值
|
||||
*/
|
||||
private Object value;
|
||||
|
||||
// 属性值时间: 设备上报时间
|
||||
/**
|
||||
* 属性值时间: 设备上报时间
|
||||
*/
|
||||
private Long occurred;
|
||||
|
||||
|
||||
|
|
|
@ -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<DeviceInfo, String> {
|
|||
* @param deviceId 设备id
|
||||
* @param properties 设备属性map
|
||||
*/
|
||||
void saveProperties(String deviceId, Map<String, Object> properties);
|
||||
void saveProperties(String deviceId, Map<String, DevicePropertyCache> properties);
|
||||
|
||||
/**
|
||||
* 获取设备属性map
|
||||
*
|
||||
* @param deviceId 设备id
|
||||
*/
|
||||
Map<String, Object> getProperties(String deviceId);
|
||||
Map<String, DevicePropertyCache> getProperties(String deviceId);
|
||||
|
||||
/**
|
||||
* 根据设备ID取设备信息
|
||||
|
|
|
@ -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<String, Object> properties) {
|
||||
Map<String, Object> old = getProperties(deviceId);
|
||||
public void saveProperties(String deviceId, Map<String, DevicePropertyCache> properties) {
|
||||
Map<String, DevicePropertyCache> 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<String, Object> getProperties(String deviceId) {
|
||||
public Map<String, DevicePropertyCache> 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
|
||||
|
|
|
@ -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<String, Object> properties) {
|
||||
public void saveProperties(String deviceId, Map<String, DevicePropertyCache> properties) {
|
||||
deviceInfoData.saveProperties(deviceId, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProperties(String deviceId) {
|
||||
public Map<String, DevicePropertyCache> getProperties(String deviceId) {
|
||||
return deviceInfoData.getProperties(deviceId);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<DeviceI
|
|||
}
|
||||
|
||||
@Override
|
||||
public void saveProperties(String deviceId, Map<String, Object> properties) {
|
||||
public void saveProperties(String deviceId, Map<String, DevicePropertyCache> properties) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getProperties(String deviceId) {
|
||||
public Map<String, DevicePropertyCache> getProperties(String deviceId) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -173,6 +173,7 @@ public class SysMenuDataImpl implements ISysMenuData, IJPACommData<SysMenu, Long
|
|||
tbSysMenu.parentId, tbSysMenu.menuName, tbSysMenu.path, tbSysMenu.component, tbSysMenu.queryParam,
|
||||
tbSysMenu.visible, tbSysMenu.status, tbSysMenu.perms, tbSysMenu.isFrame, tbSysMenu.isCache, tbSysMenu.menuType,
|
||||
tbSysMenu.icon, tbSysMenu.orderNum, tbSysMenu.createTime))
|
||||
.distinct()
|
||||
.from(tbSysMenu)
|
||||
.leftJoin(tbSysRoleMenu).on(tbSysMenu.id.eq(tbSysRoleMenu.menuId))
|
||||
.leftJoin(tbSysUserRole).on(tbSysRoleMenu.roleId.eq(tbSysUserRole.roleId))
|
||||
|
|
|
@ -54,7 +54,7 @@ public class PageBuilder {
|
|||
Map<String,String> sortMap = pageRequest.getSortMap();
|
||||
if (CollUtil.isNotEmpty(sortMap)){
|
||||
sortMap.forEach((k,v) -> {
|
||||
orders.add(new Order(Direction.ASC, k));
|
||||
orders.add(new Order(Direction.fromString("desc"), k));
|
||||
});
|
||||
}
|
||||
return orders;
|
||||
|
|
|
@ -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<DeviceProperty> findDevicePropertyHistory(String deviceId, String name, long start, long end);
|
||||
List<DeviceProperty> 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<String, Object> properties, long time);
|
||||
void addProperties(String deviceId, Map<String, DevicePropertyCache> properties, long time);
|
||||
|
||||
}
|
||||
|
|
|
@ -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<String> indexSet = new HashSet<>();
|
||||
|
||||
public List<DeviceProperty> findDevicePropertyHistory(String deviceId, String name, long start, long end) {
|
||||
@Override
|
||||
public List<DeviceProperty> 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<DocDeviceProperty> 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<String, Object> properties, long time) {
|
||||
public void addProperties(String deviceId, Map<String, DevicePropertyCache> 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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -13,11 +13,9 @@
|
|||
|
||||
<description>
|
||||
时序数据库服务接口的TDengine实现
|
||||
支持版本:v0.4.1
|
||||
TDengine版本:2.6.0.12
|
||||
TDengine版本:3.x
|
||||
</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
|
@ -45,7 +43,7 @@
|
|||
<dependency>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>2.0.40</version>
|
||||
<version>3.2.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -36,7 +36,8 @@ public class DevicePropertyDataImpl implements IDevicePropertyData {
|
|||
@Qualifier("deviceInfoDataCache")
|
||||
private IDeviceInfoData deviceInfoData;
|
||||
|
||||
public List<DeviceProperty> findDevicePropertyHistory(String deviceId, String name, long start, long end) {
|
||||
@Override
|
||||
public List<DeviceProperty> 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<TbDeviceProperty> 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<String, Object> properties, long time) {
|
||||
public void addProperties(String deviceId, Map<String, DevicePropertyCache> properties, long time) {
|
||||
DeviceInfo device = deviceInfoData.findByDeviceId(deviceId);
|
||||
if (device == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> propertiesMap = new HashMap<>();
|
||||
properties.forEach((key, val) -> {
|
||||
DevicePropertyCache propertyCache = (DevicePropertyCache) val;
|
||||
propertiesMap.put(key, propertyCache.getValue());
|
||||
});
|
||||
//获取设备旧属性
|
||||
Map<String, Object> oldProperties = deviceInfoData.getProperties(deviceId);
|
||||
Map<String, DevicePropertyCache> 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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -52,19 +52,13 @@ public class JavaScriptEngine implements IScriptEngine {
|
|||
public <T> T invokeMethod(TypeReference<T> type, String methodName, Object... args) {
|
||||
Value member = jsScript.getMember("invoke");
|
||||
|
||||
StringBuilder sbArgs = new StringBuilder("[");
|
||||
//将入参转成json
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = JsonUtils.toJsonString(args[i]);
|
||||
sbArgs.append(i == args.length - 1 ? "," : "").append(args[i]);
|
||||
}
|
||||
sbArgs.append("]");
|
||||
StringBuilder sbArgs = formatArgs(args);
|
||||
|
||||
//通过调用invoke方法将目标方法返回结果转成json
|
||||
Value rst = member.execute(methodName, args);
|
||||
|
||||
String json = rst.asString();
|
||||
log.info("invoke script {},args:{}, result:{}", methodName, sbArgs, json);
|
||||
log.info("invoke script={}, args={}, result={}", methodName, sbArgs, json);
|
||||
|
||||
//没有返回值
|
||||
if (json == null || "null".equals(json)) {
|
||||
|
@ -74,4 +68,15 @@ public class JavaScriptEngine implements IScriptEngine {
|
|||
return JsonUtils.parseObject(json, type);
|
||||
}
|
||||
|
||||
private static StringBuilder formatArgs(Object[] args) {
|
||||
StringBuilder sbArgs = new StringBuilder("[");
|
||||
//将入参转成json
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = JsonUtils.toJsonString(args[i]);
|
||||
sbArgs.append(args[i]).append(i != args.length - 1 ? "," : "");
|
||||
}
|
||||
sbArgs.append("]");
|
||||
return sbArgs;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-DLT645-component</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-web-proxy</include>
|
||||
<include>io.vertx:vertx-web</include>
|
||||
<include>io.vertx:vertx-bridge-common</include>
|
||||
<include>io.vertx:vertx-http-proxy</include>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
<include>io.netty:netty-codec-http2</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>5.8.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -25,9 +25,9 @@ public class Device {
|
|||
|
||||
private String model;
|
||||
|
||||
private Map<String, Object> property = new HashMap<>();
|
||||
private Map<String, ?> property = new HashMap<>();
|
||||
|
||||
private Map<String, Object> tag = new HashMap<>();
|
||||
private Map<String, ?> tag = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 是否透传
|
||||
|
|
|
@ -78,7 +78,7 @@ public class DevicePropertyConsumer implements ConsumerHandler<ThingModelMessage
|
|||
getProperties().stream().collect(Collectors.toMap(
|
||||
ThingModel.Property::getIdentifier, ThingModel.Property::getDataType));
|
||||
|
||||
Map<String, Object> addProperties = new HashMap<>();
|
||||
Map<String, DevicePropertyCache> addProperties = new HashMap<>();
|
||||
Long occurred = msg.getOccurred();
|
||||
//删除非属性字段
|
||||
properties.forEach((key,val)->{
|
||||
|
@ -131,7 +131,7 @@ public class DevicePropertyConsumer implements ConsumerHandler<ThingModelMessage
|
|||
/**
|
||||
* 更新设备当前属性
|
||||
*/
|
||||
private void updateDeviceCurrentProperties(String deviceId, Map<String, Object> properties) {
|
||||
private void updateDeviceCurrentProperties(String deviceId, Map<String, DevicePropertyCache> properties) {
|
||||
try {
|
||||
log.info("save device property,deviceId:{},property:{}", deviceId, JsonUtils.toJsonString(properties));
|
||||
deviceInfoData.saveProperties(deviceId, properties);
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-component-tcp</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-core</artifactId>
|
||||
<version>3.4.29</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.36</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-data-service</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-script-engine</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-emqx-component</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
<include>io.vertx:vertx-web-proxy</include>
|
||||
<include>io.vertx:vertx-mqtt</include>
|
||||
<include>io.vertx:vertx-web</include>
|
||||
<include>io.vertx:vertx-http-proxy</include>
|
||||
<include>org.luaj:luaj-jse</include>
|
||||
<include>io.netty:netty-common</include>
|
||||
<include>io.netty:netty-transport</include>
|
||||
<include>io.netty:netty-handler</include>
|
||||
<include>io.netty:netty-resolver</include>
|
||||
<include>io.netty:netty-buffer</include>
|
||||
<include>io.netty:netty-handler</include>
|
||||
<include>io.netty:netty-proxy</include>
|
||||
<include>io.netty:netty-codec</include>
|
||||
<include>io.netty:netty-codec-mqtt</include>
|
||||
<include>io.netty:netty-codec-dns</include>
|
||||
<include>io.netty:netty-resolver-dns</include>
|
||||
<include>io.netty:netty-tcnative-boringssl-static</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-model</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-data-service</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-script-engine</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,66 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-http-biz-component</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-web-proxy</include>
|
||||
<include>io.vertx:vertx-web</include>
|
||||
<include>io.vertx:vertx-bridge-common</include>
|
||||
<include>io.vertx:vertx-http-proxy</include>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
<include>io.netty:netty-codec-http2</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-script-engine</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,84 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-mqtt-component</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
<include>io.vertx:vertx-mqtt</include>
|
||||
<include>io.netty:netty-codec-mqtt</include>
|
||||
<include>org.luaj:luaj-jse</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.36</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-data-service</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-script-engine</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,84 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-nb-component</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
<include>io.vertx:vertx-mqtt</include>
|
||||
<include>io.netty:netty-codec-mqtt</include>
|
||||
<include>org.luaj:luaj-jse</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.36</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-data-service</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-script-engine</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>iot-components</artifactId>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>iot-websocket-component</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>io.vertx:vertx-core</include>
|
||||
<include>org.luaj:luaj-jse</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<encoding>utf8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.26</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.36</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-component-base</artifactId>
|
||||
<version>0.4.5-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -153,7 +153,7 @@ public class DeviceController {
|
|||
return deviceServiceImpl.logs(request);
|
||||
}
|
||||
|
||||
@ApiOperation("设备属性日志")
|
||||
@ApiOperation("获取设备属性历史数据")
|
||||
@SaCheckPermission("iot:deviceLog:query")
|
||||
@PostMapping("/deviceProperty/log/list")
|
||||
public List<DeviceProperty> getPropertyHistory(@Validated @RequestBody
|
||||
|
@ -163,7 +163,7 @@ public class DeviceController {
|
|||
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("设备解绑")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cc.iotkit.manager.dto.vo.ruleinfo;
|
||||
|
||||
import cc.iotkit.model.rule.RuleInfo;
|
||||
import cc.iotkit.model.rule.RuleLog;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
@ -10,27 +10,23 @@ import java.io.Serializable;
|
|||
|
||||
@ApiModel(value = "RuleLogVo")
|
||||
@Data
|
||||
@AutoMapper(target = RuleInfo.class)
|
||||
@AutoMapper(target = RuleLog.class)
|
||||
public class RuleLogVo implements Serializable {
|
||||
private static final long serialVersionUID = -1L;
|
||||
|
||||
@ApiModelProperty(value = "时间")
|
||||
private Long time;
|
||||
private Long logAt;
|
||||
|
||||
@ApiModelProperty(value = "规则id")
|
||||
|
||||
private String ruleId;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
|
||||
private String state1;
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "内容")
|
||||
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "是否成功")
|
||||
|
||||
private Boolean success;
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class SpaceDeviceVo {
|
|||
/**
|
||||
* 设备属性
|
||||
*/
|
||||
private Map<String, Object> property = new HashMap<>();
|
||||
private Map<String, ?> property = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 产品key
|
||||
|
|
|
@ -260,7 +260,6 @@ public class ExampleDataInit implements SmartInitializingSingleton {
|
|||
initData("sys_oper_log", sysOperLogData, new TypeReference<List<SysOperLog>>() {
|
||||
});
|
||||
|
||||
|
||||
initData("sys_oss", sysOssData, new TypeReference<List<SysOss>>() {
|
||||
});
|
||||
|
||||
|
@ -294,7 +293,8 @@ public class ExampleDataInit implements SmartInitializingSingleton {
|
|||
});
|
||||
}
|
||||
|
||||
private <T> T initData(String name, ICommonData service, TypeReference<T> type) throws IOException {
|
||||
private <T> T initData(String name, ICommonData service, TypeReference<T> type) {
|
||||
try {
|
||||
log.info("init {} data...", name);
|
||||
if (service.count() > 0) {
|
||||
new RuntimeException("原数据库已存在" + name + "的旧数据,请清除后再重新初始化!").printStackTrace();
|
||||
|
@ -306,6 +306,10 @@ public class ExampleDataInit implements SmartInitializingSingleton {
|
|||
service.save((Id) obj);
|
||||
}
|
||||
return (T) list;
|
||||
} catch (Exception e) {
|
||||
log.error("initData error", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface IDeviceService {
|
|||
|
||||
Paging<ThingModelMessage> logs(PageRequest<DeviceLogQueryBo> request);
|
||||
|
||||
List<DeviceProperty> getPropertyHistory(String deviceId, String name, long start, long end);
|
||||
List<DeviceProperty> getPropertyHistory(String deviceId, String name, long start, long end,int size);
|
||||
|
||||
boolean unbindDevice(String data);
|
||||
|
||||
|
|
|
@ -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<DeviceInfo> ret=deviceInfoData.findByProductNodeType(uid);
|
||||
List<DeviceInfo> 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<DeviceProperty> getPropertyHistory(String deviceId, String name, long start, long end) {
|
||||
return devicePropertyData.findDevicePropertyHistory(deviceId, name, start, end);
|
||||
public List<DeviceProperty> 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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ public class OpenDeviceServiceImpl implements OpenDeviceService {
|
|||
DeviceInfo deviceInfo = deviceInfoData.findByProductKeyAndDeviceName(bo.getProductKey(), bo.getDeviceName());
|
||||
List<OpenPropertyVo> openPropertyVos = new ArrayList<>();
|
||||
if (propertyVo != null){
|
||||
Map<String, Object> properties = deviceInfoData.getProperties(deviceInfo.getDeviceId());
|
||||
Map<String, ?> 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<String,Object> map = (Map<String, Object>) properties.get(openPropertyVo.getIdentifier());
|
||||
|
|
|
@ -54,7 +54,7 @@ public class DeviceCondition {
|
|||
}
|
||||
Object left = null;
|
||||
if ("property".equals(type)) {
|
||||
Map<String, Object> properties = deviceInfo.getProperty();
|
||||
Map<String, ?> properties = deviceInfo.getProperty();
|
||||
left = properties.get(identifier);
|
||||
} else if ("state".equals(type)) {
|
||||
DeviceInfo.State state = deviceInfo.getState();
|
||||
|
|
Binary file not shown.
|
@ -92,7 +92,7 @@
|
|||
<!-- </dependency>-->
|
||||
|
||||
<!--打开注释 启用tdengine数据库-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cc.iotkit</groupId>-->
|
||||
<!-- <artifactId>iot-temproal-serviceImpl-td</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
|
Loading…
Reference in New Issue