From 0a23c8636341905b08af15169a0e1b2ec3cdea78 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Tue, 14 May 2024 20:25:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E7=BB=9F=E8=AE=A1=E6=B7=BB=E5=8A=A0=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E9=98=88=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/service/TestPlanStatisticsService.java | 11 +++++++++++ .../src/test/resources/dml/init_test_plan_test.sql | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanStatisticsService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanStatisticsService.java index da4591ce7b..d8ea69c294 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanStatisticsService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanStatisticsService.java @@ -1,8 +1,11 @@ package io.metersphere.plan.service; +import io.metersphere.plan.domain.TestPlanConfig; +import io.metersphere.plan.domain.TestPlanConfigExample; import io.metersphere.plan.domain.TestPlanFunctionalCase; import io.metersphere.plan.dto.response.TestPlanStatisticsResponse; import io.metersphere.plan.mapper.ExtTestPlanFunctionalCaseMapper; +import io.metersphere.plan.mapper.TestPlanConfigMapper; import io.metersphere.sdk.constants.FunctionalCaseExecuteResult; import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; @@ -18,6 +21,8 @@ import java.util.stream.Collectors; @Service public class TestPlanStatisticsService { + @Resource + private TestPlanConfigMapper testPlanConfigMapper; @Resource private ExtTestPlanFunctionalCaseMapper extTestPlanFunctionalCaseMapper; @@ -65,6 +70,11 @@ public class TestPlanStatisticsService { rateFormat.setMinimumFractionDigits(2); rateFormat.setMaximumFractionDigits(2); + // 计划的更多配置 + TestPlanConfigExample example = new TestPlanConfigExample(); + example.createCriteria().andTestPlanIdIn(planIds); + List testPlanConfigList = testPlanConfigMapper.selectByExample(example); + Map planConfigMap = testPlanConfigList.stream().collect(Collectors.toMap(TestPlanConfig::getTestPlanId, p -> p)); // 计划-功能用例的关联数据 List planFunctionalCases = extTestPlanFunctionalCaseMapper.getPlanFunctionalCaseByIds(planIds); Map> planFunctionalCaseMap = planFunctionalCases.stream().collect(Collectors.groupingBy(TestPlanFunctionalCase::getTestPlanId)); @@ -72,6 +82,7 @@ public class TestPlanStatisticsService { planIds.forEach(planId -> { TestPlanStatisticsResponse statisticsResponse = new TestPlanStatisticsResponse(); statisticsResponse.setId(planId); + statisticsResponse.setPassThreshold(planConfigMap.get(planId).getPassThreshold()); int success = 0, error = 0, fakeError = 0, block = 0, pending = 0; // 功能用例统计开始 List functionalCases = planFunctionalCaseMap.get(planId); diff --git a/backend/services/test-plan/src/test/resources/dml/init_test_plan_test.sql b/backend/services/test-plan/src/test/resources/dml/init_test_plan_test.sql index aa2ffb835a..7ae0336264 100644 --- a/backend/services/test-plan/src/test/resources/dml/init_test_plan_test.sql +++ b/backend/services/test-plan/src/test/resources/dml/init_test_plan_test.sql @@ -33,7 +33,8 @@ VALUES INSERT INTO `test_plan_config`(`test_plan_id`, `automatic_status_update`, `repeat_case`, `pass_threshold`, `test_planning`) VALUES ('wx_test_plan_id_1', b'0', b'0', 100, b'0'), - ('wx_test_plan_id_4', b'0', b'0', 100, b'0'); + ('wx_test_plan_id_4', b'0', b'0', 100, b'0'), + ('wx_test_plan_id_7', b'0', b'0', 100, b'0'); INSERT INTO project (id, num, organization_id, name, description, create_user, update_user, create_time, update_time, module_setting)