|
@@ -2,6 +2,8 @@ package com.zhonglai.luhui.mqtt.service.topic; |
|
@@ -2,6 +2,8 @@ package com.zhonglai.luhui.mqtt.service.topic; |
|
2
|
|
2
|
|
|
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
|
4
|
import com.alibaba.fastjson.JSONObject;
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
5
|
+import com.zhonglai.luhui.device.analysis.comm.service.BusinessDataUpdateService;
|
|
|
|
6
|
+import com.zhonglai.luhui.device.analysis.dto.topic.AddPostDto;
|
|
5
|
import com.zhonglai.luhui.device.domain.IotThingsModel;
|
7
|
import com.zhonglai.luhui.device.domain.IotThingsModel;
|
|
6
|
import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto;
|
8
|
import com.zhonglai.luhui.device.analysis.comm.dto.ServerDto;
|
|
7
|
import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto;
|
9
|
import com.zhonglai.luhui.device.analysis.comm.dto.business.BusinessDto;
|
|
@@ -17,6 +19,7 @@ import org.apache.commons.lang3.EnumUtils; |
|
@@ -17,6 +19,7 @@ import org.apache.commons.lang3.EnumUtils; |
|
17
|
import org.springframework.beans.factory.annotation.Autowired;
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
18
|
import org.springframework.stereotype.Service;
|
20
|
import org.springframework.stereotype.Service;
|
|
19
|
|
21
|
|
|
|
|
22
|
+import java.util.ArrayList;
|
|
20
|
import java.util.HashMap;
|
23
|
import java.util.HashMap;
|
|
21
|
|
24
|
|
|
22
|
@Service("READ_REQ")
|
25
|
@Service("READ_REQ")
|
|
@@ -26,12 +29,20 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { |
|
@@ -26,12 +29,20 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { |
|
26
|
@Autowired
|
29
|
@Autowired
|
|
27
|
private TerminalDataThingsModeService terminalDataThingsModeService;
|
30
|
private TerminalDataThingsModeService terminalDataThingsModeService;
|
|
28
|
|
31
|
|
|
|
|
32
|
+ @Autowired
|
|
|
|
33
|
+ private BusinessDataUpdateService businessDataUpdateService;
|
|
|
|
34
|
+
|
|
29
|
@Override
|
35
|
@Override
|
|
30
|
public ServerDto analysis(Topic topic, ReadReqDto data) {
|
36
|
public ServerDto analysis(Topic topic, ReadReqDto data) {
|
|
31
|
if(1==data.getCode())
|
37
|
if(1==data.getCode())
|
|
32
|
{
|
38
|
{
|
|
33
|
JSONObject vjsonObject = data.getData().clone();
|
39
|
JSONObject vjsonObject = data.getData().clone();
|
|
34
|
-// businessDataUpdateService.updataDta(BusinessDataUpdateService.Type.ADD,topic,true,data);
|
40
|
+ AddPostDto serverDto = new AddPostDto();
|
|
|
|
41
|
+ serverDto.setData(data.getData());
|
|
|
|
42
|
+ serverDto.setIotTerminalList(new ArrayList<>());
|
|
|
|
43
|
+ serverDto.setDeviceSensorDataList(new ArrayList<>());
|
|
|
|
44
|
+ serverDto.setLogDeviceOperationList(new ArrayList<>());
|
|
|
|
45
|
+ businessDataUpdateService.updataDta(BusinessDataUpdateService.Type.ADD,topic,serverDto,"远程控制",false);
|
|
35
|
|
46
|
|
|
36
|
if(null != vjsonObject && vjsonObject.size() !=0 )
|
47
|
if(null != vjsonObject && vjsonObject.size() !=0 )
|
|
37
|
{
|
48
|
{
|
|
@@ -79,7 +90,7 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { |
|
@@ -79,7 +90,7 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { |
|
79
|
message.setCode(MessageCode.DEFAULT_SUCCESS_CODE);
|
90
|
message.setCode(MessageCode.DEFAULT_SUCCESS_CODE);
|
|
80
|
message.setMessage("成功");
|
91
|
message.setMessage("成功");
|
|
81
|
});
|
92
|
});
|
|
82
|
- return data;
|
93
|
+ return serverDto;
|
|
83
|
}else if(0==data.getCode())
|
94
|
}else if(0==data.getCode())
|
|
84
|
{
|
95
|
{
|
|
85
|
clienNoticeService.replySendMessage(topic, message -> {
|
96
|
clienNoticeService.replySendMessage(topic, message -> {
|
|
@@ -90,9 +101,9 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { |
|
@@ -90,9 +101,9 @@ public class ReadReqTopic implements BusinessAgreement<ReadReqDto> { |
|
90
|
message.setCode(MessageCode.DEFAULT_FAIL_CODE);
|
101
|
message.setCode(MessageCode.DEFAULT_FAIL_CODE);
|
|
91
|
message.setMessage("失败");
|
102
|
message.setMessage("失败");
|
|
92
|
});
|
103
|
});
|
|
93
|
- return data;
|
104
|
+ return null;
|
|
94
|
}
|
105
|
}
|
|
95
|
- return data;
|
106
|
+ return null;
|
|
96
|
}
|
107
|
}
|
|
97
|
|
108
|
|
|
98
|
@Override
|
109
|
@Override
|