|
@@ -104,73 +104,79 @@ public class MonitorDatasynch {
|
|
|
return response;
|
|
return response;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static PsMonitorSz setPsMonitorSz(Map map, String[] dataArr, Map keyMap, String resultStr, PsMonitorSz monitordata) {
|
|
|
|
|
- Pattern pattern = Pattern.compile("^[aw]{1}[0-9]{1,5}$");
|
|
|
|
|
- fieldMap.keySet().forEach(item -> {
|
|
|
|
|
- String aa = item;
|
|
|
|
|
- if (pattern.matcher(item).matches()) {
|
|
|
|
|
- aa = item + resultStr;
|
|
|
|
|
- } else {
|
|
|
|
|
- aa = item;
|
|
|
|
|
|
|
+ public static List<PsMonitorSz> setPsMonitorSz(String oldDataStr,String[] dataArr,String ipPort) {
|
|
|
|
|
+ ArrayList<String> arrayList = new ArrayList<>();
|
|
|
|
|
+ List<PsMonitorSz> psMonitorSzList = new ArrayList<>();
|
|
|
|
|
+ for (String param : dataArr) {
|
|
|
|
|
+ System.out.println("param = " + param);
|
|
|
|
|
+ String String = "&&";
|
|
|
|
|
+ boolean contains = param.contains(String);
|
|
|
|
|
+ if (contains) {
|
|
|
|
|
+ param = param.replace(String, ",");
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- keyMap.put(aa, fieldMap.get(item));
|
|
|
|
|
- });
|
|
|
|
|
- for (String str : dataArr) {
|
|
|
|
|
- // 判断对应值是有包含&&符号,如有就替换为空字符
|
|
|
|
|
- if (str.contains("&&")) {
|
|
|
|
|
- str = str.replace("&&", "");
|
|
|
|
|
|
|
+ if (param.contains(",")) {
|
|
|
|
|
+ arrayList.add(param);
|
|
|
}
|
|
}
|
|
|
- List<String> dtList = new ArrayList<>();
|
|
|
|
|
- if (str.contains(",")) {
|
|
|
|
|
- // 通过,符号截取同项目不同数据值的数据。
|
|
|
|
|
- String[] split = str.split(",");
|
|
|
|
|
- dtList = Arrays.asList(split);
|
|
|
|
|
- } else {
|
|
|
|
|
- dtList.add(str);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ ArrayList<String> objects = new ArrayList<>();
|
|
|
|
|
+ for (String entity : arrayList) {
|
|
|
|
|
+ String substring = null;
|
|
|
|
|
+ if (entity.contains("-")) {
|
|
|
|
|
+ substring = entity.substring(0, entity.indexOf("-"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isBlank(substring)) {
|
|
|
|
|
+ continue;
|
|
|
}
|
|
}
|
|
|
- for (String item : dtList) {
|
|
|
|
|
- if (item.contains("=")) {
|
|
|
|
|
- int index = item.indexOf("=");
|
|
|
|
|
- int lastIndex = item.lastIndexOf("=");
|
|
|
|
|
- // 判断是否有多个数据值
|
|
|
|
|
- if (index == lastIndex) {
|
|
|
|
|
- // 判断=符号,是否是最后一个字符
|
|
|
|
|
- if (index + 1 != item.length()) {
|
|
|
|
|
- String key = item.substring(0, index);// 011-Rtd
|
|
|
|
|
- String val = item.substring(index + 1); // 35.570
|
|
|
|
|
- // 替换字段键
|
|
|
|
|
- if (keyMap.containsKey(key)) {
|
|
|
|
|
- if ("DataTime".equals(key)) {
|
|
|
|
|
- map.put(keyMap.get(key), DateTimeUtil.parseDateTime(val));
|
|
|
|
|
- } else {
|
|
|
|
|
- map.put(keyMap.get(key), val);
|
|
|
|
|
|
|
+ if (entity.startsWith(substring)) {
|
|
|
|
|
+ objects.add(substring);
|
|
|
|
|
+ String[] split = entity.split(",");
|
|
|
|
|
+
|
|
|
|
|
+ PsMonitorSz psMonitorSz = new PsMonitorSz();
|
|
|
|
|
+ psMonitorSz.setRemark(oldDataStr);
|
|
|
|
|
+ for (String parameters : split) {
|
|
|
|
|
+
|
|
|
|
|
+ String[] split1 = parameters.split("=");
|
|
|
|
|
+ psMonitorSz.setCode(substring);
|
|
|
|
|
+ if (parameters.startsWith(substring + "-Rtd=")) {
|
|
|
|
|
+ psMonitorSz.setRealTime(new BigDecimal(split1[1]));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (parameters.startsWith(substring + "-Flag=")) {
|
|
|
|
|
+ psMonitorSz.setFlag(split1[1]);
|
|
|
|
|
+ }
|
|
|
|
|
+ psMonitorSz.setRecordTime(LocalDateTime.now());
|
|
|
|
|
+ psMonitorSz.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
|
+ for (String comParams : dataArr) {
|
|
|
|
|
+ if (comParams.contains("&&") && !comParams.contains(",")) {
|
|
|
|
|
+ String replace = comParams.replace("&&", ",");
|
|
|
|
|
+ String[] split2 = replace.split(",");
|
|
|
|
|
+ if (split2.length>1) {
|
|
|
|
|
+ String dateString = split2[1];
|
|
|
|
|
+ if (dateString.startsWith("DataTime=")) {
|
|
|
|
|
+ psMonitorSz.setSampleTime(DateTimeUtil.parseDateTime(dateString.split("=")[1]));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- // 判断=符号,是否是最后一个字符
|
|
|
|
|
- if (lastIndex + 1 != item.length()) {
|
|
|
|
|
- String key = item.substring(index + 1, lastIndex);
|
|
|
|
|
- String val = item.substring(lastIndex + 1);
|
|
|
|
|
- // 替换字段键
|
|
|
|
|
- if (keyMap.containsKey(key)) {
|
|
|
|
|
- if ("DataTime".equals(key)) {
|
|
|
|
|
- map.put(keyMap.get(key), DateTimeUtil.parseDateTime(val));
|
|
|
|
|
- } else {
|
|
|
|
|
- map.put(keyMap.get(key), val);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String[] comsplit1 = comParams.split("=");
|
|
|
|
|
+ String paraname = comsplit1[0];
|
|
|
|
|
+ String value = comsplit1[1];
|
|
|
|
|
+ if (paraname.equals("MN")) {
|
|
|
|
|
+ psMonitorSz.setMn(value);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (paraname.equals("Flag")) {
|
|
|
|
|
+ psMonitorSz.setFlag(value);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ psMonitorSz.setIpport(ipPort);
|
|
|
|
|
+ psMonitorSzList.add(psMonitorSz);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return monitordata;
|
|
|
|
|
|
|
+ return psMonitorSzList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static List<MinuteDataInfo> minuteDataInfoData(String oldDataStr,String[] dataArr) {
|
|
public static List<MinuteDataInfo> minuteDataInfoData(String oldDataStr,String[] dataArr) {
|
|
|
- Pattern pattern = Pattern.compile("^[aw]{1}[0-9]{1,5}$");
|
|
|
|
|
ArrayList<String> arrayList = new ArrayList<>();
|
|
ArrayList<String> arrayList = new ArrayList<>();
|
|
|
List<MinuteDataInfo> minuteDataInfolist = new ArrayList<>();
|
|
List<MinuteDataInfo> minuteDataInfolist = new ArrayList<>();
|
|
|
for (String param : dataArr) {
|
|
for (String param : dataArr) {
|