燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-07-27 e02280936bc490681b25c37805d8c202353a3c69
1
已修改2个文件
42 ■■■■ 文件已修改
src/main/java/com/yssh/controller/WeatherController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/service/WarningAnalyseService.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/WeatherController.java
@@ -61,7 +61,7 @@
            }
            //List<Weather> list = weatherService.query(begin, end);
            String key = CacheUtils.getMd5("weatherService.query_" + begin + "_" + end);
            String key = CacheUtils.getMd5("weatherService.query." + begin + "." + end);
            List<Weather> list = CacheUtils.getListByKey(key);
            if (null == list) {
                list = weatherService.query(begin, end);
src/main/java/com/yssh/service/WarningAnalyseService.java
@@ -8,6 +8,7 @@
import com.yssh.mapper.QxshMapper;
import com.yssh.mapper.SuYuanMapper;
import com.yssh.mapper.WarningDetailMapper;
import com.yssh.utils.CacheUtils;
import com.yssh.utils.CalculateUtils;
import com.yssh.utils.DateUtils;
import com.yssh.utils.StringUtils;
@@ -125,9 +126,16 @@
        Integer start = Integer.parseInt(DateUtils.getYyyyMmDdHh(startDate));
        //  List<String> times = DateUtils.get3Hours();
        List<Qxsh> list = qxshMapper.select3Hours(start, end);
        if (null == list || list.isEmpty()) {
            return null;
        //List<Qxsh> list = qxshMapper.select3Hours(start, end);
        //if (null == list || list.isEmpty()) {
        //    return null;
        //}
        String key = "qxshMapper.select3Hours." + start + "." + end;
        List<Qxsh> list = CacheUtils.getListByKey(key);
        if (null == list) {
            list = qxshMapper.select3Hours(start, end);
            CacheUtils.putListByKey(key, list);
        }
        /* Map<String, List<Double>> map = new LinkedHashMap<>();
@@ -145,7 +153,14 @@
     */
    public List<Qxsh> selectMonthTop10() {
        String time = DateUtils.getYyyyMm(new Date());
        List<Qxsh> list = qxshMapper.selectMonthTop10(time + "%");
        //List<Qxsh> list = qxshMapper.selectMonthTop10(time + "%");
        String key = "qxshMapper.selectMonthTop10." + time;
        List<Qxsh> list = CacheUtils.getListByKey(key);
        if (null == list) {
            list = qxshMapper.selectMonthTop10(time + "%");
            CacheUtils.putListByKey(key, list);
        }
        return list;
    }
@@ -163,7 +178,13 @@
        Integer intMon = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, mon) + "00"); // 2023080700
        Integer intSun = Integer.parseInt(DateUtils.parseDateToStr(DateUtils.YYYYMMDD, sun) + "23"); // 2023081323
        List<Qxsh> list = qxshMapper.selectWeekTop10(intMon, intSun);
        //List<Qxsh> list = qxshMapper.selectWeekTop10(intMon, intSun);
        String key = "qxshMapper.selectWeekTop10." + intMon + "." + intSun;
        List<Qxsh> list = CacheUtils.getListByKey(key);
        if (null == list) {
            list = qxshMapper.selectWeekTop10(intMon, intSun);
            CacheUtils.putListByKey(key, list);
        }
        return list;
    }
@@ -173,7 +194,14 @@
     */
    public List<Qxsh> selectDayTop10() {
        String time = DateUtils.getYyyyMmDd(new Date());
        List<Qxsh> list = qxshMapper.selectDayTop10(time + "%");
        //List<Qxsh> list = qxshMapper.selectDayTop10(time + "%");
        String key = "qxshMapper.selectDayTop10." + time;
        List<Qxsh> list = CacheUtils.getListByKey(key);
        if (null == list) {
            list = qxshMapper.selectDayTop10(time + "%");
            CacheUtils.putListByKey(key, list);
        }
        return list;
    }