|
|
@@ -70,13 +70,19 @@ public class ItMonitorController {
|
|
|
return new Result<>(ResultCode.SUCCESS, myPage);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/agent/add")
|
|
|
+ @PostMapping("/agent/add") // TODO: check agent key exist
|
|
|
public Result<?> addItMonitorAgent(@Validated @RequestBody ItMonitorAgent itMonitorAgent) {
|
|
|
itMonitorAgent.setAgentId(null);
|
|
|
int result = itMonitorService.addAgent(itMonitorAgent);
|
|
|
return new Result<>(result == 1 ? ResultCode.SUCCESS : ResultCode.FAILED);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/agent/set") // TODO: check agent key exist
|
|
|
+ public Result<?> setItMonitorAgent(@Validated @RequestBody ItMonitorAgent itMonitorAgent) {
|
|
|
+ int result = itMonitorService.setAgent(itMonitorAgent);
|
|
|
+ return new Result<>(result == 1 ? ResultCode.SUCCESS : ResultCode.FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
@PostMapping("/agent/del/{i}")
|
|
|
public Result<?> delItMonitorAgent(@PathVariable String i) {
|
|
|
Long id = Long.parseLong(i);
|
|
|
@@ -124,7 +130,7 @@ public class ItMonitorController {
|
|
|
return new Result<>(result == 1 ? ResultCode.SUCCESS : ResultCode.FAILED);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/resource/group/del/{i}")
|
|
|
+ @PostMapping("/resource/group/del/{i}") // TODO: del resource
|
|
|
public Result<?> delItMonitorResourceGroup(@PathVariable String i) {
|
|
|
Long id = Long.parseLong(i);
|
|
|
int result = itMonitorService.delResourceGroup(id);
|
|
|
@@ -161,7 +167,7 @@ public class ItMonitorController {
|
|
|
return new Result<>(result == 1 ? ResultCode.SUCCESS : ResultCode.FAILED);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/resource/del/{i}")
|
|
|
+ @PostMapping("/resource/del/{i}") // TODO: delete data/alarm/threshold?
|
|
|
public Result<?> delItMonitorResource(@PathVariable String i) {
|
|
|
Long id = Long.parseLong(i);
|
|
|
int result = itMonitorService.delResource(id);
|
|
|
@@ -205,7 +211,7 @@ public class ItMonitorController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/item/group/set")
|
|
|
- public Result<?> setItMonitorItemGroup(ItMonitorItemGroup itMonitorItemGroup) { // 只允许修改名称、间隔、置顶itemId
|
|
|
+ public Result<?> setItMonitorItemGroup(ItMonitorItemGroup itMonitorItemGroup) { // 只允许修改名称、间隔、置顶itemId、是否为表格
|
|
|
if (itMonitorItemGroup.getGroupId() == null || itMonitorItemGroup.getGroupName() == null || itMonitorItemGroup.getGroupName().isEmpty()
|
|
|
|| (itMonitorItemGroup.getTopItemId() != -1 && !itMonitorService.checkItemExistByItemId(itMonitorItemGroup.getTopItemId(), itMonitorItemGroup.getGroupId()))
|
|
|
) {
|
|
|
@@ -222,7 +228,7 @@ public class ItMonitorController {
|
|
|
return new Result<>(ResultCode.SUCCESS, itMonitorService.getAllItemByGroupId(id));
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/item/add")
|
|
|
+ @PostMapping("/item/add") // TODO: check groupId
|
|
|
public Result<?> addItMonitorItem(@Validated @RequestBody ItMonitorItem itMonitorItem) {
|
|
|
if (!itMonitorService.checkItemGroupExistByGroupId(itMonitorItem.getItemGroupId())) {
|
|
|
return new Result<>(ResultCode.FAILED_PARAM_INVALID);
|
|
|
@@ -239,7 +245,7 @@ public class ItMonitorController {
|
|
|
return new Result<>(result == 1 ? ResultCode.SUCCESS : ResultCode.FAILED);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/item/set")
|
|
|
+ @PostMapping("/item/set") // TODO: check groupId
|
|
|
public Result<?> setItMonitorItem(@Validated @RequestBody ItMonitorItem itMonitorItem) {
|
|
|
return new Result<>(ResultCode.SUCCESS, itMonitorService.setItem(itMonitorItem));
|
|
|
}
|
|
|
@@ -275,7 +281,7 @@ public class ItMonitorController {
|
|
|
return new Result<>(success ? ResultCode.SUCCESS : ResultCode.FAILED);
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/data/getItem")
|
|
|
+ @PostMapping("/data/get")
|
|
|
public Result<MyPage<ItMonitorData>> getItMonitorDataByIds(@RequestBody ItMonitorDataGetReqVo itMonitorDataGetReqVo) {
|
|
|
if (itMonitorDataGetReqVo.getPageNo() == null) {
|
|
|
itMonitorDataGetReqVo.setPageNo(1);
|