|
@@ -2,11 +2,13 @@ package com.jay.monitor.data.server.controllers;//package com.jay.monitor.data.s
|
|
|
|
|
|
import com.jay.monitor.data.core.model.response.PageResponseModel;
|
|
|
import com.jay.monitor.data.core.utils.JsonHelper;
|
|
|
+import com.jay.monitor.data.core.utils.ResponseUtils;
|
|
|
import com.jay.monitor.data.server.componts.html.DefaultDataRender;
|
|
|
import com.jay.monitor.data.server.controllers.crud.BaseSimpleCrudController;
|
|
|
import com.jay.monitor.data.server.enums.AlertMsgEnums;
|
|
|
import com.jay.monitor.data.server.models.request.alert.AlertPlatformConfigRequest;
|
|
|
import com.jay.monitor.data.server.models.store.AlertPlatformConfig;
|
|
|
+import com.jay.monitor.data.server.report.alert.AlertDataService;
|
|
|
import com.jay.monitor.data.server.store.IAlertPlatformProcess;
|
|
|
import com.jay.monitor.data.server.store.ISimpleCrudProcess;
|
|
|
import com.jay.monitor.data.server.utils.HtmlComponentUtils;
|
|
@@ -23,8 +25,6 @@ import java.util.List;
|
|
|
|
|
|
import static com.jay.monitor.data.server.controllers.AlertPlatformController.PREFIX_URL;
|
|
|
|
|
|
-//import com.jay.monitor.data.server.services.impl.DefaultBackstageRouteService;
|
|
|
-
|
|
|
/**
|
|
|
* 后台路由管理
|
|
|
*
|
|
@@ -51,6 +51,9 @@ public class AlertPlatformController extends BaseSimpleCrudController<AlertPlatf
|
|
|
@Autowired
|
|
|
private IAlertPlatformProcess alertPlatformProcess;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AlertDataService alertDataService;
|
|
|
+
|
|
|
@Override
|
|
|
public ISimpleCrudProcess getCrudProcess() {
|
|
|
return alertPlatformProcess;
|
|
@@ -87,7 +90,12 @@ public class AlertPlatformController extends BaseSimpleCrudController<AlertPlatf
|
|
|
|
|
|
@Override
|
|
|
protected void addBefore(AlertPlatformConfig req) {
|
|
|
+ checkExpression(req);
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void addAfter(AlertPlatformConfig req, boolean result) {
|
|
|
+ refreshPlatformId(req.getId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -99,9 +107,34 @@ public class AlertPlatformController extends BaseSimpleCrudController<AlertPlatf
|
|
|
modelAfter(model, alertPlatformConfig);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void updateBefore(AlertPlatformConfig req) {
|
|
|
+ checkExpression(req);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void updateAfter(AlertPlatformConfig req, boolean result) {
|
|
|
+ refreshPlatformId(req.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ public void refreshPlatformId(String id) {
|
|
|
+ alertDataService.refreshPlatformId(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void deleteAfter(AlertPlatformConfig req, boolean result) {
|
|
|
+ refreshPlatformId(req.getId());
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void modelAfter(Model model, AlertPlatformConfig entity) {
|
|
|
List<DefaultDataRender> alertPlatformList = HtmlComponentUtils.convertDataRender(AlertMsgEnums.class);
|
|
|
model.addAttribute("alertPlatformList", JsonHelper.toJsonString(alertPlatformList));
|
|
|
}
|
|
|
+
|
|
|
+ private void checkExpression(AlertPlatformConfig req) {
|
|
|
+ ResponseUtils.checkNull(req.getAlertName(), "告警组名称不能为空!");
|
|
|
+ ResponseUtils.checkNull(req.getPlatformType(), "告警类型不能为空!");
|
|
|
+ ResponseUtils.checkNull(req.getUrl(), "告警url不能为空!");
|
|
|
+ }
|
|
|
}
|