打印了JENKINS节点日志
This commit is contained in:
parent
99161d3f7d
commit
9acae67438
@ -73,8 +73,11 @@ public class DeployApiController {
|
||||
@Operation(summary = "获取我的部署审批任务", description = "查询当前登录用户待审批的部署任务,包含完整的部署业务上下文信息")
|
||||
@GetMapping("/my-approval-tasks")
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
public Response<List<DeployApprovalTaskDTO>> getMyApprovalTasks() {
|
||||
return Response.success(deployService.getMyApprovalTasks());
|
||||
public Response<List<DeployApprovalTaskDTO>> getMyApprovalTasks(
|
||||
@Parameter(description = "工作流定义Key列表(可选,支持查询多个工作流的待审批任务)")
|
||||
@RequestParam(required = false) List<String> workflowDefinitionKeys
|
||||
) {
|
||||
return Response.success(deployService.getMyApprovalTasks(workflowDefinitionKeys));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -31,9 +31,10 @@ public interface IDeployService {
|
||||
* 获取当前用户的部署审批任务列表
|
||||
* <p>查询当前登录用户待审批的部署任务,包含完整的部署业务上下文信息
|
||||
*
|
||||
* @param workflowDefinitionKeys 工作流定义Key列表(可选,支持查询多个工作流的待审批任务)
|
||||
* @return 部署审批任务列表
|
||||
*/
|
||||
List<DeployApprovalTaskDTO> getMyApprovalTasks();
|
||||
List<DeployApprovalTaskDTO> getMyApprovalTasks(List<String> workflowDefinitionKeys);
|
||||
|
||||
/**
|
||||
* 完成部署审批
|
||||
|
||||
@ -31,6 +31,7 @@ import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -695,17 +696,31 @@ public class DeployServiceImpl implements IDeployService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeployApprovalTaskDTO> getMyApprovalTasks() {
|
||||
public List<DeployApprovalTaskDTO> getMyApprovalTasks(List<String> workflowDefinitionKeys) {
|
||||
// 1. 获取当前登录用户
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
log.info("查询用户 {} 的部署审批任务", currentUsername);
|
||||
log.info("查询用户 {} 的部署审批任务, workflowDefinitionKeys={}", currentUsername, workflowDefinitionKeys);
|
||||
|
||||
// 2. 查询用户的所有待办任务(包括候选人和分配人,支持或签模式)
|
||||
List<Task> tasks = taskService.createTaskQuery()
|
||||
// 2. 查询用户的部署工作流待办任务(支持多个工作流)
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.taskCandidateOrAssigned(currentUsername)
|
||||
.orderByTaskCreateTime()
|
||||
.desc()
|
||||
.list();
|
||||
.desc();
|
||||
|
||||
// 如果指定了工作流定义Key列表,则精确筛选这些工作流的所有待审批任务
|
||||
if (workflowDefinitionKeys != null && !workflowDefinitionKeys.isEmpty()) {
|
||||
// 过滤掉空字符串
|
||||
List<String> validKeys = workflowDefinitionKeys.stream()
|
||||
.filter(key -> key != null && !key.trim().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!validKeys.isEmpty()) {
|
||||
taskQuery.processDefinitionKeyIn(validKeys);
|
||||
log.debug("按工作流定义Key列表筛选: {}", validKeys);
|
||||
}
|
||||
}
|
||||
|
||||
List<Task> tasks = taskQuery.list();
|
||||
|
||||
if (tasks.isEmpty()) {
|
||||
log.info("用户 {} 当前没有待办审批任务", currentUsername);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user