refactor(系统设置): 更新k8s任务相关信息

This commit is contained in:
fit2-zhao 2024-10-22 09:58:47 +08:00 committed by Craftsman
parent b6f58a89dd
commit 597989781b
2 changed files with 31 additions and 30 deletions

View File

@ -7,59 +7,63 @@ import lombok.Setter;
import java.util.List;
/**
*用来解析TestResourceBlob的结构
* 用来解析TestResourceBlob的结构
*/
@Getter
@Setter
public class TestResourceDTO {
/**
* 资源id
*/
private String id;
/**
* type为 node时, 接口测试 性能测试 node 节点配置
* type为 node时, 接口测试 node 节点配置
*/
@Schema(description = "type为node时, 接口测试,性能测试node节点配置")
@Schema(description = "type为node时, 接口测试")
private List<TestResourceNodeDTO> nodesList;
/**
* type为 k8s 接口测试性能测试的ip
* type为 k8s 接口测试
*/
@Schema(description = "type为k8s时接口测试性能测试的ip")
@Schema(description = "type为k8s时接口测试")
private String ip;
/**
* type为 k8s 接口测试性能测试的token
* type为 k8s 接口测试
*/
@Schema(description = "type为k8s时接口测试性能测试的token")
@Schema(description = "type为k8s时接口测试")
private String token;
/**
* type为 k8s 接口测试性能测试的命名空间
* type为 k8s 接口测试命名空间
*/
@Schema(description = "type为k8s时接口测试,性能测试的命名空间")
@Schema(description = "type为k8s时接口测试")
private String namespace;
/**
* type为 k8s 接口测试性能测试UI测试的最大并发数
* type为 k8s 接口测试
*/
@Schema(description = "type为k8s时接口测试性能测试UI测试的最大并发数")
@Schema(description = "type为k8s时接口测试")
private Integer concurrentNumber;
/**
* type为 k8s 接口测试性能测试的单pod 最大线程
* type为k8s时最大任务并发
*/
@Schema(description = "type为k8s时接口测试性能测试的单pod最大线程")
@Schema(description = "type为k8s时最大任务并发")
private Integer podThreads;
/**
* type为 k8s 接口测试deployName
* type为 k8s 接口测试deployName
*/
@Schema(description = "type为k8s时接口测试deployName")
@Schema(description = "type为k8s时接口测试deployName")
private String deployName;
@Schema(description = "grid最大线程数")
@Schema(description = "grid最大线程数")
private Integer girdConcurrentNumber;
/**
* 关联的组织id集合
*/
@Schema(description = "关联的组织id集合")
private List<String>orgIds;
@Schema(description = "关联的组织id集合")
private List<String> orgIds;
}

View File

@ -171,28 +171,26 @@ public class BaseTaskHubService {
UserExample userExample = new UserExample();
userExample.createCriteria().andIdIn(userIds);
List<User> userList = userMapper.selectByExample(userExample);
Map<String, String> userMaps = userList.stream().collect(Collectors.toMap(User::getId, User::getName));
return userMaps;
return userList.stream().collect(Collectors.toMap(User::getId, User::getName));
}
private Map<String, String> getOrganizationMaps(List<String> organizationIds) {
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andIdIn(organizationIds);
List<Organization> organizationList = organizationMapper.selectByExample(organizationExample);
Map<String, String> organizationMaps = organizationList.stream().collect(Collectors.toMap(Organization::getId, Organization::getName));
return organizationMaps;
return organizationList.stream().collect(Collectors.toMap(Organization::getId, Organization::getName));
}
private Map<String, String> getProjectMaps(List<String> projectIds) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andIdIn(projectIds);
List<Project> projectList = projectMapper.selectByExample(projectExample);
Map<String, String> projectMaps = projectList.stream().collect(Collectors.toMap(Project::getId, Project::getName));
return projectMaps;
return projectList.stream().collect(Collectors.toMap(Project::getId, Project::getName));
}
/**
* 获取任务的报告集合
*
* @param taskIds 任务ID集合
* @return 报告集合
*/
@ -238,8 +236,8 @@ public class BaseTaskHubService {
Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userSet));
List<String> resourceIds = list.stream()
.filter(item -> StringUtils.isNotBlank(item.getResourceId()))
.map(TaskHubScheduleDTO::getResourceId)
.filter(StringUtils::isNotBlank)
.toList();
Map<String, TaskHubScheduleDTO> trigerTimeMap = Map.of();
@ -378,8 +376,7 @@ public class BaseTaskHubService {
TestResourcePoolExample poolExample = new TestResourcePoolExample();
poolExample.createCriteria().andIdIn(resourcePoolIds);
List<TestResourcePool> poolList = testResourcePoolMapper.selectByExample(poolExample);
Map<String, String> poolMaps = poolList.stream().collect(Collectors.toMap(TestResourcePool::getId, TestResourcePool::getName));
return poolMaps;
return poolList.stream().collect(Collectors.toMap(TestResourcePool::getId, TestResourcePool::getName));
}
/**
@ -439,8 +436,7 @@ public class BaseTaskHubService {
TestResourcePoolBlobExample blobExample = new TestResourcePoolBlobExample();
blobExample.createCriteria().andIdIn(ids);
List<TestResourcePoolBlob> testResourcePoolBlobs = testResourcePoolBlobMapper.selectByExampleWithBLOBs(blobExample);
Map<String, List<TestResourcePoolBlob>> poolMap = testResourcePoolBlobs.stream().collect(Collectors.groupingBy(TestResourcePoolBlob::getId));
return poolMap;
return testResourcePoolBlobs.stream().collect(Collectors.groupingBy(TestResourcePoolBlob::getId));
}
private List<ResourcePoolOptionsDTO> handleOptions(List<TestResourcePool> allResourcePools, Map<String, List<TestResourcePoolBlob>> poolMap) {
@ -525,7 +521,7 @@ public class BaseTaskHubService {
node.setPort(split[1]);
status = nodeResourcePoolService.validateNode(node);
} catch (Exception e) {
status = false;
LogUtils.error(e);
}
boolean finalStatus = status;
v.forEach(item -> {
@ -888,6 +884,7 @@ public class BaseTaskHubService {
/**
* 查询批量执行任务报告列表
*
* @param request 请求参数
* @return 执行任务报告集合
*/