| | |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | | import com.moral.pojo.AQI; |
| | | import com.moral.util.AQIUtils; |
| | | import com.moral.util.RegionCodeUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | } |
| | | if (i<curHour24){ |
| | | O3_8h = (double)Math.round(O3_8hList.stream().mapToDouble(aDouble ->aDouble).summaryStatistics().getAverage()); |
| | | if (O3_8hList.size()>0){ |
| | | O3_8h = (double)Math.round(O3_8hList.stream().mapToDouble(aDouble ->aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | } |
| | | } |
| | | oneGovMonitorPointOneHourData.put("O3_8h_"+govMonitorPointId,O3_8h); |
| | |
| | | break; |
| | | } |
| | | } |
| | | Double PM2_5Avg_daliy = (double)Math.round(PM2_5List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | Double PM10Avg_daliy = (double)Math.round(PM10List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | Double SO2Avg_daliy = (double)Math.round(SO2List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | Double NO2Avg_daliy = (double)Math.round(NO2List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | Double COAvg_daliy = new BigDecimal(COList_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | Double O3_1hAvg_daliy = (double)Math.round(O3_1hList_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | Double O3_8hAvg_daliy = (double)Math.round(O3_8hList_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | Double PM2_5Avg_daliy = null; |
| | | Double PM10Avg_daliy = null; |
| | | Double SO2Avg_daliy = null; |
| | | Double NO2Avg_daliy = null; |
| | | Double COAvg_daliy = null; |
| | | Double O3_1hAvg_daliy = null; |
| | | Double O3_8hAvg_daliy = null; |
| | | if (PM2_5List_daliy.size()>0){ |
| | | PM2_5Avg_daliy = (double)Math.round(PM2_5List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | if (PM10List_daliy.size()>0){ |
| | | PM10Avg_daliy = (double)Math.round(PM10List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | if (SO2List_daliy.size()>0){ |
| | | SO2Avg_daliy = (double)Math.round(SO2List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | if (NO2List_daliy.size()>0){ |
| | | NO2Avg_daliy = (double)Math.round(NO2List_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | if (COList_daliy.size()>0){ |
| | | COAvg_daliy = new BigDecimal(COList_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); |
| | | } |
| | | if (O3_1hList_daliy.size()>0){ |
| | | O3_1hAvg_daliy = (double)Math.round(O3_1hList_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | if (O3_8hList_daliy.size()>0){ |
| | | O3_8hAvg_daliy = (double)Math.round(O3_8hList_daliy.stream().mapToDouble(aDouble -> aDouble).summaryStatistics().getAverage()); |
| | | } |
| | | hour_AVG.put("a34004_"+govMonitorPointId,PM2_5Avg_daliy); |
| | | hour_AVG.put("a34002_"+govMonitorPointId,PM10Avg_daliy); |
| | | hour_AVG.put("a21026_"+govMonitorPointId,SO2Avg_daliy); |
| | |
| | | if (!ObjectUtils.isEmpty(PM2_5)){ |
| | | AQIMap.put("a05024",O3_1h); |
| | | } |
| | | Map<String,Object> AQIResultMap = new HashMap<>(); |
| | | AQI aqi = new AQI(); |
| | | if (AQIMap.size()!=0){ |
| | | AQIResultMap = AQIUtils.hourlyAqi_pollutant(AQIMap); |
| | | aqi = AQIUtils.hourlyAQI(AQIMap); |
| | | } |
| | | Map<String,Object> avgMap = new HashMap<>(); |
| | | avgMap.put("a34004_"+"0",PM2_5); |
| | |
| | | avgMap.put("a21005_"+"0",CO); |
| | | avgMap.put("a05024_"+"0",O3_1h); |
| | | avgMap.put("O3_8h_"+"0",O3_8h); |
| | | if (!ObjectUtils.isEmpty(AQIResultMap.get("aqi"))){ |
| | | avgMap.put("aqi",AQIResultMap.get("aqi")); |
| | | if (!ObjectUtils.isEmpty(aqi.getAQIValue())){ |
| | | avgMap.put("aqi",aqi.getAQIValue()); |
| | | }else { |
| | | avgMap.put("aqi",""); |
| | | } |
| | | if (!ObjectUtils.isEmpty(AQIResultMap.get("pollutant"))){ |
| | | if (Integer.parseInt(AQIResultMap.get("aqi").toString())>50){ |
| | | String pollutant = AQIResultMap.get("pollutant").toString(); |
| | | if (!ObjectUtils.isEmpty(aqi.getPrimaryPollutantNames())){ |
| | | if (Integer.parseInt(aqi.getAQIValue().toString())>50){ |
| | | String pollutant = aqi.getPrimaryPollutantNames().toString(); |
| | | pollutant = pollutant.replace("[",""); |
| | | pollutant = pollutant.replace("]",""); |
| | | avgMap.put("pollutant",pollutant); |