|
@@ -37,10 +37,14 @@ public class Add implements MqttStrategy {
|
|
|
private DmpDeviceStatusService dmpDeviceStatusService;
|
|
|
|
|
|
public String disposeMessage(MqttBaseVO mqttBaseVO){
|
|
|
+ String[] topics = mqttBaseVO.getTopic().toString().split(",");
|
|
|
+ String topic_deviceUUID = topics[3];
|
|
|
String deviceInfoStr = mqttBaseVO.getData().toString();
|
|
|
JSONObject deviceInfoJson = JSONObject.parseObject(deviceInfoStr);
|
|
|
String productCode = deviceInfoJson.get("productCode").toString();
|
|
|
String deviceId = deviceInfoJson.get("deviceId").toString();
|
|
|
+ String deviceUUID = deviceInfoJson.get("deviceUUID").toString();
|
|
|
+ Integer categoryType = Integer.valueOf(deviceInfoJson.get("categoryType").toString());
|
|
|
|
|
|
//判断上报数据对应产品是否注册,如未注册则为非法
|
|
|
Map<String, ProductMapVO> productMapList = dmpProductService.getProductMap();
|
|
@@ -72,7 +76,11 @@ public class Add implements MqttStrategy {
|
|
|
dmpDeviceInfo.setCreatedTime(LocalDateTime.now());
|
|
|
dmpDeviceInfo.setTenantId(productMapVO.getTenantId());
|
|
|
dmpDeviceInfo.setServiceStatus(1);
|
|
|
- dmpDeviceInfo.setDeviceUuid(UUIDUtils.uuid());
|
|
|
+ dmpDeviceInfo.setDeviceUuid(deviceUUID);
|
|
|
+ dmpDeviceInfo.setCategoryType(categoryType);
|
|
|
+ if(categoryType == 3){
|
|
|
+ dmpDeviceInfo.setGatewayUuid(topic_deviceUUID);
|
|
|
+ }
|
|
|
dmpDeviceService.save(dmpDeviceInfo);
|
|
|
|
|
|
DmpDeviceStatus dmpDeviceStatus = new DmpDeviceStatus();
|
|
@@ -103,7 +111,11 @@ public class Add implements MqttStrategy {
|
|
|
dmpDeviceInfo.setCreatedTime(LocalDateTime.now());
|
|
|
dmpDeviceInfo.setTenantId(productMapVO.getTenantId());
|
|
|
dmpDeviceInfo.setServiceStatus(1);
|
|
|
- dmpDeviceInfo.setDeviceUuid(UUIDUtils.uuid());
|
|
|
+ dmpDeviceInfo.setDeviceUuid(deviceUUID);
|
|
|
+ dmpDeviceInfo.setCategoryType(categoryType);
|
|
|
+ if(categoryType == 3){
|
|
|
+ dmpDeviceInfo.setGatewayUuid(topic_deviceUUID);
|
|
|
+ }
|
|
|
dmpDeviceService.save(dmpDeviceInfo);
|
|
|
|
|
|
DmpDeviceStatus dmpDeviceStatus = new DmpDeviceStatus();
|