| | |
| | | List<Map<String, Object>> result = historyMapper.getAVGSensorRankByMonitorPointIdList(sensor, monitorPointIdList, before5Time, endTime);
|
| | | return result;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> gitHourlyAQIByMonitorPointIdAndTimeslot(Map<String, Object> parameters) {
|
| | | String monitor_point_id = parameters.get("monitor_point_id").toString();
|
| | | //获取日期
|
| | | LocalDate localDate = LocalDate.now();
|
| | | Calendar c = Calendar.getInstance();//可以对每个时间域单独修改
|
| | | int endHour = c.get(Calendar.HOUR_OF_DAY);
|
| | | String endTime = localDate+" "+endHour+":00:00";
|
| | | |
| | | String startTime;
|
| | | if(endHour == 0) {
|
| | | LocalDate startDate = localDate.minusDays(1);
|
| | | startTime = startDate+" "+"23:00:00";
|
| | | }else {
|
| | | int startHour = endHour-1;
|
| | | startTime = localDate+" "+startHour+":00:00";
|
| | | }
|
| | | Map<String, Object> map = historyMapper.getMonitorPointAVGValueByMonitorPointIdAndTimeslot(monitor_point_id, startTime, endTime);
|
| | | System.out.println(map);
|
| | | Map<String, Object> returnMap = new HashMap<>();
|
| | | if (map.isEmpty()) {
|
| | | returnMap.put("AQI", "N/V");
|
| | | } else {
|
| | | Map<String, Double> AQIMap = new HashMap<>();
|
| | | for (Map.Entry<String, Object> entry : map.entrySet()) {
|
| | | String key = entry.getKey();
|
| | | Double value = Double.parseDouble(entry.getValue().toString());
|
| | | AQIMap.put(key, value);
|
| | | }
|
| | | returnMap = AQICalculation.hourlyAQI(AQIMap);
|
| | | }
|
| | | |
| | | return returnMap;
|
| | | }
|
| | | }
|