From 8ed2df212d3230016a94fb443c9871dae3687f21 Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Thu, 18 Jun 2026 13:52:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9=20"Candida?= =?UTF-8?q?te=20group=20list=20is=20empty"=EF=BC=88=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/FlowTaskServiceImpl.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/healthlink-his-server/core-flowable/src/main/java/com/core/flowable/service/impl/FlowTaskServiceImpl.java b/healthlink-his-server/core-flowable/src/main/java/com/core/flowable/service/impl/FlowTaskServiceImpl.java index a5408ac95..1ffb2de6c 100755 --- a/healthlink-his-server/core-flowable/src/main/java/com/core/flowable/service/impl/FlowTaskServiceImpl.java +++ b/healthlink-his-server/core-flowable/src/main/java/com/core/flowable/service/impl/FlowTaskServiceImpl.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.AjaxResult; import com.core.common.core.domain.entity.SysRole; import com.core.common.core.domain.entity.SysUser; +import com.core.common.core.domain.model.LoginUser; import com.core.common.exception.CustomException; import com.core.common.utils.SecurityUtils; import com.core.flowable.common.constant.ProcessConstants; @@ -629,11 +630,20 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask public AjaxResult todoList(FlowQueryVo queryVo) { Page page = new Page<>(); // 只查看自己的数据 - SysUser sysUser = SecurityUtils.getLoginUser().getUser(); + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (loginUser == null) { + return AjaxResult.success(page); + } + SysUser sysUser = loginUser.getUser(); + List roleIds = sysUser.getRoles() != null + ? sysUser.getRoles().stream().map(role -> role.getRoleId().toString()).collect(Collectors.toList()) + : Collections.emptyList(); TaskQuery taskQuery = taskService.createTaskQuery().active().includeProcessVariables() - .taskCandidateGroupIn( - sysUser.getRoles().stream().map(role -> role.getRoleId().toString()).collect(Collectors.toList())) - .taskCandidateOrAssigned(sysUser.getUserId().toString()).orderByTaskCreateTime().desc(); + .taskCandidateOrAssigned(sysUser.getUserId().toString()); + if (!roleIds.isEmpty()) { + taskQuery.taskCandidateGroupIn(roleIds); + } + taskQuery.orderByTaskCreateTime().desc(); // TODO 传入名称查询不到数据? if (StringUtils.isNotBlank(queryVo.getName())) {