From c1071d82f40ebbc239ff6065c8fc068dffc41dac Mon Sep 17 00:00:00 2001 From: opensnail <598092184@qq.com> Date: Fri, 7 Jun 2024 00:02:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(sj=5F1.0.0):=20=E4=BF=AE=E5=A4=8D=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/impl/GroupConfigServiceImpl.java | 3 ++- .../server/web/service/impl/JobServiceImpl.java | 10 ++++------ .../web/service/impl/NotifyConfigServiceImpl.java | 3 ++- .../service/impl/RetryDeadLetterServiceImpl.java | 13 +++++++------ .../web/service/impl/RetryTaskLogServiceImpl.java | 8 +++++--- .../web/service/impl/RetryTaskServiceImpl.java | 4 +++- .../web/service/impl/SceneConfigServiceImpl.java | 9 ++++----- .../web/service/impl/WorkflowServiceImpl.java | 4 +++- 8 files changed, 30 insertions(+), 24 deletions(-) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/GroupConfigServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/GroupConfigServiceImpl.java index a2025340..22c49906 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/GroupConfigServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/GroupConfigServiceImpl.java @@ -182,6 +182,7 @@ public class GroupConfigServiceImpl implements GroupConfigService { UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); String namespaceId = userSessionVO.getNamespaceId(); + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); ConfigAccess groupConfigAccess = accessTemplate.getGroupConfigAccess(); PageDTO groupConfigPageDTO = groupConfigAccess.listPage( @@ -189,7 +190,7 @@ public class GroupConfigServiceImpl implements GroupConfigService { new LambdaQueryWrapper() .eq(GroupConfig::getNamespaceId, namespaceId) .eq(Objects.nonNull(queryVO.getGroupStatus()), GroupConfig::getGroupStatus, queryVO.getGroupStatus()) - .in(userSessionVO.isUser(), GroupConfig::getGroupName, userSessionVO.getGroupNames()) + .in(CollUtil.isNotEmpty(groupNames), GroupConfig::getGroupName, groupNames) .likeRight(StrUtil.isNotBlank(queryVO.getGroupName()), GroupConfig::getGroupName, StrUtil.trim(queryVO.getGroupName())) .orderByDesc(GroupConfig::getId)); diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/JobServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/JobServiceImpl.java index e2f8c7a2..9703dbab 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/JobServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/JobServiceImpl.java @@ -44,10 +44,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; +import java.util.*; /** * @author opensnail @@ -83,11 +80,12 @@ public class JobServiceImpl implements JobService { PageDTO pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); + PageDTO selectPage = jobMapper.selectPage(pageDTO, new LambdaQueryWrapper() .eq(Job::getNamespaceId, userSessionVO.getNamespaceId()) - .in(userSessionVO.isUser(), Job::getGroupName, userSessionVO.getGroupNames()) - .eq(StrUtil.isNotBlank(queryVO.getGroupName()), Job::getGroupName, queryVO.getGroupName()) + .in(CollUtil.isNotEmpty(groupNames), Job::getGroupName, groupNames) .likeRight(StrUtil.isNotBlank(queryVO.getJobName()), Job::getJobName, StrUtil.trim(queryVO.getJobName())) .eq(Objects.nonNull(queryVO.getJobStatus()), Job::getJobStatus, queryVO.getJobStatus()) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyConfigServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyConfigServiceImpl.java index 30e9d34d..c8a43e0f 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyConfigServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/NotifyConfigServiceImpl.java @@ -55,12 +55,13 @@ public class NotifyConfigServiceImpl implements NotifyConfigService { @Override public PageResult> getNotifyConfigList(NotifyConfigQueryVO queryVO) { PageDTO pageDTO = new PageDTO<>(); + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); List notifyConfigs = accessTemplate.getNotifyConfigAccess().listPage(pageDTO, new LambdaQueryWrapper() .eq(NotifyConfig::getNamespaceId, userSessionVO.getNamespaceId()) - .in(userSessionVO.isUser(), NotifyConfig::getGroupName, userSessionVO.getGroupNames()) + .in(CollUtil.isNotEmpty(groupNames), NotifyConfig::getGroupName, groupNames) .eq(StrUtil.isNotBlank(queryVO.getGroupName()), NotifyConfig::getGroupName, queryVO.getGroupName()) .eq(StrUtil.isNotBlank(queryVO.getSceneName()), NotifyConfig::getBusinessId, queryVO.getSceneName()) .orderByDesc(NotifyConfig::getId)) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryDeadLetterServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryDeadLetterServiceImpl.java index ceea11d2..81764a20 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryDeadLetterServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryDeadLetterServiceImpl.java @@ -1,5 +1,6 @@ package com.aizuda.snailjob.server.web.service.impl; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import com.aizuda.snailjob.common.core.enums.RetryStatusEnum; @@ -15,6 +16,7 @@ import com.aizuda.snailjob.server.web.model.base.PageResult; import com.aizuda.snailjob.server.web.model.request.BatchDeleteRetryDeadLetterVO; import com.aizuda.snailjob.server.web.model.request.BatchRollBackRetryDeadLetterVO; import com.aizuda.snailjob.server.web.model.request.RetryDeadLetterQueryVO; +import com.aizuda.snailjob.server.web.model.request.UserSessionVO; import com.aizuda.snailjob.server.web.model.response.RetryDeadLetterResponseVO; import com.aizuda.snailjob.server.web.service.RetryDeadLetterService; import com.aizuda.snailjob.server.web.service.convert.RetryDeadLetterResponseVOConverter; @@ -35,10 +37,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * @author: opensnail @@ -59,13 +58,15 @@ public class RetryDeadLetterServiceImpl implements RetryDeadLetterService { if (StrUtil.isBlank(queryVO.getGroupName())) { return new PageResult<>(pageDTO, new ArrayList<>()); } - String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId(); + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); + + String namespaceId = UserSessionUtils.currentUserSession().getNamespaceId(); PageDTO retryDeadLetterPageDTO = accessTemplate.getRetryDeadLetterAccess() .listPage(queryVO.getGroupName(), namespaceId, pageDTO, new LambdaQueryWrapper() .eq(RetryDeadLetter::getNamespaceId, namespaceId) - .eq(RetryDeadLetter::getGroupName, queryVO.getGroupName()) + .in(CollUtil.isNotEmpty(groupNames), RetryDeadLetter::getGroupName, groupNames) .eq(StrUtil.isNotBlank(queryVO.getSceneName()), RetryDeadLetter::getSceneName, queryVO.getSceneName()) .eq(StrUtil.isNotBlank(queryVO.getBizNo()), RetryDeadLetter::getBizNo, queryVO.getBizNo()) .eq(StrUtil.isNotBlank(queryVO.getIdempotentId()), RetryDeadLetter::getIdempotentId, queryVO.getIdempotentId()) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskLogServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskLogServiceImpl.java index c9a283f8..611652a6 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskLogServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskLogServiceImpl.java @@ -43,14 +43,16 @@ public class RetryTaskLogServiceImpl implements RetryTaskLogService { @Override public PageResult> getRetryTaskLogPage(RetryTaskLogQueryVO queryVO) { + PageDTO pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); String namespaceId = userSessionVO.getNamespaceId(); - PageDTO pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); + + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); + LambdaQueryWrapper retryTaskLogLambdaQueryWrapper = new LambdaQueryWrapper() .eq(RetryTaskLog::getNamespaceId, namespaceId) - .in(userSessionVO.isUser(), RetryTaskLog::getGroupName, userSessionVO.getGroupNames()) - .eq(StrUtil.isNotBlank(queryVO.getGroupName()), RetryTaskLog::getGroupName, queryVO.getGroupName()) + .in(CollUtil.isNotEmpty(groupNames), RetryTaskLog::getGroupName, groupNames) .eq(StrUtil.isNotBlank(queryVO.getSceneName()), RetryTaskLog::getSceneName, queryVO.getSceneName()) .eq(StrUtil.isNotBlank(queryVO.getBizNo()), RetryTaskLog::getBizNo, queryVO.getBizNo()) .eq(StrUtil.isNotBlank(queryVO.getUniqueId()), RetryTaskLog::getUniqueId, queryVO.getUniqueId()) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskServiceImpl.java index eeae92e1..a66880bc 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/RetryTaskServiceImpl.java @@ -86,9 +86,11 @@ public class RetryTaskServiceImpl implements RetryTaskService { return new PageResult<>(pageDTO, new ArrayList<>()); } + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() .eq(RetryTask::getNamespaceId, namespaceId) - .eq(RetryTask::getGroupName, queryVO.getGroupName()) + .in(CollUtil.isNotEmpty(groupNames), RetryTask::getGroupName, groupNames) .eq(StrUtil.isNotBlank(queryVO.getSceneName()), RetryTask::getSceneName, queryVO.getSceneName()) .eq(StrUtil.isNotBlank(queryVO.getBizNo()), RetryTask::getBizNo, queryVO.getBizNo()) .eq(StrUtil.isNotBlank(queryVO.getIdempotentId()), RetryTask::getIdempotentId, queryVO.getIdempotentId()) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/SceneConfigServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/SceneConfigServiceImpl.java index 62bb48bc..ea659f41 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/SceneConfigServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/SceneConfigServiceImpl.java @@ -75,14 +75,13 @@ public class SceneConfigServiceImpl implements SceneConfigService { PageDTO pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); - String namespaceId = userSessionVO.getNamespaceId(); + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); + pageDTO = accessTemplate.getSceneConfigAccess().listPage(pageDTO, new LambdaQueryWrapper() - .eq(RetrySceneConfig::getNamespaceId, namespaceId) - .in(userSessionVO.isUser(), RetrySceneConfig::getGroupName, userSessionVO.getGroupNames()) + .eq(RetrySceneConfig::getNamespaceId, userSessionVO.getNamespaceId()) + .in(CollUtil.isNotEmpty(groupNames), RetrySceneConfig::getGroupName, groupNames) .eq(Objects.nonNull(queryVO.getSceneStatus()), RetrySceneConfig::getSceneStatus, queryVO.getSceneStatus()) - .eq(StrUtil.isNotBlank(queryVO.getGroupName()), - RetrySceneConfig::getGroupName, StrUtil.trim(queryVO.getGroupName())) .likeRight(StrUtil.isNotBlank(queryVO.getSceneName()), RetrySceneConfig::getSceneName, StrUtil.trim(queryVO.getSceneName())) .orderByDesc(RetrySceneConfig::getCreateDt)); diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/WorkflowServiceImpl.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/WorkflowServiceImpl.java index 2631beba..bb3e22dc 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/WorkflowServiceImpl.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/service/impl/WorkflowServiceImpl.java @@ -178,11 +178,13 @@ public class WorkflowServiceImpl implements WorkflowService { PageDTO pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize()); UserSessionVO userSessionVO = UserSessionUtils.currentUserSession(); + List groupNames = UserSessionUtils.getGroupNames(queryVO.getGroupName()); + PageDTO page = workflowMapper.selectPage(pageDTO, new LambdaQueryWrapper() .eq(Workflow::getDeleted, StatusEnum.NO.getStatus()) .eq(Workflow::getNamespaceId, userSessionVO.getNamespaceId()) - .eq(StrUtil.isNotBlank(queryVO.getGroupName()), Workflow::getGroupName, queryVO.getGroupName()) + .in(CollUtil.isNotEmpty(groupNames), Workflow::getGroupName, groupNames) .like(StrUtil.isNotBlank(queryVO.getWorkflowName()), Workflow::getWorkflowName, queryVO.getWorkflowName()) .eq(Objects.nonNull(queryVO.getWorkflowStatus()), Workflow::getWorkflowStatus,