| | |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.RedisConstants; |
| | | import com.moral.pojo.AQI; |
| | | import com.moral.util.AQIUtils; |
| | | import com.moral.util.RegionCodeUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | if (!ObjectUtils.isEmpty(PM2_5)){ |
| | | AQIMap.put("a05024",O3_1h); |
| | | } |
| | | Map<String,Object> AQIResultMap = new HashMap<>(); |
| | | AQI aqi = new AQI(); |
| | | if (AQIMap.size()!=0){ |
| | | AQIResultMap = AQIUtils.hourlyAqi_pollutant(AQIMap); |
| | | aqi = AQIUtils.hourlyAQI(AQIMap); |
| | | } |
| | | Map<String,Object> avgMap = new HashMap<>(); |
| | | avgMap.put("a34004_"+"0",PM2_5); |
| | |
| | | avgMap.put("a21005_"+"0",CO); |
| | | avgMap.put("a05024_"+"0",O3_1h); |
| | | avgMap.put("O3_8h_"+"0",O3_8h); |
| | | if (!ObjectUtils.isEmpty(AQIResultMap.get("aqi"))){ |
| | | avgMap.put("aqi",AQIResultMap.get("aqi")); |
| | | if (!ObjectUtils.isEmpty(aqi.getAQIValue())){ |
| | | avgMap.put("aqi",aqi.getAQIValue()); |
| | | }else { |
| | | avgMap.put("aqi",""); |
| | | } |
| | | if (!ObjectUtils.isEmpty(AQIResultMap.get("pollutant"))){ |
| | | if (Integer.parseInt(AQIResultMap.get("aqi").toString())>50){ |
| | | String pollutant = AQIResultMap.get("pollutant").toString(); |
| | | if (!ObjectUtils.isEmpty(aqi.getPrimaryPollutantNames())){ |
| | | if (Integer.parseInt(aqi.getAQIValue().toString())>50){ |
| | | String pollutant = aqi.getPrimaryPollutantNames().toString(); |
| | | pollutant = pollutant.replace("[",""); |
| | | pollutant = pollutant.replace("]",""); |
| | | avgMap.put("pollutant",pollutant); |