whyclxw
3 天以前 0765476c28433c40aaba975eec8477ca09fb1ab2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package com.whyc.controller;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.constant.BattSingalIdEnum;
import com.whyc.dto.AnalysisAlm.AnalysisChangeRes;
import com.whyc.dto.Param.AlmAnalyseDto;
import com.whyc.dto.Response;
import com.whyc.pojo.db_alarm.BattalarmData;
import com.whyc.pojo.db_param.AppParam;
import com.whyc.service.*;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.text.ParseException;
import java.util.List;
 
@RequestMapping("analysis")
@RestController
@Api(tags = "预警分析管理")
public class AnalysisAlmController {
    @Autowired
    private BattalarmDataService battalarmDataService;
 
    @Autowired
    private PwrdevAlarmService pwrdevAlarmService;
 
    @Autowired
    private AlmAnalysisParamService almAnalysisParamService;
 
    @Autowired
    private DevalarmDataService  devalarmDataService;
 
    @Autowired
    private AppParamService appParamService;
 
    @PostMapping("getBattAlmAnalyse")
    @ApiOperation("预警分析管理-电池告警")
    public Response getBattAlmAnalyse(@RequestBody AlmAnalyseDto dto){
        Integer uid= ActionUtil.getUser().getId();
        dto.setUid(uid);
        return battalarmDataService.getBattAlmAnalyse(dto);
    }
 
    @PostMapping("getDevAlmAnalyse")
    @ApiOperation("预警分析管理-设备告警")
    public Response getDevAlmAnalyse(@RequestBody AlmAnalyseDto dto){
        Integer uid= ActionUtil.getUser().getId();
        dto.setUid(uid);
        return devalarmDataService.getDevAlmAnalyse(dto);
    }
 
    @PostMapping("getPwrtAlmAnalyse")
    @ApiOperation("预警分析管理-电源告警")
    public Response getPwrtAlmAnalyse(@RequestBody AlmAnalyseDto dto){
        Integer uid=ActionUtil.getUser().getId();
        dto.setUid(uid);
        return pwrdevAlarmService.getPwrtAlmAnalyse(dto);
    }
 
    @GetMapping("getHisRealInAlm")
    @ApiOperation("预警分析管理-电源主属性和分析属性")
    public Response getHisRealInAlm(@RequestParam Integer battgroupId,@RequestParam Integer powerId,@RequestParam String startTime,@RequestParam(required = false) Integer almId) throws ParseException, InterruptedException {
        return almAnalysisParamService.getHisRealInAlm(battgroupId,powerId,startTime,almId);
    }
 
    @PostMapping("getHisRealWithChage")
    @ApiOperation("预警分析管理-切换时间间隔和副属性")
    public Response getHisRealWithChage(@RequestBody AnalysisChangeRes res) throws ParseException, InterruptedException {
        return almAnalysisParamService.getHisRealWithChage(res);
    }
 
    @PostMapping("getAlmSummaryParam")
    @ApiOperation("预警分析管理-查询所有的属性对应关系")
    public Response getAlmSummaryParam(){
        return almAnalysisParamService.getAlmSummaryParam();
    }
 
    @GetMapping("updateAlarmAnalysisCycle")
    @ApiOperation("预警分析管理-设置时间间隔")
    public Response updateAlarmAnalysisCycle(@RequestParam Integer intervalTime){
        return appParamService.updateAlarmAnalysisCycle(intervalTime);
    }
 
    @GetMapping("getAlarmAnalysisCycle")
    @ApiOperation("预警分析管理-查询时间间隔")
    public Response getAlarmAnalysisCycle(){
        AppParam appParam= appParamService.getAlarmAnalysisCycle();
        return new Response().setII(1,appParam!=null,appParam,"查询时间间隔");
    }
}