燕山石化溯源三维电子沙盘-【后端】-服务
13693261870
2023-07-14 db44f336e46825afc855466512065cc08e5790bd
src/main/java/com/yssh/controller/WarningAnalyseController.java
@@ -5,7 +5,6 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,23 +12,22 @@
import org.springframework.web.bind.annotation.RestController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yssh.service.IWarningAnalyseService;
import com.yssh.service.WarningAnalyseService;
import com.yssh.utils.Result;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Api(tags = "告警分析")
@RequestMapping("/warning")
@RestController
@SuppressWarnings("rawtypes")
public class WarningAnalyseController {
    @Autowired
    private IWarningAnalyseService warningService;
    @Resource
    private WarningAnalyseService warningService;
    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
@@ -79,15 +77,15 @@
        Object obj = CacheUtils.get(key);
        Map<String, List<Double>> map;
        if (null != obj) {
            map = (Map<String, List<Double>>) obj;
        } else {
            //map = warningService.selectEachLocationDataChange();
            map = warningService.select3Hours();
            if (null != map && map.size() > 0) {
                CacheUtils.put(key, map);
            }
        }
        //if (null != obj) {
        //    map = (Map<String, List<Double>>) obj;
        //} else {
        //map = warningService.selectEachLocationDataChange();
        map = warningService.select3Hours();
        //    if (null != map && map.size() > 0) {
        //        CacheUtils.put(key, map);
        //    }
        //}
        return Result.ok(map);
    }
@@ -98,19 +96,19 @@
    public Result monthTop10() {
        //return Result.OK(warningService.selectThisMonthLocationValueDataTop10());
        String key = dateFormat.format(new Date()) + "_top10";
        Object obj = CacheUtils.get(key);
        //String key = dateFormat.format(new Date()) + "_top10";
        //Object obj = CacheUtils.get(key);
        List<Qxsh> list;
        if (null != obj) {
            list = (List<Qxsh>) obj;
        } else {
            //list = warningService.selectThisMonthLocationValueDataTop10();
            list = warningService.selectMonthTop10();
            if (null != list && list.size() > 0) {
                CacheUtils.put(key, list);
            }
        }
        //if (null != obj) {
        //    list = (List<Qxsh>) obj;
        //} else {
        //list = warningService.selectThisMonthLocationValueDataTop10();
        list = warningService.selectMonthTop10();
        //    if (null != list && list.size() > 0) {
        //        CacheUtils.put(key, list);
        //    }
        //}
        return Result.ok(list);
    }