fix(接口定义): 修复场景批量编辑报错的缺陷

--bug=1014910 --user=王孝刚 【接口测试】批量编辑场景报错
https://www.tapd.cn/55049933/s/1202534
This commit is contained in:
wxg0103 2022-07-15 11:05:27 +08:00 committed by f2c-ci-robot[bot]
parent ca25efde6c
commit bf83735730
2 changed files with 25 additions and 4 deletions

View File

@ -1153,7 +1153,16 @@ public class ApiAutomationService {
scenarioRequest.setProjectId(scenario.getProjectId());
scenarioRequest.setName(scenario.getName());
scenarioRequest.setId(scenario.getId());
scenarioRequest.setApiScenarioModuleId(request.getApiScenarioModuleId());
if (StringUtils.isEmpty(request.getApiScenarioModuleId())) {
scenarioRequest.setApiScenarioModuleId(scenario.getApiScenarioModuleId());
} else {
scenarioRequest.setApiScenarioModuleId(request.getApiScenarioModuleId());
}
if (StringUtils.isEmpty(request.getModulePath())) {
scenarioRequest.setModulePath(scenario.getModulePath());
} else {
scenarioRequest.setModulePath(request.getModulePath());
}
scenarioRequest.setModulePath(request.getModulePath());
scenarioRequest.setVersionId(scenario.getVersionId());
checkNameExist(scenarioRequest, false);

View File

@ -1686,13 +1686,25 @@ public class ApiDefinitionService {
//检查是否同名
SaveApiDefinitionRequest apiDefinitionRequest = new SaveApiDefinitionRequest();
apiDefinitionRequest.setProjectId(api.getProjectId());
apiDefinitionRequest.setMethod(api.getMethod());
if (StringUtils.isEmpty(request.getMethod())) {
apiDefinitionRequest.setMethod(api.getMethod());
} else {
apiDefinitionRequest.setMethod(request.getMethod());
}
apiDefinitionRequest.setProtocol(api.getProtocol());
apiDefinitionRequest.setPath(api.getPath());
apiDefinitionRequest.setName(api.getName());
apiDefinitionRequest.setId(api.getId());
apiDefinitionRequest.setModuleId(request.getModuleId());
apiDefinitionRequest.setModulePath(request.getModulePath());
if (StringUtils.isEmpty(request.getModuleId())) {
apiDefinitionRequest.setModuleId(api.getModuleId());
} else {
apiDefinitionRequest.setMethod((request.getModuleId()));
}
if (StringUtils.isEmpty(request.getModulePath())) {
apiDefinitionRequest.setModulePath(api.getModulePath());
} else {
apiDefinitionRequest.setModulePath(request.getModulePath());
}
apiDefinitionRequest.setVersionId(api.getVersionId());
checkNameExist(apiDefinitionRequest, false);
});