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;
|
}
|
|
}
|