|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.cn.esermis.utils;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson2.JSONObject;
|
|
4
|
+import com.cn.esermis.constant.Constant;
|
4
|
5
|
import lombok.extern.slf4j.Slf4j;
|
5
|
6
|
|
6
|
7
|
import java.util.LinkedList;
|
|
@@ -66,7 +67,9 @@ public class HJ212MsgUtils {
|
66
|
67
|
.replace(",", "\",\"").replace(";", "\",\"");
|
67
|
68
|
data.put("SIZE", headStr.substring(0, 4));
|
68
|
69
|
data.putAll(JSONObject.parseObject("{\"" + headStr.substring(4) + "\"}"));
|
69
|
|
-
|
|
70
|
+ if (!Constant.COMMAND.contains(data.getString("CN"))){
|
|
71
|
+ return data;
|
|
72
|
+ }
|
70
|
73
|
// 清洗数据体基本数据
|
71
|
74
|
String[] monitors = subMsg[1].split(";");
|
72
|
75
|
List<JSONObject> cp = new LinkedList<>();
|
|
@@ -100,13 +103,23 @@ public class HJ212MsgUtils {
|
100
|
103
|
* 解析污染源数据,获取污染源编号
|
101
|
104
|
*/
|
102
|
105
|
private static String[] getPollutionSource(String data) {
|
103
|
|
- String key = data.substring(0, data.indexOf("-"));
|
104
|
|
- data = data.replaceAll(key + "-", "");
|
|
106
|
+ if (data.contains("-")){
|
|
107
|
+ String key = data.substring(0, data.indexOf("-"));
|
|
108
|
+ data = data.replaceAll(key + "-", "");
|
|
109
|
+
|
|
110
|
+ String[] result = new String[2];
|
|
111
|
+ result[0] = key;
|
|
112
|
+ result[1] = data;
|
|
113
|
+ return result;
|
|
114
|
+ }else {
|
|
115
|
+ if (data.contains(":")){
|
|
116
|
+ String[] split = data.split(":");
|
|
117
|
+ return split;
|
|
118
|
+ }
|
|
119
|
+
|
|
120
|
+ return new String[]{data};
|
|
121
|
+ }
|
105
|
122
|
|
106
|
|
- String[] result = new String[2];
|
107
|
|
- result[0] = key;
|
108
|
|
- result[1] = data;
|
109
|
|
- return result;
|
110
|
123
|
}
|
111
|
124
|
|
112
|
125
|
|