From 85e1801eeb5080aa098e8a143e8c48ad4e798077 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Tue, 22 Oct 2024 13:58:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E7=BB=84=E6=89=A7=E8=A1=8C=E4=BB=BB=E5=8A=A1=EF=BC=8C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=AF=B9=E5=BA=94=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/service/TestPlanReportService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index 2f0b04f310..19fbfdbdda 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -558,7 +558,7 @@ public class TestPlanReportService { if (StringUtils.isNotBlank(genParam.getTaskId())) { reportApiCases.sort(Comparator.comparing(TestPlanReportApiCase::getPos).reversed()); - initApiCaseExecTaskItem(genParam.getTaskId(), reportApiCases, report.getCreateUser(), project); + initApiCaseExecTaskItem(genParam.getTaskId(), genParam.getTaskId(), reportApiCases, report.getCreateUser(), project); } }); } @@ -601,7 +601,7 @@ public class TestPlanReportService { if (StringUtils.isNotBlank(genParam.getTaskId())) { reportApiScenarios.sort(Comparator.comparing(TestPlanReportApiScenario::getPos).reversed()); - initScenarioExecTaskItem(genParam.getTaskId(), reportApiScenarios, report.getCreateUser(), project); + initScenarioExecTaskItem(genParam.getTaskId(), genParam.getTestPlanId(), reportApiScenarios, report.getCreateUser(), project); } }); } @@ -651,7 +651,7 @@ public class TestPlanReportService { .functionCaseCount(funcCaseCount.get()).apiCaseCount(apiCaseCount.get()).apiScenarioCount(apiScenarioCount.get()).bugCount(bugCount.get()).build(); } - private void initApiCaseExecTaskItem(String taskId, List apiTestCases, String userId, Project project) { + private void initApiCaseExecTaskItem(String taskId, String testPlanId, List apiTestCases, String userId, Project project) { List execTaskItems = new ArrayList<>(apiTestCases.size()); for (TestPlanReportApiCase apiTestCase : apiTestCases) { ExecTaskItem execTaskItem = apiCommonService.newExecTaskItem(taskId, project.getId(), userId); @@ -659,12 +659,13 @@ public class TestPlanReportService { execTaskItem.setResourceType(ApiExecuteResourceType.PLAN_RUN_API_CASE.name()); execTaskItem.setResourceId(apiTestCase.getId()); execTaskItem.setResourceName(apiTestCase.getApiCaseName()); + execTaskItem.setTaskOrigin(testPlanId); execTaskItems.add(execTaskItem); } baseTaskHubService.insertExecTaskDetail(execTaskItems); } - private void initScenarioExecTaskItem(String taskId, List testPlanReportApiScenarios, String userId, Project project) { + private void initScenarioExecTaskItem(String taskId, String testPlanId, List testPlanReportApiScenarios, String userId, Project project) { List execTaskItems = new ArrayList<>(testPlanReportApiScenarios.size()); for (TestPlanReportApiScenario testPlanReportApiScenario : testPlanReportApiScenarios) { ExecTaskItem execTaskItem = apiCommonService.newExecTaskItem(taskId, project.getId(), userId); @@ -672,6 +673,7 @@ public class TestPlanReportService { execTaskItem.setResourceType(ApiExecuteResourceType.PLAN_RUN_API_SCENARIO.name()); execTaskItem.setResourceId(testPlanReportApiScenario.getId()); execTaskItem.setResourceName(testPlanReportApiScenario.getApiScenarioName()); + execTaskItem.setTaskOrigin(testPlanId); execTaskItems.add(execTaskItem); } baseTaskHubService.insertExecTaskDetail(execTaskItems);