RealTimeWarningController
1 package com.-.it.regioc.controller;
2
3 import org.apache.commons.lang3.StringUtils;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.http.MediaType;
6 import org.springframework.web.bind.annotation.PostMapping;
7 import org.springframework.web.bind.annotation.RequestBody;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController;
10
11 import java.io.IOException;
12 import java.util.List;
13
14 @RestController
15 @RequestMapping(path = "/warning", produces = MediaType.APPLICATION_JSON_VALUE)
16 @JalorResource(code = "RealTimeWarningController", desc = "作战沙盘实时告警")
17 public class RealTimeWarningController {
18 @Autowired
19 private IRealTimeWarningService realTimeWarningService;
20
21 @PostMapping("/queryWarningTotal")
22 public Result<List<WarningItem>> query(@RequestBody Condition condition) throws IOException {
23 List<WarningItem> warningItems = realTimeWarningService.queryWarningTotal(condition);
24 return Result.success(warningItems);
25 }
26
27 /**
28 * 前端分页,将需要查询的probeId,projectId传过来,传多少查多少
29 */
30 @PostMapping("/queryDetailsList")
31 //@JalorOperation(code = "queryRegion", desc = "实时告警详列表")
32 public Result<List<WarningDetails>> queryDetailsList(@RequestBody List<WarningDetailsParam> params) {
33 if (params == null || params.size() >= 10) {
34 return Result.fail("参数错误");
35 }
36 List<WarningDetails> data = realTimeWarningService.queryDetailsList(params);
37 return Result.success(data);
38 }
39
40 /**
41 * 详情清单
42 */
43 @PostMapping("/queryDetails")
44 //@JalorOperation(code = "queryRegion", desc = "实时告警详情清单")
45 public Result<WarningDetailsCheckList> queryDetails(@RequestBody WarningDetailsParam param) {
46 if (param == null || StringUtils.isBlank(param.getProbeId()) || StringUtils.isBlank(param.getProjectId())) {
47 return Result.fail("参数错误");
48 }
49 WarningDetailsCheckList details = realTimeWarningService.queryDetails(param);
50 return Result.success(details);
51 }
52
53 /**
54 * 趋势图
55 */
56 @PostMapping("/trending")
57 //@JalorOperation(code = "trendingWeek", desc = "实时告警详情趋势")
58 public Result<List<WarningTrending>> trendingWeek(@RequestBody WaringTrendingParam warnings) {
59 List<WarningTrending> data = realTimeWarningService.trendingWeek(warnings);
60 return Result.success(data);
61 }
62
63 }