fix(接口测试): 修复场景导入关联用例时用例目标项目选择错误的问题
--bug=1048019 --user=宋天阳 【场景导入】-导入有引用关系的场景文件,切换组织后,在新项目中导入场景,没有在目标项目中新建关联资源 https://www.tapd.cn/55049933/s/1599124
This commit is contained in:
parent
5f3d4682b6
commit
bb3f8a9cdc
|
@ -834,7 +834,6 @@ public class ApiScenarioDataTransferService {
|
|||
List<ApiDefinitionDetail> apiDefinitionDetails = entry.getValue();
|
||||
// 如果没有权限,需要在当前项目进行校验
|
||||
Project targetProject = projectMapper.selectByPrimaryKey(targetProjectId);
|
||||
|
||||
// 项目不存在或者项目和当前项目不在统一组织下,需要在当前项目进行校验。场景不能跨项目关联
|
||||
if (targetProject == null || !StringUtils.equals(targetProject.getOrganizationId(), project.getOrganizationId())) {
|
||||
targetProjectId = projectId;
|
||||
|
@ -850,12 +849,16 @@ public class ApiScenarioDataTransferService {
|
|||
for (Map.Entry<String, List<ApiTestCaseDTO>> entry : parseResult.getRelatedApiTestCaseList().stream().collect(Collectors.groupingBy(ApiTestCaseDTO::getProjectId)).entrySet()) {
|
||||
String targetProjectId = entry.getKey();
|
||||
List<ApiTestCaseDTO> apiTestCaseList = entry.getValue();
|
||||
|
||||
// 如果没有权限,需要在当前项目进行校验
|
||||
if (projectMapper.selectByPrimaryKey(targetProjectId) == null) {
|
||||
Project targetProject = projectMapper.selectByPrimaryKey(targetProjectId);
|
||||
// 项目不存在或者项目和当前项目不在统一组织下,需要在当前项目进行校验。场景不能跨项目关联
|
||||
if (targetProject == null || !StringUtils.equals(targetProject.getOrganizationId(), project.getOrganizationId())) {
|
||||
targetProjectId = projectId;
|
||||
} else if (!permissionCheckService.userHasProjectPermission(operator, targetProjectId, PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD)) {
|
||||
} else if (!permissionCheckService.userHasProjectPermission(operator, targetProjectId, PermissionConstants.PROJECT_API_DEFINITION_ADD)) {
|
||||
targetProjectId = projectId;
|
||||
}
|
||||
|
||||
if (projectApiCaseMap.containsKey(targetProjectId)) {
|
||||
projectApiCaseMap.get(targetProjectId).addAll(apiTestCaseList);
|
||||
} else {
|
||||
|
@ -866,9 +869,11 @@ public class ApiScenarioDataTransferService {
|
|||
String targetProjectId = entry.getKey();
|
||||
List<ApiScenarioImportDetail> scenarioList = entry.getValue();
|
||||
// 如果没有权限,需要在当前项目进行校验
|
||||
if (projectMapper.selectByPrimaryKey(targetProjectId) == null) {
|
||||
Project targetProject = projectMapper.selectByPrimaryKey(targetProjectId);
|
||||
// 项目不存在或者项目和当前项目不在统一组织下,需要在当前项目进行校验。场景不能跨项目关联
|
||||
if (targetProject == null || !StringUtils.equals(targetProject.getOrganizationId(), project.getOrganizationId())) {
|
||||
targetProjectId = projectId;
|
||||
} else if (!permissionCheckService.userHasProjectPermission(operator, targetProjectId, PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD)) {
|
||||
} else if (!permissionCheckService.userHasProjectPermission(operator, targetProjectId, PermissionConstants.PROJECT_API_DEFINITION_ADD)) {
|
||||
targetProjectId = projectId;
|
||||
}
|
||||
if (projectScenarioMap.containsKey(targetProjectId)) {
|
||||
|
|
Loading…
Reference in New Issue