From 45988d225efb798811ef29345a4e35d867ffda89 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 22 Jul 2021 18:41:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E6=8A=A5=E5=91=8A=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E5=90=8D=E7=A7=B0=E8=BF=87=E9=95=BF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#1005119=20--bug=3D1005119=20--user=3D=E8=B5=B5=E5=8B=87=20?= =?UTF-8?q?=E3=80=90github#4596=E3=80=91=E6=89=B9=E9=87=8F=E8=BF=90...=20h?= =?UTF-8?q?ttps://www.tapd.cn/55049933/s/1028242?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index a632dc6c58..a4e4ef2861 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -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())) { request.getConfig().setReportId(UUID.randomUUID().toString()); - if (CollectionUtils.isNotEmpty(scenarioIds) && scenarioIds.size() > 100) { - scenarioIds = scenarioIds.subList(0, 100); - } - APIScenarioReportResult report = createScenarioReport(request.getConfig().getReportId(), JSON.toJSONString(scenarioIds), scenarioNames.deleteCharAt(scenarioNames.toString().length() - 1).toString(), ReportTriggerMode.MANUAL.name(), - ExecuteType.Saved.name(), request.getProjectId(), request.getReportUserID(), request.getConfig()); + APIScenarioReportResult report = createScenarioReport(request.getConfig().getReportId(), + 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(), + ReportTriggerMode.MANUAL.name(), ExecuteType.Saved.name(), request.getProjectId(), request.getReportUserID(), request.getConfig()); + report.setName(request.getConfig().getReportName()); report.setId(serialReportId); apiScenarioReportMapper.insert(report); // 增加并行集合报告 if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.PARALLEL.toString())) { List reportIds = executeQueue.entrySet().stream() - .map(reports -> reports.getKey()) - .collect(Collectors.toList()); + .map(reports -> reports.getKey()).collect(Collectors.toList()); ReportCounter counter = new ReportCounter(); counter.setNumber(0); counter.setReportIds(reportIds); @@ -1063,7 +1062,6 @@ public class ApiAutomationService { } // 开始执行 this.run(executeQueue, request, serialReportId); - return request.getId(); }