From 1d68044df517b4d7097b3f3671f5a4dad544bf8d Mon Sep 17 00:00:00 2001 From: ronger Date: Wed, 11 Mar 2020 09:44:39 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=98=AF=E5=90=A6=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=88=A4=E6=96=AD=20bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rymcu/vertical/service/impl/CommentServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 1fcfdbf..b9b3c88 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/CommentServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/CommentServiceImpl.java @@ -14,6 +14,7 @@ import com.rymcu.vertical.util.NotificationUtils; import com.rymcu.vertical.util.Utils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -52,6 +53,7 @@ public class CommentServiceImpl extends AbstractService implements Comm } @Override + @Transactional(rollbackFor = Exception.class) public Map postComment(Comment comment, HttpServletRequest request) { Map map = new HashMap(1); if(comment.getCommentArticleId() == null){ @@ -94,7 +96,7 @@ public class CommentServiceImpl extends AbstractService implements Comm NotificationUtils.saveNotification(article.getArticleAuthorId(),comment.getIdComment(), NotificationConstant.Comment, commentContent); } // 判断是否是回复消息 - if (comment.getCommentOriginalCommentId() != null) { + if (comment.getCommentOriginalCommentId() != null && comment.getCommentOriginalCommentId() != 0) { Comment originalComment = commentMapper.selectByPrimaryKey(comment.getCommentOriginalCommentId()); // 回复消息时,评论者不是上级评论作者则进行消息通知 if (!comment.getCommentAuthorId().equals(originalComment.getCommentAuthorId())) {