jinpengyong
2021-11-03 267c20d552dbce24bce0a0d59a106f49f879ab62
screen-job/src/main/java/com/moral/api/service/impl/CityAqiServiceImpl.java
@@ -110,19 +110,19 @@
                if (cityAqis.size() >= 6) {
                    OptionalDouble average = cityAqis.parallelStream().flatMapToDouble(v -> {
                        Map<String, Object> dataValue = JSONObject.parseObject((String) v.get("value"), Map.class);
                        double o3 = Double.parseDouble(dataValue.get("o3").toString());
                        double o3 = Double.parseDouble(dataValue.get("O3").toString());
                        return DoubleStream.of(o3);
                    }).average();
                    if (average.isPresent()) {
                        double o3_8h = AmendUtils.sciCal(average.getAsDouble(), 0);
                        aqi.put("o3_8h", o3_8h);
                        double O3_8H = AmendUtils.sciCal(average.getAsDouble(), 0);
                        aqi.put("O3_8H", O3_8H);
                    }
                }
            }
            //综合指数计算
            Map<String, Object> temp = new HashMap<>(aqi);
            temp.put("o3", temp.get("o3_8h"));
            temp.put("O3", temp.get("O3_8H"));
            Double compositeIndex = ComprehensiveIndexUtils.dailyData(temp);
            aqi.put("compositeIndex", compositeIndex);
@@ -136,7 +136,7 @@
            sixParamMap.put("a21026",aqi.get("SO2"));
            AQI aqiAndPollutant = AQIUtils.hourlyAQI(sixParamMap);
            if (!ObjectUtils.isEmpty(aqiAndPollutant.getPrimaryPollutantNames())) {
                aqi.put("pollutant",aqiAndPollutant.getPrimaryPollutantNames());
                aqi.put("primaryPollutant", aqiAndPollutant.getPrimaryPollutantNames());
            }
            CityAqi cityAqi = new CityAqi();