From ef56fba8673d76a43bb5da372dff4d09cd982f0a Mon Sep 17 00:00:00 2001 From: x ronger Date: Sun, 8 Mar 2020 00:53:36 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E8=AF=84=E8=AE=BA=E8=80=85=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=E4=BD=9C=E8=80=85=E6=9C=AC=E4=BA=BA=E6=89=8D=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=E6=96=87=E7=AB=A0=E4=BD=9C=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CommentServiceImpl.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/service/impl/CommentServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/CommentServiceImpl.java index 6f4c197..2e7b044 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/CommentServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/CommentServiceImpl.java @@ -81,18 +81,20 @@ public class CommentServiceImpl extends AbstractService implements Comm commentSharpUrl.append("/comment/").append(comment.getIdComment()); commentMapper.updateCommentSharpUrl(comment.getIdComment(), commentSharpUrl.toString()); - String commentContent = comment.getCommentContent(); - if(StringUtils.isNotBlank(commentContent)){ - Integer length = commentContent.length(); - if(length > MAX_PREVIEW){ - length = 200; + // 评论者不是作者本人则进行消息通知 + if (!article.getArticleAuthorId().equals(comment.getCommentAuthorId())) { + String commentContent = comment.getCommentContent(); + if(StringUtils.isNotBlank(commentContent)){ + Integer length = commentContent.length(); + if(length > MAX_PREVIEW){ + length = 200; + } + String commentPreviewContent = commentContent.substring(0,length); + commentContent = Html2TextUtil.getContent(commentPreviewContent); + NotificationUtils.saveNotification(article.getArticleAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent); } - String commentPreviewContent = commentContent.substring(0,length); - commentContent = Html2TextUtil.getContent(commentPreviewContent); } - NotificationUtils.saveNotification(article.getArticleAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent); - return map; } }