jinpengyong
2022-12-13 4d927073d6d7c26ecf4e5163e14e827a1afa7f8d
screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
@@ -73,7 +73,7 @@
        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);
        List<HistoryAqi> historyAqis = new ArrayList<>();
//        List<HistoryAqi> historyAqis = new ArrayList<>();
        for (GovMonitorPoint govMonitorPoint : govMonitorPoints) {
            HistoryAqi historyAqi = new HistoryAqi();
@@ -96,10 +96,9 @@
                historyAqi.setGuid(guid);
                historyAqi.setTime(DateUtils.addHours(time, -1));
                //存入数据库
//                historyAqi.setValue(JSONObject.toJSONString(map));
               historyAqi.setJson(JSONObject.toJSONString(map));
                historyAqi.setValue(JSONObject.toJSONString(map));
                historyAqis.add(historyAqi);
//                historyAqis.add(historyAqi);
                Map<String, Object> value = new HashMap<>();
                Object pm2_5 = map.get("pm2_5");
@@ -134,6 +133,8 @@
                //aqi数据存入redis
                redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value);
                historyAqiMapper.insert(historyAqi);
            }else {
                ResponseEntity<String> response;
                try {
@@ -151,9 +152,9 @@
                historyAqi.setGuid(guid);
                historyAqi.setTime(DateUtils.addHours(time, -1));
                //存入数据库
                historyAqi.setJson(JSONObject.toJSONString(map));
                historyAqi.setValue(JSONObject.toJSONString(map));
                historyAqis.add(historyAqi);
//                historyAqis.add(historyAqi);
                Map<String, Object> value = new HashMap<>();
                Object pm2_5 = map.get("pm2_5");
@@ -188,11 +189,12 @@
                //aqi数据存入redis
                redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value);
                historyAqiMapper.insert(historyAqi);
            }
        }
        //存入数据库
        historyAqiMapper.insertHistoryAqi(historyAqis);
//        historyAqiMapper.insertHistoryAqi(historyAqis);
    }
    @Override