kaiyu
2022-02-18 ddaee239feb428cc426396a742c9d992d5983548
screen-api
更改优良天变化率正负号
2 files modified
23 ■■■■■ changed files
screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/DataPercentRange.java 1 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/CityAqiYearlyServiceImpl.java 22 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/pojo/dto/cityAQI/DataPercentRange.java
@@ -12,6 +12,7 @@
@Data
public class DataPercentRange {
    /*
     * 对应的浓度/指数/天数
     * */
screen-api/src/main/java/com/moral/api/service/impl/CityAqiYearlyServiceImpl.java
@@ -118,7 +118,13 @@
        String percent = null;
        if(cityPollutionLevelCompare!=null){
            Integer compareFineDays = cityPollutionLevelCompare.getExcellentWeatherDays() + cityPollutionLevelCompare.getGoodWeatherDays();
            percent = (fineDays - compareFineDays) + " 天";
            Integer percentInt = fineDays - compareFineDays;
            if (percentInt > 0) {
                percent = "+" + percentInt + " 天";
            } else {
                percent = percentInt + " 天";
            }
        }
        //计算省内排名
        Integer provinceRange = null;
@@ -286,31 +292,31 @@
        Double pm2_5 = calculateSensorYOY(dataMap, compareDataMap, "PM2_5");
        if (pm2_5 != null)
            result.put("PM2_5", pm2_5.intValue() + " μg/m³");
            result.put("PM2_5", pm2_5.intValue() > 0 ? "+" + pm2_5.intValue() + " μg/m³" : pm2_5.intValue() + " μg/m³");
        Double pm10 = calculateSensorYOY(dataMap, compareDataMap, "PM10");
        if (pm10 != null)
            result.put("PM10", pm10.intValue() + " μg/m³");
            result.put("PM10", pm10.intValue() > 0 ? "+" + pm10.intValue() + " μg/m³" : pm10.intValue() + " μg/m³");
        Double so2 = calculateSensorYOY(dataMap, compareDataMap, "SO2");
        if (so2 != null)
            result.put("SO2", so2.intValue() + " μg/m³");
            result.put("SO2", so2.intValue() > 0 ? "+" + so2.intValue() + " μg/m³" : so2.intValue() + " μg/m³");
        Double no2 = calculateSensorYOY(dataMap, compareDataMap, "NO2");
        if (no2 != null)
            result.put("NO2", no2.intValue() + " μg/m³");
            result.put("NO2", no2.intValue() > 0 ? "+" + no2.intValue() + " μg/m³" : no2.intValue() + " μg/m³");
        Double o3 = calculateSensorYOY(dataMap, compareDataMap, "O3");
        if (o3 != null)
            result.put("O3", o3.intValue() + " μg/m³");
            result.put("O3", o3.intValue() > 0 ? "+" + o3.intValue() + " μg/m³" : o3.intValue() + " μg/m³");
        Double co = calculateSensorYOY(dataMap, compareDataMap, "CO");
        if (co != null) {
            co = AmendUtils.sciCal(co, 1);
            result.put("CO", co + " mg/m³");
            result.put("CO", co.intValue() > 0 ? "+" + co.intValue() + " mg/m³" : co.intValue() + " mg/m³");
        }
        //计算综合指数同比数据
@@ -321,7 +327,7 @@
        if (compositeIndex != null && compareCompositeIndex != null) {
            Double compareResult = MathUtils.division(compositeIndex - compareCompositeIndex, compareCompositeIndex, 3);
            compareResult = MathUtils.mul(compareResult, 100);
            result.put("compositeIndex", compareResult + "%");
            result.put("compositeIndex", compareResult > 0 ? "+" + compareResult + " %" : compareResult + " %");
        }
        if (result.size() != 7)
            return null;