whycrzg
2021-02-19 656bd1b190ed296a7bf63623dc8e9fe2bc9d3098
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
package com.fgkj.controller;
 
import com.fgkj.dto.*;
import com.fgkj.services.Battalarm_dataService;
import com.fgkj.util.*;
import com.google.gson.Gson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Date;
import java.util.List;
 
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
 
@RequestMapping("battAlarmData")
@RestController
@Api(tags = "battAlarmData接口")
public class Battalarm_dataController {
 
    @Resource
    private Battalarm_dataService service;
 
    // private Batt_Maint_Dealarm bmd;
    // private String bads;
 
    //3.1电池告警实时查询
    @PostMapping("byCondition")
    @ApiOperation(notes = "binf.stationName1&binf.stationName 模糊查询 { \"binf\": { \"stationName\": \"\", \"stationName1\": \"\", \"battGroupId\": 0 },\"mainf\": { \"num\": 0, \"battGroupId\": 0, \"uname\": \"\", \"fault_level\": 0, \"fault_type_id\": 0, \"record_uid\": 0, \"maint_type_id\": 0, \"maint_done\": 0, \"maint_close\": 0, \"master_audit\": 0, \"appoint_uid\": 0 },\"pageBean\": { \"pageSize\": 10, \"pageNum\": 0 },\"adata\": { \"alm_id\": 0, \"alm_signal_id\": 0, \"alm_start_time\": \"2021-01-29 09:40:11\", \"alm_start_time1\": \"2021-01-29 09:40:11\" } }", value = "电池告警实时查询")
    public ServiceModel serchByCondition(@RequestBody Batt_Maint_Dealarm bmd) {
        User_inf uinf = (User_inf) ActionUtil.getUser();
        bmd.setUinf(uinf);
        ServiceModel model = service.serchByCondition(bmd);
        return model;
    }
 
    //3.2电池告警历史记录查询
    @PostMapping("byInfo")
    @ApiOperation(notes = "stationName、stationName模糊查询条件 binf.stationName1&binf.stationName 模糊查询 { \"binf\": { \"stationName\": \"\", \"stationName1\": \"\", \"battGroupId\": 0 },\"mainf\": { \"num\": 0, \"battGroupId\": 0, \"fault_level\": 0, \"fault_type_id\": 0, \"record_uid\": 0, \"maint_type_id\": 0, \"maint_done\": 0, \"maint_close\": 0, \"master_audit\": 0, \"appoint_uid\": 0 },\"pageBean\": { \"pageSize\": 10, \"pageNum\": 0 },\"adata\": { \"alm_id\": 0, \"alm_signal_id\": 0, \"alm_start_time\": \"2021-01-29 09:40:11\", \"alm_start_time1\": \"2021-01-29 09:40:11\" } }", value = "电池告警历史记录查询")
    public ServiceModel serchByInfo(@RequestBody Batt_Maint_Dealarm bmd) {
        // bmd = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_Maint_Dealarm.class);
        User_inf uinf = (User_inf) ActionUtil.getUser();
        bmd.setUinf(uinf);
        ServiceModel model = service.serchByInfo(bmd);
        return model;
    }
 
    //0.5查询实时告警数
    @PostMapping("alm")
    @ApiOperation(notes = "stationName 模糊查询", value = "查询实时告警数")
    public ServiceModel serchAlm(@ApiParam(value = "地址 模糊查询条件", required = true) @RequestParam String stationName) {
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        User_inf uinf = (User_inf) ActionUtil.getUser();
        bmd.setUinf(uinf);
        bmd.setBinf(new BattInf());
        bmd.getBinf().setStationName(stationName);
        ServiceModel model = service.serchAlm(bmd);
        return model;
    }
 
    //0.10实时告警记录总数查询
    @GetMapping("realTime")
    @ApiOperation(notes = "", value = "实时告警记录总数查询")
    public ServiceModelOnce serchRealTime() {
        User_inf uinf = (User_inf) ActionUtil.getUser();
        ServiceModelOnce model = service.serchRealTime(uinf);
        return model;
    }
    
    /*// 3.1电池告警实时查询(确认告警)
    public ServiceModel update() {
        ServiceModel model=new ServiceModel();
        if(bads!=null && bads.length()>0){
            Gson gson=new Gson();
            List<Battalarm_data> list=gson.fromJson(bads, new TypeToken<List<Battalarm_data>>(){}.getType());
            model=service.update(list);
        }
        result=ActionUtil.tojson(model);
        return model;
    }*/
 
 
    // 3.1电池告警实时查询(确认告警)
    @PutMapping("/")
    @ApiOperation(notes = "[{ \"num\": 1902, \"alm_is_confirmed\": 0, \"alm_confirmed_time\": \"2021-01-29 09:40:11\", \"stationname\": \"st\", \"note\": \"t\" }]", value = "电池告警实时查询(确认告警)")
    public ServiceModel update(@RequestBody List<Battalarm_data> list) {
        ServiceModel model = new ServiceModel();
        if (list != null && list.size() > 0) {
            model = service.updatePro(list);
        } else {
            model.setCode(0);
        }
        return model;
    }
    /*// 3.1电池告警实时查询(取消告警)
    public ServiceModel cancelalarm() {
        ServiceModel model=new ServiceModel();
        if(bads!=null && bads.length()>0){
            Gson gson=new Gson();
            List<Battalarm_data> list=gson.fromJson(bads, new TypeToken<List<Battalarm_data>>(){}.getType());
            model=service.cancelalarm(list);
        }
        result=ActionUtil.tojson(model);
        return model;
    }*/
 
 
    // 3.1电池告警实时查询(取消告警)
    @PutMapping("/cancel")
    @ApiOperation(notes = "[{ \"num\": 1902, \"record_Id\": 0, \"alm_end_time\": \"2021-01-29 09:40:11\", \"alm_cleared_type\": 0, \"stationname\": \"st\", \"note\": \"t\" }]", value = "电池告警实时查询(取消告警)")
    public ServiceModel cancelalarm(@RequestBody List<Battalarm_data> list) {
        ServiceModel model = new ServiceModel();
        if (list != null && list.size() > 0) {
            model = service.cancelalarmPro(list);
        } else {
            model.setCode(0);
        }
        return model;
    }
 
    //3.1/3.2电池告警查询(删除记录)
    @DeleteMapping("/")
    @ApiOperation(notes = "[{ \"num\": 1902, \"stationname\": \"\", \"note\": \"\" }]", value = "电池告警查询(删除记录)")
    public ServiceModel delete(@RequestBody List<Battalarm_data> list) {
        ServiceModel model = new ServiceModel();
        if (list != null && list.size() > 0) {
            model = service.delete(list);
        } else {
            model.setCode(0);
        }
        return model;
    }
 
    //饼状图电池单体健康率
    @GetMapping("healthRate")
    @ApiOperation(notes = "sum:总单体数 data:单体容量告警和单体告警告警", value = "饼状图电池单体健康率")
    public ServiceModelOnce serchGood() {
        User_inf uinf = (User_inf) ActionUtil.getUser();
        ServiceModelOnce model = service.serchGood(uinf);//单体容量告警和单体告警告警
        return model;
    }
 
    //项目下方的滚动,查询最新电池告警(电池告警和设备告警筛选出最新的一条)(旧版本)
    @GetMapping("topAlm")
    @Deprecated
    @ApiOperation(notes = "Deprecated(旧版本)", value = "项目下方的滚动,查询最新电池告警(电池告警和设备告警筛选出最新的一条)(旧版本)")
    public ServiceModelOnce serchTopAlm() {
//        ServiceModelOnce model=service.serchTopAlm();
        return new ServiceModelOnce();
    }
 
    //项目下方的滚动,查询最新电池告警(电池告警和设备告警筛选出最新的五条)
    @GetMapping("topAlmTen")
    @ApiOperation(notes = "", value = "项目下方的滚动,查询最新电池告警(电池告警和设备告警筛选出最新的五条)")
    public ServiceModel serchTopAlmTen() {
        User_inf uinf = (User_inf) ActionUtil.getUser();
        ServiceModel model = service.serchTopAlmTen(uinf);
        return model;
    }
 
    //点击项目下方的滚动,查询该条告警的实时信息
    @PostMapping("battAlarm")
    @ApiOperation(notes = "", value = "点击项目下方的滚动,查询该条告警的实时信息")
    public ServiceModel serchBatt_alarm(@ApiParam(value = "battGroupId", required = true) @RequestParam Integer battGroupId, @ApiParam(value = "monNum", required = true) @RequestParam Integer monNum, @ApiParam(value = "alm_id", required = true) @RequestParam Integer alm_id, @ApiParam(value = "告警开始时间 格式2021/01/1 09:40:11", required = true) @RequestParam Date alm_start_time) {
        Battalarm_data data = new Battalarm_data();
        data.setBattGroupId(battGroupId);
        data.setMonNum(monNum);
        data.setAlm_id(alm_id);
        data.setAlm_start_time(alm_start_time);
        ServiceModel model = service.serchBatt_alarm(data);
        return model;
    }
 
    //3.1电池告警实时查询<***********跨域专用**************>
    @PostMapping("byCondition_ky")
    @ApiOperation(tags = "跨域", notes = "", value = "电池告警实时查询 跨域专用")
    public ServiceModel serchByCondition_ky(@RequestParam Integer battGroupId) {
        BattInf binf = new BattInf();
        binf.setBattGroupId(battGroupId);
        ServiceModel model = service.serchByCondition_ky(binf);
        return model;
    }
 
    // 3.1电池告警实时查询(确认告警)<***********跨域专用**************>
    @PutMapping("/ky")
    @ApiOperation(tags = "跨域", notes = "[{ \"num\": 1902, \"alm_is_confirmed\": 0, \"alm_confirmed_time\": \"2021-01-29 09:40:11\", \"stationname\": \"st\", \"note\": \"t\" }]", value = "电池告警实时查询(确认告警) 跨域专用")
    public ServiceModel update_ky(@RequestBody List<Battalarm_data> list) {
        ServiceModel model = new ServiceModel();
        if (list != null && list.size() > 0) {
            model = service.updatePro(list);//和update 共用
        } else {
            model.setCode(0);
        }
        return model;
    }
 
    // 3.1电池告警实时查询(取消告警)<***********跨域专用**************>
    @PutMapping("/cancelAlarm_ky")
    @ApiOperation(tags = "跨域", notes = "[{ \"num\": 1902, \"record_Id\": 0, \"alm_end_time\": \"2021-01-29 09:40:11\", \"alm_cleared_type\": 0, \"stationname\": \"st\", \"note\": \"t\" }]", value = "电池告警实时查询(取消告警) 跨域专用")
    public ServiceModel cancelalarm_ky(@RequestBody List<Battalarm_data> list) {
        ServiceModel model = new ServiceModel();
        if (list != null && list.size() > 0) {
            model = service.cancelalarmPro(list);
        } else {
            model.setCode(0);
        }
        return model;
    }
 
    //3.1/3.2电池告警查询(删除记录)<***********跨域专用**************>
    @DeleteMapping("/ky")
    @ApiOperation(tags = "跨域", notes = "[{ \"num\": 1902, \"stationname\": \"\", \"note\": \"\" }]", value = "电池告警查询(删除记录) 跨域专用")
    public ServiceModel delete_ky(@RequestBody List<Battalarm_data> list) {
        ServiceModel model = new ServiceModel();
        if (list != null && list.size() > 0) {
            model = service.delete(list);
        } else {
            model.setCode(0);
        }
        return model;
    }
 
}