| | |
| | | return CalculateUtils.sort(result, "value", true).subList(0, 10); |
| | | } |
| | | |
| | | /** |
| | | * 三小时监测站点数据变化趋势 |
| | | */ |
| | | public Object select3Hours(Date endDate) { |
| | | Integer end = Integer.parseInt(DateUtils.getYyyyMmDdHh(endDate)); |
| | | Date startDate = DateUtils.getAPeriodOfTime(endDate, -2, Calendar.HOUR_OF_DAY); |
| | | Integer start = Integer.parseInt(DateUtils.getYyyyMmDdHh(startDate)); |
| | | |
| | | // List<String> times = DateUtils.get3Hours(); |
| | | List<Qxsh> list = qxshMapper.selectByBeginAndEnd(start, end); |
| | | if (null == list || list.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | /* Map<String, List<Double>> map = new LinkedHashMap<>(); |
| | | for (Qxsh qxsh : list) { |
| | | String name = qxsh.getName(); |
| | | List<Double> values = map.computeIfAbsent(name, k -> new ArrayList<>()); |
| | | values.add(qxsh.getValue()); |
| | | }*/ |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取本月监测大数据站点最大值TOP10 |
| | | */ |
| | | public List<Qxsh> selectMonthTop10() { |
| | | String time = DateUtils.getYyyyMm(new Date()); |
| | | List<Qxsh> list = qxshMapper.selectMonthTop10(time + "%"); |
| | |
| | | return list; |
| | | } |
| | | |
| | | public Map<String, List<Double>> select3Hours() { |
| | | Map<String, List<Double>> map = new LinkedHashMap<>(); |
| | | |
| | | List<String> times = DateUtils.get3Hours(); |
| | | List<Qxsh> list = qxshMapper.select3Hours(times); |
| | | if (null == list || list.isEmpty()) { |
| | | return map; |
| | | } |
| | | |
| | | for (Qxsh qxsh : list) { |
| | | String name = qxsh.getName(); |
| | | List<Double> values = map.computeIfAbsent(name, k -> new ArrayList<>()); |
| | | values.add(qxsh.getValue()); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 根据时间获取报警和预警信息 |
| | | */ |
| | | public List<Report> getAlarmAndWarnByTime(Date beginDate, Date endDate) { |
| | | String strStart = DateUtils.getYyyyMmDdHh(beginDate); |
| | | String strEnd = DateUtils.getYyyyMmDdHh(endDate); |
| | |
| | | } |
| | | |
| | | return dict; |
| | | } |
| | | |
| | | public List<Report> getAlarmAndWarnByTime2(Date begin, Date end) { |
| | | String startTime = DateUtils.getYyyyMmDdHhMmSs(begin); |
| | | String endTime = DateUtils.getYyyyMmDdHhMmSs(end); |
| | | |
| | | List<WarningDetail> rs = new ArrayList<>(); |
| | | List<WarningDetail> rsYj = warningDetailMapper.selectByTimeForYj(startTime, endTime); |
| | | if (null != rsYj && rsYj.size() > 0) rs.addAll(rsYj); |
| | | |
| | | List<WarningDetail> rsBj = warningDetailMapper.selectByTimeForBj(startTime, endTime); |
| | | if (null != rsBj && rsBj.size() > 0) rs.addAll(rsBj); |
| | | |
| | | Hashtable<String, Boolean> dict = new Hashtable<>(); |
| | | List<Report> list = new ArrayList<>(); |
| | | for (WarningDetail wd : rs) { |
| | | /*DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(wd.getTableName(), wd.getSuYuanId()); |
| | | Double lastVal = warningDetailMapper.getLastYearVal(wd.getId()); |
| | | |
| | | int rows = suYuanMapper.isTableExists(wd.getTableName()); |
| | | DistanceSuYuan suMax = null; |
| | | if (rows > 0) { |
| | | MonitorPointPosition point = commonService.select3dCheckPointByName(wd.getLocationName()); |
| | | List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50); |
| | | suMax = suYuanMapper.getSuYuan500Max(wd.getTableName(), ids3d); |
| | | } else { |
| | | suMax = suYuan; |
| | | }*/ |
| | | if (dict.containsKey(wd.getTableName())) { |
| | | if (!dict.get(wd.getTableName())) continue; |
| | | } else { |
| | | Boolean b = suYuanMapper.isTableExists(wd.getTableName()) > 0; |
| | | dict.put(wd.getTableName(), b); |
| | | if (!b) continue; |
| | | } |
| | | |
| | | DistanceSuYuan suYuan = suYuanMapper.getSuYuanById(wd.getTableName(), wd.getSuYuanId()); |
| | | Double lastVal = warningDetailMapper.getLastYearVal(wd.getId()); |
| | | |
| | | MonitorPointPosition point = commonService.select3dCheckPointByName(wd.getLocationName()); |
| | | List<String> ids3d = CalculateUtils.aloneCrosswiseExtend(point, 50); |
| | | DistanceSuYuan suMax = suYuanMapper.getSuYuan500Max(wd.getTableName(), ids3d); |
| | | suMax.setAddr(getAddr(suMax.getId())); |
| | | |
| | | Report report = Report.calcReport(wd, suYuan, suMax); |
| | | report.setLastVal(lastVal); |
| | | |
| | | list.add(report); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | private String getAddr(String id) { |