From edc4bcc010dee0e6b635dee136d2f16602106b19 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 10 Jan 2024 16:54:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=9A=84=E8=AF=84=E8=AE=BA=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functional/dto/FunctionalCaseCommentDTO.java | 14 +++----------- .../service/FunctionalCaseCommentService.java | 14 ++++++++++---- .../io/metersphere/system/dto/CommentUserInfo.java | 8 +++++++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseCommentDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseCommentDTO.java index e711ddf78a..b25c8fe82e 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseCommentDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/FunctionalCaseCommentDTO.java @@ -1,6 +1,7 @@ package io.metersphere.functional.dto; import io.metersphere.functional.domain.FunctionalCaseComment; +import io.metersphere.system.dto.CommentUserInfo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -9,17 +10,8 @@ import java.util.List; @Data public class FunctionalCaseCommentDTO extends FunctionalCaseComment { - @Schema(description = "评论的人名") - private String userName; - - @Schema(description = "被回复的人名") - private String replyUserName; - - @Schema(description = "被回复的人头像") - private String replyUserLogo; - - @Schema(description = "评论的人头像") - private String userLogo; + @Schema(description = "评论相关用户信息") + private List commentUserInfos; @Schema(description = "该条评论下的所有回复数据") private List childComments; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java index caa64dc8ec..db7c732406 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseCommentService.java @@ -242,13 +242,19 @@ public class FunctionalCaseCommentService { Listlist = new ArrayList<>(); for (FunctionalCaseComment functionalCaseComment : functionalCaseComments) { FunctionalCaseCommentDTO functionalCaseCommentDTO = new FunctionalCaseCommentDTO(); + ListcommentUserInfos = new ArrayList<>(); BeanUtils.copyBean(functionalCaseCommentDTO,functionalCaseComment); - functionalCaseCommentDTO.setUserName(userMap.get(functionalCaseComment.getCreateUser()).getName()); - functionalCaseCommentDTO.setUserLogo(userMap.get(functionalCaseComment.getCreateUser()).getAvatar()); + CommentUserInfo createUserInfo = userMap.get(functionalCaseComment.getCreateUser()); + commentUserInfos.add(createUserInfo); if (StringUtils.isNotBlank(functionalCaseComment.getReplyUser())) { - functionalCaseCommentDTO.setReplyUserName(userMap.get(functionalCaseComment.getReplyUser()).getName()); - functionalCaseCommentDTO.setReplyUserLogo(userMap.get(functionalCaseComment.getReplyUser()).getAvatar()); + CommentUserInfo replyUserInfo = userMap.get(functionalCaseComment.getReplyUser()); + commentUserInfos.add(replyUserInfo); } + if (StringUtils.isNotBlank(functionalCaseComment.getNotifier())) { + List notifiers = Arrays.asList(functionalCaseComment.getNotifier().split(";")); + notifiers.forEach(t-> commentUserInfos.add(userMap.get(functionalCaseComment.getReplyUser()))); + } + functionalCaseCommentDTO.setCommentUserInfos(commentUserInfos); list.add(functionalCaseCommentDTO); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/CommentUserInfo.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/CommentUserInfo.java index 9c55e6c470..1e2475c1fd 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/CommentUserInfo.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/CommentUserInfo.java @@ -3,8 +3,14 @@ package io.metersphere.system.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.io.Serial; +import java.io.Serializable; + @Data -public class CommentUserInfo{ +public class CommentUserInfo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; @Schema(description = "用户ID") private String id;