|
@@ -71,30 +71,62 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
@@ -71,30 +71,62 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
71
|
{
|
71
|
{
|
|
72
|
if(deviceDataConfigMap.containsKey(key))
|
72
|
if(deviceDataConfigMap.containsKey(key))
|
|
73
|
{
|
73
|
{
|
|
|
|
74
|
+ log.info("点位{}",key);
|
|
74
|
String dttribute_value = object.get(key).toString();
|
75
|
String dttribute_value = object.get(key).toString();
|
|
75
|
String newDataValue= ByteUtil.changerTwoStr(dttribute_value);
|
76
|
String newDataValue= ByteUtil.changerTwoStr(dttribute_value);
|
|
76
|
|
77
|
|
|
77
|
DeviceDataConfig deviceDataConfig = deviceDataConfigMap.get(key);
|
78
|
DeviceDataConfig deviceDataConfig = deviceDataConfigMap.get(key);
|
|
78
|
- String newAlrmCode = "00";
|
|
|
|
79
|
String deviceInfoId = deviceDataConfig.getDeviceInfoId(topic.getClientid()); //根据点位协议解析到设备id
|
79
|
String deviceInfoId = deviceDataConfig.getDeviceInfoId(topic.getClientid()); //根据点位协议解析到设备id
|
|
|
|
80
|
+ log.info("点位对应的设备id{}",deviceInfoId);
|
|
|
|
81
|
+ if(deviceInfoId.equals(topic.getClientid()))
|
|
|
|
82
|
+ {
|
|
|
|
83
|
+ if(null != list )
|
|
|
|
84
|
+ {
|
|
|
|
85
|
+ for (DeviceInfo deviceInfo:list)
|
|
|
|
86
|
+ {
|
|
|
|
87
|
+ updevice(deviceInfo,deviceDataConfig,topic,data,newDataValue);
|
|
|
|
88
|
+ }
|
|
|
|
89
|
+ }
|
|
|
|
90
|
+ }else {
|
|
80
|
DeviceInfo deviceInfo = getDeviceInfo(deviceInfoList,deviceInfoId);
|
91
|
DeviceInfo deviceInfo = getDeviceInfo(deviceInfoList,deviceInfoId);
|
|
|
|
92
|
+ updevice(deviceInfo,deviceDataConfig,topic,data,newDataValue);
|
|
|
|
93
|
+ }
|
|
|
|
94
|
+
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+
|
|
|
|
97
|
+ }
|
|
|
|
98
|
+
|
|
|
|
99
|
+ }
|
|
|
|
100
|
+ }
|
|
|
|
101
|
+ return data;
|
|
|
|
102
|
+ }
|
|
|
|
103
|
+
|
|
|
|
104
|
+
|
|
|
|
105
|
+ private void updevice(DeviceInfo deviceInfo, DeviceDataConfig deviceDataConfig,Topic topic,AllPostDto data,String newDataValue)
|
|
|
|
106
|
+ {
|
|
81
|
if(null != deviceInfo)
|
107
|
if(null != deviceInfo)
|
|
82
|
{
|
108
|
{
|
|
|
|
109
|
+ String newAlrmCode = "00";
|
|
|
|
110
|
+
|
|
83
|
switch (PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()))
|
111
|
switch (PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()))
|
|
84
|
{
|
112
|
{
|
|
85
|
case 故障代码:
|
113
|
case 故障代码:
|
|
|
|
114
|
+ log.info("故障代码{}",newDataValue);
|
|
86
|
if(newDataValue.equals(deviceDataConfig.getAlarmValue()))
|
115
|
if(newDataValue.equals(deviceDataConfig.getAlarmValue()))
|
|
87
|
{
|
116
|
{
|
|
88
|
newAlrmCode = deviceDataConfig.getAlarmCode();
|
117
|
newAlrmCode = deviceDataConfig.getAlarmCode();
|
|
89
|
}
|
118
|
}
|
|
90
|
break;
|
119
|
break;
|
|
91
|
case 控制柜状态:
|
120
|
case 控制柜状态:
|
|
|
|
121
|
+ log.info("控制柜状态{}",newDataValue);
|
|
92
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
122
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
|
93
|
break;
|
123
|
break;
|
|
94
|
case 校准时间:
|
124
|
case 校准时间:
|
|
|
|
125
|
+ log.info("校准时间{}",newDataValue);
|
|
95
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
126
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
|
96
|
break;
|
127
|
break;
|
|
97
|
default:
|
128
|
default:
|
|
|
|
129
|
+ log.info("默认功能{}",newDataValue);
|
|
98
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
130
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
|
99
|
break;
|
131
|
break;
|
|
100
|
}
|
132
|
}
|
|
@@ -104,14 +136,6 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
@@ -104,14 +136,6 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
104
|
deviceInfo.setOnline("01");
|
136
|
deviceInfo.setOnline("01");
|
|
105
|
}
|
137
|
}
|
|
106
|
}
|
138
|
}
|
|
107
|
-
|
|
|
|
108
|
- }
|
|
|
|
109
|
-
|
|
|
|
110
|
- }
|
|
|
|
111
|
- }
|
|
|
|
112
|
- return data;
|
|
|
|
113
|
- }
|
|
|
|
114
|
-
|
|
|
|
115
|
private void analysisTime( JSONObject jsonObject,Map<String, DeviceDataConfig> deviceDataConfigMap,Topic topic,List<DeviceInfo> deviceInfoList)
|
139
|
private void analysisTime( JSONObject jsonObject,Map<String, DeviceDataConfig> deviceDataConfigMap,Topic topic,List<DeviceInfo> deviceInfoList)
|
|
116
|
{
|
140
|
{
|
|
117
|
if(null != jsonObject && jsonObject.size() != 0)
|
141
|
if(null != jsonObject && jsonObject.size() != 0)
|
|
@@ -227,6 +251,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
@@ -227,6 +251,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
227
|
jsonObject = GsonConstructor.get().fromJson(dataValue,JSONObject.class);
|
251
|
jsonObject = GsonConstructor.get().fromJson(dataValue,JSONObject.class);
|
|
228
|
}
|
252
|
}
|
|
229
|
String odlDataValue = (String) jsonObject.get(PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()).sensorDataType);
|
253
|
String odlDataValue = (String) jsonObject.get(PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()).sensorDataType);
|
|
|
|
254
|
+ log.info("数据变化"+deviceDataConfig.getAttribute_name()+" "+odlDataValue+"-->"+newDataValue);
|
|
230
|
if(!newDataValue.equals(odlDataValue))
|
255
|
if(!newDataValue.equals(odlDataValue))
|
|
231
|
{
|
256
|
{
|
|
232
|
jsonObject.put(PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()).sensorDataType,newDataValue); //更新数据
|
257
|
jsonObject.put(PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()).sensorDataType,newDataValue); //更新数据
|