| | |
| | | package com.yssh.service.impl; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | |
| | | @Autowired |
| | | private IAsyncService asyncService; |
| | | |
| | | private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH"); |
| | | |
| | | @Override |
| | | @Async("threadPoolTaskExecutor") |
| | | public void insertWarningDetails(List<WarningDetail> warning) throws Exception { |
| | |
| | | if (StringUtils.isNull(dictRecord)) { |
| | | nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY); |
| | | } |
| | | List<WarningDetail> list = alarmAnalyseOperation(nowDate); |
| | | |
| | | //List<WarningDetail> list = alarmAnalyseOperation(nowDate); |
| | | |
| | | List<WarningDetail> list = new ArrayList<>(); |
| | | Calendar calendar = getCalendar(nowDate); |
| | | for (int i = 0; i < 3; i++) { |
| | | calendar.add(Calendar.HOUR, -1); |
| | | List<WarningDetail> rs = alarmAnalyseOperation(calendar.getTime()); |
| | | if (null != rs && rs.size() > 0) { |
| | | list.addAll(rs); |
| | | } |
| | | } |
| | | |
| | | list.forEach(s -> { |
| | | result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue())); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | private Calendar getCalendar(Date nowDate) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(nowDate); |
| | | calendar.add(Calendar.HOUR, 1); |
| | | |
| | | return calendar; |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (StringUtils.isNull(dictRecord)) { |
| | | nowDate = DateUtils.getAPeriodOfTime(nowDate, -1, Calendar.HOUR_OF_DAY); |
| | | } |
| | | List<WarningDetail> list = warningAnalyseOperation(nowDate); |
| | | |
| | | //List<WarningDetail> list = warningAnalyseOperation(nowDate); |
| | | List<WarningDetail> list = new ArrayList<>(); |
| | | Calendar calendar = getCalendar(nowDate); |
| | | for (int i = 0; i < 3; i++) { |
| | | calendar.add(Calendar.HOUR, -1); |
| | | List<WarningDetail> rs = warningAnalyseOperation(calendar.getTime()); |
| | | if (null != rs && rs.size() > 0) { |
| | | list.addAll(rs); |
| | | } |
| | | } |
| | | |
| | | list.forEach(s -> { |
| | | result.add(new WarningVo(s.getLocationName(), s.getSuYuanId(), 0.0, 0.0, s.getValue())); |
| | | }); |
| | |
| | | |
| | | @Override |
| | | public Map<String, List<Double>> selectEachLocationDataChange() { |
| | | Map<String, List<Double>> result = new LinkedHashMap<>(); |
| | | /*Map<String, List<Double>> result = new LinkedHashMap<>(); |
| | | List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d(); |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate)); |
| | |
| | | result.put(c.getName(), values); |
| | | } |
| | | }); |
| | | return result;*/ |
| | | |
| | | Map<String, List<Double>> result = new LinkedHashMap<>(); |
| | | List<MonitorPointPosition> checkPoints = commonService.getCheckPoints3d(); |
| | | |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | Long endTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, nowDate)); |
| | | Long startTime = Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHH, DateUtils.getAPeriodOfTime(nowDate, -3, Calendar.HOUR_OF_DAY))); |
| | | List<DictRecord> recordList = dictRecordMapper.selectByTimeDictRecordList(startTime, endTime); |
| | | |
| | | List<String> tableNames = new ArrayList<>(); |
| | | for(DictRecord dr : recordList){ |
| | | if (suYuanMapper.isTableExists(dr.getTableName())>0){ |
| | | tableNames.add(dr.getTableName()); |
| | | } |
| | | } |
| | | if (tableNames.isEmpty()){ |
| | | return result; |
| | | } |
| | | |
| | | for(MonitorPointPosition c : checkPoints){ |
| | | List<Double> values = new ArrayList<>(); |
| | | List<SuYuanMonitorData> data = suYuanMapper.getMonitorData(tableNames, c.getId()); |
| | | data.forEach(v -> { |
| | | values.add(v.getValue()); |
| | | }); |
| | | result.put(c.getName(), values); |
| | | } |
| | | return result; |
| | | } |
| | | |