fix(任务中心): 任务中心组织&项目筛选
This commit is contained in:
parent
a38dea6e30
commit
b016c753fa
|
@ -1,7 +1,11 @@
|
||||||
package io.metersphere.system.dto.taskhub;
|
package io.metersphere.system.dto.taskhub;
|
||||||
|
|
||||||
import io.metersphere.system.domain.ExecTaskItem;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,5 +35,9 @@ public class TaskHubItemDTO extends ExecTaskItem {
|
||||||
@Schema(description = "线程id")
|
@Schema(description = "线程id")
|
||||||
private String threadId;
|
private String threadId;
|
||||||
|
|
||||||
|
@Schema(description = "项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@Schema(description = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,16 @@
|
||||||
and exec_task.trigger_mode in
|
and exec_task.trigger_mode in
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||||
</when>
|
</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>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
@ -90,6 +90,16 @@
|
||||||
and exec_task.result in
|
and exec_task.result in
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||||
</when>
|
</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>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
@ -407,13 +407,13 @@
|
||||||
and task.resource_type in
|
and task.resource_type in
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
|
||||||
</when>
|
</when>
|
||||||
<when test="key=='projectIds'">
|
<when test="key=='projectName'">
|
||||||
and task.project_id in
|
and task.project_id in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
</foreach>
|
</foreach>
|
||||||
</when>
|
</when>
|
||||||
<when test="key=='organizationIds'">
|
<when test="key=='organizationName'">
|
||||||
and task.organization_id in
|
and task.organization_id in
|
||||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||||
#{value}
|
#{value}
|
||||||
|
|
|
@ -389,11 +389,17 @@ public class BaseTaskHubService {
|
||||||
}
|
}
|
||||||
List<String> userIds = list.stream().map(TaskHubItemDTO::getExecutor).distinct().toList();
|
List<String> userIds = list.stream().map(TaskHubItemDTO::getExecutor).distinct().toList();
|
||||||
List<String> resourcePoolIds = list.stream().map(TaskHubItemDTO::getResourcePoolId).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> userMaps = getUserMaps(userIds);
|
||||||
Map<String, String> resourcePoolMaps = getResourcePoolMaps(resourcePoolIds);
|
Map<String, String> resourcePoolMaps = getResourcePoolMaps(resourcePoolIds);
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
item.setUserName(userMaps.getOrDefault(item.getExecutor(), StringUtils.EMPTY));
|
item.setUserName(userMaps.getOrDefault(item.getExecutor(), StringUtils.EMPTY));
|
||||||
item.setResourcePoolName(resourcePoolMaps.getOrDefault(item.getResourcePoolId(), 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