Ver código fonte

增加部分注释

menglu 3 anos atrás
pai
commit
84dec5080d

+ 10 - 4
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/CheckUtil.java

@@ -73,6 +73,7 @@ public class CheckUtil {
 
 	public static void getPropertyBefore_query(Repository Repository, SceneProperty sceneProperty, List<SceneProperty> result) throws Exception {
 		JSONObject sql_json = JSON.parseObject(sceneProperty.query_sql);
+		// 查询目标中的引用为true,其他引用为false
 		Map<String, Boolean> refList = new HashMap<String, Boolean>();
 		query(sql_json, refList);
 		for (String refString : refList.keySet()) {
@@ -128,6 +129,7 @@ public class CheckUtil {
 		}
 	}
 
+	// 往下找一级
 	private static List<SceneProperty> getProperty(SceneObject parentData, String[] splits, int splits_index, boolean refInTarget) throws Exception {
 		String name = splits[splits_index];
 		SceneProperty findSP = null;
@@ -145,11 +147,13 @@ public class CheckUtil {
 		}
 	}
 
+	// 根据当前所处parent级别获取依赖属性
 	private static List<SceneProperty> getProperty(SceneProperty parentData, String[] splits, int splits_index, boolean refInTarget)
 			throws Exception {
 		List<SceneProperty> result = new ArrayList<SceneProperty>();
-		boolean doit = true;
+		boolean valid_find = true;
 		if (parentData.propertyValueType.equals("static") && parentData.propertyValueSchema.equals("JSONArray")) {
+			// 静态数组根据是否有匹配,找下一级Object的对应属性
 			String split = splits[splits_index];
 			int index_ = split.indexOf('=');
 			if (index_ != -1) {
@@ -178,8 +182,10 @@ public class CheckUtil {
 				}
 			}
 		} else if (parentData.propertyValueType.equals("deamon")) {
+			valid_find = false;
 			result.add(parentData);
 		} else if (splits_index == splits.length) {
+			valid_find = false;
 			result.add(parentData);
 		} else {
 			String name = splits[splits_index];
@@ -207,14 +213,14 @@ public class CheckUtil {
 				if (sp_custom != null) {
 					result = getProperty(sp_custom, splits, splits_index + 1, refInTarget);
 				} else if (parentData.propertyValueType.equals("query") && splits_index == splits.length - 1) {
-					doit = false;
+					valid_find = false;
 					result.add(parentData);
 				}
 			}
 		}
 
-		// throw new Exception();
-		if (doit && refInTarget && splits_index + 1 == splits.length) {
+		// 查询目标中有引用的,需要增加引用项下级的附加属性(query类型的原始值)
+		if (valid_find && refInTarget && splits_index + 1 == splits.length) {
 			List<SceneProperty> tmpList = new ArrayList<SceneProperty>();
 			for (SceneProperty spTmp : result) {
 				if (spTmp.query_attached != null) {

+ 3 - 6
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ComputeUtil.java

@@ -137,9 +137,6 @@ public class ComputeUtil {
 			{
 				String path = getPath(Repository, spInner);
 				log.info("getPropertyBefore:" + path);
-				if (path.equals("基础对象-设备-设备类型-清单-报警处理状态")) {
-					System.out.println();
-				}
 			}
 			{
 				List<SceneProperty> beforeList = CheckUtil.getPropertyBefore(Repository, spInner);
@@ -330,9 +327,9 @@ public class ComputeUtil {
 						sb.append(ss.propertyName);
 					}
 					log.info("computeOnce:" + sb.toString());
-					if (sb.toString().equals("基础对象-设备-清单")) {
-						System.out.println();
-					}
+					// if (sb.toString().equals("基础对象-设备-清单")) {
+					// System.out.println();
+					// }
 				}
 				// 打印路径
 				List<SceneDataValue> sdvList = Repository.property2SDV.get(spInner2);