|
@@ -1,6 +1,7 @@
|
|
|
package com.example.opc_da.util;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.example.opc_common.entity.*;
|
|
|
import com.example.opc_common.enums.ResultEnum;
|
|
@@ -552,29 +553,34 @@ public class OpcDaUtil {
|
|
|
List<Map<String, String>> mapList = new ArrayList<>();
|
|
|
|
|
|
Iterator iter = branch.getBranches().iterator();
|
|
|
- while (iter.hasNext()) {
|
|
|
- Branch subBranch = (Branch) iter.next();
|
|
|
- String name = subBranch.getName();
|
|
|
- if (name.contains(nextItemStr)) {
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
- map.put("children", branch.getName() + "." + name + "." + needItemStr);
|
|
|
- map.put("current", name);
|
|
|
- mapList.add(map);
|
|
|
- }
|
|
|
- }
|
|
|
- if (Blank.isNotEmpty(mapList)) {
|
|
|
- Map<String, String> map0 = mapList.get(0);
|
|
|
- map0 = getFirstNodeDetails(treeBrowser, new Branch(branch, map0.get("current")), needItemStr, map0);
|
|
|
- if (Blank.isNotEmpty(map0)) {
|
|
|
- mapList.set(0, map0);
|
|
|
- } else {
|
|
|
- mapList = new ArrayList<>();
|
|
|
+ JSONArray objects = JSONObject.parseArray(needItemStr);
|
|
|
+ for (Object obj : objects) {
|
|
|
+ String itemstr = obj.toString();
|
|
|
+ while (iter.hasNext()) {
|
|
|
+ Branch subBranch = (Branch) iter.next();
|
|
|
+ String name = subBranch.getName();
|
|
|
+ if (name.contains(nextItemStr)) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("children", branch.getName() + "." + name + "." + itemstr);
|
|
|
+ map.put("current", name);
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
}
|
|
|
- String prefix = map0.get("prefix");
|
|
|
- //根据区别映射出其他所有数据项的叶节点
|
|
|
- for (int i = 1; i < mapList.size(); i++) {
|
|
|
- Map<String, String> map = mapList.get(i);
|
|
|
- map.put("itemReadName", prefix + "." + map.get("current") + "." + needItemStr);
|
|
|
+
|
|
|
+ if (Blank.isNotEmpty(mapList)) {
|
|
|
+ Map<String, String> map0 = mapList.get(0);
|
|
|
+ map0 = getFirstNodeDetails(treeBrowser, new Branch(branch, map0.get("current")), itemstr, map0);
|
|
|
+ if (Blank.isNotEmpty(map0)) {
|
|
|
+ mapList.set(0, map0);
|
|
|
+ } else {
|
|
|
+ mapList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ String prefix = map0.get("prefix");
|
|
|
+ //根据区别映射出其他所有数据项的叶节点
|
|
|
+ for (int i = 1; i < mapList.size(); i++) {
|
|
|
+ Map<String, String> map = mapList.get(i);
|
|
|
+ map.put("itemReadName", prefix + "." + map.get("current") + "." + itemstr);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return mapList;
|