|
@@ -2,6 +2,7 @@ package com.ruoyi.generator.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
@@ -90,6 +91,11 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
@Autowired
|
|
|
private CommunityArticleRecommendMapper recommendMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICommunityArticleService communityArticleService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICommunityPrivacyService communityPrivacyService;
|
|
|
|
|
|
|
|
|
* 查询文章列表
|
|
@@ -603,6 +609,70 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
return communityUserLikeVos;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ *
|
|
|
+ * @param communityArticleComment
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean checkCommentPermission(CommunityArticleComment communityArticleComment) throws ParseException {
|
|
|
+
|
|
|
+ * 1.获取文章创建人ID
|
|
|
+ * 2.通过文章创建人ID 查询隐私设置表 communityPrivacyService.selectUserPrivacy
|
|
|
+ * 3.查询是否开启 只允许我关注的人评论我 有则进入3,没有就返回,
|
|
|
+ * 4.获取用户关注列表
|
|
|
+ * 5.是否是关注的人评论我 有则评论成功,没有则返回失败
|
|
|
+ */
|
|
|
+
|
|
|
+ List<CommunityArticle> communityArticles
|
|
|
+ = communityArticleMapper
|
|
|
+ .selectList(new QueryWrapper<CommunityArticle>().eq("id", communityArticleComment.getArticleId()));
|
|
|
+
|
|
|
+
|
|
|
+ Long articleId = null;
|
|
|
+
|
|
|
+ if (!communityArticles.isEmpty()) {
|
|
|
+ CommunityArticle article = communityArticles.get(0);
|
|
|
+ articleId = article.getUserId();
|
|
|
+ } else {
|
|
|
+
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (articleId.equals(SecurityUtils.getLoginUser().getUserId())) {
|
|
|
+
|
|
|
+ communityArticleService.sendComment(communityArticleComment);*/
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<CommunityUserPrivacyVo> communityUserPrivacyVos = communityPrivacyService.selectUserPrivacy(articleId);
|
|
|
+
|
|
|
+ boolean IsComment = false;
|
|
|
+ for (CommunityUserPrivacyVo privacyVo : communityUserPrivacyVos) {
|
|
|
+ if (privacyVo.getIsComment() != null && privacyVo.getIsComment()) {
|
|
|
+ IsComment = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (IsComment) {
|
|
|
+ List<CommunityUserLikeVo> communityUserLikeVos = communityArticleService.selectCommunityUserLikeList(articleId);
|
|
|
+
|
|
|
+
|
|
|
+ boolean isFollower = communityUserLikeVos.stream()
|
|
|
+ .anyMatch(like -> like.getUserId().equals(SecurityUtils.getLoginUser().getUserId()));
|
|
|
+
|
|
|
+
|
|
|
+ if (!isFollower) {
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|