| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.moral.api.entity.CityAqi; |
| | | import com.moral.api.entity.GovMonitorPoint; |
| | | import com.moral.api.entity.HistoryAqi; |
| | | import com.moral.api.mapper.CityAqiMapper; |
| | | import com.moral.api.mapper.HistoryAqiMapper; |
| | | import com.moral.api.service.GovMonitorPointService; |
| | | import com.moral.api.service.HistoryAqiService; |
| | |
| | | |
| | | @Autowired |
| | | private HistoryAqiMapper historyAqiMapper; |
| | | @Autowired |
| | | private CityAqiMapper cityAqiMapper; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value); |
| | | |
| | | historyAqiMapper.insert(historyAqi); |
| | | CityAqi cityAqi = new CityAqi(); |
| | | cityAqi.setCityCode(11111); |
| | | cityAqi.setTime(DateUtils.addHours(time, -1)); |
| | | cityAqi.setValue(JSONObject.toJSONString(map)); |
| | | cityAqiMapper.insert(cityAqi); |
| | | |
| | | }else { |
| | | ResponseEntity<String> response; |
| | | try { |
| | |
| | | //aqi数据存入redis |
| | | redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value); |
| | | historyAqiMapper.insert(historyAqi); |
| | | |
| | | CityAqi cityAqi = new CityAqi(); |
| | | cityAqi.setCityCode(11111); |
| | | cityAqi.setTime(DateUtils.addHours(time, -1)); |
| | | cityAqi.setValue(JSONObject.toJSONString(map)); |
| | | cityAqiMapper.insert(cityAqi); |
| | | } |
| | | |
| | | } |