告警平台对接
parent
49501e1d1c
commit
370117aecc
|
@ -63,6 +63,7 @@ public class IndexDataController {
|
|||
public GeneralResult userStatic(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
|
||||
return indexService.userDataStatic(requestContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前用户授权应用列表
|
||||
* @param pager
|
||||
|
@ -74,4 +75,16 @@ public class IndexDataController {
|
|||
public GeneralResult userAppList(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
|
||||
return indexService.userAppList(requestContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 近7日告警趋势
|
||||
* @param pager
|
||||
* @param requestContext
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/sevenDayWarnTrend")
|
||||
@Operation(summary = "近7日告警趋势")
|
||||
public GeneralResult sevenDayWarnTrend(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
|
||||
return indexService.sevenDayWarnTrend(requestContext);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,6 @@ public interface IndexService {
|
|||
GeneralResult userDataStatic(RequestContext requestContext);
|
||||
|
||||
GeneralResult userAppList(RequestContext requestContext);
|
||||
|
||||
GeneralResult sevenDayWarnTrend(RequestContext requestContext);
|
||||
}
|
||||
|
|
|
@ -101,10 +101,6 @@ public class IndexServiceImpl implements IndexService {
|
|||
String data = ykUtil.call(YkInfo.getCountTaskByUser, userParam, JSONArray.class);
|
||||
List<JSONObject> list = JSONObject.parseObject(data, List.class);
|
||||
|
||||
String result = warnUtil.call(WarnInfo.get1DayWarnCount.getUrl(), "GET");
|
||||
log.info("result:" + result);
|
||||
|
||||
// log.info("resultMap:{}", JSON.toJSONString(resultMap));
|
||||
|
||||
return new GeneralResult(true, list, "查询成功");
|
||||
} catch (Exception e) {
|
||||
|
@ -144,6 +140,19 @@ public class IndexServiceImpl implements IndexService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneralResult sevenDayWarnTrend(RequestContext requestContext) {
|
||||
|
||||
try {
|
||||
String result = warnUtil.call(WarnInfo.get7DayWarnTrend.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();
|
||||
|
|
|
@ -21,6 +21,11 @@ public class WarnUtil {
|
|||
@Value("${warn.password:alistarapi123}")
|
||||
private String password;
|
||||
|
||||
public static void main(String[] args) {
|
||||
String user = "alistar:alistarapi123";
|
||||
System.out.println(Base64.getEncoder().encodeToString(user.getBytes()));
|
||||
}
|
||||
|
||||
|
||||
public String call(String urlSuffix, String method) throws Exception {
|
||||
URL obj = new URL(url + urlSuffix);
|
||||
|
|
Loading…
Reference in New Issue