Procházet zdrojové kódy

dataSource单独拎出来

menglu před 3 roky
rodič
revize
3c2a8d3d53

+ 28 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java

@@ -60,6 +60,7 @@ public class RWDLoadUtil {
 			File[] files = root.listFiles();
 			Map<String, SceneDataSet> infoArrayDic = new ConcurrentHashMap<String, SceneDataSet>();
 			Map<String, JSONArray> infoJsonArray = new ConcurrentHashMap<String, JSONArray>();
+			JSONArray dataSourceAll = new JSONArray();
 			for (File file : files) {
 				int index_ = file.getName().indexOf('.');
 				String code = file.getName().substring(0, index_);
@@ -70,6 +71,26 @@ public class RWDLoadUtil {
 					SceneDataSet.set = RWDUtil.array2SDOList(array);
 					infoArrayDic.put(code, SceneDataSet);
 					infoJsonArray.put(code, array);
+					for (int i = 0; i < array.size(); i++) {
+						JSONObject arrayItem = array.getJSONObject(i);
+						if (arrayItem.containsKey("dataSource")) {
+							Object itemValue = arrayItem.get("dataSource");
+							String infoCode = arrayItem.getString("code");
+							if (itemValue instanceof JSONArray) {
+								JSONArray itemValueArray = (JSONArray) itemValue;
+								for (int ii = 0; ii < itemValueArray.size(); ii++) {
+									JSONObject dataSourceItem = itemValueArray.getJSONObject(ii);
+									JSONObject itemTmp = new JSONObject();
+									for (String itemKey : dataSourceItem.keySet()) {
+										itemTmp.put(itemKey, dataSourceItem.get(itemKey));
+									}
+									itemTmp.put("infoCode", infoCode);
+									itemTmp.put("classCode", code);
+									dataSourceAll.add(itemTmp);
+								}
+							}
+						}
+					}
 				} catch (Exception e) {
 					log.warn(e.getMessage(), e);
 				}
@@ -113,6 +134,12 @@ public class RWDLoadUtil {
 			}
 			Repository.infoArrayJson = infoJsonArray;
 			Repository.infoArrayDic = infoArrayDic;
+			{
+				SceneDataSet SceneDataSet = new SceneDataSet(false);
+				SceneDataSet.set = RWDUtil.array2SDOList(dataSourceAll);
+				Repository.infoDataSource = SceneDataSet;
+				FileUtil.Save("tmp-dataSource" + ".json", FastJsonUtil.toFormatString(dataSourceAll));
+			}
 		}
 
 		String objectPath = validPath + Constant.getSeperator() + "object";
@@ -982,7 +1009,7 @@ public class RWDLoadUtil {
 					.ReadJSONArray(new File(validPath + Constant.getSeperator() + "info-point-relation.json"));
 			Repository.InfoPointRelationArray.set = RWDUtil.array2SDOList(classArray);
 		}
-		if(Constant.scaleplate_enable){
+		if (Constant.scaleplate_enable) {
 			JSONArray classArray = FastJsonReaderUtil.Instance().ReadJSONArray(new File(validPath + Constant.getSeperator() + "scaleplate.json"));
 			Repository.scaleplate.set = RWDUtil.array2SDOList(classArray);
 		}

+ 4 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryImpl.java

@@ -38,6 +38,7 @@ public class RepositoryImpl extends RepositoryBase {
 	public SceneDataSet classArray = new SceneDataSet(false);
 	public Map<String, SceneDataSet> infoArrayDic = new ConcurrentHashMap<String, SceneDataSet>();
 	public Map<String, JSONArray> infoArrayJson = new ConcurrentHashMap<String, JSONArray>();
+	public SceneDataSet infoDataSource = new SceneDataSet(false);
 	// 对象类型到对象实例清单
 	public Map<String, SceneDataValue> objectArrayDic = new ConcurrentHashMap<String, SceneDataValue>();
 	// 所有对象实例清单
@@ -94,6 +95,7 @@ public class RepositoryImpl extends RepositoryBase {
 		this.classArray = RepositoryContainer.instance.classArray;
 		this.infoArrayDic = RepositoryContainer.instance.infoArrayDic;
 		this.infoArrayJson = RepositoryContainer.instance.infoArrayJson;
+		this.infoDataSource = RepositoryContainer.instance.infoDataSource;
 		this.objectArrayDic = RepositoryContainer.instance.objectArrayDic;
 		this.objectArrayAll = RepositoryContainer.instance.objectArrayAll;
 		this.object2info2point = RepositoryContainer.instance.object2info2point;
@@ -162,6 +164,8 @@ public class RepositoryImpl extends RepositoryBase {
 				} else {
 					result = this.infoArrayDic.get(objType);
 				}
+			} else if (rwd.equals("info_dataSource")) {
+				result = this.infoDataSource;
 			} else if (rwd.equals("relation")) {
 				if (descSet.get("graphCode") != null && descSet.get("relCode") != null) {
 					String graphCode = (descSet.get("graphCode")).toString();