parent
f8a132e9b3
commit
dda795dcc4
|
@ -65,4 +65,6 @@ public class SaveApiScenarioRequest {
|
|||
private String environmentGroupId;
|
||||
|
||||
private String versionId;
|
||||
|
||||
private Boolean newCreate;
|
||||
}
|
||||
|
|
|
@ -83,4 +83,7 @@ public class SaveApiDefinitionRequest {
|
|||
//发送信息给场景创建人
|
||||
private Boolean scenarioCreator;
|
||||
|
||||
//是否新建
|
||||
private Boolean newCreate;
|
||||
|
||||
}
|
||||
|
|
|
@ -270,6 +270,7 @@ public class ApiAutomationService {
|
|||
msScenario.setHashTree(new LinkedList<>());
|
||||
request.setScenarioDefinition(msScenario);
|
||||
}
|
||||
request.setNewCreate(true);
|
||||
checkNameExist(request, false);
|
||||
int nextNum = getNextNum(request.getProjectId());
|
||||
if (StringUtils.isBlank(request.getCustomNum())) {
|
||||
|
@ -724,7 +725,7 @@ public class ApiAutomationService {
|
|||
} else {
|
||||
criteria.andApiScenarioModuleIdEqualTo(request.getApiScenarioModuleId());
|
||||
}
|
||||
if (apiScenarioMapper.countByExample(example) > 0 && StringUtils.isBlank(request.getId())) {
|
||||
if (apiScenarioMapper.countByExample(example) > 0 && request.getNewCreate() != null && request.getNewCreate()) {
|
||||
MSException.throwException(Translator.get("automation_versions_create"));
|
||||
}
|
||||
criteria.andVersionIdEqualTo(request.getVersionId());
|
||||
|
|
|
@ -361,6 +361,7 @@ public class ApiDefinitionService {
|
|||
} else {
|
||||
FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles);
|
||||
}
|
||||
request.setNewCreate(true);
|
||||
return createTest(request);
|
||||
}
|
||||
|
||||
|
@ -634,7 +635,7 @@ public class ApiDefinitionService {
|
|||
criteria.andModuleIdEqualTo(request.getModuleId());
|
||||
}
|
||||
criteria.andNameEqualTo(request.getName());
|
||||
if (apiDefinitionMapper.countByExample(example) > 0 && StringUtils.isBlank(request.getId())) {
|
||||
if (apiDefinitionMapper.countByExample(example) > 0 && request.getNewCreate() != null && request.getNewCreate()) {
|
||||
MSException.throwException(Translator.get("api_versions_create"));
|
||||
}
|
||||
criteria.andVersionIdEqualTo(request.getVersionId());
|
||||
|
@ -642,7 +643,7 @@ public class ApiDefinitionService {
|
|||
MSException.throwException(Translator.get("api_definition_name_not_repeating") + " :" + Translator.get("api_definition_module") + ":" + request.getModulePath() + " ," + Translator.get("api_definition_name") + " :" + request.getName() + "-" + request.getPath());
|
||||
}
|
||||
} else {
|
||||
if (apiDefinitionMapper.countByExample(example) > 0 && StringUtils.isBlank(request.getId())) {
|
||||
if (apiDefinitionMapper.countByExample(example) > 0 && request.getNewCreate() != null && request.getNewCreate()) {
|
||||
MSException.throwException(Translator.get("api_versions_create"));
|
||||
}
|
||||
criteria.andVersionIdEqualTo(request.getVersionId());
|
||||
|
@ -659,7 +660,7 @@ public class ApiDefinitionService {
|
|||
} else {
|
||||
criteria.andModuleIdEqualTo(request.getModuleId());
|
||||
}
|
||||
if (apiDefinitionMapper.countByExample(example) > 0 && StringUtils.isBlank(request.getId())) {
|
||||
if (apiDefinitionMapper.countByExample(example) > 0 && request.getNewCreate() != null && request.getNewCreate()) {
|
||||
MSException.throwException(Translator.get("api_versions_create"));
|
||||
}
|
||||
criteria.andVersionIdEqualTo(request.getVersionId());
|
||||
|
|
|
@ -419,6 +419,7 @@ export default {
|
|||
}
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
if (apiCase.request.protocol === 'HTTP') {
|
||||
if (!apiCase.request.body) {
|
||||
apiCase.request.body = new Body();
|
||||
}
|
||||
|
@ -442,6 +443,7 @@ export default {
|
|||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
|
|
|
@ -676,6 +676,7 @@ export default {
|
|||
item.tags = JSON.parse(item.tags);
|
||||
}
|
||||
item.caseTotal = parseInt(item.caseTotal);
|
||||
if (item.protocol === 'HTTP') {
|
||||
if (!item.response) {
|
||||
let response = {headers: [], body: new Body(), statusCode: [], type: "HTTP"};
|
||||
item.response = JSON.stringify(response);
|
||||
|
@ -720,6 +721,7 @@ export default {
|
|||
}
|
||||
item.request = JSON.stringify(item.request);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$emit('getTrashApi');
|
||||
if (this.$refs.table) {
|
||||
|
|
Loading…
Reference in New Issue