|
@@ -3,6 +3,7 @@ package com.persagy.ibms.data.sdk.util;
|
|
|
import java.io.File;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -312,6 +313,57 @@ public class RWDDownloadUtil {
|
|
|
+ ibmsClassCode + ".json", FastJsonUtil.toFormatString(infoArray));
|
|
|
}
|
|
|
log.debug("Download zkt physical world finish " + path);
|
|
|
+
|
|
|
+ {
|
|
|
+ Map<String, Boolean> alarmTypeMap = new HashMap<String, Boolean>();
|
|
|
+ if (Constant.alarm_rest_get) {
|
|
|
+ for (int i = 0; i < classArray.size(); i++) {
|
|
|
+ JSONObject classItem = classArray.getJSONObject(i);
|
|
|
+ String ibmsSceneCode = classItem.getString("ibmsSceneCode");
|
|
|
+ String ibmsClassCode = classItem.getString("ibmsClassCode");
|
|
|
+ JSONObject criteria = new JSONObject();
|
|
|
+ criteria.put("appId", "0");
|
|
|
+ criteria.put("userId", "systemId");
|
|
|
+ criteria.put("projectId", RepositoryContainer.RepositoryBase.projectId);
|
|
|
+ criteria.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
|
|
|
+ String post_result = HttpClientUtil.get(
|
|
|
+ Constant.alarm_rest + "alarm-config/itemList/" + ibmsSceneCode + "/" + ibmsClassCode + "?projectId="
|
|
|
+ + RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode,
|
|
|
+ null);
|
|
|
+ JSONObject resultJSON = JSON.parseObject(post_result);
|
|
|
+ JSONArray Content = resultJSON.getJSONArray("Content");
|
|
|
+ for (int ii = 0; ii < Content.size(); ii++) {
|
|
|
+ JSONObject ContentItem = Content.getJSONObject(ii);
|
|
|
+ String name = ContentItem.getString("name");
|
|
|
+ alarmTypeMap.put(name, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ JSONObject criteria = new JSONObject();
|
|
|
+ criteria.put("appId", "0");
|
|
|
+ criteria.put("userId", "systemId");
|
|
|
+ criteria.put("projectId", RepositoryContainer.RepositoryBase.projectId);
|
|
|
+ criteria.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
|
|
|
+ String post_result = HttpClientUtil.post(Constant.alarm_rest + "alarm/queryItem", criteria.toJSONString());
|
|
|
+ JSONObject resultJSON = JSON.parseObject(post_result);
|
|
|
+ JSONArray Content = resultJSON.getJSONArray("Content");
|
|
|
+ for (int ii = 0; ii < Content.size(); ii++) {
|
|
|
+ JSONObject ContentItem = Content.getJSONObject(ii);
|
|
|
+ String name = ContentItem.getString("name");
|
|
|
+ alarmTypeMap.put(name, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ JSONArray alarmTypeArray = new JSONArray();
|
|
|
+ String[] alarmTypes = alarmTypeMap.keySet().toArray(new String[0]);
|
|
|
+ Arrays.sort(alarmTypes);
|
|
|
+ for (String key : alarmTypes) {
|
|
|
+ JSONObject item = new JSONObject();
|
|
|
+ item.put("code", key);
|
|
|
+ item.put("name", key);
|
|
|
+ alarmTypeArray.add(item);
|
|
|
+ }
|
|
|
+ FileUtil.Save(path + Constant.getSeperator() + "alarmTypeArray.json", FastJsonUtil.toFormatString(alarmTypeArray));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public static boolean Process_ibms_physical_world() throws Exception {
|