From b6aca285061b85ff89b50d31d85dec079ec95623 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 12 Jun 2024 14:08:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8A=A5=E5=91=8A=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=B1=A0=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/definition/ApiReportService.java | 4 +++- .../api/service/scenario/ApiScenarioReportService.java | 7 ++++--- .../api/controller/ApiScenarioReportControllerTests.java | 2 +- .../views/project-management/taskCenter/locale/en-US.ts | 2 +- .../views/project-management/taskCenter/locale/zh-CN.ts | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java index 6045d315fb..9c210704af 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java @@ -15,6 +15,7 @@ import io.metersphere.sdk.mapper.EnvironmentMapper; import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.SubListUtils; import io.metersphere.sdk.util.Translator; +import io.metersphere.system.domain.TestResourcePool; import io.metersphere.system.domain.User; import io.metersphere.system.mapper.TestResourcePoolMapper; import io.metersphere.system.mapper.UserMapper; @@ -194,7 +195,8 @@ public class ApiReportService { apiReportDTO.setConsole(String.join("\n", consoleList)); } //查询资源池名称 - apiReportDTO.setPoolName(testResourcePoolMapper.selectByPrimaryKey(apiReportDTO.getPoolId()).getName()); + TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(apiReportDTO.getPoolId()); + apiReportDTO.setPoolName(testResourcePool != null ? testResourcePool.getName() : null); //查询环境名称 String environmentName = null; if (StringUtils.isNoneBlank(apiReportDTO.getEnvironmentId())) { diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java index 5b008d6e10..65fe00a9ac 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/scenario/ApiScenarioReportService.java @@ -9,7 +9,6 @@ import io.metersphere.api.dto.scenario.ApiScenarioReportDTO; import io.metersphere.api.dto.scenario.ApiScenarioReportDetailDTO; import io.metersphere.api.dto.scenario.ApiScenarioReportStepDTO; import io.metersphere.api.mapper.*; -import io.metersphere.api.utils.ApiDataUtils; import io.metersphere.sdk.constants.ExecStatus; import io.metersphere.sdk.constants.ReportStatus; import io.metersphere.sdk.domain.Environment; @@ -19,6 +18,7 @@ import io.metersphere.sdk.mapper.EnvironmentMapper; import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.SubListUtils; import io.metersphere.sdk.util.Translator; +import io.metersphere.system.domain.TestResourcePool; import io.metersphere.system.domain.User; import io.metersphere.system.mapper.TestResourcePoolMapper; import io.metersphere.system.mapper.UserMapper; @@ -224,7 +224,8 @@ public class ApiScenarioReportService { scenarioReportDTO.setConsole(String.join("\n", consoleList)); } //查询资源池名称 - scenarioReportDTO.setPoolName(testResourcePoolMapper.selectByPrimaryKey(scenarioReport.getPoolId()).getName()); + TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(scenarioReport.getPoolId()); + scenarioReportDTO.setPoolName(testResourcePool != null ? testResourcePool.getName() : null); //查询环境名称 String environmentName = null; if (StringUtils.isNotBlank(scenarioReport.getEnvironmentId())) { @@ -353,7 +354,7 @@ public class ApiScenarioReportService { ApiScenarioReportDetailDTO apiScenarioReportDetail = apiReportDetails.get(Integer.parseInt(index) - 1); apiReportDetails = Collections.singletonList(apiScenarioReportDetail); } - return apiReportDetails; + return apiReportDetails; } private List checkResourceStep(String stepId, String reportId) { diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java index a031be677f..ff632cb18d 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioReportControllerTests.java @@ -362,7 +362,7 @@ public class ApiScenarioReportControllerTests extends BaseTest { .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(status().is5xxServerError()); - mockMvc.perform(getRequestBuilder(GET + "scenario-report-id2000")) + mockMvc.perform(getRequestBuilder(GET + "scenario-report-id200000")) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(status().is5xxServerError()); diff --git a/frontend/src/views/project-management/taskCenter/locale/en-US.ts b/frontend/src/views/project-management/taskCenter/locale/en-US.ts index 095414d232..33e769cd5d 100644 --- a/frontend/src/views/project-management/taskCenter/locale/en-US.ts +++ b/frontend/src/views/project-management/taskCenter/locale/en-US.ts @@ -16,7 +16,7 @@ export default { 'project.taskCenter.batchExecution': 'Batch execution', 'project.taskCenter.stop': 'stop', 'project.taskCenter.execution': 'execution', - 'project.taskCenter.viewReport': 'View report', + 'project.taskCenter.viewReport': 'Execution Result', 'project.taskCenter.batchStopTask': 'Are you sure to stop {num} tasks?', 'project.taskCenter.stopTask': 'Are you sure to stop {name} task?', 'project.taskCenter.stopTaskContent': diff --git a/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts b/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts index bb1be0427b..9616364e2e 100644 --- a/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts +++ b/frontend/src/views/project-management/taskCenter/locale/zh-CN.ts @@ -16,7 +16,7 @@ export default { 'project.taskCenter.batchExecution': '批量执行', 'project.taskCenter.stop': '停止', 'project.taskCenter.execution': '执行', - 'project.taskCenter.viewReport': '查看报告', + 'project.taskCenter.viewReport': '执行结果', 'project.taskCenter.batchStopTask': '确定停止 {num} 个任务吗?', 'project.taskCenter.stopTask': '确定停止 {name} 个任务吗?', 'project.taskCenter.stopTaskContent': '停止后会影响报告的生成,执行完成的报告不可以停止',