jinpengyong
2021-12-22 b085a13260ad46142af47cd58ac641c69a354cb1
screen-job/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
@@ -86,7 +86,7 @@
            }
            HistoryAqi historyAqi = new HistoryAqi();
            historyAqi.setGuid(guid);
            historyAqi.setTime(time);
            historyAqi.setTime(DateUtils.addHours(time, -1));
            //存入数据库
            historyAqi.setValue(JSONObject.toJSONString(map));
            historyAqiMapper.insert(historyAqi);
@@ -126,4 +126,15 @@
            redisTemplate.opsForHash().put(RedisConstants.AQI_DATA, guid, value);
        }
    }
    @Override
    public HistoryAqi getHistoryApiByTimeAndGuid(String guid, String time) {
        QueryWrapper<HistoryAqi> wrapper_historyAqi = new QueryWrapper<>();
        wrapper_historyAqi.eq("guid", guid).eq("time", time);
        HistoryAqi historyAqi = new HistoryAqi();
        if (historyAqiMapper.selectCount(wrapper_historyAqi) == 1) {
            historyAqi = historyAqiMapper.selectOne(wrapper_historyAqi);
        }
        return historyAqi;
    }
}