增加设备配置功能
parent
57fce9102a
commit
413818248a
|
@ -23,7 +23,6 @@ hs_err_pid*
|
||||||
.idea
|
.idea
|
||||||
target
|
target
|
||||||
*.iml
|
*.iml
|
||||||
*.yml
|
|
||||||
log
|
log
|
||||||
data/elasticsearch
|
data/elasticsearch
|
||||||
.init
|
.init
|
||||||
|
|
|
@ -63,6 +63,30 @@ this.decode = function (msg) {
|
||||||
time: new Date().getTime(),
|
time: new Date().getTime(),
|
||||||
code: payload.code
|
code: payload.code
|
||||||
};
|
};
|
||||||
|
}else if(topic.endsWith("/config/set_reply")){
|
||||||
|
//设备配置设置回复
|
||||||
|
return {
|
||||||
|
mid: msg.mid,
|
||||||
|
productKey: msg.productKey,
|
||||||
|
deviceName: msg.deviceName,
|
||||||
|
type:"config",
|
||||||
|
identifier: "set_reply",
|
||||||
|
occur: new Date().getTime(),
|
||||||
|
time: new Date().getTime(),
|
||||||
|
code: payload.code
|
||||||
|
};
|
||||||
|
}else if(topic.endsWith("/config/get")){
|
||||||
|
//设备配置获取
|
||||||
|
return {
|
||||||
|
mid: msg.mid,
|
||||||
|
productKey: msg.productKey,
|
||||||
|
deviceName: msg.deviceName,
|
||||||
|
type:"config",
|
||||||
|
identifier: "get",
|
||||||
|
occur: new Date().getTime(),
|
||||||
|
time: new Date().getTime(),
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
} else if (topic.endsWith("_reply")) {
|
} else if (topic.endsWith("_reply")) {
|
||||||
//服务回复
|
//服务回复
|
||||||
return {
|
return {
|
||||||
|
@ -119,7 +143,12 @@ this.encode = function (service,device) {
|
||||||
}else if(type=="service"){
|
}else if(type=="service"){
|
||||||
method+=identifier;
|
method+=identifier;
|
||||||
topic+=identifier;
|
topic+=identifier;
|
||||||
|
}else if(type=="config"){
|
||||||
|
//设备配置下发
|
||||||
|
method+=identifier;
|
||||||
|
topic="/sys/"+service.productKey+"/"+service.deviceName+"/c/config/"+identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var p in service.params){
|
for(var p in service.params){
|
||||||
params[p]=service.params[p];
|
params[p]=service.params[p];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.oauth.controller;
|
package cc.iotkit.oauth.controller;
|
||||||
|
|
||||||
import cc.iotkit.common.utils.JsonUtil;
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.oauth.service;
|
package cc.iotkit.oauth.service;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.oauth.service;
|
package cc.iotkit.oauth.service;
|
||||||
|
|
||||||
import cc.iotkit.dao.UserInfoCache;
|
import cc.iotkit.dao.UserInfoCache;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.oauth.vo;
|
package cc.iotkit.oauth.vo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.utils;
|
package cc.iotkit.utils;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,21 @@ public interface Constants {
|
||||||
*/
|
*/
|
||||||
String THING_MODEL_MESSAGE_TOPIC = "device_thing";
|
String THING_MODEL_MESSAGE_TOPIC = "device_thing";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备属性上报消息的topic
|
||||||
|
*/
|
||||||
|
String DEVICE_PROPERTY_REPORT_TOPIC = "device_property_report";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不含消息内容的设备上报记录的topic,用于统计
|
||||||
|
*/
|
||||||
|
String DEVICE_REPORT_RECORD_TOPIC = "device_report_record";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置消息topic
|
||||||
|
*/
|
||||||
|
String DEVICE_CONFIG_TOPIC = "device_config";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http消费设备信息的topic
|
* http消费设备信息的topic
|
||||||
*/
|
*/
|
||||||
|
@ -102,7 +117,7 @@ public interface Constants {
|
||||||
/**
|
/**
|
||||||
* 三方平台openUid名称
|
* 三方平台openUid名称
|
||||||
*/
|
*/
|
||||||
enum ThirdOpenUid{
|
enum ThirdOpenUid {
|
||||||
duerosOpenUid("小度OpenUid"),
|
duerosOpenUid("小度OpenUid"),
|
||||||
aligenieOpenUid("天猫精灵OpenUid"),
|
aligenieOpenUid("天猫精灵OpenUid"),
|
||||||
miiotOpenUid("小爱OpenUid");
|
miiotOpenUid("小爱OpenUid");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp;
|
package cc.iotkit.comp;
|
||||||
|
|
||||||
import cc.iotkit.comp.model.AuthInfo;
|
import cc.iotkit.comp.model.AuthInfo;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp;
|
package cc.iotkit.comp;
|
||||||
|
|
||||||
import cc.iotkit.comp.model.AuthInfo;
|
import cc.iotkit.comp.model.AuthInfo;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.utils;
|
package cc.iotkit.comp.utils;
|
||||||
|
|
||||||
import org.springframework.aop.framework.AopContext;
|
import org.springframework.aop.framework.AopContext;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.converter;
|
package cc.iotkit.converter;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.converter;
|
package cc.iotkit.converter;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.converter;
|
package cc.iotkit.converter;
|
||||||
|
|
||||||
import cc.iotkit.common.thing.ThingService;
|
import cc.iotkit.common.thing.ThingService;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -92,6 +92,11 @@
|
||||||
<artifactId>iot-message-bus</artifactId>
|
<artifactId>iot-message-bus</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.iotkit</groupId>
|
||||||
|
<artifactId>iot-device-dao</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps;
|
package cc.iotkit.comps;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps;
|
package cc.iotkit.comps;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps;
|
package cc.iotkit.comps;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps;
|
package cc.iotkit.comps;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps;
|
package cc.iotkit.comps;
|
||||||
|
|
||||||
import cc.iotkit.comp.IComponent;
|
import cc.iotkit.comp.IComponent;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package cc.iotkit.comps.config;
|
package cc.iotkit.comps.config;
|
||||||
|
|
||||||
|
import cc.iotkit.model.device.message.DeviceReport;
|
||||||
import cc.iotkit.model.device.message.ThingModelMessage;
|
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||||
import cc.iotkit.mq.MqConsumer;
|
import cc.iotkit.mq.MqConsumer;
|
||||||
import cc.iotkit.mq.MqProducer;
|
import cc.iotkit.mq.MqProducer;
|
||||||
|
@ -53,4 +54,13 @@ public class ComponentConfig {
|
||||||
return new VertxMqConsumer<>(ThingModelMessage.class);
|
return new VertxMqConsumer<>(ThingModelMessage.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean("deviceReportProducer")
|
||||||
|
public MqProducer<DeviceReport> getDeviceReportProducer() {
|
||||||
|
return new VertxMqProducer<>(DeviceReport.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean("deviceReportConsumer")
|
||||||
|
public MqConsumer<DeviceReport> getDeviceReportConsumer() {
|
||||||
|
return new VertxMqConsumer<>(DeviceReport.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps.service;
|
package cc.iotkit.comps.service;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
@ -194,11 +203,9 @@ public class DeviceBehaviourService {
|
||||||
if (online) {
|
if (online) {
|
||||||
device.getState().setOnline(true);
|
device.getState().setOnline(true);
|
||||||
device.getState().setOnlineTime(System.currentTimeMillis());
|
device.getState().setOnlineTime(System.currentTimeMillis());
|
||||||
// deviceStateHolder.online(device.getDeviceId());
|
|
||||||
} else {
|
} else {
|
||||||
device.getState().setOnline(false);
|
device.getState().setOnline(false);
|
||||||
device.getState().setOfflineTime(System.currentTimeMillis());
|
device.getState().setOfflineTime(System.currentTimeMillis());
|
||||||
// deviceStateHolder.offline(device.getDeviceId());
|
|
||||||
}
|
}
|
||||||
deviceInfoRepository.save(device);
|
deviceInfoRepository.save(device);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
package cc.iotkit.comps.service;
|
||||||
|
|
||||||
|
import cc.iotkit.common.Constants;
|
||||||
|
import cc.iotkit.common.thing.ThingService;
|
||||||
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
import cc.iotkit.comps.DeviceComponentManager;
|
||||||
|
import cc.iotkit.dao.DeviceConfigRepository;
|
||||||
|
import cc.iotkit.model.device.DeviceConfig;
|
||||||
|
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||||
|
import cc.iotkit.mq.ConsumerHandler;
|
||||||
|
import cc.iotkit.mq.MqConsumer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置服务
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DeviceConfigService implements ConsumerHandler<ThingModelMessage> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MqConsumer<ThingModelMessage> configMessageConsumer;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DeviceComponentManager deviceComponentManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceConfigRepository deviceConfigRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
configMessageConsumer.consume(Constants.DEVICE_CONFIG_TOPIC, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handler(ThingModelMessage msg) {
|
||||||
|
try {
|
||||||
|
String identifier = msg.getIdentifier();
|
||||||
|
if (ThingModelMessage.ID_CONFIG_GET.equals(identifier)) {
|
||||||
|
//收到设备获取配置消息,回复配置信息给设备
|
||||||
|
DeviceConfig deviceConfig = deviceConfigRepository.findByDeviceId(msg.getDeviceId());
|
||||||
|
if (deviceConfig == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map config = JsonUtil.parse(deviceConfig.getConfig(), Map.class);
|
||||||
|
ThingService<Object> service = ThingService.builder()
|
||||||
|
.productKey(msg.getProductKey())
|
||||||
|
.deviceName(msg.getDeviceName())
|
||||||
|
.identifier(ThingModelMessage.ID_CONFIG_GET + "_reply")
|
||||||
|
.type(ThingModelMessage.TYPE_CONFIG)
|
||||||
|
.mid(msg.getMid())
|
||||||
|
.params(config)
|
||||||
|
.build();
|
||||||
|
deviceComponentManager.send(service);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error("consumer device config msg error", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,21 +1,28 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comps.service;
|
package cc.iotkit.comps.service;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
import cc.iotkit.common.utils.JsonUtil;
|
|
||||||
import cc.iotkit.dao.*;
|
import cc.iotkit.dao.*;
|
||||||
import cc.iotkit.model.device.DeviceInfo;
|
import cc.iotkit.model.device.DeviceInfo;
|
||||||
import cc.iotkit.model.device.message.DeviceProperty;
|
|
||||||
import cc.iotkit.model.device.message.DeviceReport;
|
import cc.iotkit.model.device.message.DeviceReport;
|
||||||
import cc.iotkit.model.device.message.ThingModelMessage;
|
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||||
import cc.iotkit.mq.ConsumerHandler;
|
import cc.iotkit.mq.ConsumerHandler;
|
||||||
import cc.iotkit.mq.MqConsumer;
|
import cc.iotkit.mq.MqConsumer;
|
||||||
|
import cc.iotkit.mq.MqProducer;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@ -24,18 +31,14 @@ public class DeviceMessageConsumer implements ConsumerHandler<ThingModelMessage>
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ThingModelMessageRepository messageRepository;
|
private ThingModelMessageRepository messageRepository;
|
||||||
@Lazy
|
|
||||||
@Autowired
|
|
||||||
private DevicePropertyRepository propertyRepository;
|
|
||||||
@Lazy
|
|
||||||
@Autowired
|
|
||||||
private DeviceReportRepository deviceReportRepository;
|
|
||||||
@Autowired
|
|
||||||
private DeviceDao deviceDao;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceCache deviceCache;
|
private DeviceCache deviceCache;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MqConsumer<ThingModelMessage> thingModelMessageConsumer;
|
private MqConsumer<ThingModelMessage> thingModelMessageConsumer;
|
||||||
|
@Autowired
|
||||||
|
private MqProducer<ThingModelMessage> thingModelMessageMqProducer;
|
||||||
|
@Autowired
|
||||||
|
private MqProducer<DeviceReport> deviceReportProducer;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
|
@ -45,48 +48,22 @@ public class DeviceMessageConsumer implements ConsumerHandler<ThingModelMessage>
|
||||||
@Override
|
@Override
|
||||||
public void handler(ThingModelMessage msg) {
|
public void handler(ThingModelMessage msg) {
|
||||||
try {
|
try {
|
||||||
String deviceId = msg.getDeviceId();
|
String type = msg.getType();
|
||||||
log.info("save message to es:{}", JsonUtil.toJsonString(msg));
|
//重新发布属性入库消息
|
||||||
//属性入库
|
if (ThingModelMessage.TYPE_PROPERTY.equals(type)
|
||||||
if (ThingModelMessage.TYPE_PROPERTY.equals(msg.getType())
|
|
||||||
&& "report".equals(msg.getIdentifier())) {
|
&& "report".equals(msg.getIdentifier())) {
|
||||||
log.info("update device property,deviceId:{},property:{}",
|
thingModelMessageMqProducer.publish(Constants.DEVICE_PROPERTY_REPORT_TOPIC, msg);
|
||||||
deviceId, JsonUtil.toJsonString(msg.getData()));
|
|
||||||
deviceDao.updateProperties(deviceId, (Map<String, Object>) msg.getData());
|
|
||||||
|
|
||||||
//设备属性历史数据存储
|
|
||||||
if (msg.getData() instanceof Map) {
|
|
||||||
Map map = (Map) msg.getData();
|
|
||||||
int index = 0;
|
|
||||||
for (Object key : map.keySet()) {
|
|
||||||
index++;
|
|
||||||
try {
|
|
||||||
propertyRepository.save(
|
|
||||||
new DeviceProperty(
|
|
||||||
//防止重复id被覆盖
|
|
||||||
msg.getMid() + "_" + index,
|
|
||||||
deviceId,
|
|
||||||
key.toString(),
|
|
||||||
map.get(key),
|
|
||||||
msg.getOccurred()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
log.warn("save property data to es error", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (ThingModelMessage.TYPE_CONFIG.equals(type)) {
|
||||||
|
//重新发布设备配置消息,用于设备配置下发
|
||||||
|
thingModelMessageMqProducer.publish(Constants.DEVICE_CONFIG_TOPIC, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
//重新发布设备上报记录,不包含消息内容,用于数据统计
|
||||||
//todo 存在性能问题,量大可再拆分处理
|
deviceReportProducer.publish(Constants.DEVICE_REPORT_RECORD_TOPIC, getDeviceReport(msg));
|
||||||
//设备消息日志入库
|
|
||||||
|
//设备消息入库
|
||||||
messageRepository.save(msg);
|
messageRepository.save(msg);
|
||||||
//设备上报日志入库
|
|
||||||
deviceReportRepository.save(getDeviceReport(msg));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
log.warn("save device message to es error", e);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
//不能重复消费
|
//不能重复消费
|
||||||
log.error("device message consumer error", e);
|
log.error("device message consumer error", e);
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package cc.iotkit.comps.service;
|
||||||
|
|
||||||
|
import cc.iotkit.common.Constants;
|
||||||
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
import cc.iotkit.dao.DeviceDao;
|
||||||
|
import cc.iotkit.dao.DevicePropertyRepository;
|
||||||
|
import cc.iotkit.model.device.message.DeviceProperty;
|
||||||
|
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||||
|
import cc.iotkit.mq.ConsumerHandler;
|
||||||
|
import cc.iotkit.mq.MqConsumer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备属性消息消费入库
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class PropertyPersistService implements ConsumerHandler<ThingModelMessage> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MqConsumer<ThingModelMessage> thingModelMessageMqConsumer;
|
||||||
|
@Autowired
|
||||||
|
private DeviceDao deviceDao;
|
||||||
|
@Autowired
|
||||||
|
private DevicePropertyRepository propertyRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
thingModelMessageMqConsumer.consume(Constants.DEVICE_PROPERTY_REPORT_TOPIC, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handler(ThingModelMessage msg) {
|
||||||
|
if (!(msg.getData() instanceof Map)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> properties = (Map<String, Object>) msg.getData();
|
||||||
|
String deviceId = msg.getDeviceId();
|
||||||
|
|
||||||
|
//更新设备当前属性
|
||||||
|
updateDeviceCurrentProperties(deviceId, properties);
|
||||||
|
|
||||||
|
//设备属性历史数据存储
|
||||||
|
List<DeviceProperty> batch = new ArrayList<>();
|
||||||
|
for (String key : properties.keySet()) {
|
||||||
|
batch.add(new DeviceProperty(
|
||||||
|
//防止重复id被覆盖
|
||||||
|
msg.getMid() + "_" + key,
|
||||||
|
deviceId,
|
||||||
|
key,
|
||||||
|
properties.get(key),
|
||||||
|
msg.getOccurred()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
//批量保存
|
||||||
|
try {
|
||||||
|
propertyRepository.saveAll(batch);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.warn("save property data error", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备当前属性
|
||||||
|
*/
|
||||||
|
private void updateDeviceCurrentProperties(String deviceId, Map<String, Object> properties) {
|
||||||
|
try {
|
||||||
|
log.info("update device property,deviceId:{},property:{}",
|
||||||
|
deviceId, JsonUtil.toJsonString(properties));
|
||||||
|
deviceDao.updateProperties(deviceId, properties);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error("save device current properties error", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package cc.iotkit.comps.service;
|
||||||
|
|
||||||
|
import cc.iotkit.common.Constants;
|
||||||
|
import cc.iotkit.dao.DeviceReportRepository;
|
||||||
|
import cc.iotkit.model.device.message.DeviceReport;
|
||||||
|
import cc.iotkit.mq.ConsumerHandler;
|
||||||
|
import cc.iotkit.mq.MqConsumer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备上报记录消费入库
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ReportRecordPersistService implements ConsumerHandler<DeviceReport> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MqConsumer<DeviceReport> deviceReportMqConsumer;
|
||||||
|
@Autowired
|
||||||
|
private DeviceReportRepository deviceReportRepository;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
deviceReportMqConsumer.consume(Constants.DEVICE_REPORT_RECORD_TOPIC, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handler(DeviceReport msg) {
|
||||||
|
try {
|
||||||
|
deviceReportRepository.save(msg);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.warn("save report record error", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>iot-emqx-component</artifactId>
|
<artifactId>iot-emqx-component</artifactId>
|
||||||
|
@ -82,25 +82,25 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-model</artifactId>
|
<artifactId>iot-model</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-dao</artifactId>
|
<artifactId>iot-dao</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-common</artifactId>
|
<artifactId>iot-common</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-component-base</artifactId>
|
<artifactId>iot-component-base</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>iot-http-biz-component</artifactId>
|
<artifactId>iot-http-biz-component</artifactId>
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-component-base</artifactId>
|
<artifactId>iot-component-base</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.biz;
|
package cc.iotkit.comp.biz;
|
||||||
|
|
||||||
import cc.iotkit.common.utils.JsonUtil;
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.biz;
|
package cc.iotkit.comp.biz;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>iot-mqtt-component</artifactId>
|
<artifactId>iot-mqtt-component</artifactId>
|
||||||
|
@ -80,19 +80,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-common</artifactId>
|
<artifactId>iot-common</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-component-base</artifactId>
|
<artifactId>iot-component-base</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iot-dao</artifactId>
|
<artifactId>iot-dao</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-components</artifactId>
|
<artifactId>iot-components</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.mqtt;
|
package cc.iotkit.comp.mqtt;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.mqtt;
|
package cc.iotkit.comp.mqtt;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.mqtt;
|
package cc.iotkit.comp.mqtt;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
@ -13,6 +22,7 @@ import io.vertx.core.net.PemKeyCertOptions;
|
||||||
import io.vertx.mqtt.*;
|
import io.vertx.mqtt.*;
|
||||||
import io.vertx.mqtt.messages.codes.MqttSubAckReasonCode;
|
import io.vertx.mqtt.messages.codes.MqttSubAckReasonCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -122,6 +132,10 @@ public class MqttVerticle extends AbstractVerticle {
|
||||||
String payload = message.payload().toString(Charset.defaultCharset());
|
String payload = message.payload().toString(Charset.defaultCharset());
|
||||||
log.info("Received message:{}, with QoS {}", payload,
|
log.info("Received message:{}, with QoS {}", payload,
|
||||||
message.qosLevel());
|
message.qosLevel());
|
||||||
|
if (StringUtils.isBlank(payload)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, Object> head = new HashMap<>();
|
Map<String, Object> head = new HashMap<>();
|
||||||
head.put("topic", message.topicName());
|
head.put("topic", message.topicName());
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.mqtt;
|
package cc.iotkit.comp.mqtt;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.comp.mqtt;
|
package cc.iotkit.comp.mqtt;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-data-service</artifactId>
|
<artifactId>iot-data-service</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
package cc.iotkit.dao;
|
||||||
|
|
||||||
|
import cc.iotkit.model.device.DeviceConfig;
|
||||||
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
|
|
||||||
|
public interface DeviceConfigRepository extends ElasticsearchRepository<DeviceConfig, String> {
|
||||||
|
|
||||||
|
DeviceConfig findByProductKeyAndDeviceName(String productKey, String deviceName);
|
||||||
|
|
||||||
|
DeviceConfig findByDeviceId(String deviceId);
|
||||||
|
|
||||||
|
}
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.dao;
|
package cc.iotkit.dao;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.dao.config;
|
package cc.iotkit.dao.config;
|
||||||
|
|
||||||
public interface EmbeddedEs {
|
public interface EmbeddedEs {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?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/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>iot-data-service</artifactId>
|
||||||
|
<groupId>cc.iotkit</groupId>
|
||||||
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>iot-device-dao</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.iotkit</groupId>
|
||||||
|
<artifactId>iot-model</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
package cc.iotkit.data;
|
||||||
|
|
||||||
|
import cc.iotkit.model.product.Product;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品接口
|
||||||
|
*/
|
||||||
|
public interface ProductDao {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过产品id取产品信息
|
||||||
|
*/
|
||||||
|
Product findById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加产品
|
||||||
|
*/
|
||||||
|
void add(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按id更新产品
|
||||||
|
*/
|
||||||
|
void updateById(Product product);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户id统计产品数量
|
||||||
|
*/
|
||||||
|
long countByUid(String uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户id取产品列表
|
||||||
|
*/
|
||||||
|
List<Product> findByUid(String uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按品类取产品列表
|
||||||
|
*/
|
||||||
|
List<Product> findByCategory(String category);
|
||||||
|
|
||||||
|
}
|
|
@ -5,9 +5,9 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-data-service</artifactId>
|
<artifactId>iot-data-service</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>iot-model</artifactId>
|
<artifactId>iot-model</artifactId>
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
package cc.iotkit.model.device;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Document(indexName = "device_config")
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeviceConfig {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品key
|
||||||
|
*/
|
||||||
|
private String productKey;
|
||||||
|
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置json内容
|
||||||
|
*/
|
||||||
|
private String config;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Date)
|
||||||
|
private Long createAt;
|
||||||
|
}
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.model.device;
|
package cc.iotkit.model.device;
|
||||||
|
|
||||||
import cc.iotkit.model.Owned;
|
import cc.iotkit.model.Owned;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.model.device;
|
package cc.iotkit.model.device;
|
||||||
|
|
||||||
import cc.iotkit.model.Owned;
|
import cc.iotkit.model.Owned;
|
||||||
|
|
|
@ -36,9 +36,12 @@ public class ThingModelMessage {
|
||||||
public static final String TYPE_PROPERTY = "property";
|
public static final String TYPE_PROPERTY = "property";
|
||||||
public static final String TYPE_EVENT = "event";
|
public static final String TYPE_EVENT = "event";
|
||||||
public static final String TYPE_SERVICE = "service";
|
public static final String TYPE_SERVICE = "service";
|
||||||
|
public static final String TYPE_CONFIG = "config";
|
||||||
|
|
||||||
public static final String ID_PROPERTY_GET = "get";
|
public static final String ID_PROPERTY_GET = "get";
|
||||||
public static final String ID_PROPERTY_SET = "set";
|
public static final String ID_PROPERTY_SET = "set";
|
||||||
|
public static final String ID_CONFIG_GET = "get";
|
||||||
|
public static final String ID_CONFIG_SET = "set";
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private String mid;
|
private String mid;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.model.stats;
|
package cc.iotkit.model.stats;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.model.stats;
|
package cc.iotkit.model.stats;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>iot-model</module>
|
<module>iot-model</module>
|
||||||
<module>iot-dao</module>
|
<module>iot-dao</module>
|
||||||
|
<module>iot-device-dao</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>iot-data-service</artifactId>
|
<artifactId>iot-data-service</artifactId>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.mq;
|
package cc.iotkit.mq;
|
||||||
|
|
||||||
public interface ConsumerHandler<T> {
|
public interface ConsumerHandler<T> {
|
||||||
|
|
|
@ -30,12 +30,12 @@ public class BeanCodec<T> implements MessageCodec<T, T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T transform(T o) {
|
public T transform(T o) {
|
||||||
return Json.decodeValue(JsonUtil.toJsonString(o), beanType);
|
return JsonUtil.parse(JsonUtil.toJsonString(o), beanType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
return "beanCodec";
|
return beanType.getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.mq.vertx;
|
package cc.iotkit.mq.vertx;
|
||||||
|
|
||||||
import io.vertx.core.Vertx;
|
import io.vertx.core.Vertx;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
*/
|
*/
|
||||||
package cc.iotkit.mq.vertx;
|
package cc.iotkit.mq.vertx;
|
||||||
|
|
||||||
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
import cc.iotkit.mq.ConsumerHandler;
|
import cc.iotkit.mq.ConsumerHandler;
|
||||||
import cc.iotkit.mq.MqConsumer;
|
import cc.iotkit.mq.MqConsumer;
|
||||||
import io.vertx.core.AbstractVerticle;
|
import io.vertx.core.AbstractVerticle;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class VertxMqProducer<T> implements MqProducer<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void publish(String topic, T msg) {
|
public void publish(String topic, T msg) {
|
||||||
eventBus.publish(topic, msg, new DeliveryOptions().setCodecName("beanCodec"));
|
eventBus.publish(topic, msg, new DeliveryOptions().setCodecName(cls.getSimpleName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.ruleengine.action;
|
package cc.iotkit.ruleengine.action;
|
||||||
|
|
||||||
import cc.iotkit.model.device.message.ThingModelMessage;
|
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.ruleengine.handler;
|
package cc.iotkit.ruleengine.handler;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.ruleengine.task;
|
package cc.iotkit.ruleengine.task;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.config;
|
package cc.iotkit.manager.config;
|
||||||
|
|
||||||
import redis.embedded.RedisServer;
|
import redis.embedded.RedisServer;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.config;
|
package cc.iotkit.manager.config;
|
||||||
|
|
||||||
import cn.dev33.satoken.interceptor.SaAnnotationInterceptor;
|
import cn.dev33.satoken.interceptor.SaAnnotationInterceptor;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import cc.iotkit.manager.model.query.DeviceQuery;
|
||||||
import cc.iotkit.manager.service.DataOwnerService;
|
import cc.iotkit.manager.service.DataOwnerService;
|
||||||
import cc.iotkit.manager.service.DeferredDataConsumer;
|
import cc.iotkit.manager.service.DeferredDataConsumer;
|
||||||
import cc.iotkit.manager.service.DeviceService;
|
import cc.iotkit.manager.service.DeviceService;
|
||||||
|
import cc.iotkit.model.device.DeviceConfig;
|
||||||
import cc.iotkit.model.device.DeviceGroup;
|
import cc.iotkit.model.device.DeviceGroup;
|
||||||
import cc.iotkit.utils.AuthUtil;
|
import cc.iotkit.utils.AuthUtil;
|
||||||
import cc.iotkit.model.InvokeResult;
|
import cc.iotkit.model.InvokeResult;
|
||||||
|
@ -75,6 +76,8 @@ public class DeviceController {
|
||||||
private DeviceGroupRepository deviceGroupRepository;
|
private DeviceGroupRepository deviceGroupRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceCache deviceCache;
|
private DeviceCache deviceCache;
|
||||||
|
@Autowired
|
||||||
|
private DeviceConfigRepository deviceConfigRepository;
|
||||||
|
|
||||||
@PostMapping(Constants.API_DEVICE.INVOKE_SERVICE)
|
@PostMapping(Constants.API_DEVICE.INVOKE_SERVICE)
|
||||||
public InvokeResult invokeService(@PathVariable("deviceId") String deviceId,
|
public InvokeResult invokeService(@PathVariable("deviceId") String deviceId,
|
||||||
|
@ -394,4 +397,46 @@ public class DeviceController {
|
||||||
deviceGroupRepository.save(deviceGroup);
|
deviceGroupRepository.save(deviceGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存设备配置
|
||||||
|
*/
|
||||||
|
@PostMapping("/config/{deviceId}/save")
|
||||||
|
public void saveConfig(@PathVariable("deviceId") String deviceId, String config) {
|
||||||
|
DeviceInfo deviceInfo = deviceCache.get(deviceId);
|
||||||
|
dataOwnerService.checkOwner(deviceInfo);
|
||||||
|
|
||||||
|
DeviceConfig deviceConfig = deviceConfigRepository.findByDeviceId(deviceId);
|
||||||
|
if (deviceConfig == null) {
|
||||||
|
deviceConfig = DeviceConfig.builder()
|
||||||
|
.deviceId(deviceId)
|
||||||
|
.deviceName(deviceInfo.getDeviceName())
|
||||||
|
.productKey(deviceInfo.getProductKey())
|
||||||
|
.config(config)
|
||||||
|
.createAt(System.currentTimeMillis())
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
deviceConfig.setConfig(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceConfigRepository.save(deviceConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/config/{deviceId}/get")
|
||||||
|
public DeviceConfig getConfig(@PathVariable("deviceId") String deviceId) {
|
||||||
|
DeviceInfo deviceInfo = deviceCache.get(deviceId);
|
||||||
|
dataOwnerService.checkOwner(deviceInfo);
|
||||||
|
return deviceConfigRepository.findByDeviceId(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置下发
|
||||||
|
*/
|
||||||
|
@PostMapping("/config/{deviceId}/send")
|
||||||
|
public InvokeResult sendConfig(@PathVariable("deviceId") String deviceId) {
|
||||||
|
return new InvokeResult(deviceService.sendConfig(deviceId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.controller;
|
package cc.iotkit.manager.controller;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.controller;
|
package cc.iotkit.manager.controller;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.controller;
|
package cc.iotkit.manager.controller;
|
||||||
|
|
||||||
import cc.iotkit.common.utils.JsonUtil;
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.controller;
|
package cc.iotkit.manager.controller;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.model.query;
|
package cc.iotkit.manager.model.query;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.model.stats;
|
package cc.iotkit.manager.model.stats;
|
||||||
|
|
||||||
import cc.iotkit.model.stats.DataItem;
|
import cc.iotkit.model.stats.DataItem;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.service;
|
package cc.iotkit.manager.service;
|
||||||
|
|
||||||
import cc.iotkit.common.Constants;
|
import cc.iotkit.common.Constants;
|
||||||
|
|
|
@ -11,11 +11,14 @@ package cc.iotkit.manager.service;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.NotFoundException;
|
import cc.iotkit.common.exception.NotFoundException;
|
||||||
import cc.iotkit.common.exception.OfflineException;
|
import cc.iotkit.common.exception.OfflineException;
|
||||||
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
import cc.iotkit.common.utils.UniqueIdUtil;
|
import cc.iotkit.common.utils.UniqueIdUtil;
|
||||||
import cc.iotkit.comps.DeviceComponentManager;
|
import cc.iotkit.comps.DeviceComponentManager;
|
||||||
import cc.iotkit.common.thing.ThingService;
|
import cc.iotkit.common.thing.ThingService;
|
||||||
|
import cc.iotkit.dao.DeviceConfigRepository;
|
||||||
import cc.iotkit.dao.DeviceInfoRepository;
|
import cc.iotkit.dao.DeviceInfoRepository;
|
||||||
import cc.iotkit.dao.ThingModelMessageRepository;
|
import cc.iotkit.dao.ThingModelMessageRepository;
|
||||||
|
import cc.iotkit.model.device.DeviceConfig;
|
||||||
import cc.iotkit.model.device.DeviceInfo;
|
import cc.iotkit.model.device.DeviceInfo;
|
||||||
import cc.iotkit.model.device.message.ThingModelMessage;
|
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||||
import cc.iotkit.virtualdevice.VirtualManager;
|
import cc.iotkit.virtualdevice.VirtualManager;
|
||||||
|
@ -41,79 +44,100 @@ public class DeviceService {
|
||||||
private ThingModelMessageRepository thingModelMessageRepository;
|
private ThingModelMessageRepository thingModelMessageRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VirtualManager virtualManager;
|
private VirtualManager virtualManager;
|
||||||
|
@Autowired
|
||||||
|
private DeviceConfigRepository deviceConfigRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备服务调用
|
||||||
|
*/
|
||||||
public String invokeService(String deviceId, String service,
|
public String invokeService(String deviceId, String service,
|
||||||
Map<String, Object> args) {
|
Map<String, Object> args) {
|
||||||
return invokeService(deviceId, service, args, true);
|
return invokeService(deviceId, service, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备服务调用
|
||||||
|
*/
|
||||||
public String invokeService(String deviceId, String service,
|
public String invokeService(String deviceId, String service,
|
||||||
Map<String, Object> args, boolean checkOwner) {
|
Map<String, Object> args, boolean checkOwner) {
|
||||||
DeviceInfo device = deviceInfoRepository.findById(deviceId)
|
DeviceInfo device = getAndCheckDevice(deviceId, checkOwner);
|
||||||
.orElseThrow(() -> new NotFoundException("device not found by deviceId"));
|
|
||||||
|
|
||||||
if (checkOwner) {
|
return send(deviceId, device.getProductKey(), device.getDeviceName(),
|
||||||
dataOwnerService.checkOwner(device);
|
args, ThingModelMessage.TYPE_SERVICE, service);
|
||||||
}
|
|
||||||
if (!device.getState().isOnline()) {
|
|
||||||
throw new OfflineException("device is offline");
|
|
||||||
}
|
|
||||||
|
|
||||||
ThingService<?> thingService = ThingService.builder()
|
|
||||||
.mid(UniqueIdUtil.newRequestId())
|
|
||||||
.productKey(device.getProductKey())
|
|
||||||
.deviceName(device.getDeviceName())
|
|
||||||
.type(ThingModelMessage.TYPE_SERVICE)
|
|
||||||
.identifier(service)
|
|
||||||
.params(args)
|
|
||||||
.build();
|
|
||||||
thingModelService.parseParams(thingService);
|
|
||||||
|
|
||||||
deviceComponentManager.send(thingService);
|
|
||||||
String mid = thingService.getMid();
|
|
||||||
|
|
||||||
//保存设备日志
|
|
||||||
ThingModelMessage thingModelMessage = ThingModelMessage.builder()
|
|
||||||
.mid(mid)
|
|
||||||
.deviceId(deviceId)
|
|
||||||
.productKey(device.getProductKey())
|
|
||||||
.deviceName(device.getDeviceName())
|
|
||||||
.type(ThingModelMessage.TYPE_SERVICE)
|
|
||||||
.identifier(service)
|
|
||||||
.data(args)
|
|
||||||
.occurred(System.currentTimeMillis())
|
|
||||||
.time(System.currentTimeMillis())
|
|
||||||
.build();
|
|
||||||
thingModelMessageRepository.save(thingModelMessage);
|
|
||||||
|
|
||||||
return mid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备属性设置
|
||||||
|
*/
|
||||||
public String setProperty(String deviceId, Map<String, Object> properties) {
|
public String setProperty(String deviceId, Map<String, Object> properties) {
|
||||||
return setProperty(deviceId, properties, true);
|
return setProperty(deviceId, properties, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备属性设置
|
||||||
|
*/
|
||||||
public String setProperty(String deviceId, Map<String, Object> properties,
|
public String setProperty(String deviceId, Map<String, Object> properties,
|
||||||
boolean checkOwner) {
|
boolean checkOwner) {
|
||||||
|
DeviceInfo device = getAndCheckDevice(deviceId, checkOwner);
|
||||||
|
|
||||||
|
return send(deviceId, device.getProductKey(), device.getDeviceName(), properties,
|
||||||
|
ThingModelMessage.TYPE_PROPERTY, ThingModelMessage.ID_PROPERTY_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置下发
|
||||||
|
*/
|
||||||
|
public String sendConfig(String deviceId, boolean checkOwner) {
|
||||||
|
DeviceInfo device = getAndCheckDevice(deviceId, checkOwner);
|
||||||
|
|
||||||
|
DeviceConfig config = deviceConfigRepository.findByDeviceId(deviceId);
|
||||||
|
Map data = JsonUtil.parse(config.getConfig(), Map.class);
|
||||||
|
|
||||||
|
return send(deviceId, device.getProductKey(), device.getDeviceName(), data,
|
||||||
|
ThingModelMessage.TYPE_CONFIG, ThingModelMessage.ID_CONFIG_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备配置下发
|
||||||
|
*/
|
||||||
|
public String sendConfig(String deviceId) {
|
||||||
|
return sendConfig(deviceId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查设备操作权限和状态
|
||||||
|
*/
|
||||||
|
private DeviceInfo getAndCheckDevice(String deviceId, boolean checkOwner) {
|
||||||
DeviceInfo device = deviceInfoRepository.findById(deviceId)
|
DeviceInfo device = deviceInfoRepository.findById(deviceId)
|
||||||
.orElseThrow(() -> new NotFoundException("device not found by deviceId"));
|
.orElseThrow(() -> new NotFoundException("device not found by deviceId"));
|
||||||
|
|
||||||
if (checkOwner) {
|
if (checkOwner) {
|
||||||
dataOwnerService.checkOwner(device);
|
dataOwnerService.checkOwner(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!device.getState().isOnline()) {
|
if (!device.getState().isOnline()) {
|
||||||
throw new OfflineException("device is offline");
|
throw new OfflineException("device is offline");
|
||||||
}
|
}
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据下发
|
||||||
|
*/
|
||||||
|
private String send(String deviceId, String pk, String dn,
|
||||||
|
Object data, String type, String identifier) {
|
||||||
ThingService<?> thingService = ThingService.builder()
|
ThingService<?> thingService = ThingService.builder()
|
||||||
.mid(UniqueIdUtil.newRequestId())
|
.mid(UniqueIdUtil.newRequestId())
|
||||||
.productKey(device.getProductKey())
|
.productKey(pk)
|
||||||
.deviceName(device.getDeviceName())
|
.deviceName(dn)
|
||||||
.type(ThingModelMessage.TYPE_PROPERTY)
|
.type(type)
|
||||||
.identifier("set")
|
.identifier(identifier)
|
||||||
.params(properties)
|
.params(data)
|
||||||
.build();
|
.build();
|
||||||
|
if (!type.equals(ThingModelMessage.TYPE_CONFIG)) {
|
||||||
|
//非配置下发需要做物模型转换
|
||||||
thingModelService.parseParams(thingService);
|
thingModelService.parseParams(thingService);
|
||||||
|
}
|
||||||
|
|
||||||
if (virtualManager.isVirtual(deviceId)) {
|
if (virtualManager.isVirtual(deviceId)) {
|
||||||
//虚拟设备指令下发
|
//虚拟设备指令下发
|
||||||
|
@ -128,11 +152,11 @@ public class DeviceService {
|
||||||
ThingModelMessage thingModelMessage = ThingModelMessage.builder()
|
ThingModelMessage thingModelMessage = ThingModelMessage.builder()
|
||||||
.mid(mid)
|
.mid(mid)
|
||||||
.deviceId(deviceId)
|
.deviceId(deviceId)
|
||||||
.productKey(device.getProductKey())
|
.productKey(pk)
|
||||||
.deviceName(device.getDeviceName())
|
.deviceName(dn)
|
||||||
.type(ThingModelMessage.TYPE_PROPERTY)
|
.type(type)
|
||||||
.identifier("set")
|
.identifier(identifier)
|
||||||
.data(properties)
|
.data(data)
|
||||||
.occurred(System.currentTimeMillis())
|
.occurred(System.currentTimeMillis())
|
||||||
.time(System.currentTimeMillis())
|
.time(System.currentTimeMillis())
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.manager.service;
|
package cc.iotkit.manager.service;
|
||||||
|
|
||||||
import cc.iotkit.common.utils.JsonUtil;
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
server:
|
||||||
|
port: 8086
|
||||||
|
|
||||||
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
enabled: true
|
||||||
|
max-file-size: 10MB
|
||||||
|
max-request-size: 12MB
|
||||||
|
|
||||||
|
elasticsearch:
|
||||||
|
rest:
|
||||||
|
#使用内置es的配置
|
||||||
|
uris: http://127.0.0.1:9200
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
connection-timeout: 10s
|
||||||
|
|
||||||
|
redis:
|
||||||
|
#使用内置redis的配置
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
database: 0
|
||||||
|
password:
|
||||||
|
|
||||||
|
mvc:
|
||||||
|
pathmatch:
|
||||||
|
matching-strategy: ant_path_matcher
|
||||||
|
|
||||||
|
#图片存储用的是阿里云oss,如果需要上传产品图片才需要配置
|
||||||
|
aliyun:
|
||||||
|
bucketId: iotkit-img
|
||||||
|
endpoint: oss-cn-shenzhen.aliyuncs.com
|
||||||
|
accessKeyId: 填写阿里云accessKeyId
|
||||||
|
accessKeySecret: 填写阿里云accessKeySecret
|
||||||
|
|
||||||
|
sa-token:
|
||||||
|
# token名称 (同时也是cookie名称)
|
||||||
|
token-name: token
|
||||||
|
# token有效期,单位s 默认30天, -1代表永不过期
|
||||||
|
timeout: 2592000
|
||||||
|
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||||
|
activity-timeout: -1
|
||||||
|
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||||
|
is-concurrent: true
|
||||||
|
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||||
|
is-share: false
|
||||||
|
# token风格
|
||||||
|
token-style: uuid
|
||||||
|
# 是否输出操作日志
|
||||||
|
is-log: false
|
||||||
|
|
||||||
|
#认证中心地址
|
||||||
|
oauth2:
|
||||||
|
auth-server-url: http://127.0.0.1:8086
|
||||||
|
|
||||||
|
a b: 123:4 5
|
|
@ -0,0 +1,55 @@
|
||||||
|
server:
|
||||||
|
port: 8086
|
||||||
|
|
||||||
|
spring:
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
enabled: true
|
||||||
|
max-file-size: 10MB
|
||||||
|
max-request-size: 12MB
|
||||||
|
|
||||||
|
elasticsearch:
|
||||||
|
rest:
|
||||||
|
#使用内置es的配置
|
||||||
|
uris: http://127.0.0.1:9200
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
connection-timeout: 10s
|
||||||
|
|
||||||
|
redis:
|
||||||
|
#使用内置redis的配置
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
database: 0
|
||||||
|
password:
|
||||||
|
|
||||||
|
mvc:
|
||||||
|
pathmatch:
|
||||||
|
matching-strategy: ant_path_matcher
|
||||||
|
|
||||||
|
#图片存储用的是阿里云oss,如果需要上传产品图片才需要配置
|
||||||
|
aliyun:
|
||||||
|
bucketId: iotkit-img
|
||||||
|
endpoint: oss-cn-shenzhen.aliyuncs.com
|
||||||
|
accessKeyId: 填写阿里云accessKeyId
|
||||||
|
accessKeySecret: 填写阿里云accessKeySecret
|
||||||
|
|
||||||
|
sa-token:
|
||||||
|
# token名称 (同时也是cookie名称)
|
||||||
|
token-name: token
|
||||||
|
# token有效期,单位s 默认30天, -1代表永不过期
|
||||||
|
timeout: 2592000
|
||||||
|
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||||
|
activity-timeout: -1
|
||||||
|
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||||
|
is-concurrent: true
|
||||||
|
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||||
|
is-share: false
|
||||||
|
# token风格
|
||||||
|
token-style: uuid
|
||||||
|
# 是否输出操作日志
|
||||||
|
is-log: false
|
||||||
|
|
||||||
|
#认证中心地址
|
||||||
|
oauth2:
|
||||||
|
auth-server-url: http://127.0.0.1:8086
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iot-test-tool</artifactId>
|
<artifactId>iot-test-tool</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.test.mqtt;
|
package cc.iotkit.test.mqtt;
|
||||||
|
|
||||||
import cc.iotkit.test.mqtt.config.Mqtt;
|
import cc.iotkit.test.mqtt.config.Mqtt;
|
||||||
|
@ -19,19 +28,19 @@ public class Simulator {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB", "AA:BB:CC:DD:22");
|
Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB", "AA:BB:CC:DD:22");
|
||||||
gateway.addSubDevice("Rf4QSjbm65X45753", "ABC12300002", "S01");
|
gateway.addSubDevice("Rf4QSjbm65X45753", "ABC12300002", "S01");
|
||||||
gateway.addSubDevice("Rf4QSjbm65X45753", "ABC12300003", "S01");
|
// gateway.addSubDevice("Rf4QSjbm65X45753", "ABC12300003", "S01");
|
||||||
gateway.addSubDevice("hdX3PCMcFrCYpesJ", "ABD12300001", "F01");
|
// gateway.addSubDevice("hdX3PCMcFrCYpesJ", "ABD12300001", "F01");
|
||||||
gateway.addSubDevice("hdX3PCMcFrCYpesJ", "ABD12300002", "F01");
|
// gateway.addSubDevice("hdX3PCMcFrCYpesJ", "ABD12300002", "F01");
|
||||||
gateway.addSubDevice("hdX3PCMcFrCYpesJ", "ABD12300002", "F01");
|
// gateway.addSubDevice("hdX3PCMcFrCYpesJ", "ABD12300002", "F01");
|
||||||
gateway.start();
|
gateway.start();
|
||||||
|
//
|
||||||
Gateway gateway2 = new Gateway("N523nWsCiG3CAn6X", "AA:BB:CC:EE:01");
|
// Gateway gateway2 = new Gateway("N523nWsCiG3CAn6X", "AA:BB:CC:EE:01");
|
||||||
//插座
|
// //插座
|
||||||
gateway2.addSubDevice("cGCrkK7Ex4FESAwe", "ABE12300001", "S1");
|
// gateway2.addSubDevice("cGCrkK7Ex4FESAwe", "ABE12300001", "S1");
|
||||||
gateway2.addSubDevice("cGCrkK7Ex4FESAwe", "ABE12300002", "S1");
|
// gateway2.addSubDevice("cGCrkK7Ex4FESAwe", "ABE12300002", "S1");
|
||||||
gateway2.addSubDevice("6kYp6jszrDns2yh4", "ABE12400001", "S1");
|
// gateway2.addSubDevice("6kYp6jszrDns2yh4", "ABE12400001", "S1");
|
||||||
gateway2.addSubDevice("", "ABE12500001", "M1");
|
// gateway2.addSubDevice("", "ABE12500001", "M1");
|
||||||
gateway2.start();
|
// gateway2.start();
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
System.in.read();
|
System.in.read();
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.test.mqtt.model;
|
package cc.iotkit.test.mqtt.model;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.test.mqtt.model;
|
package cc.iotkit.test.mqtt.model;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ConnectionTest {
|
||||||
Mqtt.brokerHost = args[0];
|
Mqtt.brokerHost = args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int total = 1000;
|
int total = 500;
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
total = Integer.parseInt(args[1]);
|
total = Integer.parseInt(args[1]);
|
||||||
}
|
}
|
||||||
|
@ -46,17 +46,17 @@ public class ConnectionTest {
|
||||||
Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB",
|
Gateway gateway = new Gateway("hbtgIA0SuVw9lxjB",
|
||||||
"TEST:GW:" + StringUtils.leftPad(finalI + "", 6, "0"));
|
"TEST:GW:" + StringUtils.leftPad(finalI + "", 6, "0"));
|
||||||
|
|
||||||
gateway.addSubDevice("Rf4QSjbm65X45753",
|
// gateway.addSubDevice("Rf4QSjbm65X45753",
|
||||||
"TEST_SW_" + StringUtils.leftPad(finalI + "", 6, "0"),
|
// "TEST_SW_" + StringUtils.leftPad(finalI + "", 6, "0"),
|
||||||
"S01");
|
// "S01");
|
||||||
|
//
|
||||||
gateway.addSubDevice("cGCrkK7Ex4FESAwe",
|
// gateway.addSubDevice("cGCrkK7Ex4FESAwe",
|
||||||
"TEST_SC_" + StringUtils.leftPad(finalI + "", 6, "0"),
|
// "TEST_SC_" + StringUtils.leftPad(finalI + "", 6, "0"),
|
||||||
"S01");
|
// "S01");
|
||||||
|
//
|
||||||
gateway.addSubDevice("xpsYHExTKPFaQMS7",
|
// gateway.addSubDevice("xpsYHExTKPFaQMS7",
|
||||||
"TEST_LT_" + StringUtils.leftPad(finalI + "", 6, "0"),
|
// "TEST_LT_" + StringUtils.leftPad(finalI + "", 6, "0"),
|
||||||
"L01");
|
// "L01");
|
||||||
|
|
||||||
gateway.start();
|
gateway.start();
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ReportTest {
|
||||||
Mqtt.brokerHost = args[0];
|
Mqtt.brokerHost = args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
int total = 1000;
|
int total = 500;
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
total = Integer.parseInt(args[1]);
|
total = Integer.parseInt(args[1]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,14 @@ public class Gateway extends Device {
|
||||||
log.info("subscribe topic:{}", topic);
|
log.info("subscribe topic:{}", topic);
|
||||||
|
|
||||||
client.subscribe(topic, 1, r -> {
|
client.subscribe(topic, 1, r -> {
|
||||||
|
//配置获取
|
||||||
|
// String configGetTopic = String.format("/sys/%s/%s/s/config/get", productKey, deviceName);
|
||||||
|
// Request configRequest = new Request();
|
||||||
|
// configRequest.setId(UUID.randomUUID().toString());
|
||||||
|
// String configPayload = JsonUtil.toJsonString(configRequest);
|
||||||
|
// client.publish(configGetTopic, Buffer.buffer(configPayload), MqttQoS.AT_LEAST_ONCE, false, false);
|
||||||
|
// log.info("publish message,topic:{},payload:{}", configGetTopic, configPayload);
|
||||||
|
|
||||||
//注册子设备
|
//注册子设备
|
||||||
for (Device subDevice : subDevices) {
|
for (Device subDevice : subDevices) {
|
||||||
log.info("start register sub device,pk:{},dn:{}", subDevice.getProductKey(), subDevice.getDeviceName());
|
log.info("start register sub device,pk:{},dn:{}", subDevice.getProductKey(), subDevice.getDeviceName());
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.test.mqtt.service;
|
package cc.iotkit.test.mqtt.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.test.mqtt.service;
|
package cc.iotkit.test.mqtt.service;
|
||||||
|
|
||||||
import cc.iotkit.common.utils.JsonUtil;
|
import cc.iotkit.common.utils.JsonUtil;
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
/*
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
* | Author: xw2sy@163.com
|
||||||
|
* +----------------------------------------------------------------------
|
||||||
|
*/
|
||||||
package cc.iotkit.test.mqtt.service;
|
package cc.iotkit.test.mqtt.service;
|
||||||
|
|
||||||
import io.vertx.core.Vertx;
|
import io.vertx.core.Vertx;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ public class VirtualManager {
|
||||||
//更新deviceId的虚拟设备Id对应关系
|
//更新deviceId的虚拟设备Id对应关系
|
||||||
Set<String> virtualIds = deviceIdToVirtualId.getOrDefault(deviceId, new HashSet<>());
|
Set<String> virtualIds = deviceIdToVirtualId.getOrDefault(deviceId, new HashSet<>());
|
||||||
virtualIds.add(id);
|
virtualIds.add(id);
|
||||||
|
//一个真实设备可能会被多个虚拟设备使用
|
||||||
deviceIdToVirtualId.put(deviceId, virtualIds);
|
deviceIdToVirtualId.put(deviceId, virtualIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,9 +212,14 @@ public class VirtualManager {
|
||||||
virtualScripts.remove(id);
|
virtualScripts.remove(id);
|
||||||
|
|
||||||
//更新deviceId的虚拟设备Id对应关系
|
//更新deviceId的虚拟设备Id对应关系
|
||||||
for (String deviceId : deviceIdToVirtualId.keySet()) {
|
Iterator<String> keyIterator = deviceIdToVirtualId.keySet().iterator();
|
||||||
|
while (keyIterator.hasNext()) {
|
||||||
|
String deviceId = keyIterator.next();
|
||||||
Set<String> virtualIds = deviceIdToVirtualId.get(deviceId);
|
Set<String> virtualIds = deviceIdToVirtualId.get(deviceId);
|
||||||
virtualIds.remove(id);
|
virtualIds.remove(id);
|
||||||
|
if (virtualIds.size() == 0) {
|
||||||
|
keyIterator.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除job
|
//删除job
|
||||||
|
|
8
pom.xml
8
pom.xml
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<groupId>cc.iotkit</groupId>
|
<groupId>cc.iotkit</groupId>
|
||||||
<artifactId>iotkit-parent</artifactId>
|
<artifactId>iotkit-parent</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<name>iotkit-parent</name>
|
<name>iotkit-parent</name>
|
||||||
<description>iotkit parent</description>
|
<description>iotkit parent</description>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -292,6 +292,12 @@
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cc.iotkit</groupId>
|
||||||
|
<artifactId>iot-device-dao</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue