fix(接口自动化): 修复报告场景名称过长问题 #1005119

--bug=1005119 --user=赵勇 【github#4596】批量运... https://www.tapd.cn/55049933/s/1028242
This commit is contained in:
fit2-zhao 2021-07-22 18:41:24 +08:00 committed by fit2-zhao
parent 1b0f953058
commit 45988d225e
1 changed files with 6 additions and 8 deletions

View File

@ -1042,19 +1042,18 @@ public class ApiAutomationService {
if (request.getConfig() != null && StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString()) && StringUtils.isNotEmpty(request.getConfig().getReportName())) { if (request.getConfig() != null && StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString()) && StringUtils.isNotEmpty(request.getConfig().getReportName())) {
request.getConfig().setReportId(UUID.randomUUID().toString()); request.getConfig().setReportId(UUID.randomUUID().toString());
if (CollectionUtils.isNotEmpty(scenarioIds) && scenarioIds.size() > 100) { APIScenarioReportResult report = createScenarioReport(request.getConfig().getReportId(),
scenarioIds = scenarioIds.subList(0, 100); JSON.toJSONString(CollectionUtils.isNotEmpty(scenarioIds) && scenarioIds.size() > 100 ? scenarioIds.subList(0, 100) : scenarioIds),
} scenarioNames.length() >= 6000 ? scenarioNames.substring(0, 5999) : scenarioNames.deleteCharAt(scenarioNames.toString().length() - 1).toString(),
APIScenarioReportResult report = createScenarioReport(request.getConfig().getReportId(), JSON.toJSONString(scenarioIds), scenarioNames.deleteCharAt(scenarioNames.toString().length() - 1).toString(), ReportTriggerMode.MANUAL.name(), ReportTriggerMode.MANUAL.name(), ExecuteType.Saved.name(), request.getProjectId(), request.getReportUserID(), request.getConfig());
ExecuteType.Saved.name(), request.getProjectId(), request.getReportUserID(), request.getConfig());
report.setName(request.getConfig().getReportName()); report.setName(request.getConfig().getReportName());
report.setId(serialReportId); report.setId(serialReportId);
apiScenarioReportMapper.insert(report); apiScenarioReportMapper.insert(report);
// 增加并行集合报告 // 增加并行集合报告
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.PARALLEL.toString())) { if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.PARALLEL.toString())) {
List<String> reportIds = executeQueue.entrySet().stream() List<String> reportIds = executeQueue.entrySet().stream()
.map(reports -> reports.getKey()) .map(reports -> reports.getKey()).collect(Collectors.toList());
.collect(Collectors.toList());
ReportCounter counter = new ReportCounter(); ReportCounter counter = new ReportCounter();
counter.setNumber(0); counter.setNumber(0);
counter.setReportIds(reportIds); counter.setReportIds(reportIds);
@ -1063,7 +1062,6 @@ public class ApiAutomationService {
} }
// 开始执行 // 开始执行
this.run(executeQueue, request, serialReportId); this.run(executeQueue, request, serialReportId);
return request.getId(); return request.getId();
} }