Forráskód Böngészése

过滤首页的模块统计

menglu 3 éve
szülő
commit
e515d992f7

+ 0 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java

@@ -17,7 +17,6 @@ import com.persagy.ibms.core.util.FastJsonUtil;
 import com.persagy.ibms.core.util.FileUtil;
 import com.persagy.ibms.core.util.LogOfDownload;
 import com.persagy.ibms.core.util.LogUtil;
-import com.persagy.ibms.core.util.RWDUtil;
 
 import lombok.extern.slf4j.Slf4j;
 

+ 224 - 168
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDRepositoryUtil.java

@@ -208,6 +208,7 @@ public class RWDRepositoryUtil {
 			SceneClassName.putIfAbsent(ibmsSceneCode, new ConcurrentHashMap<String, String>());
 			SceneClassName.get(ibmsSceneCode).put(name, ibmsClassCode);
 		}
+		Map<String, Boolean> SceneVisible = new ConcurrentHashMap<String, Boolean>();
 		Map<String, Map<String, Boolean>> SceneClassVisible = new ConcurrentHashMap<String, Map<String, Boolean>>();
 		for (SceneDataObject SceneDataObject : Repository.InfoPointListArray.set) {
 			String ibmsSceneCode = (String) SceneDataObject.get("ibmsSceneCode").value_prim.value;
@@ -215,205 +216,260 @@ public class RWDRepositoryUtil {
 			boolean isVisible = (Boolean) SceneDataObject.get("isVisible").value_prim.value;
 			SceneClassVisible.putIfAbsent(ibmsSceneCode, new ConcurrentHashMap<String, Boolean>());
 			SceneClassVisible.get(ibmsSceneCode).putIfAbsent(ibmsClassCode, false);
+			SceneVisible.putIfAbsent(ibmsSceneCode, false);
 			if (isVisible) {
 				SceneClassVisible.get(ibmsSceneCode).put(ibmsClassCode, true);
+				SceneVisible.put(ibmsSceneCode, true);
 			}
 		}
 
-		String[] parentPathArray = { "基础对象类型'设备", "基础对象'设备", "基础对象'品质", "基础对象'运营", "基础对象'安全", "基础对象'系统", "基础对象'逻辑编组", "场景数据'设备", "场景数据'品质", "场景数据'运营",
-				"场景数据'安全" };
-		// String[] parentPathArray = { "基础对象类型'设备" };
-		// String[] parentPathArray = { "基础对象'系统" };
-		List<SceneProperty> equipTypeList = new ArrayList<SceneProperty>();
-		List<String> SceneCodeList = new ArrayList<String>();
-		List<String> SceneNameList = new ArrayList<String>();
-		List<String> PathList = new ArrayList<String>();
-		for (String parentPath : parentPathArray) {
-			List<Object> tmpList = PathUtil.getByPath(sceneObject, parentPath);
-			for (Object tmp : tmpList) {
-				SceneProperty spInner = (SceneProperty) tmp;
-				if (spInner.propertyValueType.equals("static") && spInner.propertyValueSchema.equals("JSONArray")) {
-					for (SceneObject soScene : spInner.static_array) {
-						String SceneName = null;
-						for (SceneProperty spInner2 : soScene.propertyList) {
-							if (spInner2.propertyName.equals("名称")) {
-								SceneName = spInner2.static_value;
-								break;
+		{
+			String[] parentPathArray = { "场景数据'首页'模块统计'模块" };
+			List<SceneObject> sceneList = new ArrayList<SceneObject>();
+			for (String parentPath : parentPathArray) {
+				List<Object> tmpList = PathUtil.getByPath(sceneObject, parentPath);
+				for (Object tmp : tmpList) {
+					SceneProperty spInner = (SceneProperty) tmp;
+					if (spInner.propertyValueType.equals("static") && spInner.propertyValueSchema.equals("JSONArray")) {
+						for (SceneObject soScene : spInner.static_array) {
+							String SceneName = null;
+							for (SceneProperty spInner2 : soScene.propertyList) {
+								if (spInner2.propertyName.equals("名称")) {
+									SceneName = spInner2.static_value;
+									break;
+								}
+							}
+							if (!SceneName2Code.containsKey(SceneName)) {
+								continue;
+							}
+							String SceneCode = SceneName2Code.get(SceneName);
+
+							sceneList.add(soScene);
+
+							if (!SceneVisible.containsKey(SceneCode)) {
+								continue;
+							}
+							boolean isVisible = SceneVisible.get(SceneCode);
+							if (!isVisible) {
+								log.warn("info-point-new delete " + parentPath + "'名称=" + SceneName);
+								soScene.allow_pass = "0";
 							}
 						}
-						if (!SceneName2Code.containsKey(SceneName)) {
-							continue;
+
+						List<SceneObject> static_array = new ArrayList<SceneObject>();
+						boolean has_delete = false;
+						for (SceneObject soScene : spInner.static_array) {
+							if (soScene.allow_pass.equals("0")) {
+								has_delete = true;
+							} else {
+								static_array.add(soScene);
+							}
+						}
+						if (has_delete) {
+							spInner.static_array = static_array.toArray(new SceneObject[0]);
 						}
-						String SceneCode = SceneName2Code.get(SceneName);
+					}
+				}
+			}
+		}
 
-						SceneProperty equipType = null;
-						SceneProperty equipType_gl = null;
-						SceneProperty gailan = null;
-						for (SceneProperty spInner2 : soScene.propertyList) {
-							if (spInner2.propertyName.equals("设备类型")) {
-								equipType = spInner2;
-							} else if (spInner2.propertyName.equals("系统概览")) {
-								if (spInner2.propertyValueType.equals("static") && spInner2.propertyValueSchema.equals("JSONArray")) {
-									gailan = spInner2;
-								} else {
-									for (SceneProperty spInner2_att : spInner2.query_attached) {
-										if (spInner2_att.propertyName.equals("设备类型")) {
-											equipType_gl = spInner2_att;
-											break;
+		{
+			String[] parentPathArray = { "基础对象类型'设备", "基础对象'设备", "基础对象'品质", "基础对象'运营", "基础对象'安全", "基础对象'系统", "基础对象'逻辑编组", "场景数据'设备", "场景数据'品质",
+					"场景数据'运营", "场景数据'安全" };
+			List<SceneProperty> equipTypeList = new ArrayList<SceneProperty>();
+			List<String> SceneCodeList = new ArrayList<String>();
+			List<String> SceneNameList = new ArrayList<String>();
+			List<String> PathList = new ArrayList<String>();
+			// 准备以上四个入口list
+			for (String parentPath : parentPathArray) {
+				List<Object> tmpList = PathUtil.getByPath(sceneObject, parentPath);
+				for (Object tmp : tmpList) {
+					SceneProperty spInner = (SceneProperty) tmp;
+					if (spInner.propertyValueType.equals("static") && spInner.propertyValueSchema.equals("JSONArray")) {
+						for (SceneObject soScene : spInner.static_array) {
+							String SceneName = null;
+							for (SceneProperty spInner2 : soScene.propertyList) {
+								if (spInner2.propertyName.equals("名称")) {
+									SceneName = spInner2.static_value;
+									break;
+								}
+							}
+							if (!SceneName2Code.containsKey(SceneName)) {
+								continue;
+							}
+							String SceneCode = SceneName2Code.get(SceneName);
+
+							SceneProperty equipType = null;
+							SceneProperty equipType_gl = null;
+							SceneProperty gailan = null;
+							for (SceneProperty spInner2 : soScene.propertyList) {
+								if (spInner2.propertyName.equals("设备类型")) {
+									equipType = spInner2;
+								} else if (spInner2.propertyName.equals("系统概览")) {
+									if (spInner2.propertyValueType.equals("static") && spInner2.propertyValueSchema.equals("JSONArray")) {
+										gailan = spInner2;
+									} else {
+										for (SceneProperty spInner2_att : spInner2.query_attached) {
+											if (spInner2_att.propertyName.equals("设备类型")) {
+												equipType_gl = spInner2_att;
+												break;
+											}
 										}
 									}
 								}
 							}
+							if (equipType != null) {
+								equipTypeList.add(equipType);
+								SceneCodeList.add(SceneCode);
+								SceneNameList.add(SceneName);
+								PathList.add(parentPath + "'" + "名称=" + SceneName + "'" + "设备类型");
+							}
+							if (equipType_gl != null) {
+								equipTypeList.add(equipType_gl);
+								SceneCodeList.add(SceneCode);
+								SceneNameList.add(SceneName);
+								PathList.add(parentPath + "'" + "名称=" + SceneName + "'系统概览'" + "设备类型");
+							}
+							if (gailan != null) {
+								equipTypeList.add(gailan);
+								SceneCodeList.add(SceneCode);
+								SceneNameList.add(SceneName);
+								PathList.add(parentPath + "'" + "名称=" + SceneName + "'系统概览");
+							}
 						}
-						if (equipType != null) {
-							equipTypeList.add(equipType);
-							SceneCodeList.add(SceneCode);
-							SceneNameList.add(SceneName);
-							PathList.add(parentPath + "'" + "名称=" + SceneName + "'" + "设备类型");
-						}
-						if (equipType_gl != null) {
-							equipTypeList.add(equipType_gl);
-							SceneCodeList.add(SceneCode);
-							SceneNameList.add(SceneName);
-							PathList.add(parentPath + "'" + "名称=" + SceneName + "'系统概览'" + "设备类型");
-						}
-						if (gailan != null) {
-							equipTypeList.add(gailan);
-							SceneCodeList.add(SceneCode);
-							SceneNameList.add(SceneName);
-							PathList.add(parentPath + "'" + "名称=" + SceneName + "'系统概览");
-						}
-					}
-				} else if (spInner.propertyValueType.equals("custom")) {
-					for (SceneProperty spInner2 : spInner.custom_object.propertyList) {
-						String SceneName = spInner2.propertyName;
-						if (!SceneName2Code.containsKey(SceneName)) {
-							continue;
-						}
-						String SceneCode = SceneName2Code.get(SceneName);
+					} else if (spInner.propertyValueType.equals("custom")) {
+						for (SceneProperty spInner2 : spInner.custom_object.propertyList) {
+							String SceneName = spInner2.propertyName;
+							if (!SceneName2Code.containsKey(SceneName)) {
+								continue;
+							}
+							String SceneCode = SceneName2Code.get(SceneName);
 
-						SceneProperty floor = null;
-						for (SceneProperty spInner3 : spInner2.custom_object.propertyList) {
-							if (spInner3.propertyName.equals("楼层数据")) {
-								floor = spInner3;
-								break;
+							SceneProperty floor = null;
+							for (SceneProperty spInner3 : spInner2.custom_object.propertyList) {
+								if (spInner3.propertyName.equals("楼层数据")) {
+									floor = spInner3;
+									break;
+								}
+							}
+							if (floor == null) {
+								continue;
 							}
-						}
-						if (floor == null) {
-							continue;
-						}
 
-						SceneProperty equipType = null;
-						SceneProperty gailan = null;
-						for (SceneProperty spInner2_att : floor.query_attached) {
-							if (spInner2_att.propertyName.equals("设备类型")) {
-								equipType = spInner2_att;
-							} else if (spInner2_att.propertyName.equals("系统概览")) {
-								gailan = spInner2_att;
+							SceneProperty equipType = null;
+							SceneProperty gailan = null;
+							for (SceneProperty spInner2_att : floor.query_attached) {
+								if (spInner2_att.propertyName.equals("设备类型")) {
+									equipType = spInner2_att;
+								} else if (spInner2_att.propertyName.equals("系统概览")) {
+									gailan = spInner2_att;
+								}
+							}
+							if (equipType != null) {
+								equipTypeList.add(equipType);
+								SceneCodeList.add(SceneCode);
+								SceneNameList.add(SceneName);
+								PathList.add(parentPath + "'" + SceneName + "'楼层数据" + "'设备类型");
+							}
+							if (gailan != null) {
+								equipTypeList.add(gailan);
+								SceneCodeList.add(SceneCode);
+								SceneNameList.add(SceneName);
+								PathList.add(parentPath + "'" + SceneName + "'楼层数据" + "'系统概览");
 							}
-						}
-						if (equipType != null) {
-							equipTypeList.add(equipType);
-							SceneCodeList.add(SceneCode);
-							SceneNameList.add(SceneName);
-							PathList.add(parentPath + "'" + SceneName + "'楼层数据" + "'设备类型");
-						}
-						if (gailan != null) {
-							equipTypeList.add(gailan);
-							SceneCodeList.add(SceneCode);
-							SceneNameList.add(SceneName);
-							PathList.add(parentPath + "'" + SceneName + "'楼层数据" + "'系统概览");
 						}
 					}
-				}
+				} // end for
 			} // end for
-		} // end for
-		for (int i = 0; i < equipTypeList.size(); i++) {
-			SceneProperty equipType = equipTypeList.get(i);
-			String SceneCode = SceneCodeList.get(i);
-			String SceneName = SceneNameList.get(i);
-			String Path = PathList.get(i);
-			if (SceneCode.equals("sbzwy")) {
-				continue;
-			}
-			for (SceneObject soEquipType : equipType.static_array) {
-				SceneProperty spName = null;
-				SceneProperty spList = null;
-				for (SceneProperty spInner2 : soEquipType.propertyList) {
-					if (spInner2.propertyName.equals("清单")) {
-						spList = spInner2;
-					} else if (spInner2.propertyName.equals("名称")) {
-						spName = spInner2;
-					}
-				}
-				if (spList == null) {
+
+			// 从上面四个list的下级里面筛选
+			for (int i = 0; i < equipTypeList.size(); i++) {
+				SceneProperty equipType = equipTypeList.get(i);
+				String SceneCode = SceneCodeList.get(i);
+				String SceneName = SceneNameList.get(i);
+				String Path = PathList.get(i);
+				if (SceneCode.equals("sbzwy")) {
 					continue;
 				}
-				String ibmsSceneCode = null;
-				String ibmsClassCode = null;
-				if (spList != null && spList.propertyValueType.equals("query")) {
-					JSONObject query_sql = JSON.parseObject(spList.query_sql);
-					JSONObject Target = query_sql.getJSONObject("Target");
-					String Source = Target.getString("Source");
-					if (Source.equals("zkt-object")) {
-						ibmsSceneCode = Target.getString("ibmsSceneCode");
-						ibmsClassCode = Target.getString("ibmsClassCode");
-					} else if (Source.equals("ibms-group")) {
-						JSONObject Criteria = query_sql.getJSONObject("Criteria");
-						ibmsSceneCode = Criteria.getString("ibmsSceneCode");
-						ibmsClassCode = Criteria.getString("ibmsClassCode");
-					} else if (Source.equals("ref")) {
-						String ref = Target.getString("ref");
-						String[] splits = ref.split("'");
-						if (splits.length >= 6) {
-							String type1 = splits[2];
-							String type2 = splits[4];
-							if (type1.startsWith("名称=") && type2.startsWith("名称=")) {
-								ibmsSceneCode = SceneName2Code.get(type1.substring("名称=".length()));
-								ibmsClassCode = SceneClassName.get(ibmsSceneCode).get(type2.substring("名称=".length()));
+				for (SceneObject soEquipType : equipType.static_array) {
+					SceneProperty spName = null;
+					SceneProperty spList = null;
+					for (SceneProperty spInner2 : soEquipType.propertyList) {
+						if (spInner2.propertyName.equals("清单")) {
+							spList = spInner2;
+						} else if (spInner2.propertyName.equals("名称")) {
+							spName = spInner2;
+						}
+					}
+					if (spList == null) {
+						continue;
+					}
+					String ibmsSceneCode = null;
+					String ibmsClassCode = null;
+					if (spList != null && spList.propertyValueType.equals("query")) {
+						JSONObject query_sql = JSON.parseObject(spList.query_sql);
+						JSONObject Target = query_sql.getJSONObject("Target");
+						String Source = Target.getString("Source");
+						if (Source.equals("zkt-object")) {
+							ibmsSceneCode = Target.getString("ibmsSceneCode");
+							ibmsClassCode = Target.getString("ibmsClassCode");
+						} else if (Source.equals("ibms-group")) {
+							JSONObject Criteria = query_sql.getJSONObject("Criteria");
+							ibmsSceneCode = Criteria.getString("ibmsSceneCode");
+							ibmsClassCode = Criteria.getString("ibmsClassCode");
+						} else if (Source.equals("ref")) {
+							String ref = Target.getString("ref");
+							String[] splits = ref.split("'");
+							if (splits.length >= 6) {
+								String type1 = splits[2];
+								String type2 = splits[4];
+								if (type1.startsWith("名称=") && type2.startsWith("名称=")) {
+									ibmsSceneCode = SceneName2Code.get(type1.substring("名称=".length()));
+									ibmsClassCode = SceneClassName.get(ibmsSceneCode).get(type2.substring("名称=".length()));
+								}
 							}
 						}
+					} else {
+						ibmsSceneCode = SceneCode;
+						ibmsClassCode = SceneClassName.get(ibmsSceneCode).get(spName.static_value);
 					}
-				} else {
-					ibmsSceneCode = SceneCode;
-					ibmsClassCode = SceneClassName.get(ibmsSceneCode).get(spName.static_value);
-				}
-				if (ibmsSceneCode == null || ibmsClassCode == null) {
-					continue;
-				}
-				if (!ibmsSceneCode.equals(SceneCode)) {
-					String name = null;
-					for (SceneProperty spInner2 : soEquipType.propertyList) {
-						if (spInner2.propertyName.equals("名称")) {
-							name = spInner2.static_value;
-							break;
+					if (ibmsSceneCode == null || ibmsClassCode == null) {
+						continue;
+					}
+					if (!ibmsSceneCode.equals(SceneCode)) {
+						String name = null;
+						for (SceneProperty spInner2 : soEquipType.propertyList) {
+							if (spInner2.propertyName.equals("名称")) {
+								name = spInner2.static_value;
+								break;
+							}
 						}
+						log.error(SceneName + " " + SceneCode + " has " + name + " " + ibmsSceneCode + " " + ibmsClassCode);
 					}
-					log.error(SceneName + " " + SceneCode + " has " + name + " " + ibmsSceneCode + " " + ibmsClassCode);
-				}
 
-				if (!SceneClassVisible.containsKey(ibmsSceneCode) || !SceneClassVisible.get(ibmsSceneCode).containsKey(ibmsClassCode)) {
-					continue;
-				}
-				boolean isVisible = SceneClassVisible.get(ibmsSceneCode).get(ibmsClassCode);
-				if (!isVisible) {
-					log.warn("info-point-new delete " + Path + "'名称=" + spName.static_value);
-					soEquipType.allow_pass = "0";
-				}
-			}
-			boolean deleteSO = true;
-			if (deleteSO) {
-				List<SceneObject> static_array = new ArrayList<SceneObject>();
-				boolean has_delete = false;
-				for (SceneObject soEquipType : equipType.static_array) {
-					if (soEquipType.allow_pass.equals("0")) {
-						has_delete = true;
-					} else {
-						static_array.add(soEquipType);
+					if (!SceneClassVisible.containsKey(ibmsSceneCode) || !SceneClassVisible.get(ibmsSceneCode).containsKey(ibmsClassCode)) {
+						continue;
+					}
+					boolean isVisible = SceneClassVisible.get(ibmsSceneCode).get(ibmsClassCode);
+					if (!isVisible) {
+						log.warn("info-point-new delete " + Path + "'名称=" + spName.static_value);
+						soEquipType.allow_pass = "0";
 					}
 				}
-				if (has_delete) {
-					equipType.static_array = static_array.toArray(new SceneObject[0]);
+				boolean deleteSO = true;
+				if (deleteSO) {
+					List<SceneObject> static_array = new ArrayList<SceneObject>();
+					boolean has_delete = false;
+					for (SceneObject soEquipType : equipType.static_array) {
+						if (soEquipType.allow_pass.equals("0")) {
+							has_delete = true;
+						} else {
+							static_array.add(soEquipType);
+						}
+					}
+					if (has_delete) {
+						equipType.static_array = static_array.toArray(new SceneObject[0]);
+					}
 				}
 			}
 		}