| | |
| | | @Autowired |
| | | private SensorService sensorService; |
| | | |
| | | private static Map<String, String> senorMap = new HashMap<>(); |
| | | private static final Map<String, String> senorMap = new HashMap<>(); |
| | | |
| | | static { |
| | | senorMap.put(Constants.SENSOR_CODE_PM25, "PM2_5"); |
| | |
| | | } |
| | | Map<String, Object> cityDataMap = new HashMap<>(); |
| | | //本市数据 |
| | | cityDataMap.put("name", cityValue); |
| | | cityDataMap.put("value", cityValue); |
| | | cityDataList.add(cityDataMap); |
| | | } |
| | | |
| | |
| | | allDeviceSum = Double.parseDouble(o.toString()); |
| | | } |
| | | |
| | | List<HistoryMonthly> preofessionDeviceHistoryMonthlyList = professionDataMap.get(resultTime); |
| | | List<HistoryMonthly> professionDeviceHistoryMonthlyList = professionDataMap.get(resultTime); |
| | | //贡献率 |
| | | String contributionRate = null; |
| | | Double professionAvg = null; |
| | | if (!ObjectUtils.isEmpty(preofessionDeviceHistoryMonthlyList)) { |
| | | if (!ObjectUtils.isEmpty(professionDeviceHistoryMonthlyList)) { |
| | | //该行业均值计算 |
| | | professionAvg = historyMonthlyService.calculatedValue(preofessionDeviceHistoryMonthlyList, sensorCode, "avg"); |
| | | professionAvg = historyMonthlyService.calculatedValue(professionDeviceHistoryMonthlyList, sensorCode, "avg"); |
| | | //该行业累加值计算 |
| | | Double professionSum = historyMonthlyService.calculatedValue(preofessionDeviceHistoryMonthlyList, sensorCode, "sum"); |
| | | Double professionSum = historyMonthlyService.calculatedValue(professionDeviceHistoryMonthlyList, sensorCode, "sum"); |
| | | //行业贡献率计算 |
| | | NumberFormat numberFormat = NumberFormat.getInstance(); |
| | | numberFormat.setMaximumFractionDigits(2); |
| | |
| | | } |
| | | |
| | | //行业均值 |
| | | timeDataMap.put("name", professionAvg == null ? null : AmendUtils.sciCal(professionAvg, 0)); |
| | | timeDataMap.put("value", professionAvg == null ? null : AmendUtils.sciCal(professionAvg, 0)); |
| | | //贡献率 |
| | | timeDataMap.put("value", contributionRate); |
| | | timeDataMap.put("name", contributionRate); |
| | | dataList.add(timeDataMap); |
| | | } |
| | | professionMap.put("data", dataList); |
| | |
| | | } |
| | | Map<String, Object> cityDataMap = new HashMap<>(); |
| | | //本市数据 |
| | | cityDataMap.put("name", cityValue); |
| | | cityDataMap.put("value", cityValue); |
| | | cityDataList.add(cityDataMap); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //行业均值 |
| | | timeDataMap.put("name", professionAvg == null ? null : AmendUtils.sciCal(professionAvg, 0)); |
| | | timeDataMap.put("value", professionAvg == null ? null : AmendUtils.sciCal(professionAvg, 0)); |
| | | //贡献率 |
| | | timeDataMap.put("value", contributionRate); |
| | | timeDataMap.put("name", contributionRate); |
| | | dataList.add(timeDataMap); |
| | | } |
| | | professionMap.put("data", dataList); |
| | |
| | | } |
| | | Map<String, Object> cityDataMap = new HashMap<>(); |
| | | //本市数据 |
| | | cityDataMap.put("name", cityValue); |
| | | cityDataMap.put("value", cityValue); |
| | | cityDataList.add(cityDataMap); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //行业均值 |
| | | timeDataMap.put("name", professionAvg == null ? null : AmendUtils.sciCal(professionAvg, 0)); |
| | | timeDataMap.put("value", professionAvg == null ? null : AmendUtils.sciCal(professionAvg, 0)); |
| | | //贡献率 |
| | | timeDataMap.put("value", contributionRate); |
| | | timeDataMap.put("name", contributionRate); |
| | | dataList.add(timeDataMap); |
| | | } |
| | | professionMap.put("data", dataList); |