From f76ac42e240c6b3442482036c7ce7de80f2d3964 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Thu, 28 Mar 2024 10:38:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3=E6=8A=A5=E5=91=8A=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/definition/ApiTestCaseBatchRunService.java | 4 ++-- .../api/service/definition/ApiTestCaseService.java | 2 +- .../api/service/scenario/ApiScenarioBatchRunService.java | 5 +++-- .../metersphere/api/service/scenario/ApiScenarioService.java | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java index b13fd92621..bd560d820d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseBatchRunService.java @@ -274,7 +274,7 @@ public class ApiTestCaseBatchRunService { */ private ApiReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List ids, String userId, String projectId) { ApiReport apiReport = getApiReport(runModeConfig, userId); - apiReport.setName(runModeConfig.getCollectionReport().getReportName() + DateUtils.getTimeString(System.currentTimeMillis())); + apiReport.setName(runModeConfig.getCollectionReport().getReportName() + "_" + DateUtils.getTimeString(System.currentTimeMillis())); apiReport.setIntegrated(true); apiReport.setProjectId(projectId); // 初始化集成报告与用例的关联关系 @@ -369,7 +369,7 @@ public class ApiTestCaseBatchRunService { private ApiReport getApiReport(ApiRunModeConfigDTO runModeConfig, ApiTestCase apiTestCase, String userId) { ApiReport apiReport = getApiReport(runModeConfig, userId); apiReport.setEnvironmentId(getEnvId(runModeConfig, apiTestCase)); - apiReport.setName(apiTestCase.getName() + DateUtils.getTimeString(System.currentTimeMillis())); + apiReport.setName(apiTestCase.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis())); apiReport.setProjectId(apiTestCase.getProjectId()); apiReport.setTriggerMode(TaskTriggerMode.BATCH.name()); return apiReport; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java index 46962d2796..af760e970a 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiTestCaseService.java @@ -724,7 +724,7 @@ public class ApiTestCaseService extends MoveNodeService { ApiReport apiReport = getApiReport(userId); apiReport.setId(reportId); apiReport.setTriggerMode(TaskTriggerMode.MANUAL.name()); - apiReport.setName(apiTestCase.getName() + DateUtils.getTimeString(System.currentTimeMillis())); + apiReport.setName(apiTestCase.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis())); apiReport.setRunMode(ApiBatchRunMode.PARALLEL.name()); apiReport.setPoolId(poolId); apiReport.setEnvironmentId(apiTestCase.getEnvironmentId()); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java index cad7f04254..e9687d3e0c 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioBatchRunService.java @@ -23,6 +23,7 @@ import io.metersphere.sdk.dto.api.task.TaskRequestDTO; import io.metersphere.sdk.dto.queue.ExecutionQueue; import io.metersphere.sdk.dto.queue.ExecutionQueueDetail; import io.metersphere.sdk.util.BeanUtils; +import io.metersphere.sdk.util.DateUtils; import io.metersphere.sdk.util.LogUtils; import io.metersphere.system.uid.IDGenerator; import jakarta.annotation.Resource; @@ -236,7 +237,7 @@ public class ApiScenarioBatchRunService { */ private ApiScenarioReport initIntegratedReport(ApiRunModeConfigDTO runModeConfig, List ids, String userId, String projectId) { ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId); - apiScenarioReport.setName(runModeConfig.getCollectionReport().getReportName()); + apiScenarioReport.setName(runModeConfig.getCollectionReport().getReportName() + "_" + DateUtils.getTimeString(System.currentTimeMillis())); apiScenarioReport.setIntegrated(true); apiScenarioReport.setProjectId(projectId); // 初始化集成报告与用例的关联关系 @@ -334,7 +335,7 @@ public class ApiScenarioBatchRunService { private ApiScenarioReport getScenarioReport(ApiRunModeConfigDTO runModeConfig, ApiScenario apiScenario, String userId) { ApiScenarioReport apiScenarioReport = getScenarioReport(runModeConfig, userId); apiScenarioReport.setEnvironmentId(getEnvId(runModeConfig, apiScenario)); - apiScenarioReport.setName(apiScenario.getName()); + apiScenarioReport.setName(apiScenario.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis())); apiScenarioReport.setProjectId(apiScenario.getProjectId()); apiScenarioReport.setTriggerMode(TaskTriggerMode.BATCH.name()); return apiScenarioReport; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java index f7747c7b56..0a9c22b154 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioService.java @@ -1292,7 +1292,7 @@ public class ApiScenarioService extends MoveNodeService { ApiScenarioReport scenarioReport = getScenarioReport(userId); scenarioReport.setId(reportId); scenarioReport.setTriggerMode(TaskTriggerMode.MANUAL.name()); - scenarioReport.setName(apiScenario.getName() + DateUtils.getTimeString(System.currentTimeMillis())); + scenarioReport.setName(apiScenario.getName() + "_" + DateUtils.getTimeString(System.currentTimeMillis())); scenarioReport.setRunMode(ApiBatchRunMode.PARALLEL.name()); scenarioReport.setPoolId(poolId); scenarioReport.setEnvironmentId(apiScenario.getEnvironmentId());