refactor(功能用例): 优化功能用例返回的评论结构
This commit is contained in:
parent
26e48a6319
commit
edc4bcc010
|
@ -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<CommentUserInfo> commentUserInfos;
|
||||
|
||||
@Schema(description = "该条评论下的所有回复数据")
|
||||
private List<FunctionalCaseCommentDTO> childComments;
|
||||
|
|
|
@ -242,13 +242,19 @@ public class FunctionalCaseCommentService {
|
|||
List<FunctionalCaseCommentDTO>list = new ArrayList<>();
|
||||
for (FunctionalCaseComment functionalCaseComment : functionalCaseComments) {
|
||||
FunctionalCaseCommentDTO functionalCaseCommentDTO = new FunctionalCaseCommentDTO();
|
||||
List<CommentUserInfo>commentUserInfos = 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<String> notifiers = Arrays.asList(functionalCaseComment.getNotifier().split(";"));
|
||||
notifiers.forEach(t-> commentUserInfos.add(userMap.get(functionalCaseComment.getReplyUser())));
|
||||
}
|
||||
functionalCaseCommentDTO.setCommentUserInfos(commentUserInfos);
|
||||
list.add(functionalCaseCommentDTO);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue