|
|
|
@ -7,6 +7,7 @@ import com.luoo.comment.dao.CommentHisDao;
|
|
|
|
|
import com.luoo.comment.pojo.Comment;
|
|
|
|
|
import com.luoo.comment.pojo.CommentHis;
|
|
|
|
|
import com.luoo.comment.pojo.JournalRespDTO;
|
|
|
|
|
import com.luoo.comment.pojo.PublicationLike;
|
|
|
|
|
import constants.Constants;
|
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
|
import dto.UserMessageDto;
|
|
|
|
@ -96,6 +97,7 @@ public class CommentService {
|
|
|
|
|
commentHis.setNickName(userLoginDto.getNickName());
|
|
|
|
|
commentHis.setCommentContent(comment.getContent());
|
|
|
|
|
commentHis.setContent(parentComment.getContent());
|
|
|
|
|
commentHis.setParentCommentId(parentComment.get_id());
|
|
|
|
|
commentHis.setCommenterAvatar(Constants.RESOURCE_PREFIX+userLoginDto.getAvatar());
|
|
|
|
|
commentHis.setJournalId(parentComment.getJournalId());
|
|
|
|
|
commentHis.setJournalImage(parentComment.getJournalImage());
|
|
|
|
@ -151,8 +153,32 @@ public class CommentService {
|
|
|
|
|
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT+"_"+comment.getRootJournalId());
|
|
|
|
|
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_NEW+"_"+comment.getRootJournalId());
|
|
|
|
|
}
|
|
|
|
|
commentDao.deleteById(id);
|
|
|
|
|
|
|
|
|
|
comment.setContent("原评论已删除");
|
|
|
|
|
// 同步publicationLike和CommentHis
|
|
|
|
|
|
|
|
|
|
// 同步更新publicationLike中的评论信息
|
|
|
|
|
Query query1 = new Query();
|
|
|
|
|
query1.addCriteria(Criteria.where("likedItemId").is(id));
|
|
|
|
|
Update update1 = new Update();
|
|
|
|
|
update1.set("commentContent","原评论已删除");
|
|
|
|
|
mongoTemplate.updateMulti(query1,update1, PublicationLike.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 同步更新CommentHis中的评论信息
|
|
|
|
|
Query query2 = new Query();
|
|
|
|
|
query2.addCriteria(Criteria.where("parentCommentId").is(id));
|
|
|
|
|
Update update2 = new Update();
|
|
|
|
|
update2.set("content","原评论已删除");
|
|
|
|
|
mongoTemplate.updateMulti(query2,update2,CommentHis.class);
|
|
|
|
|
|
|
|
|
|
Query query3 = new Query();
|
|
|
|
|
query3.addCriteria(Criteria.where("commentId").is(id));
|
|
|
|
|
Update update3 = new Update();
|
|
|
|
|
update3.set("commentContent","原评论已删除");
|
|
|
|
|
mongoTemplate.updateMulti(query3,update3,CommentHis.class);
|
|
|
|
|
// commentDao.deleteById(id);
|
|
|
|
|
commentDao.save(comment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Page<Comment> findByParentId(String parentId, int page, int size) {
|
|
|
|
|