From 9eba1b9b1aef18d756b0806d19d85e508ad4b2ef Mon Sep 17 00:00:00 2001 From: guyuliang Date: Tue, 27 Aug 2024 15:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E5=B9=B3=E5=8F=B0=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IndexDataController.java | 24 ++++++++++++++++++ .../bocloud/sms/interfaces/IndexService.java | 4 +++ .../bocloud/sms/service/IndexServiceImpl.java | 25 +++++++++++++++++++ .../java/com/bocloud/sms/enums/WarnInfo.java | 2 ++ 4 files changed, 55 insertions(+) diff --git a/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java b/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java index 958b16d..8f30234 100644 --- a/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java +++ b/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java @@ -87,4 +87,28 @@ public class IndexDataController { public GeneralResult sevenDayWarnTrend(@Value(Common.REQ_CONTEXT) RequestContext requestContext) { return indexService.sevenDayWarnTrend(requestContext); } + + /** + * 单日告警统计 + * @param pager + * @param requestContext + * @return + */ + @GetMapping("/oneDayWarnCount") + @Operation(summary = "单日告警统计") + public GeneralResult oneDayWarnCount(@Value(Common.REQ_CONTEXT) RequestContext requestContext) { + return indexService.oneDayWarnCount(requestContext); + } + + /** + * 告警列表 + * @param pager + * @param requestContext + * @return + */ + @GetMapping("/warnList") + @Operation(summary = "告警列表") + public GeneralResult warnList(@Value(Common.REQ_CONTEXT) RequestContext requestContext) { + return indexService.warnList(requestContext); + } } diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java index 18cc0ce..fbb8879 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java @@ -17,4 +17,8 @@ public interface IndexService { GeneralResult userAppList(RequestContext requestContext); GeneralResult sevenDayWarnTrend(RequestContext requestContext); + + GeneralResult oneDayWarnCount(RequestContext requestContext); + + GeneralResult warnList(RequestContext requestContext); } diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java index fc8dc34..7d9e38e 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java @@ -153,6 +153,31 @@ public class IndexServiceImpl implements IndexService { } } + @Override + public GeneralResult oneDayWarnCount(RequestContext requestContext) { + + try { + String result = warnUtil.call(WarnInfo.get1DayWarnCount.getUrl(), "GET"); + log.info("result:"+result); + return new GeneralResult(true, "查询成功"); + } catch (Exception e) { + log.info("查询失败", e); + return new GeneralResult(false, "查询失败"); + } + } + + @Override + public GeneralResult warnList(RequestContext requestContext) { + try { + String result = warnUtil.call(WarnInfo.getWarnList.getUrl(), "GET"); + log.info("result:"+result); + return new GeneralResult(true, "查询成功"); + } catch (Exception e) { + log.info("查询失败", e); + return new GeneralResult(false, "查询失败"); + } + } + private List getUserAppList(RequestContext requestContext) throws Exception { //查询当前用户授权应用 JSONObject param = new JSONObject(); diff --git a/bocloud.sms.storage/src/main/java/com/bocloud/sms/enums/WarnInfo.java b/bocloud.sms.storage/src/main/java/com/bocloud/sms/enums/WarnInfo.java index 2d3a7f8..6ff59c7 100644 --- a/bocloud.sms.storage/src/main/java/com/bocloud/sms/enums/WarnInfo.java +++ b/bocloud.sms.storage/src/main/java/com/bocloud/sms/enums/WarnInfo.java @@ -4,6 +4,8 @@ public enum WarnInfo { //单日告警统计 get1DayWarnCount("/alistar/api/v1/alarm/current/statistics/7d"), + //告警列表 + getWarnList("/alistar/api/v1/alarm/current"), //近7日告警趋势统计 get7DayWarnTrend("/alistar/api/v1/alarm/current/today/all");