|
@@ -8,12 +8,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.persagy.ibms.core.data.SceneDataObject;
|
|
|
import com.persagy.ibms.core.data.SceneObject;
|
|
|
import com.persagy.ibms.core.data.SceneProperty;
|
|
|
import com.persagy.ibms.core.util.ComputeUtil;
|
|
|
import com.persagy.ibms.core.util.FastJsonReaderUtil;
|
|
|
import com.persagy.ibms.core.util.FastJsonUtil;
|
|
|
import com.persagy.ibms.core.util.LogOfRun;
|
|
|
+import com.persagy.ibms.core.util.PathUtil;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
@@ -22,22 +24,22 @@ public class RWDRepositoryUtil {
|
|
|
|
|
|
public static void DoRepository(LogOfRun LogOfRun, RepositoryImpl Repository, boolean load_physical_world) throws Exception {
|
|
|
if (load_physical_world) {
|
|
|
- log.warn("LoadPhysicalWorld");
|
|
|
+ log.warn("********************************" + "\t" + "LoadPhysicalWorld");
|
|
|
RWDLoadUtil.Load_physical_world(LogOfRun, Repository);
|
|
|
- log.warn("LoadReference");
|
|
|
+ log.warn("********************************" + "\t" + "LoadReference");
|
|
|
RWDLoadUtil.LoadReference(Repository);
|
|
|
|
|
|
if (Constant.zkt_physical_world_enable) {
|
|
|
- log.warn("LoadZKTPhysicalWorld");
|
|
|
+ log.warn("********************************" + "\t" + "LoadZKTPhysicalWorld");
|
|
|
RWDLoadUtil.Load_zkt_physical_world(LogOfRun, Repository);
|
|
|
}
|
|
|
|
|
|
if (Constant.ibms_physical_world_enable) {
|
|
|
- log.warn("LoadIBMSPhysicalWorld");
|
|
|
+ log.warn("********************************" + "\t" + "LoadIBMSPhysicalWorld");
|
|
|
RWDLoadUtil.Load_ibms_physical_world(LogOfRun, Repository);
|
|
|
}
|
|
|
if (Constant.info_point_enable) {
|
|
|
- log.warn("LoadInfoPoint");
|
|
|
+ log.warn("********************************" + "\t" + "LoadInfoPoint");
|
|
|
if (Constant.info_point_version.equals("old")) {
|
|
|
RWDLoadUtil.Load_info_point_old(Repository);
|
|
|
} else if (Constant.info_point_version.equals("new")) {
|
|
@@ -45,7 +47,7 @@ public class RWDRepositoryUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- log.warn("LoadAlarm");
|
|
|
+ log.warn("********************************" + "\t" + "LoadAlarm");
|
|
|
if (Constant.alarm_enable) {
|
|
|
RWDLoadUtil.LoadAlarm(Repository, false);
|
|
|
} else {
|
|
@@ -77,8 +79,8 @@ public class RWDRepositoryUtil {
|
|
|
Repository.ZKTSceneArray = RepositoryContainer.instance.ZKTSceneArray;
|
|
|
Repository.ZKTClassArray = RepositoryContainer.instance.ZKTClassArray;
|
|
|
Repository.ZKTObjectArrayDic = RepositoryContainer.instance.ZKTObjectArrayDic;
|
|
|
- Repository.subsystem_connect_status = RepositoryContainer.instance.subsystem_connect_status;
|
|
|
Repository.ZKTAlarmTypeArray = RepositoryContainer.instance.ZKTAlarmTypeArray;
|
|
|
+ Repository.subsystem_connect_status = RepositoryContainer.instance.subsystem_connect_status;
|
|
|
|
|
|
Repository.IBMSGroupArray = RepositoryContainer.instance.IBMSGroupArray;
|
|
|
Repository.IBMSArrayDic = RepositoryContainer.instance.IBMSArrayDic;
|
|
@@ -92,7 +94,7 @@ public class RWDRepositoryUtil {
|
|
|
// 重新构建依赖关系
|
|
|
Repository.refresh_dependency();
|
|
|
|
|
|
- log.warn("LoadConfig");
|
|
|
+ log.warn("********************************" + "\t" + "LoadConfig");
|
|
|
SceneObject sceneObject = new SceneObject();
|
|
|
{
|
|
|
String validPath = Constant.getLatestPath(Constant.config, false);
|
|
@@ -115,16 +117,24 @@ public class RWDRepositoryUtil {
|
|
|
FastJsonUtil.Set_JavaObject(sceneJSON, sceneObject);
|
|
|
Repository.sceneJSON = sceneJSON;
|
|
|
}
|
|
|
+ // 根据信息点是否显示过滤设备类型
|
|
|
+ if (Constant.info_point_version.equals("new")) {
|
|
|
+ try {
|
|
|
+ processFilter(Repository, sceneObject);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
Repository.sceneObject = sceneObject;
|
|
|
|
|
|
Repository.property2SDV_enable = true;
|
|
|
Repository.property2SDV.clear();
|
|
|
ComputeUtil.RefreshRepository(Repository);
|
|
|
List<List<SceneProperty>> spListList = ComputeUtil.computePrepare(Repository);
|
|
|
- log.warn("computeAll");
|
|
|
+ log.warn("********************************" + "\t" + "computeAll");
|
|
|
ComputeUtil.computeAll(Repository, spListList);
|
|
|
|
|
|
- log.warn("refresh calendar weather start");
|
|
|
+ log.warn("********************************" + "\t" + "refresh calendar weather start");
|
|
|
try {
|
|
|
RWDLoadUtil.LoadCalendar(Repository);
|
|
|
} catch (Exception e) {
|
|
@@ -133,14 +143,13 @@ public class RWDRepositoryUtil {
|
|
|
try {
|
|
|
RWDLoadUtil.LoadWeather(Repository);
|
|
|
} catch (Exception e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
}
|
|
|
- log.warn("refresh calendar weather finish");
|
|
|
+ log.warn("********************************" + "\t" + "refresh calendar weather finish");
|
|
|
|
|
|
try {
|
|
|
- log.warn("deamon start");
|
|
|
+ log.warn("********************************" + "\t" + "deamon start");
|
|
|
DeamonUtil.Process_deamon(Repository);
|
|
|
- log.warn("deamon finish");
|
|
|
+ log.warn("********************************" + "\t" + "deamon finish");
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
|
}
|
|
@@ -149,6 +158,111 @@ public class RWDRepositoryUtil {
|
|
|
Repository.property2SDV.clear();
|
|
|
}
|
|
|
|
|
|
+ // 根据信息点是否显示过滤设备类型
|
|
|
+ private static void processFilter(RepositoryImpl Repository, SceneObject sceneObject) throws Exception {
|
|
|
+ Map<String, String> SceneName2Code = new ConcurrentHashMap<String, String>();
|
|
|
+ for (SceneDataObject SceneDataObject : Repository.ZKTSceneArray.set) {
|
|
|
+ String id = (String) SceneDataObject.get("id").value_prim.value;
|
|
|
+ String name = (String) SceneDataObject.get("名称").value_prim.value;
|
|
|
+ String alias = null;
|
|
|
+ if (SceneDataObject.containsKey("别名")) {
|
|
|
+ alias = (String) SceneDataObject.get("别名").value_prim.value;
|
|
|
+ }
|
|
|
+ SceneName2Code.put(name, id);
|
|
|
+ if (alias != null && alias.length() > 0) {
|
|
|
+ String[] aliasArray = alias.split(",");
|
|
|
+ for (String one_alias : aliasArray) {
|
|
|
+ SceneName2Code.put(one_alias, id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, Map<String, Boolean>> SceneClassVisible = new ConcurrentHashMap<String, Map<String, Boolean>>();
|
|
|
+ for (SceneDataObject SceneDataObject : Repository.InfoPointListArray.set) {
|
|
|
+ String ibmsSceneCode = (String) SceneDataObject.get("ibmsSceneCode").value_prim.value;
|
|
|
+ String ibmsClassCode = (String) SceneDataObject.get("ibmsClassCode").value_prim.value;
|
|
|
+ boolean isVisible = (Boolean) SceneDataObject.get("isVisible").value_prim.value;
|
|
|
+ SceneClassVisible.putIfAbsent(ibmsSceneCode, new ConcurrentHashMap<String, Boolean>());
|
|
|
+ SceneClassVisible.get(ibmsSceneCode).putIfAbsent(ibmsClassCode, false);
|
|
|
+ if (isVisible) {
|
|
|
+ SceneClassVisible.get(ibmsSceneCode).put(ibmsClassCode, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String[] parentPathArray = { "基础对象'设备", "基础对象'品质", "基础对象'安全", "基础对象'逻辑编组" };
|
|
|
+ for (String parentPath : parentPathArray) {
|
|
|
+ List<Object> tmpList = PathUtil.getByPath(sceneObject, parentPath);
|
|
|
+ for (Object tmp : tmpList) {
|
|
|
+ SceneProperty spInner = (SceneProperty) tmp;
|
|
|
+ for (SceneObject soScene : spInner.static_array) {
|
|
|
+ String SceneName = null;
|
|
|
+ for (SceneProperty spInner2 : soScene.propertyList) {
|
|
|
+ if (spInner2.propertyName.equals("名称")) {
|
|
|
+ SceneName = spInner2.static_value;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!SceneName2Code.containsKey(SceneName)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String SceneCode = SceneName2Code.get(SceneName);
|
|
|
+
|
|
|
+ SceneProperty equipType = null;
|
|
|
+ for (SceneProperty spInner2 : soScene.propertyList) {
|
|
|
+ if (spInner2.propertyName.equals("设备类型")) {
|
|
|
+ equipType = spInner2;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (equipType == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (SceneObject soEquipType : equipType.static_array) {
|
|
|
+ SceneProperty spList = null;
|
|
|
+ for (SceneProperty spInner2 : soEquipType.propertyList) {
|
|
|
+ if (spInner2.propertyName.equals("清单")) {
|
|
|
+ spList = spInner2;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (spList == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject query_sql = JSON.parseObject(spList.query_sql);
|
|
|
+ JSONObject Target = query_sql.getJSONObject("Target");
|
|
|
+ JSONObject Criteria = query_sql.getJSONObject("Criteria");
|
|
|
+ String ibmsSceneCode = Target.getString("ibmsSceneCode");
|
|
|
+ String ibmsClassCode = Target.getString("ibmsClassCode");
|
|
|
+ if (ibmsSceneCode == null || ibmsClassCode == null) {
|
|
|
+ ibmsSceneCode = Criteria.getString("ibmsSceneCode");
|
|
|
+ ibmsClassCode = Criteria.getString("ibmsClassCode");
|
|
|
+ }
|
|
|
+ if (ibmsSceneCode == null || ibmsClassCode == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!ibmsSceneCode.equals(SceneCode)) {
|
|
|
+ String name = null;
|
|
|
+ for (SceneProperty spInner2 : soEquipType.propertyList) {
|
|
|
+ if (spInner2.propertyName.equals("名称")) {
|
|
|
+ name = spInner2.static_value;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.error(SceneName + " " + SceneCode + " has " + name + " " + ibmsSceneCode + " " + ibmsClassCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!SceneClassVisible.containsKey(ibmsSceneCode) || !SceneClassVisible.get(ibmsSceneCode).containsKey(ibmsClassCode)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ boolean isVisible = SceneClassVisible.get(ibmsSceneCode).get(ibmsClassCode);
|
|
|
+ if (!isVisible) {
|
|
|
+ soEquipType.allow_pass = "0";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private static void parse_general_query(RepositoryImpl Repository, JSONObject custom_object) {
|
|
|
Map<String, JSONObject> general_queryMap = new ConcurrentHashMap<String, JSONObject>();
|
|
|
JSONArray PropertyList = custom_object.getJSONArray("PropertyList");
|