From 6603fc3acb402c8ec6e3cef50960ab0eba778215 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Fri, 20 Sep 2024 15:20:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E6=B5=81=E7=A8=8B=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/service/task/DataProducerTask.java | 78 +++++++++---------- .../system/api/alarm/AlarmRulesApiImpl.java | 9 ++- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/task/DataProducerTask.java b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/task/DataProducerTask.java index 2b831ab..5067db1 100644 --- a/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/task/DataProducerTask.java +++ b/imt-server/imt-module-data/imt-module-data-biz/src/main/java/com/inspur/module/data/service/task/DataProducerTask.java @@ -23,45 +23,45 @@ public class DataProducerTask implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { -// Timer timer1 = new Timer(); -// timer1.schedule(new TimerTask() { -// @Override -// public void run() { -// threadPoolTaskExecutor.execute(new Channel1DataProcess()); -// } -// },1000,10000); -// -// Timer timer2 = new Timer(); -// timer2.schedule(new TimerTask() { -// @Override -// public void run() { -// threadPoolTaskExecutor.execute(new Channel2DataProcess()); -// } -// },5000,10000); -// -// Timer timer3 = new Timer(); -// timer3.schedule(new TimerTask() { -// @Override -// public void run() { -// threadPoolTaskExecutor.execute(new Channel3DataProcess()); -// } -// },10000,10000); -// -// Timer timer4 = new Timer(); -// timer4.schedule(new TimerTask() { -// @Override -// public void run() { -// threadPoolTaskExecutor.execute(new Channel4DataProcess()); -// } -// },14000,10000); -// -// Timer timer5 = new Timer(); -// timer5.schedule(new TimerTask() { -// @Override -// public void run() { -// threadPoolTaskExecutor.execute(new Channel5DataProcess()); -// } -// },19000,10000); + Timer timer1 = new Timer(); + timer1.schedule(new TimerTask() { + @Override + public void run() { + threadPoolTaskExecutor.execute(new Channel1DataProcess()); + } + },1000,10000); + + Timer timer2 = new Timer(); + timer2.schedule(new TimerTask() { + @Override + public void run() { + threadPoolTaskExecutor.execute(new Channel2DataProcess()); + } + },5000,10000); + + Timer timer3 = new Timer(); + timer3.schedule(new TimerTask() { + @Override + public void run() { + threadPoolTaskExecutor.execute(new Channel3DataProcess()); + } + },10000,10000); + + Timer timer4 = new Timer(); + timer4.schedule(new TimerTask() { + @Override + public void run() { + threadPoolTaskExecutor.execute(new Channel4DataProcess()); + } + },14000,10000); + + Timer timer5 = new Timer(); + timer5.schedule(new TimerTask() { + @Override + public void run() { + threadPoolTaskExecutor.execute(new Channel5DataProcess()); + } + },19000,10000); } } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java index 21475e5..73839d1 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/api/alarm/AlarmRulesApiImpl.java @@ -158,7 +158,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{ updateData.setAlarmDataId(alarmData.getAlarmDataId()); updateData.setAlarmValue(value); updateData.setLastAlarmTime(LocalDateTime.now()); - updateData.setAlarmLevel(rule.getAlarmLevel()); + updateData.setAlarmLevel(rule.getAlarmLevel() < alarmData.getAlarmLevel() ? rule.getAlarmLevel() : alarmData.getAlarmLevel()); updateData.setEquipId(rule.getEquipId()); updateData.setReasonDescription(rule.getReasonDescription()); alarmDataService.updateAlarmData(updateData); @@ -168,7 +168,8 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{ * 设备报警数据更新 */ private String refreshEquipAlarmData(AlarmRulesRespDTO rule){ - List equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),null); + //TODO 查询时要查询趋势报警信息 + List equipAlarmData = equipAlarmDataService.getEquipAlarmDataByEquipId(rule.getEquipId(),0); if(equipAlarmData == null || equipAlarmData.size() == 0){ return equipAlarmDataService.createEquipAlarmData(new EquipAlarmDataSaveReqVO(null,rule.getEquipId(), rule.getComponentId(),rule.getAlarmLevel(),0,LocalDateTime.now(),LocalDateTime.now(),0,null)); @@ -176,7 +177,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{ //如果没有则新增 EquipAlarmDataSaveReqVO updateData = new EquipAlarmDataSaveReqVO(); updateData.setEquipAlarmId(equipAlarmData.get(0).getEquipAlarmId()); - updateData.setAlarmLevel(rule.getAlarmLevel()); + updateData.setAlarmLevel(rule.getAlarmLevel() < equipAlarmData.get(0).getAlarmLevel() ? rule.getAlarmLevel() : equipAlarmData.get(0).getAlarmLevel()); updateData.setLatestAlarmTime(LocalDateTime.now()); equipAlarmDataService.updateEquipAlarmData(updateData); return equipAlarmData.get(0).getEquipAlarmId(); @@ -195,7 +196,7 @@ public class AlarmRulesApiImpl implements AlarmRulesApi{ //如果没有则新增 EquipAlarmDataSaveReqVO updateData = new EquipAlarmDataSaveReqVO(); updateData.setEquipAlarmId(equipAlarmData.get(0).getEquipAlarmId()); - updateData.setAlarmLevel(rule.getAlarmLevel()); + updateData.setAlarmLevel(rule.getAlarmLevel() < equipAlarmData.get(0).getAlarmLevel() ? rule.getAlarmLevel() : equipAlarmData.get(0).getAlarmLevel()); updateData.setLatestAlarmTime(LocalDateTime.now()); // updateData.setEquipAnalyseStatus(judgeEquipAnalyzeStatusByAlarmLevel(rule.getAlarmLevel())); equipAlarmDataService.updateEquipAlarmData(updateData);