fix(接口测试): 修复接口测试创建后没有返回版本名的问题

--bug=1013020 --user=刘瑞斌 【接口测试】新建接口-保存-切换到test/case/mock页面-未显示版本 https://www.tapd.cn/55049933/s/1154250
This commit is contained in:
CaptainB 2022-05-07 20:04:28 +08:00 committed by 刘瑞斌
parent 7bb3eec779
commit e86dd0d4b8
3 changed files with 10 additions and 9 deletions

View File

@ -103,7 +103,7 @@ public class ApiDefinitionController {
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API)
@MsAuditLog(module = OperLogModule.API_DEFINITION, type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class)
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CREATE, subject = "接口定义通知")
public ApiDefinitionWithBLOBs create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
public ApiDefinitionResult create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
checkPermissionService.checkProjectOwner(request.getProjectId());
return apiDefinitionService.create(request, bodyFiles);
}
@ -112,7 +112,7 @@ public class ApiDefinitionController {
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_EDIT_API)
@MsAuditLog(module = OperLogModule.API_DEFINITION, type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class)
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.UPDATE, subject = "接口定义通知")
public ApiDefinitionWithBLOBs update(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
public ApiDefinitionResult update(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
checkPermissionService.checkProjectOwner(request.getProjectId());
return apiDefinitionService.update(request, bodyFiles);
}

View File

@ -315,7 +315,7 @@ public class ApiDefinitionService {
}
}
public ApiDefinitionWithBLOBs create(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
public ApiDefinitionResult create(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
checkQuota(request.getProjectId());
if (StringUtils.equals(request.getProtocol(), "DUBBO")) {
request.setMethod("dubbo://");
@ -326,11 +326,10 @@ public class ApiDefinitionService {
} else {
FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles);
}
ApiDefinitionWithBLOBs returnModel = createTest(request);
return returnModel;
return createTest(request);
}
public ApiDefinitionWithBLOBs update(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
public ApiDefinitionResult update(SaveApiDefinitionRequest request, List<MultipartFile> bodyFiles) {
if (request.getRequest() != null) {
deleteFileByTestId(request.getRequest().getId());
}
@ -342,7 +341,7 @@ public class ApiDefinitionService {
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
mockConfigService.updateMockReturnMsgByApi(returnModel);
FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles);
return getBLOBs(returnModel.getId());
return getById(returnModel.getId());
}
public void checkQuota(String projectId) {
@ -715,7 +714,7 @@ public class ApiDefinitionService {
}
}
private ApiDefinitionWithBLOBs createTest(SaveApiDefinitionRequest request) {
private ApiDefinitionResult createTest(SaveApiDefinitionRequest request) {
checkNameExist(request);
if (StringUtils.equals(request.getMethod(), "ESB")) {
//ESB的接口类型数据采用TCP方式去发送并将方法类型改为TCP 并修改发送数据
@ -762,7 +761,7 @@ public class ApiDefinitionService {
apiDefinitionMapper.insert(test);
saveFollows(test.getId(), request.getFollows());
}
return test;
return getById(test.getId());
}
public int getNextNum(String projectId) {

View File

@ -294,6 +294,8 @@
// apiidref_id id
data.id = response.data.id;
data.remark = response.data.remark;
data.versionId = response.data.versionId;
data.versionName = response.data.versionName;
this.$emit('saveApi', data);
});
this.responseCount = 0;