From 43c1ac26dce7945ff6b1492eeecabdb6c676a858 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Tue, 21 May 2024 17:26:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E8=AF=A6=E6=83=85=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?&&=E7=94=9F=E6=88=90=E6=8A=A5=E5=91=8A=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1040811 --user=宋昌昌 【测试计划】计划详情-生成报告-未生成系统日志 https://www.tapd.cn/55049933/s/1517457 --- .../plan/domain/TestPlanReportBug.java | 7 ++- .../plan/domain/TestPlanReportBugExample.java | 60 +++++++++++++++++++ .../domain/TestPlanReportFunctionCase.java | 4 +- .../TestPlanReportFunctionCaseExample.java | 30 ++++------ .../plan/mapper/TestPlanReportBugMapper.java | 3 +- .../plan/mapper/TestPlanReportBugMapper.xml | 35 ++++++++--- .../TestPlanReportFunctionCaseMapper.java | 3 +- .../TestPlanReportFunctionCaseMapper.xml | 18 +++--- .../3.0.0/ddl/V3.0.0_12__beta_ddl.sql | 3 +- .../metersphere/bug/service/BugService.java | 8 ++- .../dto/request/OrganizationEditRequest.java | 2 +- .../mapper/ExtTestPlanReportBugMapper.xml | 9 ++- .../service/TestPlanReportLogService.java | 23 +++++++ .../plan/service/TestPlanReportService.java | 7 ++- 14 files changed, 160 insertions(+), 52 deletions(-) diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBug.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBug.java index 768451446c..ace12cfc9f 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBug.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBug.java @@ -44,6 +44,10 @@ public class TestPlanReportBug implements Serializable { @Schema(description = "缺陷处理人") private String bugHandleUser; + @Schema(description = "缺陷用例数", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{test_plan_report_bug.bug_case_count.not_blank}", groups = {Created.class}) + private Long bugCaseCount; + private static final long serialVersionUID = 1L; public enum Column { @@ -53,7 +57,8 @@ public class TestPlanReportBug implements Serializable { bugNum("bug_num", "bugNum", "BIGINT", false), bugTitle("bug_title", "bugTitle", "VARCHAR", false), bugStatus("bug_status", "bugStatus", "VARCHAR", false), - bugHandleUser("bug_handle_user", "bugHandleUser", "VARCHAR", false); + bugHandleUser("bug_handle_user", "bugHandleUser", "VARCHAR", false), + bugCaseCount("bug_case_count", "bugCaseCount", "BIGINT", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBugExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBugExample.java index 14d14925cc..c3b9ff16e0 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBugExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportBugExample.java @@ -583,6 +583,66 @@ public class TestPlanReportBugExample { addCriterion("bug_handle_user not between", value1, value2, "bugHandleUser"); return (Criteria) this; } + + public Criteria andBugCaseCountIsNull() { + addCriterion("bug_case_count is null"); + return (Criteria) this; + } + + public Criteria andBugCaseCountIsNotNull() { + addCriterion("bug_case_count is not null"); + return (Criteria) this; + } + + public Criteria andBugCaseCountEqualTo(Long value) { + addCriterion("bug_case_count =", value, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountNotEqualTo(Long value) { + addCriterion("bug_case_count <>", value, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountGreaterThan(Long value) { + addCriterion("bug_case_count >", value, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountGreaterThanOrEqualTo(Long value) { + addCriterion("bug_case_count >=", value, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountLessThan(Long value) { + addCriterion("bug_case_count <", value, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountLessThanOrEqualTo(Long value) { + addCriterion("bug_case_count <=", value, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountIn(List values) { + addCriterion("bug_case_count in", values, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountNotIn(List values) { + addCriterion("bug_case_count not in", values, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountBetween(Long value1, Long value2) { + addCriterion("bug_case_count between", value1, value2, "bugCaseCount"); + return (Criteria) this; + } + + public Criteria andBugCaseCountNotBetween(Long value1, Long value2) { + addCriterion("bug_case_count not between", value1, value2, "bugCaseCount"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCase.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCase.java index bf49cf5c85..ff2b75b8c8 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCase.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCase.java @@ -53,7 +53,7 @@ public class TestPlanReportFunctionCase implements Serializable { private String functionCaseExecuteUser; @Schema(description = "功能用例关联缺陷数") - private String functionCaseBugCount; + private Long functionCaseBugCount; @Schema(description = "执行结果", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{test_plan_report_function_case.function_case_execute_result.not_blank}", groups = {Created.class}) @@ -72,7 +72,7 @@ public class TestPlanReportFunctionCase implements Serializable { functionCaseModule("function_case_module", "functionCaseModule", "VARCHAR", false), functionCasePriority("function_case_priority", "functionCasePriority", "VARCHAR", false), functionCaseExecuteUser("function_case_execute_user", "functionCaseExecuteUser", "VARCHAR", false), - functionCaseBugCount("function_case_bug_count", "functionCaseBugCount", "VARCHAR", false), + functionCaseBugCount("function_case_bug_count", "functionCaseBugCount", "BIGINT", false), functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCaseExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCaseExample.java index 079e2526ca..f380f83944 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCaseExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportFunctionCaseExample.java @@ -734,62 +734,52 @@ public class TestPlanReportFunctionCaseExample { return (Criteria) this; } - public Criteria andFunctionCaseBugCountEqualTo(String value) { + public Criteria andFunctionCaseBugCountEqualTo(Long value) { addCriterion("function_case_bug_count =", value, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountNotEqualTo(String value) { + public Criteria andFunctionCaseBugCountNotEqualTo(Long value) { addCriterion("function_case_bug_count <>", value, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountGreaterThan(String value) { + public Criteria andFunctionCaseBugCountGreaterThan(Long value) { addCriterion("function_case_bug_count >", value, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountGreaterThanOrEqualTo(String value) { + public Criteria andFunctionCaseBugCountGreaterThanOrEqualTo(Long value) { addCriterion("function_case_bug_count >=", value, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountLessThan(String value) { + public Criteria andFunctionCaseBugCountLessThan(Long value) { addCriterion("function_case_bug_count <", value, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountLessThanOrEqualTo(String value) { + public Criteria andFunctionCaseBugCountLessThanOrEqualTo(Long value) { addCriterion("function_case_bug_count <=", value, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountLike(String value) { - addCriterion("function_case_bug_count like", value, "functionCaseBugCount"); - return (Criteria) this; - } - - public Criteria andFunctionCaseBugCountNotLike(String value) { - addCriterion("function_case_bug_count not like", value, "functionCaseBugCount"); - return (Criteria) this; - } - - public Criteria andFunctionCaseBugCountIn(List values) { + public Criteria andFunctionCaseBugCountIn(List values) { addCriterion("function_case_bug_count in", values, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountNotIn(List values) { + public Criteria andFunctionCaseBugCountNotIn(List values) { addCriterion("function_case_bug_count not in", values, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountBetween(String value1, String value2) { + public Criteria andFunctionCaseBugCountBetween(Long value1, Long value2) { addCriterion("function_case_bug_count between", value1, value2, "functionCaseBugCount"); return (Criteria) this; } - public Criteria andFunctionCaseBugCountNotBetween(String value1, String value2) { + public Criteria andFunctionCaseBugCountNotBetween(Long value1, Long value2) { addCriterion("function_case_bug_count not between", value1, value2, "functionCaseBugCount"); return (Criteria) this; } diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.java b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.java index d438c05b13..ad538c40f5 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.java @@ -2,9 +2,8 @@ package io.metersphere.plan.mapper; import io.metersphere.plan.domain.TestPlanReportBug; import io.metersphere.plan.domain.TestPlanReportBugExample; -import org.apache.ibatis.annotations.Param; - import java.util.List; +import org.apache.ibatis.annotations.Param; public interface TestPlanReportBugMapper { long countByExample(TestPlanReportBugExample example); diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.xml index 51c25e9fbc..38c7ba4f64 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportBugMapper.xml @@ -9,6 +9,7 @@ + @@ -69,7 +70,8 @@ - id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user + id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user, + bug_case_count @@ -188,6 +196,9 @@ bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR}, + + bug_case_count = #{record.bugCaseCount,jdbcType=BIGINT}, + @@ -201,7 +212,8 @@ bug_num = #{record.bugNum,jdbcType=BIGINT}, bug_title = #{record.bugTitle,jdbcType=VARCHAR}, bug_status = #{record.bugStatus,jdbcType=VARCHAR}, - bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR} + bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR}, + bug_case_count = #{record.bugCaseCount,jdbcType=BIGINT} @@ -227,6 +239,9 @@ bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR}, + + bug_case_count = #{bugCaseCount,jdbcType=BIGINT}, + where id = #{id,jdbcType=VARCHAR} @@ -237,18 +252,19 @@ bug_num = #{bugNum,jdbcType=BIGINT}, bug_title = #{bugTitle,jdbcType=VARCHAR}, bug_status = #{bugStatus,jdbcType=VARCHAR}, - bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR} + bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR}, + bug_case_count = #{bugCaseCount,jdbcType=BIGINT} where id = #{id,jdbcType=VARCHAR} insert into test_plan_report_bug - (id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user - ) + (id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user, + bug_case_count) values (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.bugId,jdbcType=VARCHAR}, #{item.bugNum,jdbcType=BIGINT}, #{item.bugTitle,jdbcType=VARCHAR}, #{item.bugStatus,jdbcType=VARCHAR}, - #{item.bugHandleUser,jdbcType=VARCHAR}) + #{item.bugHandleUser,jdbcType=VARCHAR}, #{item.bugCaseCount,jdbcType=BIGINT}) @@ -282,6 +298,9 @@ #{item.bugHandleUser,jdbcType=VARCHAR} + + #{item.bugCaseCount,jdbcType=BIGINT} + ) diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.java b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.java index 067232a50e..c859f7d6e8 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.java @@ -2,9 +2,8 @@ package io.metersphere.plan.mapper; import io.metersphere.plan.domain.TestPlanReportFunctionCase; import io.metersphere.plan.domain.TestPlanReportFunctionCaseExample; -import org.apache.ibatis.annotations.Param; - import java.util.List; +import org.apache.ibatis.annotations.Param; public interface TestPlanReportFunctionCaseMapper { long countByExample(TestPlanReportFunctionCaseExample example); diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.xml index dbc3e77cb8..4052247d25 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportFunctionCaseMapper.xml @@ -11,7 +11,7 @@ - + @@ -116,7 +116,7 @@ values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanFunctionCaseId,jdbcType=VARCHAR}, #{functionCaseId,jdbcType=VARCHAR}, #{functionCaseNum,jdbcType=BIGINT}, #{functionCaseName,jdbcType=VARCHAR}, #{functionCaseModule,jdbcType=VARCHAR}, #{functionCasePriority,jdbcType=VARCHAR}, - #{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=VARCHAR}, + #{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=BIGINT}, #{functionCaseExecuteResult,jdbcType=VARCHAR}) @@ -185,7 +185,7 @@ #{functionCaseExecuteUser,jdbcType=VARCHAR}, - #{functionCaseBugCount,jdbcType=VARCHAR}, + #{functionCaseBugCount,jdbcType=BIGINT}, #{functionCaseExecuteResult,jdbcType=VARCHAR}, @@ -229,7 +229,7 @@ function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR}, - function_case_bug_count = #{record.functionCaseBugCount,jdbcType=VARCHAR}, + function_case_bug_count = #{record.functionCaseBugCount,jdbcType=BIGINT}, function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR}, @@ -250,7 +250,7 @@ function_case_module = #{record.functionCaseModule,jdbcType=VARCHAR}, function_case_priority = #{record.functionCasePriority,jdbcType=VARCHAR}, function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR}, - function_case_bug_count = #{record.functionCaseBugCount,jdbcType=VARCHAR}, + function_case_bug_count = #{record.functionCaseBugCount,jdbcType=BIGINT}, function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR} @@ -284,7 +284,7 @@ function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR}, - function_case_bug_count = #{functionCaseBugCount,jdbcType=VARCHAR}, + function_case_bug_count = #{functionCaseBugCount,jdbcType=BIGINT}, function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR}, @@ -302,7 +302,7 @@ function_case_module = #{functionCaseModule,jdbcType=VARCHAR}, function_case_priority = #{functionCasePriority,jdbcType=VARCHAR}, function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR}, - function_case_bug_count = #{functionCaseBugCount,jdbcType=VARCHAR}, + function_case_bug_count = #{functionCaseBugCount,jdbcType=BIGINT}, function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} @@ -317,7 +317,7 @@ #{item.functionCaseId,jdbcType=VARCHAR}, #{item.functionCaseNum,jdbcType=BIGINT}, #{item.functionCaseName,jdbcType=VARCHAR}, #{item.functionCaseModule,jdbcType=VARCHAR}, #{item.functionCasePriority,jdbcType=VARCHAR}, #{item.functionCaseExecuteUser,jdbcType=VARCHAR}, - #{item.functionCaseBugCount,jdbcType=VARCHAR}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR} + #{item.functionCaseBugCount,jdbcType=BIGINT}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR} ) @@ -359,7 +359,7 @@ #{item.functionCaseExecuteUser,jdbcType=VARCHAR} - #{item.functionCaseBugCount,jdbcType=VARCHAR} + #{item.functionCaseBugCount,jdbcType=BIGINT} #{item.functionCaseExecuteResult,jdbcType=VARCHAR} diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql index 526ccadb18..6291311721 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql @@ -122,7 +122,7 @@ CREATE TABLE IF NOT EXISTS test_plan_report_function_case( `function_case_module` VARCHAR(255) COMMENT '功能用例所属模块' , `function_case_priority` VARCHAR(50) COMMENT '功能用例用例等级' , `function_case_execute_user` VARCHAR(50) COMMENT '功能用例执行人' , - `function_case_bug_count` VARCHAR(255) COMMENT '功能用例关联缺陷数' , + `function_case_bug_count` BIGINT COMMENT '功能用例关联缺陷数' , `function_case_execute_result` VARCHAR(50) NOT NULL COMMENT '执行结果' , PRIMARY KEY (id) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告内容功能用例部分'; @@ -137,6 +137,7 @@ CREATE TABLE IF NOT EXISTS test_plan_report_bug( `bug_title` VARCHAR(255) NOT NULL COMMENT '缺陷标题' , `bug_status` VARCHAR(50) COMMENT '缺陷状态' , `bug_handle_user` VARCHAR(50) COMMENT '缺陷处理人' , + `bug_case_count` BIGINT NOT NULL COMMENT '缺陷用例数' , PRIMARY KEY (id) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告内容缺陷部分'; diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java index d7cd579661..c925e84bad 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/service/BugService.java @@ -799,7 +799,13 @@ public class BugService { // 状态从内置自定义字段中获取 Optional statusField = request.getCustomFields().stream().filter(field -> StringUtils.equals(field.getId(), BugTemplateCustomField.STATUS.getId())).findFirst(); if (statusField.isPresent()) { - bug.setStatus(statusField.get().getValue()); + if (StringUtils.isBlank(statusField.get().getValue()) && StringUtils.equalsIgnoreCase(BugPlatform.LOCAL.getName(), platformName)) { + // Local平台设置状态默认值为状态流-开始状态 + List localStartStatusItem = bugStatusService.getToStatusItemOptionOnLocal(request.getProjectId(), StringUtils.EMPTY); + bug.setStatus(localStartStatusItem.get(0).getValue()); + } else { + bug.setStatus(statusField.get().getValue()); + } request.getCustomFields().removeIf(field -> StringUtils.equals(field.getId(), BugTemplateCustomField.STATUS.getId())); } else { throw new MSException(Translator.get("bug_status_can_not_be_empty")); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/request/OrganizationEditRequest.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/request/OrganizationEditRequest.java index 7bd8186a31..4dce9ccbc3 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/request/OrganizationEditRequest.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/request/OrganizationEditRequest.java @@ -25,7 +25,7 @@ public class OrganizationEditRequest implements Serializable { private String name; @Schema(description = "描述") - @Size(max = 500, groups = {Created.class, Updated.class}) + @Size(max = 1000, groups = {Created.class, Updated.class}) private String description; @Schema(description = "成员ID集合") diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportBugMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportBugMapper.xml index 96cbace737..0657a77c96 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportBugMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportBugMapper.xml @@ -3,13 +3,16 @@ diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportLogService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportLogService.java index 3018873544..4867e6a9c1 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportLogService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportLogService.java @@ -93,4 +93,27 @@ public class TestPlanReportLogService { }); operationLogService.batchAdd(logs); } + + /** + * 生成报告日志 + * @param report 报告 + * @param userId 用户ID + * @param projectId 项目ID + * @param path 路径 + */ + public void addLog(TestPlanReport report, String userId, String projectId, String path) { + Project project = projectMapper.selectByPrimaryKey(projectId); + LogDTO log = new LogDTO( + projectId, + project.getOrganizationId(), + report.getId(), + userId, + OperationLogType.ADD.name(), + OperationLogModule.TEST_PLAN_REPORT, + report.getName()); + log.setPath(path); + log.setMethod(HttpMethodConstants.POST.name()); + log.setOriginalValue(JSON.toJSONBytes(report)); + operationLogService.add(log); + } } 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 2c2ce36dae..ddbf552665 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 @@ -211,7 +211,7 @@ public class TestPlanReportService { genPreParam.setResultStatus("-"); // 是否集成报告, 目前根据是否计划组来区分 genPreParam.setIntegrated(StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP)); - TestPlanReport preReport = preGenReport(genPreParam, currentUser); + TestPlanReport preReport = preGenReport(genPreParam, currentUser, "/test-plan/report/gen"); TestPlanReportPostParam postParam = new TestPlanReportPostParam(); BeanUtils.copyBean(postParam, request); postParam.setReportId(preReport.getId()); @@ -227,7 +227,7 @@ public class TestPlanReportService { * 预生成报告内容(后续拆分优化) * @return 报告 */ - public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser) { + public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser, String logPath) { // 准备计划数据 TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId()); @@ -298,6 +298,9 @@ public class TestPlanReportService { report.setDeleted(false); report.setPassThreshold(testPlanConfig.getPassThreshold()); testPlanReportMapper.insertSelective(report); + + // 插入生成报告日志 + testPlanReportLogService.addLog(report, currentUser, genParam.getProjectId(), logPath); return report; }