From 3c303e97e082bd74927cb516fec84f7285571a89 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Sat, 21 Aug 2021 13:33:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=8F=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/domain/TestPlanWithBLOBs.java | 2 + .../base/mapper/TestPlanMapper.xml | 25 ++++- .../track/controller/TestPlanController.java | 7 ++ .../track/dto/TestPlanSimpleReportDTO.java | 1 + .../track/service/TestPlanService.java | 8 ++ .../db/migration/V93__v1.12_release.sql | 2 + .../report/detail/TestPlanApiReport.vue | 32 ++++++- .../detail/TestPlanFunctionalReport.vue | 45 ++++++++- .../report/detail/TestPlanLoadReport.vue | 32 ++++++- .../report/detail/TestPlanReportButtons.vue | 4 +- .../report/detail/TestPlanReportContent.vue | 95 ++++++++++++++++--- .../report/detail/TestPlanSummaryReport.vue | 2 +- .../detail/component/TestPlanReportConfig.vue | 39 ++++++++ .../detail/component/TestPlanReportEdit.vue | 45 +++++---- frontend/src/network/test-plan.js | 11 ++- 15 files changed, 306 insertions(+), 44 deletions(-) create mode 100644 frontend/src/business/components/track/plan/view/comonents/report/detail/component/TestPlanReportConfig.vue diff --git a/backend/src/main/java/io/metersphere/base/domain/TestPlanWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/TestPlanWithBLOBs.java index 8c546d13c1..d0126eb81d 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestPlanWithBLOBs.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestPlanWithBLOBs.java @@ -13,5 +13,7 @@ public class TestPlanWithBLOBs extends TestPlan implements Serializable { private String reportSummary; + private String reportConfig; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml index ab607e6b4f..55f7ce6105 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml @@ -26,6 +26,7 @@ + @@ -91,7 +92,7 @@ actual_start_time, actual_end_time, creator, project_id, execution_times, automatic_status_update - tags, report_summary + tags, report_summary, report_config @@ -373,6 +380,9 @@ report_summary = #{record.reportSummary,jdbcType=LONGVARCHAR}, + + report_config = #{record.reportConfig,jdbcType=LONGVARCHAR}, + @@ -401,7 +411,8 @@ execution_times = #{record.executionTimes,jdbcType=INTEGER}, automatic_status_update = #{record.automaticStatusUpdate,jdbcType=BIT}, tags = #{record.tags,jdbcType=LONGVARCHAR}, - report_summary = #{record.reportSummary,jdbcType=LONGVARCHAR} + report_summary = #{record.reportSummary,jdbcType=LONGVARCHAR}, + report_config = #{record.reportConfig,jdbcType=LONGVARCHAR} @@ -498,6 +509,9 @@ report_summary = #{reportSummary,jdbcType=LONGVARCHAR}, + + report_config = #{reportConfig,jdbcType=LONGVARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -523,7 +537,8 @@ execution_times = #{executionTimes,jdbcType=INTEGER}, automatic_status_update = #{automaticStatusUpdate,jdbcType=BIT}, tags = #{tags,jdbcType=LONGVARCHAR}, - report_summary = #{reportSummary,jdbcType=LONGVARCHAR} + report_summary = #{reportSummary,jdbcType=LONGVARCHAR}, + report_config = #{reportConfig,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java index ad0cc054cc..e4e100b933 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java @@ -119,6 +119,13 @@ public class TestPlanController { testPlanService.editTestPlanStatus(planId); } + @PostMapping("/edit/report/config") + @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT) +// @MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#planId)", content = "#msClass.getLogDetails(#planId)", msClass = TestPlanService.class) + public void editReportConfig(@RequestBody TestPlanDTO testPlanDTO) { + testPlanService.editReportConfig(testPlanDTO); + } + @PostMapping("/delete/{testPlanId}") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_DELETE) @MsAuditLog(module = "track_test_plan", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#testPlanId)", msClass = TestPlanService.class) diff --git a/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java index 07ebbd7193..49a3a51435 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java @@ -21,6 +21,7 @@ public class TestPlanSimpleReportDTO { private double executeRate; private double passRate; private String summary; + private String config; private Boolean isThirdPartIssue; private TestPlanFunctionResultReportDTO functionResult; private TestPlanApiResultReportDTO apiResult; diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 7935544806..88543b1e9f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1374,6 +1374,7 @@ public class TestPlanService { report.setStartTime(testPlan.getActualStartTime()); report.setStartTime(testPlan.getActualEndTime()); report.setSummary(testPlan.getReportSummary()); + report.setConfig(testPlan.getReportConfig()); IssueTemplateDao template = issueTemplateService.getTemplate(testPlan.getProjectId()); testPlanTestCaseService.calculatePlanReport(planId, report); issuesService.calculatePlanReport(planId, report); @@ -1467,4 +1468,11 @@ public class TestPlanService { List planScenarioIds = testPlanApiScenarios.stream().map(TestPlanApiScenario::getId).collect(Collectors.toList()); testPlanScenarioCaseService.setScenarioEnv(planScenarioIds, envMap); } + + public void editReportConfig(TestPlanDTO testPlanDTO) { + TestPlanWithBLOBs testPlan = new TestPlanWithBLOBs(); + testPlan.setId(testPlanDTO.getId()); + testPlan.setReportConfig(testPlanDTO.getReportConfig()); + testPlanMapper.updateByPrimaryKeySelective(testPlan); + } } diff --git a/backend/src/main/resources/db/migration/V93__v1.12_release.sql b/backend/src/main/resources/db/migration/V93__v1.12_release.sql index df96b89fa7..b219f916b2 100644 --- a/backend/src/main/resources/db/migration/V93__v1.12_release.sql +++ b/backend/src/main/resources/db/migration/V93__v1.12_release.sql @@ -94,3 +94,5 @@ ALTER TABLE api_document_share RENAME TO share_info; ALTER TABLE share_info change column share_api_id custom_data longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'Share Custom Data'; + +ALTER TABLE test_plan ADD report_config text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '测试计划报告配置'; diff --git a/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanApiReport.vue b/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanApiReport.vue index f8b051f4a1..357372591c 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanApiReport.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/detail/TestPlanApiReport.vue @@ -1,10 +1,10 @@