Преглед изворни кода

Merge branch 'develop' of http://git.sagacloud.cn/IBMS/ibms-sdk into develop

menglu пре 2 година
родитељ
комит
7043808863

+ 33 - 2
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java

@@ -6,9 +6,11 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.stream.Collectors;
 
 import javax.servlet.http.HttpServletRequest;
 
+import antlr.collections.impl.LList;
 import cn.hutool.core.lang.Tuple;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -250,6 +252,12 @@ public class RestUtil {
 	}
 
 	public static String subsystem_connect_status() {
+		JSONArray subsystemStatusList = new JSONArray();
+		try {
+			subsystemStatusList = queryOcssiConfigsubsystemStatusList();
+		} catch (Exception e) {
+			log.error(e.getMessage(), e);
+		}
 		RepositoryImpl Repository = RepositoryContainer.instance;
 		Date currTime = new Date();
 		for (SceneDataObject sdo_connect : Repository.subsystem_connect_status.set) {
@@ -268,8 +276,31 @@ public class RestUtil {
 				}
 			}
 		}
-		Object result = Repository.subsystem_connect_status.toJSON(2);
-		return JSONObject.toJSONString(result, SerializerFeature.WriteMapNullValue);
+		JSONArray subsystem_connect_status_array=new JSONArray();
+		for (int i = 0; i < subsystemStatusList.size(); i++) {
+			JSONObject item = (JSONObject) subsystemStatusList.get(i);
+			String ibmsSceneCode = item.getString("ibmsSceneCode");
+			SceneDataObject itemObject= Repository.subsystem_connect_status.set.stream().filter(x->x.get("ibmsSceneCode").value_prim.toString().equals(ibmsSceneCode)).findFirst().get();
+			if(itemObject!=null)
+			{
+				subsystem_connect_status_array.add(itemObject.toJSON(2));
+				
+			}
+		}
+		return JSONArray.toJSONString(subsystem_connect_status_array);
+	}
+
+	//获取子系统配置
+	private static JSONArray queryOcssiConfigsubsystemStatusList() throws Exception {
+		JSONObject postParam=new JSONObject();
+		postParam.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
+		postParam.put("projectId", RepositoryContainer.RepositoryProject.projectId);
+		String post_url = Constant.zkt_control_url + "/ocssiConfigsubsystemStatus/queryOcssiConfigsubsystemStatusList";
+		String post_result = HttpClientUtil.instance("zkt_control").post(post_url, postParam.toJSONString());
+		JSONObject resultObject = JSONObject.parseObject(post_result);
+		JSONArray result=JSONArray.parseArray(resultObject.getString("Content"));
+		log.debug(result.toJSONString());
+		return result;
 	}
 
 	public static String getIp(HttpServletRequest request) {