Browse Source

增加数据字典类型名称

menglu 3 years ago
parent
commit
f37f4c7a24

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

@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.persagy.ibms.data.sdk.data.SceneDataBase;
 import com.persagy.ibms.data.sdk.data.SceneDataObject;
 import com.persagy.ibms.data.sdk.data.SceneDataValue;
+
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
@@ -44,18 +45,14 @@ public class RWDLoadUtil {
 				JSONObject classItem = (JSONObject) classArray.get(i);
 				String objType = (String) classItem.get("objType");
 				String code = (String) classItem.get("code");
+				String name = (String) classItem.get("name");
 				if (code.equals(objType)) {
 					Repository.objTypeMap.put(objType, false);
-				}
-			}
-			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)) {
+				} else {
 					Repository.code2objTypeMap.put(code, objType);
 					Repository.objTypeMap.put(objType, true);
 				}
+				Repository.classCode2NameMap.put(code, name);
 			}
 		}
 
@@ -100,6 +97,7 @@ public class RWDLoadUtil {
 			for (File file : files) {
 				int index_ = file.getName().indexOf('.');
 				String code = file.getName().substring(0, index_);
+				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()));
 				if (code.equals("OTSECB")) {
@@ -126,6 +124,7 @@ public class RWDLoadUtil {
 				for (int i = 0; i < array.size(); i++) {
 					JSONObject arrayItem = array.getJSONObject(i);
 					String id = (String) arrayItem.get("id");
+					arrayItem.put("数据字典类型名称", className);
 					Repository.id2object.put(id, arrayItem);
 				}
 				List<SceneDataValue> sdvList = RWDUtil.array2SDVList(array);

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

@@ -19,6 +19,7 @@ public class Repository {
 
 	// 对象类型,true表示有二级类型
 	public Map<String, Boolean> objTypeMap = new HashMap<String, Boolean>();
+	public Map<String, String> classCode2NameMap = new HashMap<String, String>();
 	// classCode到objType
 	public Map<String, String> code2objTypeMap = new HashMap<String, String>();