feat(系统设置): 资源池列表新增列

This commit is contained in:
guoyuqi 2024-09-20 12:52:54 +08:00 committed by Craftsman
parent 2d48e8bb86
commit f5706f2a44
7 changed files with 43 additions and 0 deletions

View File

@ -435,6 +435,7 @@ http_result_not_found=%s不存在
enum_value_valid_message=枚举值不合法,必须为
#system organization
all_organization=全部组织
organization_member_log=组织成员
#system project
project_admin=项目管理员

View File

@ -70,6 +70,7 @@ start_time_is_null=Start time cannot be null
end_time_is_null=End time cannot be null
#organization
all_organization=All Organization
organization_not_exists=Organization is not exists
#test resource pool
test_resource_pool_id_is_null=Test Resource Pool ID cannot be null

View File

@ -70,6 +70,7 @@ startTime_must_be_less_than_endTime=开始日期必须小于结束日期
start_time_is_null=开始日期不能为空
end_time_is_null=结束日期不能为空
all_organization=全部组织
organization_not_exists=组织不存在
#test resource pool
test_resource_pool_id_is_null=资源池ID不能为空

View File

@ -70,6 +70,7 @@ end_time_is_null=結束日期不能為空
resource.name=資源
#organization
all_organization=全部組織
organization_not_exists=組織不存在
#test resource pool
test_resource_pool_id_is_null=資源池ID不能為空

View File

@ -5,6 +5,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class TestResourcePoolDTO extends TestResourcePool {
@ -13,4 +15,13 @@ public class TestResourcePoolDTO extends TestResourcePool {
@Schema(description = "资源池是否在使用中")
private Boolean inUsed;
@Schema(description = "最大并发数")
private int maxConcurrentNumber;
@Schema(description = "剩余并发数")
private Boolean lastConcurrentNumber;;
@Schema(description = "组织名称集合")
private List<String> orgNames;
}

View File

@ -36,6 +36,12 @@
and t.create_user in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when>
<when test="key=='orgId'">
and t.id in (
select tpo.test_resource_pool_id from test_resource_pool_organization tpo where tpo.org_id in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
)
</when>
</choose>
</if>
</foreach>

View File

@ -141,6 +141,28 @@ public class TestResourcePoolService {
if (pool.getAllOrg() || CollectionUtils.isNotEmpty(testResourcePoolOrganizations)) {
testResourcePoolDTO.setInUsed(true);
}
//增加组织名称
if (pool.getAllOrg()) {
testResourcePoolDTO.setOrgNames(List.of(Translator.get("all_organization")));
} else if (CollectionUtils.isNotEmpty(testResourcePoolOrganizations)) {
List<String> orgIds = testResourcePoolOrganizations.stream().map(TestResourcePoolOrganization::getOrgId).distinct().toList();
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andIdIn(orgIds);
List<Organization> organizations = organizationMapper.selectByExample(organizationExample);
List<String> orgNameList = organizations.stream().map(Organization::getName).distinct().toList();
testResourcePoolDTO.setOrgNames(orgNameList);
}
//获取最大并发
if (StringUtils.equalsIgnoreCase(pool.getType(),ResourcePoolTypeEnum.NODE.toString())) {
int concurrentNumber = 0;
for (TestResourceNodeDTO testResourceNodeDTO : testResourceDTO.getNodesList()) {
concurrentNumber = concurrentNumber+testResourceNodeDTO.getConcurrentNumber();
}
testResourcePoolDTO.setMaxConcurrentNumber(concurrentNumber);
} else {
testResourcePoolDTO.setMaxConcurrentNumber(testResourceDTO.getConcurrentNumber());
}
//TODO 调接口获取剩余并发
testResourcePoolDTOS.add(testResourcePoolDTO);
});
return testResourcePoolDTOS;