|  |  | 
 |  |  | import com.moral.constant.Constants; | 
 |  |  | import com.moral.constant.RedisConstants; | 
 |  |  | import com.moral.util.DateUtils; | 
 |  |  | import com.xxl.job.core.context.XxlJobHelper; | 
 |  |  |  | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | 
 |  |  |         List<GovMonitorPoint> govMonitorPoints = govMonitorPointService.list(queryWrapper); | 
 |  |  |         Date time = DateUtils.dataToTimeStampTime(new Date(), DateUtils.yyyy_MM_dd_HH_EN); | 
 |  |  |         String timeStr = DateUtils.dateToDateString(time, DateUtils.yyyy_MM_dd_HH_mm_ss_EN); | 
 |  |  | //        String timeStr = DateUtils.dateToDateString(DateUtils.addHours(time, -1), DateUtils.yyyy_MM_dd_HH_mm_ss_EN); | 
 |  |  |  | 
 |  |  | //        List<HistoryAqi> historyAqis = new ArrayList<>(); | 
 |  |  |         List<HistoryAqi> historyAqis = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |         for (GovMonitorPoint govMonitorPoint : govMonitorPoints) { | 
 |  |  |             HistoryAqi historyAqi = new HistoryAqi(); | 
 |  |  | 
 |  |  |                 //存入数据库 | 
 |  |  |                 historyAqi.setValue(JSONObject.toJSONString(map)); | 
 |  |  |  | 
 |  |  | //                historyAqis.add(historyAqi); | 
 |  |  |                 historyAqis.add(historyAqi); | 
 |  |  |  | 
 |  |  |                 Map<String, Object> value = new HashMap<>(); | 
 |  |  |                 Object pm2_5 = map.get("pm2_5"); | 
 |  |  | 
 |  |  |                     value.put(Constants.SENSOR_CODE_O3, o3); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //aqi数据存入redis | 
 |  |  |                 redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value); | 
 |  |  |  | 
 |  |  |                 historyAqiMapper.insert(historyAqi); | 
 |  |  | //                historyAqiMapper.insert(historyAqi); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             }else { | 
 |  |  |                 ResponseEntity<String> response; | 
 |  |  |                 try { | 
 |  |  | 
 |  |  |                 //存入数据库 | 
 |  |  |                 historyAqi.setValue(JSONObject.toJSONString(map)); | 
 |  |  |  | 
 |  |  | //                historyAqis.add(historyAqi); | 
 |  |  |                 historyAqis.add(historyAqi); | 
 |  |  |  | 
 |  |  |                 Map<String, Object> value = new HashMap<>(); | 
 |  |  |                 Object pm2_5 = map.get("pm2_5"); | 
 |  |  | 
 |  |  |  | 
 |  |  |                 //aqi数据存入redis | 
 |  |  |                 redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value); | 
 |  |  |                 historyAqiMapper.insert(historyAqi); | 
 |  |  | //                historyAqiMapper.insert(historyAqi); | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         if (ObjectUtils.isEmpty(historyAqis)){ | 
 |  |  |             XxlJobHelper.log("数据不存在"); | 
 |  |  |         } | 
 |  |  |         //存入数据库 | 
 |  |  | //        historyAqiMapper.insertHistoryAqi(historyAqis); | 
 |  |  |         historyAqiMapper.insertHistoryAqi(historyAqis); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override |