| | |
| | | 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 { |
| | |
| | | for (List<WarningDetail> corpReserveList : list) { |
| | | asyncService.executeAsync("", corpReserveList, warningDetailMapper, countDownLatch); |
| | | } |
| | | countDownLatch.await(); |
| | | countDownLatch.await(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<WarningVo> getRunTimeAlarmAnalyse() { |
| | | List<WarningVo> result = new ArrayList<>(); |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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(); |
| | |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public List<WarningDetail> warningAnalyseOperation(Date date) { |
| | | List<WarningDetail> result = new ArrayList<WarningDetail>(); |
| | | String time = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, date); |
| | |
| | | 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(); |
| | |
| | | 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); |
| | | } |
| | | }); |
| | |
| | | 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(); |