From b016c753fa4a9d8c79aa77a7d7c67b7c1f17f7bb Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Fri, 25 Oct 2024 18:17:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=20=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83=E7=BB=84=E7=BB=87&?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/system/dto/taskhub/TaskHubItemDTO.java | 8 ++++++++ .../system/mapper/ExtExecTaskItemMapper.xml | 10 ++++++++++ .../io/metersphere/system/mapper/ExtExecTaskMapper.xml | 10 ++++++++++ .../io/metersphere/system/mapper/ExtScheduleMapper.xml | 4 ++-- .../metersphere/system/service/BaseTaskHubService.java | 6 ++++++ 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/taskhub/TaskHubItemDTO.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/taskhub/TaskHubItemDTO.java index 427da2ed08..9051854fb3 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/taskhub/TaskHubItemDTO.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/taskhub/TaskHubItemDTO.java @@ -1,7 +1,11 @@ package io.metersphere.system.dto.taskhub; import io.metersphere.system.domain.ExecTaskItem; +import io.metersphere.validation.groups.Created; +import io.metersphere.validation.groups.Updated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; import lombok.Data; /** @@ -31,5 +35,9 @@ public class TaskHubItemDTO extends ExecTaskItem { @Schema(description = "线程id") private String threadId; + @Schema(description = "项目名称") + private String projectName; + @Schema(description = "组织名称") + private String organizationName; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml index e6638ee243..bf5a8a2ba6 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml @@ -110,6 +110,16 @@ and exec_task.trigger_mode in + + + and exec_task_item.organization_id in + + + + + and exec_task_item.project_id in + + diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml index aaef053319..6714387fbd 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskMapper.xml @@ -90,6 +90,16 @@ and exec_task.result in + + + and exec_task.organization_id in + + + + + and exec_task.project_id in + + diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml index 87f29a45c5..9fc4d97ddf 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtScheduleMapper.xml @@ -407,13 +407,13 @@ and task.resource_type in - + and task.project_id in #{value} - + and task.organization_id in #{value} diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java index 32863e853a..f849618699 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java @@ -389,11 +389,17 @@ public class BaseTaskHubService { } List userIds = list.stream().map(TaskHubItemDTO::getExecutor).distinct().toList(); List resourcePoolIds = list.stream().map(TaskHubItemDTO::getResourcePoolId).distinct().toList(); + List projectIds = list.stream().map(TaskHubItemDTO::getProjectId).distinct().toList(); + List organizationIds = list.stream().map(TaskHubItemDTO::getOrganizationId).distinct().toList(); + Map projectMaps = getProjectMaps(projectIds); + Map organizationMaps = getOrganizationMaps(organizationIds); Map userMaps = getUserMaps(userIds); Map resourcePoolMaps = getResourcePoolMaps(resourcePoolIds); list.forEach(item -> { item.setUserName(userMaps.getOrDefault(item.getExecutor(), StringUtils.EMPTY)); item.setResourcePoolName(resourcePoolMaps.getOrDefault(item.getResourcePoolId(), StringUtils.EMPTY)); + item.setProjectName(projectMaps.getOrDefault(item.getProjectId(), StringUtils.EMPTY)); + item.setOrganizationName(organizationMaps.getOrDefault(item.getOrganizationId(), StringUtils.EMPTY)); }); }