Browse Source

完善对象下载和加载

menglu 3 years ago
parent
commit
10825ba830

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

@@ -155,10 +155,24 @@ public class RWDDownloadUtil {
 			infoArray = infoArray == null ? new JSONArray() : infoArray;
 			FileUtil.Save(path + Constant.getSeperator() + "info" + Constant.getSeperator() + code + ".json", FastJsonUtil.toFormatString(infoArray));
 		}
+		Map<String, Boolean> objTypeMap = new HashMap<String, Boolean>();
+		for (int i = 0; i < classArray.size(); i++) {
+			JSONObject classItem = (JSONObject) classArray.get(i);
+			String objType = (String) classItem.get("objType");
+			String code = (String) classItem.get("code");
+			if (code.equals(objType)) {
+				objTypeMap.put(objType, false);
+			} else {
+				objTypeMap.put(objType, true);
+			}
+		}
 		for (int i = 0; i < classArray.size(); i++) {
 			JSONObject item = (JSONObject) classArray.get(i);
 			String objType = item.getString("objType");
 			String code = item.getString("code");
+			if (objTypeMap.containsKey(code) && objTypeMap.get(code) == true) {
+				continue;
+			}
 			JSONArray infoArray;
 			{
 				JSONObject param = new JSONObject();

+ 7 - 10
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java

@@ -110,6 +110,9 @@ public class RWDLoadUtil {
 			for (File file : files) {
 				int index_ = file.getName().indexOf('.');
 				String code = file.getName().substring(0, index_);
+				if (Repository.objTypeMap.containsKey(code) && Repository.objTypeMap.get(code) == true) {
+					continue;
+				}
 				String className = Repository.classCode2NameMap.get(code);
 				log.info(objectPath + Constant.getSeperator() + "" + file.getName());
 				JSONArray array = FastJsonReaderUtil.Instance().ReadJSONArray(new File(objectPath + Constant.getSeperator() + "" + file.getName()));
@@ -172,15 +175,9 @@ public class RWDLoadUtil {
 					Repository.id2sdv.put(id, sdv);
 				}
 				// 一级对象
-				if (Repository.objTypeMap.containsKey(code)) {
-					if (Repository.objTypeMap.get(code)) {
-						objectArrayDic.put(code + "-self", SceneDataSet);
-					} else {
-						objectArrayDic.put(code, SceneDataSet);
-					}
-				} else {
-					objectArrayDic.put(code, SceneDataSet);
-					String objType = Repository.code2objTypeMap.get(code);
+				objectArrayDic.put(code, SceneDataSet);
+				String objType = Repository.code2objTypeMap.get(code);
+				if (objType != null) {
 					if (!objectArrayDic.containsKey(objType)) {
 						objectArrayDic.put(objType, new SceneDataSet(false));
 					}
@@ -246,7 +243,7 @@ public class RWDLoadUtil {
 			if (Repository.objTypeMap.containsKey(key)) {
 				continue;
 			}
-			String classCode = key.endsWith("-self") ? key.substring(0, key.length() - "-self".length()) : key;
+			String classCode = key;
 			SceneDataSet infoArray = Repository.infoArrayDic.get(classCode);
 			SceneDataSet objectArray = Repository.objectArrayDic.get(key);
 			for (int index_object = 0; index_object < objectArray.set.size(); index_object++) {