燕山石化溯源三维电子沙盘-【后端】-服务
4
13693261870
2023-07-29 450688a18ced81ec1bd77a535492b12548249e69
src/main/java/com/yssh/controller/WarningAnalyseController.java
@@ -60,64 +60,34 @@
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "每日预警、报警数量变化趋势", notes = "一周每日预警、报警数量统计,返回参数alarmDayCount为一周每日报警统计数量列表,参数warningDayCount为一周每日预警统计数量列表")
    @ApiOperation(value = "一周预警报警数量变化趋势", notes = "一周预警报警数量变化趋势,返回参数alarmDayCount为一周每日报警统计数量列表,参数warningDayCount为一周每日预警统计数量列表")
    @GetMapping("/everydayCount")
    public Result everydayCount() {
        return Result.OK(warningService.countEverydayAlarmAndWarning());
    public Result everydayCount(@RequestParam(value = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        Date endDate = null == date ? new Date() : date;
        return Result.OK(warningService.everydayCount(endDate));
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "三小时监测站点数据变化趋势", notes = "返回值为三小时监测站点监测数据,返回值为map集合,其中key为站点名称,value为list集合,保存每天监测数值数据")
    @GetMapping("/locationDataChange")
    public Result locationDataChange() {
        //return Result.OK(warningService.selectEachLocationDataChange());
        String key = DateUtils.getYyyyMmDd(new Date()) + "_local";
        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);
        //    }
        //}
        return Result.ok(map);
    public Result locationDataChange(@RequestParam(value = "end", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date date) {
        Date endDate = null == date ? new Date() : date;
        return Result.OK(warningService.select3Hours(endDate));
    }
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "获取本月监测大数据站点最大值TOP10", notes = "获取本月监测大数据站点最大值TOP10数量列表")
    @GetMapping("/monthTop10")
    public Result monthTop10() {
        //return Result.OK(warningService.selectThisMonthLocationValueDataTop10());
        //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);
        //    }
        //}
        return Result.ok(list);
        return Result.ok(warningService.selectMonthTop10());
    }
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "根据时间获取报警和预警信息", notes = "根据时间获取报警和预警信息")
    @GetMapping("/getAlarmAndWarnByTime")
    public Result getAlarmAndWarnByTime(
            @RequestParam(value = "begin", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date begin,
            @RequestParam(value = "end", required = true) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end) {
            @RequestParam(value = "begin") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date begin,
            @RequestParam(value = "end") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date end) {
        if (null == begin || null == end) {
            return Result.error(null);
        }