| | |
| | | String body = response.getBody(); |
| | | Map<String, Object> data = JSONObject.parseObject(body, Map.class); |
| | | Map<String, Object> map = (Map<String, Object>) data.get("data"); |
| | | if (ObjectUtils.isEmpty(map)) { |
| | | continue; |
| | | } |
| | | HistoryAqi historyAqi = new HistoryAqi(); |
| | | historyAqi.setGuid(guid); |
| | | historyAqi.setTime(time); |
| | |
| | | redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public HistoryAqi getHistoryApiByTimeAndGuid(String guid, String time) { |
| | | QueryWrapper<HistoryAqi> wrapper_historyAqi = new QueryWrapper<>(); |
| | | wrapper_historyAqi.eq("guid",guid).eq("time",time); |
| | | HistoryAqi historyAqi = new HistoryAqi(); |
| | | if (historyAqiMapper.selectCount(wrapper_historyAqi)==1){ |
| | | historyAqi = historyAqiMapper.selectOne(wrapper_historyAqi); |
| | | } |
| | | return historyAqi; |
| | | } |
| | | } |