screen-job/src/main/java/com/moral/api/entity/HistoryAqi.java
@@ -36,8 +36,7 @@ /** * 数据 */ // private String value; private String json; private String value; @Override 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 screen-job/src/main/java/com/moral/api/task/AlarmTask.java
@@ -246,7 +246,7 @@ HistoryAqi historyAqi = null; historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper); if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){ String cityAqiValue = historyAqi.getJson(); String cityAqiValue = historyAqi.getValue(); JSONObject JsonObject = new JSONObject(); JSONObject previousJsonObject = new JSONObject(); previousJsonObject = JSONObject.parseObject(cityAqiValue); @@ -367,7 +367,7 @@ HistoryAqi historyAqi = null; historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper); if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){ String cityAqiValue = historyAqi.getJson(); String cityAqiValue = historyAqi.getValue(); JSONObject JsonObject = new JSONObject(); JSONObject previousJsonObject = new JSONObject(); previousJsonObject = JSONObject.parseObject(cityAqiValue); @@ -488,7 +488,7 @@ HistoryAqi historyAqi = null; historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper); if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){ String cityAqiValue = historyAqi.getJson(); String cityAqiValue = historyAqi.getValue(); JSONObject JsonObject = new JSONObject(); JSONObject previousJsonObject = new JSONObject(); previousJsonObject = JSONObject.parseObject(cityAqiValue); @@ -609,7 +609,7 @@ HistoryAqi historyAqi = null; historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper); if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){ String cityAqiValue = historyAqi.getJson(); String cityAqiValue = historyAqi.getValue(); JSONObject JsonObject = new JSONObject(); JSONObject previousJsonObject = new JSONObject(); previousJsonObject = JSONObject.parseObject(cityAqiValue); @@ -730,7 +730,7 @@ HistoryAqi historyAqi = null; historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper); if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){ String cityAqiValue = historyAqi.getJson(); String cityAqiValue = historyAqi.getValue(); JSONObject JsonObject = new JSONObject(); JSONObject previousJsonObject = new JSONObject(); previousJsonObject = JSONObject.parseObject(cityAqiValue); @@ -851,7 +851,7 @@ HistoryAqi historyAqi = null; historyAqi = historyAqiMapper.selectOne(historyAqiQueryWrapper); if (!com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isEmpty(historyAqi)){ String cityAqiValue = historyAqi.getJson(); String cityAqiValue = historyAqi.getValue(); JSONObject JsonObject = new JSONObject(); JSONObject previousJsonObject = new JSONObject(); previousJsonObject = JSONObject.parseObject(cityAqiValue); screen-job/src/main/java/com/moral/api/task/InformationTask.java
@@ -86,7 +86,7 @@ HistoryAqi beforeHistoryAqi = new HistoryAqi(); beforeHistoryAqi = historyAqiService.getHistoryApiByTimeAndGuid(guid,beforeTime); if (!ObjectUtils.isEmpty(beforeHistoryAqi)){ String value = beforeHistoryAqi.getJson(); String value = beforeHistoryAqi.getValue(); if (!ObjectUtils.isEmpty(value)){ JSONObject jsonObject = new JSONObject(); jsonObject = JSONObject.parseObject(value); @@ -104,7 +104,7 @@ HistoryAqi nowHistoryAqi = new HistoryAqi(); nowHistoryAqi = historyAqiService.getHistoryApiByTimeAndGuid(guid,nowTime); if (!ObjectUtils.isEmpty(nowHistoryAqi)){ String value = nowHistoryAqi.getJson(); String value = nowHistoryAqi.getValue(); if (!ObjectUtils.isEmpty(value)){ JSONObject jsonObject = JSONObject.parseObject(value); if (!ObjectUtils.isEmpty(jsonObject.get("pm2_5"))){