|
@@ -22,10 +22,8 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -42,6 +40,86 @@ public class ProEconAlarmPlanController {
|
|
|
@Resource
|
|
|
private IProEconAlarmPlanService proEconAlarmPlanService;
|
|
|
|
|
|
+ @GetMapping(value = "/alarmPlanlistById")
|
|
|
+ @ApiOperation(value = "通过预警编号获得报警解决方案列表", notes = "通过预警编号获得报警解决方案列表")
|
|
|
+ public AjaxResult alarmPlanlistById(String alarmId) {
|
|
|
+
|
|
|
+ List<ProEconAlarmPlan> vos=new ArrayList<>();
|
|
|
+ if(StringUtils.notEmp( alarmId) )
|
|
|
+ {
|
|
|
+ vos= proEconAlarmPlanService.alarmPlanlistById(alarmId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(vos)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, vos);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @GetMapping(value = "/alarmPlanTypelist")
|
|
|
+ @ApiOperation(value = "预警解决方案分类列表", notes = "预警解决方案分类列表")
|
|
|
+ public AjaxResult queryAlarmPlanlist() {
|
|
|
+
|
|
|
+ List<String> namels=new ArrayList();
|
|
|
+ List<ProEconAlarmPlan> alertrules = proEconAlarmPlanService.list();
|
|
|
+
|
|
|
+ Map<String, List<ProEconAlarmPlan>> map = alertrules.stream()
|
|
|
+ .collect(Collectors.groupingBy(ProEconAlarmPlan::getTypes));
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<ProEconAlarmPlan>> entry : map.entrySet()) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ namels.add(key);
|
|
|
+ }
|
|
|
+ if (StringUtils.notEmp(namels)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, namels);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/alarmPlanTypeDeallist")
|
|
|
+ @ApiOperation(value = "预警解决方案分类列表", notes = "预警解决方案分类列表")
|
|
|
+ public AjaxResult alarmPlanTypeDeallist() {
|
|
|
+
|
|
|
+ List<String> namels=new ArrayList();
|
|
|
+ List<ProEconAlarmPlan> alertrules = proEconAlarmPlanService.list();
|
|
|
+
|
|
|
+ Map<String, List<ProEconAlarmPlan>> map = alertrules.stream()
|
|
|
+ .collect(Collectors.groupingBy(ProEconAlarmPlan::getTypedetails));
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<ProEconAlarmPlan>> entry : map.entrySet()) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ namels.add(key);
|
|
|
+ }
|
|
|
+ if (StringUtils.notEmp(namels)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, namels);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/queryAlarmPlanMap")
|
|
|
+ @ApiOperation(value = "预警解决方案分类列表", notes = "预警解决方案分类列表")
|
|
|
+ public AjaxResult queryAlarmPlanMap() {
|
|
|
+
|
|
|
+ List<String> namels=new ArrayList();
|
|
|
+ List<ProEconAlarmPlan> alertrules = proEconAlarmPlanService.list();
|
|
|
+
|
|
|
+ Map<String, List<ProEconAlarmPlan>> map = alertrules.stream()
|
|
|
+ .collect(Collectors.groupingBy(ProEconAlarmPlan::getTypes));
|
|
|
+
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(map)) {
|
|
|
+
|
|
|
+ return AjaxResult.successData(AjaxStatus.success.code, map);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.successData(AjaxStatus.loginexpire.code, "error");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//@UserLoginToken
|
|
|
@PostMapping(value = "/save")
|
|
@@ -95,16 +173,17 @@ public class ProEconAlarmPlanController {
|
|
|
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页号", required = true, dataType = "Integer", paramType = "query"),
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页显示多少行", required = true, dataType = "Integer", paramType = "query"),
|
|
|
- @ApiImplicitParam(name = "pageSize", value = "每页显示多少行", required = true, dataType = "Integer", paramType = "query"),
|
|
|
- @ApiImplicitParam(name = "types", value = "名称", required = false, dataType = "string", paramType = "query"),
|
|
|
- @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "string", paramType = "query")
|
|
|
+
|
|
|
+ @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "string", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "types", value = "名称", required = false, dataType = "string", paramType = "query")
|
|
|
})
|
|
|
|
|
|
public AjaxResult queryByPage(HttpServletRequest request,
|
|
|
@RequestParam(value = "pageNum") Integer pageNum,
|
|
|
@RequestParam(value = "pageSize") Integer pageSize,
|
|
|
- @RequestParam(value = "types", required = false) String types,
|
|
|
- @RequestParam(value = "name", required = false) String name
|
|
|
+
|
|
|
+ @RequestParam(value = "name", required = false) String name ,
|
|
|
+ @RequestParam(value = "types", required = false) String types
|
|
|
) {
|
|
|
Page<ProEconAlarmPlan> page = new Page(pageNum, pageSize);
|
|
|
|
|
@@ -123,7 +202,7 @@ public class ProEconAlarmPlanController {
|
|
|
//@UserLoginToken
|
|
|
@PostMapping(value = "/save-batch")
|
|
|
@ResponseBody
|
|
|
- @ApiOperation(value = "批量保存", notes = "分页查询")
|
|
|
+ @ApiOperation(value = "批量保存", notes = "批量保存")
|
|
|
public AjaxResult saveAlertruleBatch(HttpServletRequest request, @RequestBody List<ProEconAlarmPlan> lst) throws Exception {
|
|
|
|
|
|
|
|
@@ -181,11 +260,11 @@ public class ProEconAlarmPlanController {
|
|
|
|
|
|
List<ProEconAlarmPlan> list = Arrays.asList(
|
|
|
ProEconAlarmPlan.builder().id("1").types("类型1").troubleMethod("排查步骤1")
|
|
|
- .processMethod("检修方案").tools("所需工具1").spareParts("备品备件1").name("名字1")
|
|
|
+ .processMethod("检修方案").tools("所需工具1").spareParts("备品备件1").name("名字1").typedetails("类别1")
|
|
|
|
|
|
.build(),
|
|
|
ProEconAlarmPlan.builder().id("2").types("类型2").troubleMethod("排查步骤2")
|
|
|
- .processMethod("检修方案2").tools("所需工具2").spareParts("备品备件2").name("名字2")
|
|
|
+ .processMethod("检修方案2").tools("所需工具2").spareParts("备品备件2").name("名字2").typedetails("类别2")
|
|
|
|
|
|
.build()
|
|
|
|
|
@@ -217,6 +296,12 @@ public class ProEconAlarmPlanController {
|
|
|
} else if (StringUtils.empty(alertrule.getTools())) {
|
|
|
msg = "处理工具不能为空";
|
|
|
result = false;
|
|
|
+ } else if (StringUtils.empty(alertrule.getName())) {
|
|
|
+ msg = "名称不能为空";
|
|
|
+ result = false;
|
|
|
+ } else if (StringUtils.empty(alertrule.getTypedetails())) {
|
|
|
+ msg = "类别不能为空";
|
|
|
+ result = false;
|
|
|
}
|
|
|
if (result != true) {
|
|
|
allCheck = false;
|