|
@@ -15,10 +15,7 @@ import com.ruoyi.common.utils.ip.AddressUtils;
|
|
|
import com.ruoyi.generator.domain.Community.*;
|
|
|
import com.ruoyi.generator.mapper.community.*;
|
|
|
import com.ruoyi.generator.service.*;
|
|
|
-import com.ruoyi.generator.vo.CommunityArticleCommentVo;
|
|
|
-import com.ruoyi.generator.vo.CommunityCommentRaffleVo;
|
|
|
-import com.ruoyi.generator.vo.CommunityCommentReplyVo;
|
|
|
-import com.ruoyi.generator.vo.CommunitySearchCommentVo;
|
|
|
+import com.ruoyi.generator.vo.*;
|
|
|
import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
import com.ruoyi.system.service.impl.SysUserServiceImpl;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -504,7 +501,49 @@ public class CommunityCommentController extends BaseController {
|
|
|
System.out.println(commentVos);
|
|
|
return AjaxResult.success(commentVos);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取当前登录用户个人中心信息数量
|
|
|
+ *
|
|
|
+ * @return 个人中心信息数量
|
|
|
+ */
|
|
|
+ @GetMapping("/getMyMessageNum")
|
|
|
+ @ApiOperation("获取当前登录用户个人中心信息数量")
|
|
|
+ public AjaxResult getMyMessage() {
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
|
|
+ int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 1000000000);
|
|
|
+ int searchType = Convert.toInt(ServletUtils.getParameter("searchType"), 1);
|
|
|
+ int offset = (pageNum - 1) * pageSize;
|
|
|
+
|
|
|
+ MyMessageNumVo myMessageNumVo = new MyMessageNumVo();
|
|
|
|
|
|
+ //获取当前登录用户的评论和回复 数量
|
|
|
+ List<CommentVo> commentInfoByUserId = communityArticleCommentService.getCommentInfoByUserId(userId, offset, pageSize, searchType);
|
|
|
+ long unreadCommentCount = commentInfoByUserId.stream()
|
|
|
+ .filter(comment -> !comment.isRead())
|
|
|
+ .count();
|
|
|
+
|
|
|
+ myMessageNumVo.setComments((int) unreadCommentCount);
|
|
|
+
|
|
|
+ //获取当前登录用户被推荐和收藏的信息
|
|
|
+ List<RecommendAndCollectVo> recommendAndCollectVos = communityArticleCollectMapper.selectRecommendAndCollectByUserId(userId, offset, pageSize, searchType);
|
|
|
+ long unreadRecommendAndCollect = recommendAndCollectVos.stream()
|
|
|
+ .filter(recommendAndCollect -> !recommendAndCollect.isRead())
|
|
|
+ .count();
|
|
|
+ myMessageNumVo.setLikeAndCollect((int) unreadRecommendAndCollect);
|
|
|
+
|
|
|
+ //获取当前登录用户新增关注列表
|
|
|
+ List<LikeVo> likeVos = communityUserLikeMapper.selectLikeByUserId(userId, offset, pageSize, searchType);
|
|
|
+ long unreadlike = likeVos.stream()
|
|
|
+ .filter(like -> !like.isRead())
|
|
|
+ .count();
|
|
|
+ myMessageNumVo.setLikeList((int) unreadlike);
|
|
|
+
|
|
|
+
|
|
|
+ return success(myMessageNumVo);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
/**
|
|
|
* 获取当前登录用户的评论和回复
|
|
|
*
|