fix(任务中心): 任务中心组织&项目筛选
This commit is contained in:
parent
a38dea6e30
commit
b016c753fa
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -110,6 +110,16 @@
|
|||
and exec_task.trigger_mode in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<!-- 所属组织 -->
|
||||
<when test="key=='organizationName'">
|
||||
and exec_task_item.organization_id in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<!-- 所属项目 -->
|
||||
<when test="key=='projectName'">
|
||||
and exec_task_item.project_id in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
|
|
@ -90,6 +90,16 @@
|
|||
and exec_task.result in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<!-- 所属组织 -->
|
||||
<when test="key=='organizationName'">
|
||||
and exec_task.organization_id in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<!-- 所属项目 -->
|
||||
<when test="key=='projectName'">
|
||||
and exec_task.project_id in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
</foreach>
|
||||
|
|
|
@ -407,13 +407,13 @@
|
|||
and task.resource_type in
|
||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||
</when>
|
||||
<when test="key=='projectIds'">
|
||||
<when test="key=='projectName'">
|
||||
and task.project_id in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='organizationIds'">
|
||||
<when test="key=='organizationName'">
|
||||
and task.organization_id in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
|
|
|
@ -389,11 +389,17 @@ public class BaseTaskHubService {
|
|||
}
|
||||
List<String> userIds = list.stream().map(TaskHubItemDTO::getExecutor).distinct().toList();
|
||||
List<String> resourcePoolIds = list.stream().map(TaskHubItemDTO::getResourcePoolId).distinct().toList();
|
||||
List<String> projectIds = list.stream().map(TaskHubItemDTO::getProjectId).distinct().toList();
|
||||
List<String> organizationIds = list.stream().map(TaskHubItemDTO::getOrganizationId).distinct().toList();
|
||||
Map<String, String> projectMaps = getProjectMaps(projectIds);
|
||||
Map<String, String> organizationMaps = getOrganizationMaps(organizationIds);
|
||||
Map<String, String> userMaps = getUserMaps(userIds);
|
||||
Map<String, String> 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));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue