fix(接口测试): 接口执行资源池校验问题
This commit is contained in:
parent
49af0211e3
commit
98e38ffefc
|
@ -171,18 +171,13 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OptionDTO> getPoolOptions(String projectId) {
|
public List<OptionDTO> getPoolOptions(String projectId) {
|
||||||
checkProjectNotExist(projectId);
|
List<TestResourcePool> pools = getPoolOption(projectId);
|
||||||
List<String> poolIds = getPoolIds(projectId);
|
return pools.stream().map(pool -> {
|
||||||
if (CollectionUtils.isEmpty(poolIds)) {
|
OptionDTO option = new OptionDTO();
|
||||||
return new ArrayList<>();
|
option.setId(pool.getId());
|
||||||
}
|
option.setName(pool.getName());
|
||||||
TestResourcePoolExample example = new TestResourcePoolExample();
|
return option;
|
||||||
TestResourcePoolExample.Criteria criteria = example.createCriteria();
|
}).toList();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Project checkResourceExist(String id) {
|
public static Project checkResourceExist(String id) {
|
||||||
|
|
|
@ -688,14 +688,16 @@ public class CommonProjectService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean validateProjectResourcePool(TestResourcePool resourcePool, String projectId) {
|
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);
|
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());
|
return testResourcePoolService.validateOrgResourcePool(resourcePool, project.getOrganizationId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue