diff --git a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapter.java b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapter.java index 094714358..6e4efbd70 100644 --- a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapter.java +++ b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapter.java @@ -19,8 +19,6 @@ public interface RequestContextAdapter { void queryWrapperTenantAdapt(QueryWrapper queryWrapper, String tenant, String workspace); - void tenantAdapt(String tenant, String workspace); - void queryWrapperTenantAdapt(QueryWrapper queryWrapper, String tenant); void queryWrapperWorkspaceAdapt(QueryWrapper queryWrapper, String workspace); diff --git a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapterImpl.java b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapterImpl.java index a74b4ed25..64d29a314 100644 --- a/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapterImpl.java +++ b/server/home/home-common/src/main/java/io/holoinsight/server/home/common/service/RequestContextAdapterImpl.java @@ -37,11 +37,6 @@ public void queryWrapperTenantAdapt(QueryWrapper queryWrapper, String ten } } - @Override - public void tenantAdapt(String tenant, String workspace) { - - } - @Override public void queryWrapperTenantAdapt(QueryWrapper queryWrapper, String tenant) { if (queryWrapper != null && StringUtils.isNotBlank(tenant)) { diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AlertGroupService.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AlertGroupService.java index 0e4f2bb4e..462edd525 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AlertGroupService.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/AlertGroupService.java @@ -22,8 +22,6 @@ public interface AlertGroupService extends IService { Boolean updateById(AlarmGroupDTO alarmGroupDTO); - AlarmGroupDTO queryById(Long id, String tenant); - AlarmGroupDTO queryById(Long id, String tenant, String workspace); List getListByUserLike(String userId, String tenant); diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlarmMetricServiceImpl.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlarmMetricServiceImpl.java index 6dea4c5c0..8927cd802 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlarmMetricServiceImpl.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlarmMetricServiceImpl.java @@ -56,7 +56,6 @@ public List queryByMetric(String metric, String tenant, String work @Override public List queryByRuleId(Long ruleId, String tenant, String workspace) { - this.requestContextAdapter.tenantAdapt(tenant, workspace); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("deleted", 0); if (StringUtils.isNotBlank(tenant)) { diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertDingDingRobotServiceImpl.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertDingDingRobotServiceImpl.java index ed0d27800..592cbf37e 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertDingDingRobotServiceImpl.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertDingDingRobotServiceImpl.java @@ -75,10 +75,8 @@ public MonitorPageResult getListByPage( AlarmDingDingRobot alarmDingDingRobot = alarmDingDingRobotConverter.dtoToDO(pageRequest.getTarget()); - wrapper.eq("tenant", alarmDingDingRobot.getTenant()); - if (StringUtils.isNotEmpty(alarmDingDingRobot.getWorkspace())) { - wrapper.eq("workspace", alarmDingDingRobot.getWorkspace()); - } + requestContextAdapter.queryWrapperTenantAdapt(wrapper, alarmDingDingRobot.getTenant(), + alarmDingDingRobot.getWorkspace()); if (null != alarmDingDingRobot.getId()) { wrapper.eq("id", alarmDingDingRobot.getId()); diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertGroupServiceImpl.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertGroupServiceImpl.java index d6a1f57c4..5a45bea76 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertGroupServiceImpl.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/AlertGroupServiceImpl.java @@ -44,11 +44,6 @@ public Boolean updateById(AlarmGroupDTO alarmGroupDTO) { return this.updateById(alarmGroup); } - @Override - public AlarmGroupDTO queryById(Long id, String tenant) { - return queryById(id, tenant, requestContextAdapter.getWorkspace(true)); - } - @Override public AlarmGroupDTO queryById(Long id, String tenant, String workspace) { QueryWrapper wrapper = new QueryWrapper<>(); diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmGroupFacadeImpl.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmGroupFacadeImpl.java index 3b03129cb..cd34c1fce 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmGroupFacadeImpl.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmGroupFacadeImpl.java @@ -192,7 +192,7 @@ public void checkParameter() { public void doManage() { AlarmGroupDTO item = alarmGroupService.queryById(alarmGroup.getId(), - RequestContext.getContext().ms.getTenant()); + RequestContext.getContext().ms.getTenant(), requestContextAdapter.getWorkspace(true)); if (null == item) { throw new MonitorException("cannot find record: " + alarmGroup.getId()); } @@ -233,8 +233,8 @@ public void checkParameter() { @Override public void doManage() { - AlarmGroupDTO save = - alarmGroupService.queryById(id, RequestContext.getContext().ms.getTenant()); + AlarmGroupDTO save = alarmGroupService.queryById(id, + RequestContext.getContext().ms.getTenant(), requestContextAdapter.getWorkspace(true)); JsonResult.createSuccessResult(result, save); } }); @@ -256,7 +256,8 @@ public void checkParameter() { public void doManage() { MonitorScope ms = RequestContext.getContext().ms; boolean rtn = false; - AlarmGroupDTO alarmGroup = alarmGroupService.queryById(id, ms.getTenant()); + AlarmGroupDTO alarmGroup = alarmGroupService.queryById(id, ms.getTenant(), + requestContextAdapter.getWorkspace(true)); if (alarmGroup != null && StringUtils.equals(alarmGroup.getTenant(), ms.getTenant())) { rtn = alarmGroupService.removeById(id); } diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertNotifyRecordController.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertNotifyRecordController.java index f8eb574b6..5756b6cb6 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertNotifyRecordController.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlertNotifyRecordController.java @@ -47,8 +47,8 @@ public void checkParameter() { @Override public void doManage() { MonitorScope ms = RequestContext.getContext().ms; - AlertNotifyRecordDTO save = alertNotifyRecordService.queryByHistoryDetailId(historyDetailId, - ms.getTenant(), ms.getWorkspace()); + AlertNotifyRecordDTO save = + alertNotifyRecordService.queryByHistoryDetailId(historyDetailId, tenant(), workspace()); JsonResult.createSuccessResult(result, save); } }); @@ -69,12 +69,13 @@ public void checkParameter() { @Override public void doManage() { - MonitorScope ms = RequestContext.getContext().ms; - if (null != ms && !StringUtils.isEmpty(ms.tenant)) { - pageRequest.getTarget().setTenant(ms.tenant); + String tenant = tenant(); + String workspace = workspace(); + if (StringUtils.isNotEmpty(tenant)) { + pageRequest.getTarget().setTenant(tenant); } - if (null != ms && !StringUtils.isEmpty(ms.workspace)) { - pageRequest.getTarget().setWorkspace(ms.workspace); + if (StringUtils.isNotEmpty(workspace)) { + pageRequest.getTarget().setWorkspace(workspace); } JsonResult.createSuccessResult(result, alertNotifyRecordService.getListByPage(pageRequest)); } diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java index b0b7600ea..fb627310b 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java @@ -89,7 +89,7 @@ public class AlarmRuleLevelAuthorizationChecker extends AbstractQueryChecker "max", "count", "none", "SUM", "AVG", "MIX", "MAX", "COUNT", "NONE")); private static final Set metricTypes = new HashSet<>(Arrays.asList("app", "cache", "log", "oss", "trace", "system", "metric", - "service", "function", "pg", "mongodb", "db", "miniProgram")); + "service", "function", "pg", "mongodb", "db", "miniProgram", "mysql")); private static final Set products = new HashSet<>(Arrays.asList("JVM", "Function", "OceanBase", "Tbase", "PortCheck", "System", "MiniProgram", "Spanner", "IoT"));