fix(接口测试): 优化导入接口时的报错提示
--bug=1010779 --user=宋天阳 【接口测试】接口列表导入接口自动化的数据,报错 https://www.tapd.cn/55049933/s/1113276
This commit is contained in:
parent
7132d3ff3e
commit
6735f22213
|
@ -1148,29 +1148,34 @@ public class ApiDefinitionService {
|
||||||
noticeSendService.send(NoticeConstants.TaskType.SWAGGER_TASK, noticeModel);
|
noticeSendService.send(NoticeConstants.TaskType.SWAGGER_TASK, noticeModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
importApi(request, apiImport);
|
try {
|
||||||
if (CollectionUtils.isNotEmpty(apiImport.getData())) {
|
importApi(request, apiImport);
|
||||||
List<String> names = apiImport.getData().stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList());
|
if (CollectionUtils.isNotEmpty(apiImport.getData())) {
|
||||||
request.setName(String.join(",", names));
|
List<String> names = apiImport.getData().stream().map(ApiDefinitionWithBLOBs::getName).collect(Collectors.toList());
|
||||||
List<String> ids = apiImport.getData().stream().map(ApiDefinitionWithBLOBs::getId).collect(Collectors.toList());
|
request.setName(String.join(",", names));
|
||||||
request.setId(JSON.toJSONString(ids));
|
List<String> ids = apiImport.getData().stream().map(ApiDefinitionWithBLOBs::getId).collect(Collectors.toList());
|
||||||
}
|
request.setId(JSON.toJSONString(ids));
|
||||||
// 发送通知
|
}
|
||||||
if (StringUtils.equals(request.getType(), "schedule")) {
|
// 发送通知
|
||||||
String scheduleId = scheduleService.getScheduleInfo(request.getResourceId());
|
if (StringUtils.equals(request.getType(), "schedule")) {
|
||||||
String context = request.getSwaggerUrl() + "导入成功";
|
String scheduleId = scheduleService.getScheduleInfo(request.getResourceId());
|
||||||
Map<String, Object> paramMap = new HashMap<>();
|
String context = request.getSwaggerUrl() + "导入成功";
|
||||||
paramMap.put("url", request.getSwaggerUrl());
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
NoticeModel noticeModel = NoticeModel.builder()
|
paramMap.put("url", request.getSwaggerUrl());
|
||||||
.operator(SessionUtils.getUserId())
|
NoticeModel noticeModel = NoticeModel.builder()
|
||||||
.context(context)
|
.operator(SessionUtils.getUserId())
|
||||||
.testId(scheduleId)
|
.context(context)
|
||||||
.subject(Translator.get("swagger_url_scheduled_import_notification"))
|
.testId(scheduleId)
|
||||||
.successMailTemplate("SwaggerImport")
|
.subject(Translator.get("swagger_url_scheduled_import_notification"))
|
||||||
.paramMap(paramMap)
|
.successMailTemplate("SwaggerImport")
|
||||||
.event(NoticeConstants.Event.EXECUTE_SUCCESSFUL)
|
.paramMap(paramMap)
|
||||||
.build();
|
.event(NoticeConstants.Event.EXECUTE_SUCCESSFUL)
|
||||||
noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel);
|
.build();
|
||||||
|
noticeSendService.send(NoticeConstants.Mode.SCHEDULE, "", noticeModel);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
LogUtil.error(e);
|
||||||
|
MSException.throwException(Translator.get("user_import_format_wrong"));
|
||||||
}
|
}
|
||||||
return apiImport;
|
return apiImport;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue