diff --git a/backend/framework/sdk/src/main/resources/i18n/case_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/case_en_US.properties index 61f8d920c3..c7a0d2f53e 100644 --- a/backend/framework/sdk/src/main/resources/i18n/case_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/case_en_US.properties @@ -287,6 +287,9 @@ case.export.system.other.columns.create_time=Create time case.export.system.other.columns.update_user=Update user case.export.system.other.columns.update_time=Update time case.export.columns.case_edit_type=Edit type +case.export.system.other.columns.case_comment=Case comment +case.export.system.other.columns.execute_comment=Execute comment +case.export.system.other.columns.review_comment=Review comment export_case_task_stop=Stop export export_case_task_existed=Export task already exists \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/case_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/case_zh_CN.properties index 79b588a562..41c2be7f6f 100644 --- a/backend/framework/sdk/src/main/resources/i18n/case_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/case_zh_CN.properties @@ -284,6 +284,9 @@ case.export.system.other.columns.create_time=创建时间 case.export.system.other.columns.update_user=更新人 case.export.system.other.columns.update_time=更新时间 case.export.columns.case_edit_type=编辑模式 +case.export.system.other.columns.case_comment=用例评论 +case.export.system.other.columns.execute_comment=执行评论 +case.export.system.other.columns.review_comment=评审评论 export_case_task_stop=停止导出 export_case_task_existed=已有导出任务 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/case_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/case_zh_TW.properties index 783e9945cb..61bc7e7af4 100644 --- a/backend/framework/sdk/src/main/resources/i18n/case_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/case_zh_TW.properties @@ -288,6 +288,9 @@ case.export.system.other.columns.create_time=創建時間 case.export.system.other.columns.update_user=更新人 case.export.system.other.columns.update_time=更新時間 case.export.columns.case_edit_type=編輯模式 +case.export.system.other.columns.case_comment=用例評論 +case.export.system.other.columns.execute_comment=執行評論 +case.export.system.other.columns.review_comment=評審評論 export_case_task_stop=停止導出 export_case_task_existed=已有導出任務 \ No newline at end of file diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportCaseCommentConverter.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportCaseCommentConverter.java index 56439de4ed..d7ffc2f4df 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportCaseCommentConverter.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportCaseCommentConverter.java @@ -24,7 +24,7 @@ public class FunctionalCaseExportCaseCommentConverter implements FunctionalCaseE List caseComments = caseCommentMap.get(functionalCase.getId()); caseComments.forEach(item -> { String updateTime = DateUtils.getTimeString(item.getUpdateTime()); - String content = item.getContent(); + String content = parseHtml(item.getContent()); result.append(String.format(template, item.getCreateUser(), updateTime, content)); }); return result.toString(); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportConverter.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportConverter.java index 72f335c4e9..06f0b466c2 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportConverter.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportConverter.java @@ -9,6 +9,8 @@ import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * 功能用例导出时解析其他字段对应的列 @@ -33,4 +35,14 @@ public interface FunctionalCaseExportConverter { } return value; } + + default String parseHtml(String html) { + Pattern pattern = Pattern.compile("]*>(.*?)

"); + Matcher matcher = pattern.matcher(html); + if (matcher.find()) { + String content = matcher.group(1); + return content; + } + return StringUtils.EMPTY; + } } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportExecuteCommentConverter.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportExecuteCommentConverter.java index e75affb7fd..a390ff1d9a 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportExecuteCommentConverter.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportExecuteCommentConverter.java @@ -36,9 +36,10 @@ public class FunctionalCaseExportExecuteCommentConverter implements FunctionalCa executeComment.forEach(item -> { String status = getFromMapOfNullableWithTranslate(executeStatusMap, item.getStatus()); String createTime = DateUtils.getTimeString(item.getCreateTime()); - String content = new String(item.getContent() == null ? new byte[0] : item.getContent(), StandardCharsets.UTF_8); + String content = parseHtml(new String(item.getContent() == null ? new byte[0] : item.getContent(), StandardCharsets.UTF_8)); result.append(String.format(template, item.getCreateUser(), status, createTime, content)); }); + return result.toString(); } return StringUtils.EMPTY; } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportReviewCommentConverter.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportReviewCommentConverter.java index dc5eca86dc..a86292386c 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportReviewCommentConverter.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/converter/FunctionalCaseExportReviewCommentConverter.java @@ -35,9 +35,10 @@ public class FunctionalCaseExportReviewCommentConverter implements FunctionalCas reviewComent.forEach(item -> { String status = getFromMapOfNullableWithTranslate(reviewStatusMap, item.getStatus()); String createTime = DateUtils.getTimeString(item.getCreateTime()); - String content = new String(item.getContent() == null ? new byte[0] : item.getContent(), StandardCharsets.UTF_8); + String content = parseHtml(new String(item.getContent() == null ? new byte[0] : item.getContent(), StandardCharsets.UTF_8)); result.append(String.format(template, item.getCreateUser(), status, createTime, content)); }); + return result.toString(); } return StringUtils.EMPTY; } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java index fa64b6ef73..317b0f9871 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/domain/FunctionalCaseExportColumns.java @@ -34,6 +34,9 @@ public class FunctionalCaseExportColumns { otherColumns.put("create_time", Translator.get("case.export.system.other.columns.create_time")); otherColumns.put("update_user", Translator.get("case.export.system.other.columns.update_user")); otherColumns.put("update_time", Translator.get("case.export.system.other.columns.update_time")); + otherColumns.put("case_comment", Translator.get("case.export.system.other.columns.case_comment")); + otherColumns.put("execute_comment", Translator.get("case.export.system.other.columns.execute_comment")); + otherColumns.put("review_comment", Translator.get("case.export.system.other.columns.review_comment")); }