燕山石化溯源三维电子沙盘-【后端】-服务
1
13693261870
2023-04-27 16278ec6df52c7775134b1657e5ddc7060be0208
1
已修改1个文件
25 ■■■■ 文件已修改
src/main/java/com/yssh/controller/WarningAnalyseController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yssh/controller/WarningAnalyseController.java
@@ -1,5 +1,6 @@
package com.yssh.controller;
import com.yssh.utils.CacheUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -20,7 +21,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Api(tags="告警分析")
@Api(tags = "告警分析")
@RequestMapping("/warning")
@RestController
@SuppressWarnings("rawtypes")
@@ -29,11 +30,7 @@
    @Autowired
    private IWarningAnalyseService warningService;
    private static ConcurrentHashMap<String, Object> cache = new ConcurrentHashMap<>(5);
    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    public static final long CACHE_HOLD_TIME_24H = 24 * 60 * 60 * 1000L;
    /**
     * 1.查询当前时间的所有点位value值(以47.dat查询即可)
@@ -78,13 +75,15 @@
        //return Result.OK(warningService.selectEachLocationDataChange());
        String key = dateFormat.format(new Date()) + "_local";
        Object obj = CacheUtils.get(key);
        Map<String, List<Double>> map;
        if (cache.containsKey(key)) {
            map = (Map<String, List<Double>>) cache.get(key);
        if (null != obj) {
            map = (Map<String, List<Double>>) obj;
        } else {
            map = warningService.selectEachLocationDataChange();
            if (null != map && map.size() > 0) {
                cache.put(key, map);
                CacheUtils.put(key, map);
            }
        }
@@ -98,17 +97,19 @@
        //return Result.OK(warningService.selectThisMonthLocationValueDataTop10());
        String key = dateFormat.format(new Date()) + "_top10";
        Object obj = CacheUtils.get(key);
        List<Map<String, Object>> list;
        if (cache.containsKey(key)) {
            list = (List<Map<String, Object>>) cache.get(key);
        if (null != obj) {
            list = (List<Map<String, Object>>) obj;
        } else {
            list = warningService.selectThisMonthLocationValueDataTop10();
            if (null != list && list.size() > 0) {
                cache.put(key, list);
                CacheUtils.put(key, list);
            }
        }
        return Result.OK(list);
        return Result.ok(list);
    }
    @ApiOperationSupport(order = 5)