浏览代码

计算依赖项有bug,修复

menglu 3 年之前
父节点
当前提交
8e88cb41a9

+ 8 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RecursiveUtil.java

@@ -304,8 +304,9 @@ public class RecursiveUtil {
 		JSONObject sql_json = JSON.parseObject(sceneProperty.query_sql);
 		Map<String, Boolean> refList = new HashMap<String, Boolean>();
 		CheckUtil.query(sql_json, refList);
-		List<SceneDataValue> svList = new ArrayList<SceneDataValue>();
+		List<SceneDataValue> svListAll = new ArrayList<SceneDataValue>();
 		for (String refString : refList.keySet()) {
+			List<SceneDataValue> svList = new ArrayList<SceneDataValue>();
 			String[] splits = refString.split("'");
 			SceneDataObject parentData;
 			int splits_index;
@@ -372,9 +373,10 @@ public class RecursiveUtil {
 				}
 				svList = svListInner;
 			}
+			svListAll.addAll(svList);
 		}
 
-		for (SceneDataValue sdv : svList) {
+		for (SceneDataValue sdv : svListAll) {
 			compute(Repository, sdv);
 		}
 
@@ -384,6 +386,8 @@ public class RecursiveUtil {
 				ReentrantLock lock = Repository.property2lock.get(sv.rel_property);
 				try {
 					lock.lock();
+					// String svPath = RecursiveUtil.getDataPath(sv);
+					// log.info(svPath);
 					ComputeUtil.computeProperty(Repository, sv);
 				} finally {
 					lock.unlock();
@@ -456,7 +460,8 @@ public class RecursiveUtil {
 
 		if (sdv.rel_property.propertyValueSchema.equals("JSONObject")) {
 			if (sdv.rel_property.propertyValueType.equals("query")) {
-				log.debug(path + "\t" + "variable set object" + "\t" + sdv.rel_property.propertyValueType + "\t" + sdv.value_object.change.toString());
+				log.debug(
+						path + "\t" + "variable set object" + "\t" + sdv.rel_property.propertyValueType + "\t" + sdv.value_object.change.toString());
 			}
 			print_variable_set(path, sdv.value_object);
 		} else if (sdv.rel_property.propertyValueSchema.equals("JSONArray")) {

+ 17 - 12
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ToolUtil.java

@@ -28,7 +28,7 @@ public class ToolUtil {
 		Map<String, JSONObject> SETDLSMap = getMap_object("equipment", "SETDLS");
 		Map<String, JSONObject> GeneralZoneMap = getMap_object("space", "GeneralZone");
 
-		JSONArray louceng = getArray_relation("MechInArch", "Eq2Fl");
+		JSONArray louceng = getArray_relation("MechInArch", "Eq2Fl", null);
 		Map<String, String> SELTCC2floor = new HashMap<String, String>();
 		for (int i = 0; i < louceng.size(); i++) {
 			JSONObject item = (JSONObject) louceng.get(i);
@@ -37,7 +37,7 @@ public class ToolUtil {
 			SELTCC2floor.put(objFrom, objTo);
 		}
 
-		JSONArray kongzhi = getArray_relation("MechCtrl", "EqCtrl");
+		JSONArray kongzhi = getArray_relation("MechCtrl", "EqCtrl", null);
 		Map<String, String> SELTCC2SELTCU = new HashMap<String, String>();
 		for (int i = 0; i < kongzhi.size(); i++) {
 			JSONObject item = (JSONObject) kongzhi.get(i);
@@ -46,7 +46,7 @@ public class ToolUtil {
 			SELTCC2SELTCU.put(objTo, objFrom);
 		}
 
-		JSONArray gongdian = getArray_relation("MechPower", "EqNormal");
+		JSONArray gongdian = getArray_relation("MechPower", "EqNormal", null);
 		Map<String, String> SELTCU2SETDLS = new HashMap<String, String>();
 		for (int i = 0; i < gongdian.size(); i++) {
 			JSONObject item = (JSONObject) gongdian.get(i);
@@ -55,7 +55,7 @@ public class ToolUtil {
 			SELTCU2SETDLS.put(objTo, objFrom);
 		}
 
-		JSONArray suozai = getArray_relation("MechInArch", "Eq2Sp");
+		JSONArray suozai = getArray_relation("MechInArch", "Eq2Sp", "GeneralZone");
 		Map<String, String> SETDLS2GeneralZone = new HashMap<String, String>();
 		for (int i = 0; i < suozai.size(); i++) {
 			JSONObject item = (JSONObject) suozai.get(i);
@@ -64,6 +64,7 @@ public class ToolUtil {
 			SETDLS2GeneralZone.put(objFrom, objTo);
 		}
 
+		String[] ids = { "louti", "louti", "jingguan", "jingguan", "biaozhi", "biaozhi" };
 		String[] levels = { "楼体照明", "楼体照明", "景观照明", "景观照明", "标识照明", "标识照明" };
 		String[] types = { "A", "B", "A", "B", "A", "B" };
 		JSONArray result = new JSONArray();
@@ -111,16 +112,16 @@ public class ToolUtil {
 				String floor = SELTCC2floor.get(SELTCC);
 				if (floor != null) {
 					item.put("楼层", floor);
-					item.put("二级编组", levels[index] + "-" + floorMap.get(floor).get("localId") + "-" + types[index]);
+					item.put("二级编组", ids[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("一级编组", ids[index]);
 					item.put("一级编组名称", levels[index]);
 					result.add(item);
 				}
 			} else {
-				item.put("二级编组", levels[index] + "-" + types[index]);
+				item.put("二级编组", ids[index] + "-" + types[index]);
 				item.put("二级编组名称", levels[index] + "-" + types[index]);
-				item.put("一级编组", levels[index]);
+				item.put("一级编组", ids[index]);
 				item.put("一级编组名称", levels[index]);
 				result.add(item);
 			}
@@ -134,11 +135,15 @@ public class ToolUtil {
 		return FastJsonUtil.toFormatString(result);
 	}
 
-	public static JSONArray getArray_relation(String graphCode, String relCode) {
-		JSONObject Target = generateTarget_relation(graphCode, relCode);
+	public static JSONArray getArray_relation(String graphCode, String relCode, String relValue) {
+		JSONObject Target = generateTarget_relation(graphCode, relCode, relValue);
 		JSONObject param = new JSONObject();
 		param.put("Target", Target);
-		param.put("Criteria", new JSONObject());
+		JSONObject Criteria = new JSONObject();
+		if (relValue != null) {
+			Criteria.put("relValue", relValue);
+		}
+		param.put("Criteria", Criteria);
 		param.put("QueryType", "select");
 		String queryResult = RestUtil.query(param.toJSONString());
 		JSONArray resultArray = JSON.parseArray(queryResult);
@@ -196,7 +201,7 @@ public class ToolUtil {
 		return result;
 	}
 
-	private static JSONObject generateTarget_relation(String graphCode, String relCode) {
+	private static JSONObject generateTarget_relation(String graphCode, String relCode, String relValue) {
 		JSONObject result = new JSONObject();
 		result.put("Source", "rwd");
 		result.put("rwd", "relation");