From d09e34040a6855c99d930d1b57c7254cf545ead8 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 25 四月 2023 17:25:07 +0800 Subject: [PATCH] 1 --- src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java | 54 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java b/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java index 16a278b..ef2a200 100644 --- a/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java +++ b/src/main/java/com/yssh/service/impl/WarningAnalyseServiceImpl.java @@ -37,25 +37,25 @@ public class WarningAnalyseServiceImpl implements IWarningAnalyseService { protected final Logger logger = LoggerFactory.getLogger(this.getClass()); - + @Autowired private WarningDetailMapper warningDetailMapper; - + @Autowired - private AlertConfigMapper alertConfigMapper; - + private AlertConfigMapper alertConfigMapper; + @Autowired private ICommonService commonService; - + @Autowired private SuYuanMapper suYuanMapper; - + @Autowired private DictRecordMapper dictRecordMapper; - + @Autowired - private IAsyncService asyncService; - + private IAsyncService asyncService; + @Override @Async("threadPoolTaskExecutor") public void insertWarningDetails(List<WarningDetail> warning) throws Exception { @@ -65,9 +65,9 @@ for (List<WarningDetail> corpReserveList : list) { asyncService.executeAsync("", corpReserveList, warningDetailMapper, countDownLatch); } - countDownLatch.await(); + countDownLatch.await(); } - + @Override public List<WarningVo> getRunTimeAlarmAnalyse() { List<WarningVo> result = new ArrayList<>(); @@ -78,7 +78,9 @@ nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY); } List<WarningDetail> list = alarmAnalyseOperation(nowDate); - list.forEach(s -> {result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));}); + list.forEach(s -> { + result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue())); + }); return result; } @@ -92,7 +94,9 @@ nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY); } List<WarningDetail> list = warningAnalyseOperation(nowDate); - list.forEach(s -> {result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue()));}); + list.forEach(s -> { + result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue())); + }); return result; } @@ -104,7 +108,7 @@ if (StringUtils.isNull(dictRecord)) { return result; } - String tableName =dictRecord.getTableName(); + String tableName = dictRecord.getTableName(); List<SuYuan2d> list = suYuanMapper.getAlarmsAnalyse(tableName, ids); list.forEach(s -> { String locationName = commonService.select3dCheckPointById(s.getId()).getName(); @@ -112,7 +116,7 @@ }); return result; } - + public List<WarningDetail> warningAnalyseOperation(Date date) { List<WarningDetail> result = new ArrayList<WarningDetail>(); String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date); @@ -121,7 +125,7 @@ if (StringUtils.isNull(dictRecord)) { return result; } - String tableName =dictRecord.getTableName(); + String tableName = dictRecord.getTableName(); List<SuYuan2d> list = suYuanMapper.getWarningAnalyse(tableName, ids); list.forEach(s -> { String locationName = commonService.select3dCheckPointById(s.getId()).getName(); @@ -198,12 +202,16 @@ Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY))); List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); checkPoints.forEach(c -> { - List<String> tableNames = new ArrayList<>(); - recordList.forEach(r -> {tableNames.add(r.getTableName());}); - List<Double> values = new ArrayList<>(); + List<String> tableNames = new ArrayList<>(); + recordList.forEach(r -> { + tableNames.add(r.getTableName()); + }); + List<Double> values = new ArrayList<>(); if (StringUtils.isNotNull(tableNames)) { List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId()); - data.forEach(v -> {values.add(v.getValue());}); + data.forEach(v -> { + values.add(v.getValue()); + }); result.put(c.getName(), values); } }); @@ -218,8 +226,10 @@ Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getMonthEnd())); List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); checkPoints.forEach(c -> { - List<String> tableNames = new ArrayList<>(); - recordList.forEach(r -> {tableNames.add(r.getTableName());}); + List<String> tableNames = new ArrayList<>(); + recordList.forEach(r -> { + tableNames.add(r.getTableName()); + }); Map<String, Object> map = suYuanMapper.getMonthValueDataMax(tableNames, c.getId()); if (StringUtils.isNotNull(map) && StringUtils.isNotEmpty(map)) { String suYuanId = map.get("id").toString(); -- Gitblit v1.9.3