告警平台对接

develop
guyuliang 2024-08-27 15:52:11 +08:00
parent 370117aecc
commit 9eba1b9b1a
4 changed files with 55 additions and 0 deletions

View File

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

View File

@ -17,4 +17,8 @@ public interface IndexService {
GeneralResult userAppList(RequestContext requestContext);
GeneralResult sevenDayWarnTrend(RequestContext requestContext);
GeneralResult oneDayWarnCount(RequestContext requestContext);
GeneralResult warnList(RequestContext requestContext);
}

View File

@ -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<JSONObject> getUserAppList(RequestContext requestContext) throws Exception {
//查询当前用户授权应用
JSONObject param = new JSONObject();

View File

@ -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");