|
@@ -5,24 +5,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gyee.alarm.init.CacheContext;
|
|
|
import com.gyee.alarm.model.auto.*;
|
|
|
-import com.gyee.alarm.model.vo.AjaxResult;
|
|
|
-import com.gyee.alarm.model.vo.AjaxStatus;
|
|
|
-import com.gyee.alarm.model.vo.AlarmCustomType;
|
|
|
-import com.gyee.alarm.model.vo.AlarmRuleVo;
|
|
|
+import com.gyee.alarm.model.vo.*;
|
|
|
import com.gyee.alarm.service.AlarmRuleService;
|
|
|
|
|
|
-import com.gyee.alarm.service.TokenService;
|
|
|
+import com.gyee.alarm.service.auto.IProEconAlarmTypeService;
|
|
|
import com.gyee.alarm.util.ExcelUtils;
|
|
|
import com.gyee.alarm.util.SnowflakeGenerator;
|
|
|
import com.gyee.alarm.util.StringUtils;
|
|
|
|
|
|
import com.gyee.common.util.DateUtils;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import org.codehaus.groovy.syntax.TokenUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
@@ -30,7 +29,7 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
+
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
@@ -38,6 +37,7 @@ import java.util.*;
|
|
|
@RestController
|
|
|
@RequestMapping("/alertrule")
|
|
|
@CrossOrigin
|
|
|
+@Api(value = "自定义报警规则",tags = "自定义报警规则")
|
|
|
public class AlertRuleController {
|
|
|
|
|
|
|
|
@@ -46,8 +46,11 @@ public class AlertRuleController {
|
|
|
private AlarmRuleService alarmRuleService;
|
|
|
|
|
|
@Resource
|
|
|
- private TokenService tokenService;
|
|
|
+ private IProEconAlarmTypeService proEconAlarmTypeService;
|
|
|
+
|
|
|
+
|
|
|
@GetMapping(value = "/list")
|
|
|
+ @ApiOperation(value = "查询报警关联部件名称", notes = "查询报警关联部件名称")
|
|
|
public AjaxResult queryTree() {
|
|
|
List<AlarmRuleVo> alertrules = alarmRuleService.queryTree();
|
|
|
if (StringUtils.notEmp(alertrules)) {
|
|
@@ -59,7 +62,47 @@ public class AlertRuleController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping(value = "/queryalarmtypellist")
|
|
|
+ @ApiOperation(value = "查询报警类型和预警类型", notes = "查询报警类型和预警类型")
|
|
|
+ public AjaxResult queryalAarmTypelList() {
|
|
|
+
|
|
|
+ Map<String,List<ProEconAlarmType>> map=new HashMap<>();
|
|
|
+ List<ProEconAlarmType> typels= proEconAlarmTypeService.list();
|
|
|
+
|
|
|
+ List<ProEconAlarmType> bjls=new ArrayList<>();
|
|
|
+ List<ProEconAlarmType> yjls=new ArrayList<>();
|
|
|
+ List<ProEconAlarmType> sdls=new ArrayList<>();
|
|
|
+ if(!typels.isEmpty())
|
|
|
+ {
|
|
|
+ for(ProEconAlarmType type:typels)
|
|
|
+ {
|
|
|
+ if(type.getCategory().equals(AlarmType.BJ.getCode()))
|
|
|
+ {
|
|
|
+ bjls.add(type);
|
|
|
+ }else if(type.getCategory().equals(AlarmType.YJ.getCode()))
|
|
|
+ {
|
|
|
+ yjls.add(type);
|
|
|
+ }else if(type.getCategory().equals(AlarmType.SD.getCode()))
|
|
|
+ {
|
|
|
+ sdls.add(type);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("bj",bjls);
|
|
|
+ map.put("yj",yjls);
|
|
|
+ map.put("sd",sdls);
|
|
|
+ if (StringUtils.notEmp(map)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, map);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
@GetMapping(value = "/querywpllist")
|
|
|
+ @ApiOperation(value = "查询场站列表", notes = "查询场站列表")
|
|
|
public AjaxResult queryWplList() {
|
|
|
|
|
|
List<ProBasicPowerstation> wpls= CacheContext.wpls;
|
|
@@ -72,29 +115,61 @@ public class AlertRuleController {
|
|
|
return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
}
|
|
|
}
|
|
|
- @GetMapping(value = "/querywtpointllist")
|
|
|
- public AjaxResult queryWtPointlList(String wpId,String modelId) {
|
|
|
|
|
|
- Map<String,List<ProBasicPowerstationPoint>> map=new HashMap<>();
|
|
|
- if(StringUtils.notEmp(wpId) && StringUtils.notEmp(modelId) && CacheContext.wppointmap.containsKey(wpId))
|
|
|
+ @GetMapping(value = "/querywtlist")
|
|
|
+ @ApiOperation(value = "通过场站获得设备信息", notes = "通过场站获得设备信息")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")})
|
|
|
+ public AjaxResult queryWtList(String wpId) {
|
|
|
+ List<ProBasicEquipment> wtls=new ArrayList<>();
|
|
|
+ Map<String,List<ProBasicEquipmentPoint>> map=new HashMap<>();
|
|
|
+ if(StringUtils.notEmp(wpId) && CacheContext.wpwtmap.containsKey(wpId))
|
|
|
{
|
|
|
- Map<String, ProBasicPowerstationPoint> submap= CacheContext.wppointmap.get(wpId);
|
|
|
+ wtls= CacheContext.wpwtmap.get(wpId);
|
|
|
+ }
|
|
|
|
|
|
- List<ProBasicPowerstationPoint> ailist=new ArrayList<>();
|
|
|
- List<ProBasicPowerstationPoint> dilist=new ArrayList<>();
|
|
|
- for(Map.Entry<String,ProBasicPowerstationPoint> entry:submap.entrySet()){
|
|
|
+ if (StringUtils.notEmp(wtls)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, wtls);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @GetMapping(value = "/querywtpointlist")
|
|
|
+ @ApiOperation(value = "通过场站和型号查询测点信息", notes = "通过场站和型号查询测点信息")
|
|
|
+ @ApiImplicitParams({
|
|
|
|
|
|
- if(entry.getValue().getModelId().equals(modelId))
|
|
|
+ @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "modelId", value = "型号", required = true, dataType = "string", paramType = "query")})
|
|
|
+ public AjaxResult queryWtPointlList(String wpId,String modelId) {
|
|
|
+
|
|
|
+ Map<String,List<ProBasicEquipmentPoint>> map=new HashMap<>();
|
|
|
+ if(StringUtils.notEmp(wpId) && StringUtils.notEmp(modelId) && CacheContext.wpwtmap.containsKey(wpId))
|
|
|
+ {
|
|
|
+ List<ProBasicEquipment> wtls= CacheContext.wpwtmap.get(wpId);
|
|
|
+
|
|
|
+ List<ProBasicEquipmentPoint> ailist=new ArrayList<>();
|
|
|
+ List<ProBasicEquipmentPoint> dilist=new ArrayList<>();
|
|
|
+ for(ProBasicEquipment wt:wtls)
|
|
|
+ {
|
|
|
+ if(wt.getModelId().equals(modelId) && CacheContext.wtpAimap.containsKey(wt.getId()))
|
|
|
{
|
|
|
- if(entry.getKey().contains("AI"))
|
|
|
- {
|
|
|
- ailist.add(entry.getValue());
|
|
|
- }else if(entry.getKey().contains("DI"))
|
|
|
- {
|
|
|
- dilist.add(entry.getValue());
|
|
|
+ Map<String, ProBasicEquipmentPoint> wtpointmap=CacheContext.wtpAimap.get(wt.getId());
|
|
|
+ for(Map.Entry<String,ProBasicEquipmentPoint> entry:wtpointmap.entrySet()){
|
|
|
+
|
|
|
+ if(entry.getKey().contains("AI"))
|
|
|
+ {
|
|
|
+ ailist.add(entry.getValue());
|
|
|
+ }else if(entry.getKey().contains("DI"))
|
|
|
+ {
|
|
|
+ dilist.add(entry.getValue());
|
|
|
+ }
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
map.put("ai",ailist);
|
|
|
map.put("di",dilist);
|
|
|
}
|
|
@@ -108,6 +183,7 @@ public class AlertRuleController {
|
|
|
}
|
|
|
}
|
|
|
@GetMapping(value = "/querysubllist")
|
|
|
+ @ApiOperation(value = "获得升压站列表信息", notes = "获得升压站列表信息")
|
|
|
public AjaxResult querySublList() {
|
|
|
|
|
|
List<ProBasicSubStation> subwpls= CacheContext.subwpls;
|
|
@@ -121,7 +197,31 @@ public class AlertRuleController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/queryalarmrule")
|
|
|
+ @ApiOperation(value = "根据主键获得报警规则", notes = "根据主键获得报警规则")
|
|
|
+ @ApiImplicitParams({
|
|
|
+
|
|
|
+ @ApiImplicitParam(name = "id", value = "报警规则主键", required = true, dataType = "string", paramType = "query")})
|
|
|
+ public AjaxResult queryAlarmRule(String id) {
|
|
|
+
|
|
|
+ ProEconAlarmRule alarmRule=null;
|
|
|
+ if(StringUtils.notEmp(id))
|
|
|
+ {
|
|
|
+ alarmRule= alarmRuleService.selectByAlertruleId(id);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(alarmRule)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, alarmRule);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/querysubpointllist")
|
|
|
+ @ApiOperation(value = "获得升压站主键获得测点信息", notes = "获得升压站主键获得测点信息")
|
|
|
public AjaxResult querySubPointlList(String subId) {
|
|
|
|
|
|
Map<String,List<ProBasicPowerstationPoint>> map=new HashMap<>();
|
|
@@ -156,6 +256,7 @@ public class AlertRuleController {
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/querywpbyymodellist")
|
|
|
+ @ApiOperation(value = "通过场站编号获得型号下拉列表", notes = "通过场站编号获得型号下拉列表")
|
|
|
public AjaxResult queryWpByModelList() {
|
|
|
|
|
|
Map<String,Set<ProEconEquipmentmodel>> wpByEmMap=CacheContext.wpByEmMap;
|
|
@@ -172,13 +273,13 @@ public class AlertRuleController {
|
|
|
//@UserLoginToken
|
|
|
@PostMapping(value = "/save")
|
|
|
@ResponseBody
|
|
|
-
|
|
|
- public AjaxResult saveAlertrule(HttpServletRequest request, @RequestBody ProEconAlarmRule alarmRule) throws Exception {
|
|
|
+ @ApiOperation(value = "进行修改和保存", notes = "进行修改和保存")
|
|
|
+ public AjaxResult saveAndUpdateAlertrule(HttpServletRequest request, @RequestBody ProEconAlarmRule alarmRule) throws Exception {
|
|
|
|
|
|
|
|
|
- String token = request.getHeader("token");
|
|
|
|
|
|
- if (StringUtils.notEmp(token) && tokenService.sessionMap.containsKey(token)) {
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(alarmRule) ) {
|
|
|
|
|
|
int result = alarmRuleService.saveAndUpdateAlertrule(alarmRule);
|
|
|
|
|
@@ -193,9 +294,13 @@ public class AlertRuleController {
|
|
|
}
|
|
|
|
|
|
@DeleteMapping(value = "/delete")
|
|
|
- public AjaxResult deleteAlertrule(ProEconAlarmRule alarmRule) {
|
|
|
+ @ApiOperation(value = "删除", notes = "删除")
|
|
|
+ @ApiImplicitParams({
|
|
|
+
|
|
|
+ @ApiImplicitParam(name = "id", value = "自定义报警主键", required = true, dataType = "string", paramType = "query")})
|
|
|
+ public AjaxResult deleteAlertrule(String id) {
|
|
|
|
|
|
- int i= alarmRuleService.deleteAlertrule(alarmRule);
|
|
|
+ int i= alarmRuleService.deleteAlertrule(id);
|
|
|
|
|
|
if (StringUtils.notEmp(i)) {
|
|
|
return AjaxResult.successData(AjaxStatus.success.code, i);
|
|
@@ -206,11 +311,24 @@ public class AlertRuleController {
|
|
|
|
|
|
//@UserLoginToken
|
|
|
@GetMapping(value = "/page")
|
|
|
+ @ApiOperation(value = "分页查询", notes = "分页查询")
|
|
|
+ @ApiImplicitParams({
|
|
|
+
|
|
|
+ @ApiImplicitParam(name = "pagenum", value = "页号", required = true, dataType = "Integer", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "pagesize", value = "每页显示多少行", required = true, dataType = "Integer", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "station", value = "风场编号", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "modelId", value = "型号编号", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "rank", value = "级别", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "category", value = "类别(booststation:升压站报警,windturbine:风机报警)", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "enabled", value = "是否可用", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "relatedparts", value = "部件", required = false, dataType = "string", paramType = "query")})
|
|
|
+
|
|
|
public AjaxResult queryByPage(HttpServletRequest request,
|
|
|
@RequestParam(value = "pagenum") Integer pageNum,
|
|
|
@RequestParam(value = "pagesize") Integer pageSize,
|
|
|
@RequestParam(value = "name", required = false) String name,
|
|
|
- @RequestParam(value = "station", required = false) String station,
|
|
|
+ @RequestParam(value = "wpId", required = false) String wpId,
|
|
|
@RequestParam(value = "modelId", required = false) String modelId,
|
|
|
@RequestParam(value = "rank", required = false) String rank,
|
|
|
@RequestParam(value = "category", required = false) String category,
|
|
@@ -219,7 +337,7 @@ public class AlertRuleController {
|
|
|
) {
|
|
|
Page<ProEconAlarmRule> page = new Page(pageNum, pageSize);
|
|
|
|
|
|
- IPage<ProEconAlarmRule> pageResult = alarmRuleService.pageQueryAll(page, name,station,modelId,rank,category,enabled,relatedparts);
|
|
|
+ IPage<ProEconAlarmRule> pageResult = alarmRuleService.pageQueryAll(page, name,wpId,modelId,rank,category,enabled,relatedparts);
|
|
|
|
|
|
|
|
|
|
|
@@ -236,6 +354,7 @@ public class AlertRuleController {
|
|
|
//@UserLoginToken
|
|
|
@PostMapping(value = "/save-batch")
|
|
|
@ResponseBody
|
|
|
+ @ApiOperation(value = "批量保存", notes = "分页查询")
|
|
|
public AjaxResult saveAlertruleBatch(HttpServletRequest request,@RequestBody List<ProEconAlarmRule> lst) throws Exception {
|
|
|
|
|
|
|