| | |
| | | String entity = null ; |
| | | Collection<Object> values = null; |
| | | Map<String, Object> data = null; |
| | | try { |
| | | /* try { |
| | | HttpResponse response = HttpUtils.doGet("https://api.epmap.org", "/api/v1/air/city", "GET", |
| | | new HashMap<String, String>() {{put("Authorization", "APPCODE " + "31b6ea8f804a4472be3b633cfee44849");}}, |
| | | new HashMap<String, String>() {{put("city", cityAqiConfig.get("city_name").toString());}} |
| | |
| | | if (!ObjectUtils.isEmpty(data)) { |
| | | values = data.values(); |
| | | pubtime = format.parse(data.get("pubtime").toString()); |
| | | int hours = pubtime.getHours(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | if (hour != hours){ |
| | | pubtime = null; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ObjectUtils.isEmpty(entity) || ObjectUtils.isEmpty(values) || values.contains("None")) { |
| | | }*/ |
| | | if (ObjectUtils.isEmpty(entity) || ObjectUtils.isEmpty(values) || values.contains("None") || pubtime == null) { |
| | | Map<String, Object> mjMap = restTemplate.getForObject("http://sapi.7drlb.com/api/mj?cityID={1}&apiKey=aqi", Map.class, cityAqiConfig.get("city_id")); |
| | | if (ObjectUtils.isEmpty(mjMap)) { |
| | | continue; |