cjl
2023-09-26 c0c80bebcc93e90834e06404d6056322e51b02dd
screen-api/src/main/java/com/moral/api/service/impl/CityAqiMonthlyServiceImpl.java
@@ -25,14 +25,7 @@
import java.text.DecimalFormat;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.OptionalDouble;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.DoubleStream;
@@ -126,7 +119,7 @@
        CityAqiMonthly cityAqiMonthly = cityAqiMonthlyMapper.selectOne(cityAqiMonthlyQueryWrapper);
        Double compositeIndex = null;
        String compositeIndexYearOnYear = null;
        Integer pm25 = null;
        Double pm25 = null;
        String pm25YearOnYear = null;
        if (cityAqiMonthly != null) {
            Map<String, Object> aqiMap = JSONObject.parseObject(cityAqiMonthly.getValue(), Map.class);
@@ -145,7 +138,7 @@
            //3.PM2.5浓度
            if (aqiMap.get("PM2_5") != null) {
                pm25 = Integer.parseInt(aqiMap.get("PM2_5").toString());
                pm25 = Objects.nonNull(aqiMap.get("PM2_5"))?Double.parseDouble(aqiMap.get("PM2_5").toString()):0d;
            }
            currentRankingResult.put("PM2_5", pm25 + "ug/m³");
@@ -183,7 +176,7 @@
        Map<Integer, Map<String, Object>> monthlyCumulativeResult = null;
        Double cityCompositeIndex = null;
        String cityCompositeIndexYearOnYear = null;
        Integer cityPM25 = null;
        Double cityPM25 = null;
        String cityPM25YearOnYear = null;
        if (!"1".equals(month)) {
            Map<String, Object> cumulativeRankingResult = new HashMap<>();
@@ -201,7 +194,7 @@
                        cityCompositeIndexYearOnYear = cityMap.get("compositeIndex_yearOnYear").toString();
                    }
                    //地级市PM2.5
                    cityPM25 = (int) Double.parseDouble(cityMap.get("PM2_5").toString());
                    cityPM25 = Double.parseDouble(cityMap.get("PM2_5").toString());
                    if (cityMap.get("PM2_5_yearOnYear") != null) {
                        cityPM25YearOnYear = cityMap.get("PM2_5_yearOnYear").toString();
                    }
@@ -944,7 +937,7 @@
     * @param pm25YearOnYear           中心城区(地级市)pm2.5同比
     * @description 获取本期所有县市区与中心城区(地级市)因子对比情况
     */
    private Map<String, Object> getAreaCurrentMonthResult(Map<Integer, String> areasMap, List<CityAqiMonthly> areaData, Double compositeIndex, String compositeIndexYearOnYear, Integer pm25, String pm25YearOnYear) {
    private Map<String, Object> getAreaCurrentMonthResult(Map<Integer, String> areasMap, List<CityAqiMonthly> areaData, Double compositeIndex, String compositeIndexYearOnYear, Double pm25, String pm25YearOnYear) {
        Map<String, Object> result = new HashMap<>();
        result.put("compositeIndex", compositeIndex);
        result.put("compositeIndexYearOnYear", compositeIndexYearOnYear);