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,6 +688,8 @@ public class CommonProjectService {
|
|||
* @return
|
||||
*/
|
||||
public boolean validateProjectResourcePool(TestResourcePool resourcePool, String projectId) {
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
if (!project.getAllResourcePool()) {
|
||||
ProjectTestResourcePoolExample example = new ProjectTestResourcePoolExample();
|
||||
example.createCriteria()
|
||||
.andProjectIdEqualTo(projectId)
|
||||
|
@ -695,7 +697,7 @@ public class CommonProjectService {
|
|||
if (projectTestResourcePoolMapper.countByExample(example) < 1) {
|
||||
return false;
|
||||
}
|
||||
Project project = projectMapper.selectByPrimaryKey(projectId);
|
||||
}
|
||||
// 校验组织是否有权限
|
||||
return testResourcePoolService.validateOrgResourcePool(resourcePool, project.getOrganizationId());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue