diff options
| author | shizhendong <[email protected]> | 2023-09-07 16:52:34 +0800 |
|---|---|---|
| committer | shizhendong <[email protected]> | 2023-09-07 16:52:34 +0800 |
| commit | e75bce56dfd9b44bc3ff9320697ed78a376684df (patch) | |
| tree | 2ff30637931fc87fdf9a936cde4b39e0f13d8e6e | |
| parent | 328b99ac25c2257ee0ef9ab8aa7f831c1fd4d966 (diff) | |
feat: NEZ-3171 alert_rule 接口取消 dashboard_id,新增 param
9 files changed, 45 insertions, 46 deletions
diff --git a/nz-admin/src/main/java/com/nis/common/utils/ImportValidateUtil.java b/nz-admin/src/main/java/com/nis/common/utils/ImportValidateUtil.java index 45ffbf23..fa2363ce 100644 --- a/nz-admin/src/main/java/com/nis/common/utils/ImportValidateUtil.java +++ b/nz-admin/src/main/java/com/nis/common/utils/ImportValidateUtil.java @@ -312,6 +312,23 @@ public class ImportValidateUtil { } /** + * 校验字符串是否为 jsonobject 格式 + */ + public boolean validateJsonObject(String jsonStr, Integer lineNum, int headerIndex) { + if (StrUtil.isNotEmpty(jsonStr)) { + try { + JSONObject.parseObject(jsonStr); + return true; + } catch (JSONException e) { + String header = headerInfos.get(headerIndex); + this.recordImportAttrErr(lineNum, RCode.IMPORT_FORMAT_ERROR.setParam(header)); + return false; + } + } + return true; + } + + /** * 校验内容是否在 枚举数组内 */ public void validateEnumValArr(String value, List<String> enumList, int lineNum, int headerIndex) { diff --git a/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleEntity.java b/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleEntity.java index 034ef437..91845edc 100644 --- a/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleEntity.java +++ b/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleEntity.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.nis.common.utils.Tool; -import com.nis.modules.dashboard.entity.VisualDashboard; import com.nis.modules.sys.entity.SysUserEntity; import lombok.Data; @@ -139,16 +138,9 @@ public class AlertRuleEntity implements Serializable { private String extLabels; /** - * dashboard Id - * 默认:-1(没有关联dashboard) + * 其他参数配置 */ - private Integer dashboardId; - - /** - * dashboard - */ - @TableField(exist = false) - private VisualDashboard dashboard; + private String param; /** * 收藏标识: 1:收藏 0:未收藏 diff --git a/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleImportEnum.java b/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleImportEnum.java index b76cc98b..f31bf477 100644 --- a/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleImportEnum.java +++ b/nz-admin/src/main/java/com/nis/modules/alert/entity/AlertRuleImportEnum.java @@ -27,7 +27,8 @@ public enum AlertRuleImportEnum { SCHED_ETIME("schedule end time", 18), NOTIFY_ACTIVE("notify active", 19), NOTIFY_EXPIRED("notify expired", 20), - TROUBLE_SHOOTING("trouble shooting", 21); + TROUBLE_SHOOTING("trouble shooting", 21), + PARAM("param", 22); private String name; private int index; diff --git a/nz-admin/src/main/java/com/nis/modules/alert/service/impl/AlertRuleServiceImpl.java b/nz-admin/src/main/java/com/nis/modules/alert/service/impl/AlertRuleServiceImpl.java index 79478ea3..e949fee4 100644 --- a/nz-admin/src/main/java/com/nis/modules/alert/service/impl/AlertRuleServiceImpl.java +++ b/nz-admin/src/main/java/com/nis/modules/alert/service/impl/AlertRuleServiceImpl.java @@ -27,9 +27,6 @@ import com.nis.modules.alert.entity.AlertRuleImportEnum; import com.nis.modules.alert.service.AlertMessageService; import com.nis.modules.alert.service.AlertNotifyMethodService; import com.nis.modules.alert.service.AlertRuleService; -import com.nis.modules.dashboard.entity.VisualDashboard; -import com.nis.modules.dashboard.service.VisualDashboardService; -import com.nis.modules.dashboard.utils.DashboardConstant; import com.nis.modules.sys.entity.SysUserEntity; import com.nis.modules.sys.entity.SysUserStarredEntity; import com.nis.modules.sys.service.BasicImportAndExportServices; @@ -73,9 +70,6 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt private SysConfigService sysConfigService; @Autowired - private VisualDashboardService dashboardService; - - @Autowired private AlertMessageService alertMessageService; @Autowired @@ -116,10 +110,6 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt List<AlertNotifyMethod> methodList = methodService.list(); Map<Integer, AlertNotifyMethod> methodIdAndEntitiyMap = methodList.stream().collect(Collectors.toMap(AlertNotifyMethod::getId, Function.identity())); - // dashboard list,type = `dashboard` - List<VisualDashboard> dashboardList = dashboardService.list(new LambdaQueryWrapper<VisualDashboard>() - .eq(VisualDashboard::getType, DashboardConstant.Type.DASHBOARD.getValue())); - ruleEntityList.stream().forEach(alertRule -> { String receiver = alertRule.getReceiver(); if (StringUtils.isNotEmpty(receiver)) { @@ -139,11 +129,6 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt }); alertRule.setMethods(list); } - - if (ObjectUtil.notEqual(-1, alertRule.getDashboardId())) { - VisualDashboard dashboard = dashboardList.stream().filter(d -> ObjectUtil.equal(d.getId(), alertRule.getDashboardId())).findFirst().orElse(null); - alertRule.setDashboard(dashboard); - } }); } @@ -421,6 +406,9 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt validateUtil.recordImportAttrErr(lineNum, RCode.IMPORT_NOT_WITHIN_REASON.setParam(AlertRuleImportEnum.SCHED_ETIME.getIndex())); } + String param = dataMap.get(AlertRuleImportEnum.PARAM.getIndex()); + validateUtil.validateJsonObject(param, lineNum, AlertRuleImportEnum.PARAM.getIndex()); + List<Map<String, String>> errMsgForThisLine = validateUtil.getImportErrMsgForThisLine(lineNum); if (BooleanUtil.and(Tool.StrUtil.equals("0", ignoreError), Tool.CollUtil.isNotEmpty(errMsgForThisLine))) { // 结束本次导入,自导入行开始 到结尾数据行,提示错误信息 @@ -458,6 +446,7 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt ruleEntity.setType(Integer.valueOf(type)); ruleEntity.setInr(intervalIntVal); ruleEntity.setTimeout(timeoutIntVal); + ruleEntity.setParam(param); this.saveOrUpdateRowData(ruleEntity, params); // save or update @@ -622,6 +611,7 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt tempList.add(ObjectUtil.defaultIfNull(rule.getNotifyActive(),"").toString()); tempList.add(ObjectUtil.defaultIfNull(rule.getNotifyExpired(),"").toString()); tempList.add(StrUtil.emptyToDefault(rule.getTrbShot(), "")); + tempList.add(StrUtil.emptyToDefault(rule.getParam(), "")); exportDataList.add(tempList); } return exportDataList; @@ -782,13 +772,12 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt } } - // dashboard_id - Integer dashboardId = alertRule.getDashboardId(); - if (ObjectUtil.isNotNull(dashboardId) && ObjectUtil.notEqual(-1, dashboardId)) { - VisualDashboard dashboard = dashboardService.getById(dashboardId); - ValidateUtils.is(dashboard).notNull(RCode.DASHBOARD_NOT_EXIST); - if (!StrUtil.equals(DashboardConstant.Type.DASHBOARD.getValue(), dashboard.getType())) { - throw new NZException(RCode.ALERTRULE_SELECT_DASHBOARD_TYPE_INCORRECT); + // param + String param = alertRule.getParam(); + if (StrUtil.isNotEmpty(param)) { + boolean typeJSONObject = JSONUtil.isTypeJSONObject(param); + if (BooleanUtil.negate(typeJSONObject)) { + throw new NZException(RCode.ALERTRULE_PARAM_FORMAT_ERROR); } } } @@ -828,13 +817,6 @@ public class AlertRuleServiceImpl extends ServiceImpl<AlertRuleDao, AlertRuleEnt .last("limit 1") ); alertRule.setStarred(CollUtil.isEmpty(tUserStatList) ? 0 : 1); - - // dashboard - Integer dashboardId = alertRule.getDashboardId(); - if (ObjectUtil.notEqual(-1, dashboardId)) { - VisualDashboard dashboard = dashboardService.getById(dashboardId); - alertRule.setDashboard(dashboard); - } return alertRule; } diff --git a/nz-admin/src/main/java/com/nis/modules/dashboard/service/impl/VisualDashboardServiceImpl.java b/nz-admin/src/main/java/com/nis/modules/dashboard/service/impl/VisualDashboardServiceImpl.java index df181185..5933ba21 100644 --- a/nz-admin/src/main/java/com/nis/modules/dashboard/service/impl/VisualDashboardServiceImpl.java +++ b/nz-admin/src/main/java/com/nis/modules/dashboard/service/impl/VisualDashboardServiceImpl.java @@ -279,10 +279,6 @@ public class VisualDashboardServiceImpl extends ServiceImpl<VisualDashboardDao, .set(MonitorModule::getDashboardId, null) .in(MonitorModule::getDashboardId, allDashboardIds)); - alertRuleService.update(new LambdaUpdateWrapper<AlertRuleEntity>() - .set(AlertRuleEntity::getDashboardId, -1) - .in(AlertRuleEntity::getDashboardId, allDashboardIds)); - // Playlist List<VisualPlaylist> playlistList = playlistService.list(); for (VisualPlaylist playlist : playlistList) { diff --git a/nz-admin/src/main/resources/db/R__AZ_sys_config.sql b/nz-admin/src/main/resources/db/R__AZ_sys_config.sql index c565d409..2942a723 100644 --- a/nz-admin/src/main/resources/db/R__AZ_sys_config.sql +++ b/nz-admin/src/main/resources/db/R__AZ_sys_config.sql @@ -62,7 +62,7 @@ REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'dc_export_header', '[{\"name\":\"Name\",\"i18n\":\"overall.name\",\"comment\":\"config.dc.name.comment\"},{\"name\":\"Location\",\"i18n\":\"asset.location\",\"comment\":\"config.dc.location.comment\"},{\"name\":\"Telephone\",\"i18n\":\"config.dc.tel\",\"comment\":\"config.dc.tel.comment\"},{\"name\":\"Principal\",\"i18n\":\"config.dc.principal\",\"comment\":\"config.dc.principal.comment\"},{\"name\":\"Longitude\",\"i18n\":\"config.dc.longitude\",\"comment\":\"config.dc.longitude.comment\"},{\"name\":\"Latitude\",\"i18n\":\"config.dc.latitude\",\"comment\":\"config.dc.latitude.comment\"},{\"name\":\"State\",\"i18n\":\"overall.state\",\"comment\":\"config.dc.state.comment\"}]', 1, 'dc 导入导出表头信息'); REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'model_export_header', '[{\"name\":\"Name\",\"i18n\":\"config.model.name\",\"comment\":\"config.model.name.comment\"},{\"name\":\"Brand\",\"i18n\":\"asset.brand\",\"comment\":\"config.model.brand.comment\"},{\"name\":\"dashboard template\",\"i18n\":\"model.dashboardtemplate\",\"comment\":\"config.model.dashboardtemplate.comment\"},{\"name\":\"Description\",\"i18n\":\"overall.remark\",\"comment\":\"config.model.remark.comment\"},{\"name\":\"Type\",\"i18n\":\"overall.type\",\"comment\":\"asset.assetType.comment\"},{\"name\":\"SysObjectId\",\"i18n\":\"config.model.sysObjectId\",\"comment\":\"config.model.sysObjectId.comment\"}]', 1, 'asset model 导入导出表头信息'); REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'monitor_endpoint_export_header', '[{\"name\":\"Project Name\",\"i18n\":\"project.project.projectName\",\"comment\":\"project.project.projectName.comment\"},{\"name\":\"Module Name\",\"i18n\":\"overall.module\",\"comment\":\"project.endpoint.moduleName.comment\"},{\"name\":\"Name\",\"i18n\":\"overall.name\",\"comment\":\"project.endpoint.name.comment\"},{\"name\":\"Asset Name\",\"i18n\":\"asset.asset\",\"comment\":\"project.endpoint.asset.comment\"},{\"name\":\"Config\",\"i18n\":\"overall.config\",\"comment\":\"project.endpoint.configs.comment\"}]', 1, 'monitor endpoint 导入表头'); -REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'rule_export_header', '[{\"name\":\"name\",\"i18n\":\"overall.name\",\"comment\":\"alert.config.name.comment\"},{\"name\":\"type\",\"i18n\":\"overall.type\",\"comment\":\"alert.type.comment\"},{\"name\":\"Execution cycle\",\"i18n\":\"alert.config.inr\",\"comment\":\"alert.config.inr.comment\"},{\"name\":\"timeout\",\"i18n\":\"alert.config.timeout\",\"comment\":\"alert.config.timeout.comment\"},{\"name\":\"expr\",\"i18n\":\"alert.config.expr\",\"comment\":\"alert.config.expr.comment\"},{\"name\":\"condition\",\"i18n\":\"alert.config.condition\",\"comment\":\"alert.config.condition.comment\"},{\"name\":\"extLabels\",\"i18n\":\"alert.config.extLabels\",\"comment\":\"alert.config.extLabels.comment\"},{\"name\":\"unit\",\"i18n\":\"dashboard.dashboard.chartForm.unit\",\"comment\":\"alert.config.unit.comment\"},{\"name\":\"last\",\"i18n\":\"alert.config.for\",\"comment\":\"alert.config.for.comment\"},{\"name\":\"summary\",\"i18n\":\"alert.summary\",\"comment\":\"alert.summary.comment\"},{\"name\":\"description\",\"i18n\":\"overall.remark\",\"comment\":\"alert.description.comment\"},{\"name\":\"receiver\",\"i18n\":\"alert.receiver\",\"comment\":\"alert.receiver.comment\"},{\"name\":\"notify\",\"i18n\":\"alert.notify\",\"comment\":\"alert.notify.comment\"},{\"name\":\"state\",\"i18n\":\"overall.state\",\"comment\":\"alert.state.comment\"},{\"name\":\"autoExpired\",\"i18n\":\"alert.config.autoExpired\",\"comment\":\"alert.config.autoExpired.comment\"},{\"name\":\"schedEnable\",\"i18n\":\"alert.config.schedEnable\",\"comment\":\"alert.config.schedEnable.comment\"},{\"name\":\"schedDays\",\"i18n\":\"alert.config.schedDays\",\"comment\":\"alert.config.schedDays.comment\"},{\"name\":\"startAt\",\"i18n\":\"overall.startTime\",\"comment\":\"alert.startAt.comment\"},{\"name\":\"endAt\",\"i18n\":\"overall.endTime\",\"comment\":\"alert.endAt.comment\"},{\"name\":\"notifyActive\",\"i18n\":\"alert.config.notifyActive\",\"comment\":\"alert.config.notifyActive.comment\"},{\"name\":\"notifyExpired\",\"i18n\":\"alert.config.notifyExpired\",\"comment\":\"alert.config.notifyExpired.comment\"},{\"name\":\"trbShot\",\"i18n\":\"alert.config.trbShot\",\"comment\":\"alert.config.trbShot.comment\"}]', 1, NULL); +REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'rule_export_header', '[{\"name\":\"name\",\"i18n\":\"overall.name\",\"comment\":\"alert.config.name.comment\"},{\"name\":\"type\",\"i18n\":\"overall.type\",\"comment\":\"alert.type.comment\"},{\"name\":\"Execution cycle\",\"i18n\":\"alert.config.inr\",\"comment\":\"alert.config.inr.comment\"},{\"name\":\"timeout\",\"i18n\":\"alert.config.timeout\",\"comment\":\"alert.config.timeout.comment\"},{\"name\":\"expr\",\"i18n\":\"alert.config.expr\",\"comment\":\"alert.config.expr.comment\"},{\"name\":\"condition\",\"i18n\":\"alert.config.condition\",\"comment\":\"alert.config.condition.comment\"},{\"name\":\"extLabels\",\"i18n\":\"alert.config.extLabels\",\"comment\":\"alert.config.extLabels.comment\"},{\"name\":\"unit\",\"i18n\":\"dashboard.dashboard.chartForm.unit\",\"comment\":\"alert.config.unit.comment\"},{\"name\":\"last\",\"i18n\":\"alert.config.for\",\"comment\":\"alert.config.for.comment\"},{\"name\":\"summary\",\"i18n\":\"alert.summary\",\"comment\":\"alert.summary.comment\"},{\"name\":\"description\",\"i18n\":\"overall.remark\",\"comment\":\"alert.description.comment\"},{\"name\":\"receiver\",\"i18n\":\"alert.receiver\",\"comment\":\"alert.receiver.comment\"},{\"name\":\"notify\",\"i18n\":\"alert.notify\",\"comment\":\"alert.notify.comment\"},{\"name\":\"state\",\"i18n\":\"overall.state\",\"comment\":\"alert.state.comment\"},{\"name\":\"autoExpired\",\"i18n\":\"alert.config.autoExpired\",\"comment\":\"alert.config.autoExpired.comment\"},{\"name\":\"schedEnable\",\"i18n\":\"alert.config.schedEnable\",\"comment\":\"alert.config.schedEnable.comment\"},{\"name\":\"schedDays\",\"i18n\":\"alert.config.schedDays\",\"comment\":\"alert.config.schedDays.comment\"},{\"name\":\"startAt\",\"i18n\":\"overall.startTime\",\"comment\":\"alert.startAt.comment\"},{\"name\":\"endAt\",\"i18n\":\"overall.endTime\",\"comment\":\"alert.endAt.comment\"},{\"name\":\"notifyActive\",\"i18n\":\"alert.config.notifyActive\",\"comment\":\"alert.config.notifyActive.comment\"},{\"name\":\"notifyExpired\",\"i18n\":\"alert.config.notifyExpired\",\"comment\":\"alert.config.notifyExpired.comment\"},{\"name\":\"trbShot\",\"i18n\":\"alert.config.trbShot\",\"comment\":\"alert.config.trbShot.comment\"},{\"name\":\"param\",\"i18n\":\"alert.config.param\",\"comment\":\"alert.config.param.comment\"}]', 1, NULL); REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'asset_chart_export_header', '[{\"name\":\"group\",\"i18n\":\"dashboard.dashboard.chartForm.group\",\"comment\":\"dashboard.dashboard.chartForm.group.comment\"},{\"name\":\"title\",\"i18n\":\"overall.name\",\"comment\":\"dashboard.dashboard.chartForm.name.comment\"},{\"name\":\"type\",\"i18n\":\"overall.type\",\"comment\":\"dashboard.dashboard.chartForm.type.comment\"},{\"name\":\"varType\",\"i18n\":\"dashboard.dashboard.chartForm.varType\",\"comment\":\"dashboard.dashboard.chartForm.varType.comment\"},{\"name\":\"width\",\"i18n\":\"dashboard.dashboard.chartForm.width\",\"comment\":\"dashboard.dashboard.chartForm.width.comment\"},{\"name\":\"high\",\"i18n\":\"dashboard.dashboard.chartForm.high\",\"comment\":\"dashboard.dashboard.chartForm.high.comment\"},{\"name\":\"unit\",\"i18n\":\"dashboard.dashboard.chartForm.unit\",\"comment\":\"dashboard.dashboard.chartForm.unit.comment\"},{\"name\":\"legendValue\",\"i18n\":\"dashboard.dashboard.chartForm.legendValue\",\"comment\":\"dashboard.dashboard.chartForm.legendValue.comment\"},{\"name\":\"element\",\"i18n\":\"dashboard.dashboard.chartForm.element\",\"comment\":\"dashboard.dashboard.chartForm.element.comment\"},{\"name\":\"remark\",\"i18n\":\"overall.remark\",\"comment\":\"dashboard.dashboard.chartForm.remark.comment\"},{\"name\":\"Datasource\",\"i18n\":\"dashboard.dashboard.chartForm.datasource\",\"comment\":\"dashboard.dashboard.chartForm.datasource.comment\"},{\"name\":\"x\",\"i18n\":\"dashboard.dashboard.chartForm.x\",\"comment\":\"dashboard.dashboard.chartForm.x.comment\"},{\"name\":\"y\",\"i18n\":\"dashboard.dashboard.chartForm.y\",\"comment\":\"dashboard.dashboard.chartForm.y.comment\"}]', 1, NULL); REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'ipam_subnet_import_header', '[{\"name\":\"Name\",\"i18n\":\"overall.name\",\"comment\":\"config.ipamsubnet.name.comment\"},{\"name\":\"Type\",\"i18n\":\"overall.type\",\"comment\":\"config.ipamsubnet.type.comment\"},{\"name\":\"addr\",\"i18n\":\"overall.addr\",\"comment\":\"config.ipam.addr.comment\"},{\"name\":\"mask\",\"i18n\":\"overall.mask\",\"comment\":\"config.ipamsubnet.mask.comment\"},{\"name\":\"vlan\",\"i18n\":\"overall.vlan\",\"comment\":\"config.ipamsubnet.vlan.comment\"},{\"name\":\"Datacenter\",\"i18n\":\"ipamsubnet.dc.dcId\",\"comment\":\"ipamsubnet.dc.dcId.comment\"},{\"name\":\"Remark\",\"i18n\":\"overall.remark\",\"comment\":\"overall.remark.comment\"}]', 1, 'ipamsubnet导出模板'); REPLACE INTO `sys_config`(`id`, `param_key`, `param_value`, `status`, `remark`) VALUES (null, 'ipam_ip_import_header', '[{\"name\":\"Name\",\"i18n\":\"overall.name\",\"comment\":\"config.ipamip.name.comment\"},{\"name\":\"ipamsubnet\",\"i18n\":\"config.ipamip.ipamsubnet\",\"comment\":\"config.ipamip.ipamsubnet.comment\"},{\"name\":\"addr\",\"i18n\":\"overall.addr\",\"comment\":\"config.ipam.addr.comment\"},{\"name\":\"mac\",\"i18n\":\"config.ipamip.mac\",\"comment\":\"config.ipamip.mac.comment\"},{\"name\":\"asset\",\"i18n\":\"asset.asset\",\"comment\":\"config.ipamip.asset.comment\"},{\"name\":\"state\",\"i18n\":\"overall.state\",\"comment\":\"config.ipamip.state.comment\"},{\"name\":\"Remark\",\"i18n\":\"overall.remark\",\"comment\":\"overall.remark.comment\"}]', 1, 'ipamip导入头模板'); diff --git a/nz-admin/src/main/resources/db/V2023.09.07__alert_rule table add param column.sql b/nz-admin/src/main/resources/db/V2023.09.07__alert_rule table add param column.sql new file mode 100644 index 00000000..bd050ffd --- /dev/null +++ b/nz-admin/src/main/resources/db/V2023.09.07__alert_rule table add param column.sql @@ -0,0 +1,10 @@ +/** + + 1. alert_rule drop dashboard_id + 2. alert_rule add param + + */ + +ALTER TABLE `alert_rule` +DROP COLUMN IF EXISTS `dashboard_id`, +ADD COLUMN IF NOT EXISTS `param` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '其它参数'; diff --git a/nz-admin/src/main/resources/mapper/alert/AlertRuleDao.xml b/nz-admin/src/main/resources/mapper/alert/AlertRuleDao.xml index 852dd908..102b48b2 100644 --- a/nz-admin/src/main/resources/mapper/alert/AlertRuleDao.xml +++ b/nz-admin/src/main/resources/mapper/alert/AlertRuleDao.xml @@ -23,7 +23,7 @@ <result property="condition" column="condition"/> <result property="extLabels" column="ext_labels"/> - <result property="dashboardId" column="dashboard_id"/> + <result property="param" column="param"/> <result property="autoExpired" column="auto_expired"/> <result property="schedEnable" column="sched_enable"/> diff --git a/nz-common/src/main/java/com/nis/common/utils/RCode.java b/nz-common/src/main/java/com/nis/common/utils/RCode.java index f4071fe8..4e347056 100644 --- a/nz-common/src/main/java/com/nis/common/utils/RCode.java +++ b/nz-common/src/main/java/com/nis/common/utils/RCode.java @@ -499,6 +499,7 @@ public enum RCode { ALERTRULE_EXTLABELS_FORMAT(423048, "Alert rule extLabels format error"), ALERTRULE_SNMPTRAP_OPERATOR_ERROR(423049, "The SNMP trap type operator only supports regex"), ALERTRULE_SELECT_DASHBOARD_TYPE_INCORRECT(424050,"Incorrect type selection, only `dashboard` type dashboard is supported"), + ALERTRULE_PARAM_FORMAT_ERROR(423051, "Parameter format error"), |
