Commit 3060b513 authored by 黎博's avatar 黎博

新增获取监控详情接口

parent f7e1d99c
...@@ -131,6 +131,20 @@ public class SqlMonitorTaskController { ...@@ -131,6 +131,20 @@ public class SqlMonitorTaskController {
return JsonResult.buildErrorStateResult("监控修改失败", false); return JsonResult.buildErrorStateResult("监控修改失败", false);
} }
/**
* 获取监控详情
* @param id
* @return
*/
@GetMapping("/detail")
public JsonResult getSqlMonitorTaskDetail(@RequestParam Integer id) {
SqlMonitorTask sqlMonitorTask = sqlMonitorTaskService.getById(id);
if (sqlMonitorTask == null) {
return JsonResult.buildErrorStateResult("监控不存在!", false);
}
return JsonResult.buildSuccessResult(sqlMonitorTask);
}
/** /**
* 删除监控 * 删除监控
* *
...@@ -197,7 +211,7 @@ public class SqlMonitorTaskController { ...@@ -197,7 +211,7 @@ public class SqlMonitorTaskController {
if (resultList != null) { if (resultList != null) {
dingText = SqlMonitorHandler.replaceDingText(dingText, resultList); dingText = SqlMonitorHandler.replaceDingText(dingText, resultList);
} }
String markdownMsg = DingdingUtils.buildMarkdownMsg("监控测试", dingText + "\n" + JSON.toJSONString(resultList), false); String markdownMsg = DingdingUtils.buildMarkdownMsg("监控测试", dingText, false);
boolean result = DingdingUtils.sendToDingding(markdownMsg, dingUrl); boolean result = DingdingUtils.sendToDingding(markdownMsg, dingUrl);
return JsonResult.buildSuccessResult(result ? "发送成功!" : "发送失败!", true); return JsonResult.buildSuccessResult(result ? "发送成功!" : "发送失败!", true);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -51,7 +51,7 @@ public class SqlMonitorHandler extends QuartzJobBean { ...@@ -51,7 +51,7 @@ public class SqlMonitorHandler extends QuartzJobBean {
if (resultList != null) { if (resultList != null) {
dingText = replaceDingText(dingText, resultList); dingText = replaceDingText(dingText, resultList);
} }
String markdownMsg = DingdingUtils.buildMarkdownMsg("监控测试", dingText + "\n" + JSON.toJSONString(resultList), false); String markdownMsg = DingdingUtils.buildMarkdownMsg("监控测试", dingText, false);
DingdingUtils.sendToDingding(markdownMsg, dingUrl); DingdingUtils.sendToDingding(markdownMsg, dingUrl);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment