jinpengyong
2021-07-15 371a381267699280f45748c13ed42faba66b6577
screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
@@ -13,6 +13,7 @@
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;
@@ -43,6 +44,7 @@
    private RedisTemplate redisTemplate;
    @Override
    @Transactional
    public void insertHistoryAqi() {
        RestTemplate restTemplate = new RestTemplate();
        //获取aqi城市配置
@@ -72,7 +74,7 @@
            //数据存入数据库
            historyAqiMapper.insert(historyAqi);
            //存入redis
            redisTemplate.opsForHash().putAll(RedisConstants.AQI_DATA + cityCode, value);
            redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, cityCode, value);
        }
    }
}