mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 12:39:12 +08:00
fix(接口测试): 接口执行资源池校验问题
This commit is contained in:
parent
49af0211e3
commit
98e38ffefc
@ -171,18 +171,13 @@ public class ProjectService {
|
||||
}
|
||||
|
||||
public List<OptionDTO> getPoolOptions(String projectId) {
|
||||
checkProjectNotExist(projectId);
|
||||
List<String> poolIds = getPoolIds(projectId);
|
||||
if (CollectionUtils.isEmpty(poolIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
TestResourcePoolExample example = new TestResourcePoolExample();
|
||||
TestResourcePoolExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andIdIn(poolIds).andEnableEqualTo(true).andDeletedEqualTo(false);
|
||||
List<TestResourcePool> testResourcePools = testResourcePoolMapper.selectByExample(example);
|
||||
return testResourcePools.stream().map(testResourcePool ->
|
||||
new OptionDTO(testResourcePool.getId(), testResourcePool.getName())
|
||||
).toList();
|
||||
List<TestResourcePool> pools = getPoolOption(projectId);
|
||||
return pools.stream().map(pool -> {
|
||||
OptionDTO option = new OptionDTO();
|
||||
option.setId(pool.getId());
|
||||
option.setName(pool.getName());
|
||||
return option;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
public static Project checkResourceExist(String id) {
|
||||
|
@ -688,14 +688,16 @@ public class CommonProjectService {
|
||||
* @return
|
||||
*/
|
||||
public boolean validateProjectResourcePool(TestResourcePool resourcePool, String projectId) {
|
||||
ProjectTestResourcePoolExample example = new ProjectTestResourcePoolExample();
|
||||
example.createCriteria()
|
||||
.andProjectIdEqualTo(projectId)
|
||||
.andTestResourcePoolIdEqualTo(resourcePool.getId());
|
||||
if (projectTestResourcePoolMapper.countByExample(example) < 1) {
|
||||
return false;
|
||||
}
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
if (!project.getAllResourcePool()) {
|
||||
ProjectTestResourcePoolExample example = new ProjectTestResourcePoolExample();
|
||||
example.createCriteria()
|
||||
.andProjectIdEqualTo(projectId)
|
||||
.andTestResourcePoolIdEqualTo(resourcePool.getId());
|
||||
if (projectTestResourcePoolMapper.countByExample(example) < 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 校验组织是否有权限
|
||||
return testResourcePoolService.validateOrgResourcePool(resourcePool, project.getOrganizationId());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user