Browse Source

回路增加上级名称属性

menglu 3 years ago
parent
commit
092a07c43c

+ 23 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java

@@ -432,7 +432,7 @@ public class RWDLoadUtil {
 				continue;
 			}
 			String objType = Repository.code2objTypeMap.get(classCode);
-			if (!objType.equals("equipment") && !objType.equals("system")) {
+			if (!objType.equals("equipment") && !objType.equals("system") && !objType.equals("space")) {
 				continue;
 			}
 			SceneDataSet objectArray = Repository.objectArrayDic.get(classCode);
@@ -496,6 +496,28 @@ public class RWDLoadUtil {
 				}
 			}
 			Repository.IBMSArrayDic.put(product, infoArrayDic);
+
+			if (product.equals("NightscapeLighting") || product.equals("PublicLighting")) {
+				if (!Repository.IBMSArrayDic.containsKey(product)) {
+					continue;
+				}
+				Map<String, SceneDataSet> arrayDic = Repository.IBMSArrayDic.get(product);
+				if (!arrayDic.containsKey("回路")) {
+					continue;
+				}
+				SceneDataSet huilu = arrayDic.get("回路");
+				for (SceneDataObject sdo : huilu.set) {
+					String id = (String) sdo.get("回路编号").value_prim.value;
+					if (Repository.id2sdv.containsKey(id)) {
+						SceneDataObject equipment = Repository.id2sdv.get(id);
+						equipment.put("模块名称", sdo.get("模块名称"));
+						equipment.put("配电箱名称", sdo.get("配电箱名称"));
+						equipment.put("电井名称", sdo.get("电井名称"));
+						equipment.put("一级编组名称", sdo.get("一级编组名称"));
+						equipment.put("二级编组名称", sdo.get("二级编组名称"));
+					}
+				}
+			}
 		}
 	}
 }

+ 40 - 10
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ToolUtil.java

@@ -23,13 +23,10 @@ public class ToolUtil {
 	}
 
 	private static String Lighting(boolean is_public) {
-		Map<String, JSONObject> floorMap = new HashMap<String, JSONObject>();
-		JSONArray floorArray = getArray_object("floor", null);
-		for (int i = 0; i < floorArray.size(); i++) {
-			JSONObject item = (JSONObject) floorArray.get(i);
-			String id = (String) item.get("id");
-			floorMap.put(id, item);
-		}
+		Map<String, JSONObject> floorMap = getMap_object("floor", null);
+		Map<String, JSONObject> SELTCUMap = getMap_object("equipment", "SELTCU");
+		Map<String, JSONObject> SETDLSMap = getMap_object("equipment", "SETDLS");
+		Map<String, JSONObject> GeneralZoneMap = getMap_object("space", "GeneralZone");
 
 		JSONArray louceng = getArray_relation("MechInArch", "Eq2Fl");
 		Map<String, String> SELTCC2floor = new HashMap<String, String>();
@@ -88,21 +85,43 @@ public class ToolUtil {
 			int index = BKDRHash.getHashCode(SELTCC) % levels.length;
 			JSONObject item = new JSONObject();
 			item.put("回路编号", SELTCC);
-			item.put("模块编号", SELTCU);
-			item.put("配电箱编号", SETDLS);
-			item.put("电井编号", GeneralZone);
+			if (SELTCU != null && SELTCUMap.containsKey(SELTCU)) {
+				item.put("模块编号", SELTCU);
+				item.put("模块名称", SELTCUMap.get(SELTCU).get("localId"));
+			} else {
+				item.put("模块编号", null);
+				item.put("模块名称", null);
+			}
+			if (SETDLS != null && SETDLSMap.containsKey(SETDLS)) {
+				item.put("配电箱编号", SETDLS);
+				item.put("配电箱名称", SETDLSMap.get(SETDLS).get("localId"));
+			} else {
+				item.put("配电箱编号", null);
+				item.put("配电箱名称", null);
+			}
+			if (GeneralZone != null && GeneralZoneMap.containsKey(GeneralZone)) {
+				item.put("电井编号", GeneralZone);
+				item.put("电井名称", GeneralZoneMap.get(GeneralZone).get("localId"));
+			} else {
+				item.put("电井编号", null);
+				item.put("电井名称", null);
+			}
 			item.put("类型", types[index]);
 			if (is_public) {
 				String floor = SELTCC2floor.get(SELTCC);
 				if (floor != null) {
 					item.put("楼层", floor);
 					item.put("二级编组", levels[index] + "-" + floorMap.get(floor).get("localId") + "-" + types[index]);
+					item.put("二级编组名称", levels[index] + "-" + floorMap.get(floor).get("localId") + "-" + types[index]);
 					item.put("一级编组", levels[index]);
+					item.put("一级编组名称", levels[index]);
 					result.add(item);
 				}
 			} else {
 				item.put("二级编组", levels[index] + "-" + types[index]);
+				item.put("二级编组名称", levels[index] + "-" + types[index]);
 				item.put("一级编组", levels[index]);
+				item.put("一级编组名称", levels[index]);
 				result.add(item);
 			}
 		}
@@ -126,6 +145,17 @@ public class ToolUtil {
 		return resultArray;
 	}
 
+	public static Map<String, JSONObject> getMap_object(String objType, String classCode) {
+		Map<String, JSONObject> floorMap = new HashMap<String, JSONObject>();
+		JSONArray floorArray = getArray_object(objType, classCode);
+		for (int i = 0; i < floorArray.size(); i++) {
+			JSONObject item = (JSONObject) floorArray.get(i);
+			String id = (String) item.get("id");
+			floorMap.put(id, item);
+		}
+		return floorMap;
+	}
+
 	public static JSONArray getArray_object(String objType, String classCode) {
 		JSONObject Target = generateTarget_object(objType, classCode);
 		JSONArray ReturnColumns = generateReturnColumns();