From f2ec50e15b27489d50c1ec6fea84aaf1e6569eaa Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 15 Dec 2023 12:31:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=94=A8=E4=BE=8B=E8=AF=84=E5=AE=A1):?= =?UTF-8?q?=20=E7=94=A8=E4=BE=8B=E8=AF=84=E5=AE=A1=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=B3=BB=E7=BB=9F=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/sdk/src/main/resources/i18n/case.properties | 1 + .../sdk/src/main/resources/i18n/case_en_US.properties | 1 + .../sdk/src/main/resources/i18n/case_zh_CN.properties | 1 + .../sdk/src/main/resources/i18n/case_zh_TW.properties | 1 + .../functional/service/ReviewFunctionalCaseService.java | 7 ++++++- .../controller/ReviewFunctionalCaseControllerTests.java | 8 ++++++++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/backend/framework/sdk/src/main/resources/i18n/case.properties b/backend/framework/sdk/src/main/resources/i18n/case.properties index 13f7815edb..f46f4dbbbb 100644 --- a/backend/framework/sdk/src/main/resources/i18n/case.properties +++ b/backend/framework/sdk/src/main/resources/i18n/case.properties @@ -146,3 +146,4 @@ case_review.single=单人评审 case_review.multiple=多人评审 case_review.not.exist=用例评审不存在 case_review_content.not.exist = 评审意见不能为空 +case_review_history.system=系统触发 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 3751467335..3bf66ade03 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 @@ -163,4 +163,5 @@ case_review.single=Single person review case_review.multiple=Multiple reviewers case_review.not.exist=Case review does not exist case_review_content.not.exist = Review comments cannot be empty +case_review_history.system=System trigger 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 6c2508a3b9..36ae1a87a7 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 @@ -162,4 +162,5 @@ case_review.single=单人评审 case_review.multiple=多人评审 case_review.not.exist=用例评审不存在 case_review_content.not.exist = 评审意见不能为空 +case_review_history.system=系统触发 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 063a6f3341..3b4fdea922 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 @@ -163,4 +163,5 @@ case_review.single=單人評審 case_review.multiple=多人評審 case_review.not.exist=用例評審不存在 case_review_content.not.exist = 評審意見不能為空 +case_review_history.system=系統觸發 diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java index 6414af46e3..382231456f 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/ReviewFunctionalCaseService.java @@ -218,7 +218,12 @@ public class ReviewFunctionalCaseService { public List getCaseReviewHistoryList(String reviewId, String caseId) { List list = extCaseReviewHistoryMapper.list(caseId, reviewId); for (CaseReviewHistoryDTO caseReviewHistoryDTO : list) { - caseReviewHistoryDTO.setContentText(new String(caseReviewHistoryDTO.getContent(),StandardCharsets.UTF_8)); + if (StringUtils.equalsIgnoreCase(caseReviewHistoryDTO.getCreateUser(),"system")) { + caseReviewHistoryDTO.setUserName(Translator.get("case_review_history.system")); + } + if (caseReviewHistoryDTO.getContent() != null) { + caseReviewHistoryDTO.setContentText(new String(caseReviewHistoryDTO.getContent(),StandardCharsets.UTF_8)); + } } return list; } diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/ReviewFunctionalCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/ReviewFunctionalCaseControllerTests.java index 5dff0a8ce0..6c27cd2826 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/ReviewFunctionalCaseControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/ReviewFunctionalCaseControllerTests.java @@ -231,6 +231,14 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest { public void getListSuccess() throws Exception { List caseReviews = getCaseReviews("创建用例评审1"); String reviewId = caseReviews.get(0).getId(); + CaseReviewHistory caseReviewHistory = new CaseReviewHistory(); + caseReviewHistory.setReviewId(reviewId); + caseReviewHistory.setCaseId("gyqReviewCaseTest"); + caseReviewHistory.setCreateUser("system"); + caseReviewHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString()); + caseReviewHistory.setId("test"); + caseReviewHistory.setCreateTime(System.currentTimeMillis()); + caseReviewHistoryMapper.insertSelective(caseReviewHistory); List gyqReviewCaseTest = getCaseReviewHistoryList("gyqReviewCaseTest", reviewId); System.out.println(JSON.toJSONString(gyqReviewCaseTest)); }