| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void insertHistoryAqi() { |
| | | RestTemplate restTemplate = new RestTemplate(); |
| | | //获取aqi城市配置 |
| | |
| | | //数据存入数据库 |
| | | historyAqiMapper.insert(historyAqi); |
| | | //存入redis |
| | | redisTemplate.opsForHash().putAll(RedisConstants.AQI_DATA + cityCode, value); |
| | | redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, cityCode, value); |
| | | } |
| | | } |
| | | } |