|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RedisTemplate redisTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void insertCityAqi() { | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | Date time = DateUtils.dataToTimeStampTime(now, DateUtils.yyyy_MM_dd_HH_EN); | 
|---|
|  |  |  | String format = DateUtils.yyyy_MM_dd_EN; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Date start = null; | 
|---|
|  |  |  | if (DateUtils.getHour(time) == 0 || DateUtils.getHour(time) >= 8) { | 
|---|
|  |  |  | if (DateUtils.getHour(time) >= 7) { | 
|---|
|  |  |  | start = DateUtils.addHours(time, -7); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Map<String, Object> map = (Map<String, Object>) data.get("data"); | 
|---|
|  |  |  | Map<String, Object> aqi = (Map<String, Object>) map.get("aqi"); | 
|---|
|  |  |  | aqi.put("PM2_5", aqi.remove("pm25C")); | 
|---|
|  |  |  | aqi.remove("pm25"); | 
|---|
|  |  |  | aqi.remove("pm10"); | 
|---|
|  |  |  | aqi.remove("so2"); | 
|---|
|  |  |  | aqi.remove("no2"); | 
|---|
|  |  |  | aqi.remove("co"); | 
|---|
|  |  |  | aqi.remove("o3"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | aqi.put("PM2_5", aqi.remove("pm25C")); | 
|---|
|  |  |  | aqi.put("PM10", aqi.remove("pm10C")); | 
|---|
|  |  |  | aqi.put("SO2", aqi.remove("so2C")); | 
|---|
|  |  |  | aqi.put("NO2", aqi.remove("no2C")); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //首要污染物计算 | 
|---|
|  |  |  | Map<String, Object> sixParamMap = new HashMap<>(); | 
|---|
|  |  |  | sixParamMap.put("a34002", aqi.get("PM10")); | 
|---|
|  |  |  | sixParamMap.put("a34004", aqi.get("PM2_5")); | 
|---|
|  |  |  | sixParamMap.put("a21004", aqi.get("NO2")); | 
|---|
|  |  |  | sixParamMap.put("a21005", aqi.get("CO")); | 
|---|
|  |  |  | sixParamMap.put("a05024", aqi.get("O3")); | 
|---|
|  |  |  | sixParamMap.put("a21026", aqi.get("SO2")); | 
|---|
|  |  |  | sixParamMap.put(Constants.SENSOR_CODE_PM25, aqi.get("PM2_5")); | 
|---|
|  |  |  | sixParamMap.put(Constants.SENSOR_CODE_PM10, aqi.get("PM10")); | 
|---|
|  |  |  | sixParamMap.put(Constants.SENSOR_CODE_SO2, aqi.get("SO2")); | 
|---|
|  |  |  | sixParamMap.put(Constants.SENSOR_CODE_NO2, aqi.get("NO2")); | 
|---|
|  |  |  | sixParamMap.put(Constants.SENSOR_CODE_CO, aqi.get("CO")); | 
|---|
|  |  |  | sixParamMap.put(Constants.SENSOR_CODE_O3, aqi.get("O3")); | 
|---|
|  |  |  | AQI aqiAndPollutant = AQIUtils.hourlyAQI(sixParamMap); | 
|---|
|  |  |  | if (!ObjectUtils.isEmpty(aqiAndPollutant.getPrimaryPollutantNames())) { | 
|---|
|  |  |  | aqi.put("primaryPollutant", aqiAndPollutant.getPrimaryPollutantNames()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | aqi.put("primaryPollutant", aqiAndPollutant.getPrimaryPollutantNames()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CityAqi cityAqi = new CityAqi(); | 
|---|
|  |  |  | cityAqi.setCityCode(cityCode); | 
|---|