From 6d4cc4a321e87624f2b18979fc08a822f0384835 Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Mon, 9 Jan 2023 19:50:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(UI=E8=87=AA=E5=8A=A8=E5=8C=96):=20=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E6=8A=A5=E5=91=8A=E8=AF=A6=E6=83=85-=E6=A6=82?= =?UTF-8?q?=E8=A7=88-=E8=BF=90=E8=A1=8C=E6=A8=A1=E5=BC=8F&=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E6=9C=AA=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1021723 --user=张大海 【测试跟踪】测试计划-操作-查看报告详情-概览-运行环境和运行模式未显示&报告-查看报告详情-概览-运行模式未显示 https://www.tapd.cn/55049933/s/1324655 --- .../plan/service/TestPlanReportService.java | 3 +++ .../ui/PlanTestPlanUiScenarioCaseService.java | 23 +++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index c2bb39c6f8..c6d421896c 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -1183,6 +1183,9 @@ public class TestPlanReportService { if (DiscoveryUtil.hasService(MicroServiceName.API_TEST)) { TestPlanEnvInfoDTO testPlanEnvInfo = planTestPlanScenarioCaseService.generateEnvironmentInfo(testPlanReport); BeanUtils.copyBean(testPlanReportDTO, testPlanEnvInfo); + } else if (DiscoveryUtil.hasService(MicroServiceName.UI_TEST)) { + TestPlanEnvInfoDTO testPlanEnvInfo = planTestPlanUiScenarioCaseService.generateEnvironmentInfo(testPlanReport); + BeanUtils.copyBean(testPlanReportDTO, testPlanEnvInfo); } } catch (Exception e) { LogUtil.error(e); diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/remote/ui/PlanTestPlanUiScenarioCaseService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/remote/ui/PlanTestPlanUiScenarioCaseService.java index 56eae36145..d1755974a2 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/remote/ui/PlanTestPlanUiScenarioCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/remote/ui/PlanTestPlanUiScenarioCaseService.java @@ -1,5 +1,6 @@ package io.metersphere.plan.service.remote.ui; +import io.metersphere.base.domain.TestPlanReport; import io.metersphere.base.domain.TestPlanUiScenario; import io.metersphere.base.domain.UiScenarioReportWithBLOBs; import io.metersphere.commons.constants.MicroServiceName; @@ -7,10 +8,7 @@ import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; import io.metersphere.dto.*; import io.metersphere.plan.constant.ApiReportStatus; -import io.metersphere.plan.dto.TestCaseReportStatusResultDTO; -import io.metersphere.plan.dto.TestPlanScenarioStepCountSimpleDTO; -import io.metersphere.plan.dto.TestPlanSimpleReportDTO; -import io.metersphere.plan.dto.UiPlanReportDTO; +import io.metersphere.plan.dto.*; import io.metersphere.plan.request.api.ApiPlanReportRequest; import io.metersphere.plan.request.api.ApiScenarioRequest; import io.metersphere.plan.service.TestPlanService; @@ -26,6 +24,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; @Service public class PlanTestPlanUiScenarioCaseService extends UiTestService { @@ -68,7 +67,13 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService { List planReportCaseDTOS = selectStatusForPlanReport(planId); TestPlanUiResultReportDTO uiResult = getUiResult(report, planReportCaseDTOS); - + //记录UI用例的运行环境信息 + List idList = planReportCaseDTOS.stream().map(PlanReportCaseDTO::getId).collect(Collectors.toList()); + try { + report.setProjectEnvMap(getPlanProjectEnvMap(idList)); + } catch (Exception e) { + LogUtil.error(e); + } report.setUiResult(uiResult); } } @@ -165,4 +170,12 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService { public RunModeConfigDTO setScenarioEnv(String planId, RunModeConfigDTO runModeConfig) { return microService.postForData(serviceName, BASE_URL + "/set/env/" + planId, runModeConfig, RunModeConfigDTO.class); } + + public TestPlanEnvInfoDTO generateEnvironmentInfo(TestPlanReport testPlanReport) { + return microService.postForData(serviceName, BASE_URL + "/env/generate", testPlanReport, TestPlanEnvInfoDTO.class); + } + + public Map> getPlanProjectEnvMap(List resourceIds) { + return (Map>) microService.postForData(serviceName, BASE_URL + "/get/plan/env/map", resourceIds); + } }