|
@@ -419,7 +419,7 @@ public class RWDAlarmUtil {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public static void chixushijian(SimpleDateFormat sdf, Date currentTime, SceneDataObject sdoInner) {
|
|
|
+ public static synchronized void chixushijian(SimpleDateFormat sdf, Date currentTime, SceneDataObject sdoInner) {
|
|
|
String triggerTime = (String) sdoInner.get("triggerTime").value_prim.value;
|
|
|
String duration;
|
|
|
long keep_time;
|
|
@@ -457,7 +457,7 @@ public class RWDAlarmUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static synchronized void ProcessAlarm_comment(String id, JSONObject dtoJSON) {
|
|
|
+ public static synchronized void exe_ProcessAlarm_comment(String id, JSONObject dtoJSON) {
|
|
|
SceneDataSet alarmList = RepositoryContainer.RepositoryProject.alarmArray;
|
|
|
for (int i = 0; i < alarmList.set.size(); i++) {
|
|
|
SceneDataObject sdoInner = (SceneDataObject) alarmList.set.get(i);
|
|
@@ -471,7 +471,15 @@ public class RWDAlarmUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static synchronized void ProcessAlarm(JSONObject alarm) {
|
|
|
+ public static void ProcessAlarm_comment(String id, JSONObject dtoJSON) {
|
|
|
+ JSONObject AlarmJob = new JSONObject();
|
|
|
+ AlarmJob.put("type", "comment");
|
|
|
+ AlarmJob.put("id", id);
|
|
|
+ AlarmJob.put("dtoJSON", dtoJSON);
|
|
|
+ RepositoryContainer.RepositoryProject.alarmBuffer.offer(AlarmJob, 16384);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static synchronized void exe_ProcessAlarm(JSONObject alarm, boolean addWaitCompute) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
|
|
Date currentTime = new Date();
|
|
|
String id = (String) alarm.get("id");
|
|
@@ -575,7 +583,7 @@ public class RWDAlarmUtil {
|
|
|
}
|
|
|
|
|
|
RepositoryImpl Repository = RepositoryContainer.instance;
|
|
|
- if (Repository.enable_factor) {
|
|
|
+ if (addWaitCompute && Repository.enable_factor) {
|
|
|
if (alarmArrayRowChange) {
|
|
|
Repository.addWaitCompute(RepositoryContainer.RepositoryProject.alarmArray);
|
|
|
} else {
|
|
@@ -607,7 +615,14 @@ public class RWDAlarmUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static synchronized void ProcessOrderDesc(String id, JSONObject alarm_order) {
|
|
|
+ public static void ProcessAlarm(JSONObject alarm) {
|
|
|
+ JSONObject AlarmJob = new JSONObject();
|
|
|
+ AlarmJob.put("type", "alarm");
|
|
|
+ AlarmJob.put("alarm", alarm);
|
|
|
+ RepositoryContainer.RepositoryProject.alarmBuffer.offer(AlarmJob, 16384);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static synchronized void exe_ProcessOrderDesc(String id, JSONObject alarm_order) {
|
|
|
for (SceneDataObject sdo : RepositoryContainer.RepositoryProject.alarmArray.set) {
|
|
|
String idInner = (String) sdo.get("id").value_prim.value;
|
|
|
if (idInner.equals(id)) {
|
|
@@ -632,12 +647,31 @@ public class RWDAlarmUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static synchronized int refresh() throws Exception {
|
|
|
+ public static void ProcessOrderDesc(String id, JSONObject alarm_order) {
|
|
|
+ JSONObject AlarmJob = new JSONObject();
|
|
|
+ AlarmJob.put("type", "order");
|
|
|
+ AlarmJob.put("id", id);
|
|
|
+ AlarmJob.put("alarm_order", alarm_order);
|
|
|
+ RepositoryContainer.RepositoryProject.alarmBuffer.offer(AlarmJob, 16384);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static synchronized void exe_refresh(JSONArray Content) throws Exception {
|
|
|
RepositoryContainer.RepositoryProject.alarmArray.set.clear();
|
|
|
for (String objId : RepositoryContainer.RepositoryProject.id2alarmList.keySet()) {
|
|
|
RepositoryContainer.RepositoryProject.id2alarmList.get(objId).value_array.set.clear();
|
|
|
RepositoryContainer.RepositoryProject.id2alarmCount.get(objId).value_prim.value = 0;
|
|
|
}
|
|
|
+ for (int i = 0; i < Content.size(); i++) {
|
|
|
+ JSONObject alarm = Content.getJSONObject(i);
|
|
|
+ RWDAlarmUtil.exe_ProcessAlarm(alarm, false);
|
|
|
+ }
|
|
|
+ RepositoryContainer.instance.recomputeAlarm();
|
|
|
+ }
|
|
|
+
|
|
|
+ public static int refresh() throws Exception {
|
|
|
+ JSONObject AlarmJob = new JSONObject();
|
|
|
+ AlarmJob.put("type", "refresh");
|
|
|
+ RepositoryContainer.RepositoryProject.alarmBuffer.offer(AlarmJob, 16384);
|
|
|
|
|
|
JSONArray Content;
|
|
|
if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
|
|
@@ -731,8 +765,9 @@ public class RWDAlarmUtil {
|
|
|
log.error(e.getMessage(), e);
|
|
|
log.error(LogUtil.GetExceptionStackTrace(e));
|
|
|
}
|
|
|
- RWDAlarmUtil.ProcessAlarm(alarm);
|
|
|
}
|
|
|
+
|
|
|
+ AlarmJob.put("Content", Content);
|
|
|
return Content.size();
|
|
|
}
|
|
|
|
|
@@ -812,6 +847,10 @@ public class RWDAlarmUtil {
|
|
|
String post_result = HttpClientUtil.instance("alarm").post(Constant.alarm_url + "/alarmToWorkOrder/transfer",
|
|
|
handleJSON.toJSONString());
|
|
|
result = JSON.parseObject(post_result);
|
|
|
+ String resultString = result.getString("Result");
|
|
|
+ if (!resultString.equals("success")) {
|
|
|
+ throw new Exception(result.toJSONString());
|
|
|
+ }
|
|
|
}
|
|
|
{
|
|
|
JSONObject handleJSON = new JSONObject();
|
|
@@ -822,6 +861,10 @@ public class RWDAlarmUtil {
|
|
|
String post_result = HttpClientUtil.instance("alarm").put(Constant.alarm_url + "/alarm-record/handleAlarm",
|
|
|
handleJSON.toJSONString());
|
|
|
result = JSON.parseObject(post_result);
|
|
|
+ String resultString = result.getString("Result");
|
|
|
+ if (!resultString.equals("success")) {
|
|
|
+ throw new Exception(result.toJSONString());
|
|
|
+ }
|
|
|
}
|
|
|
if (paramJSON.containsKey("comment") && paramJSON.containsKey("userId")) {
|
|
|
JSONObject commentJSON = new JSONObject();
|