|
@@ -11,17 +11,9 @@ import com.ruoyi.common.core.text.Convert;
|
|
import com.ruoyi.common.exception.user.ProjectException;
|
|
import com.ruoyi.common.exception.user.ProjectException;
|
|
import com.ruoyi.common.utils.*;
|
|
import com.ruoyi.common.utils.*;
|
|
import com.ruoyi.common.utils.ip.AddressUtils;
|
|
import com.ruoyi.common.utils.ip.AddressUtils;
|
|
-import com.ruoyi.generator.domain.Community.CommunityArticle;
|
|
|
|
-import com.ruoyi.generator.domain.Community.CommunityArticleComment;
|
|
|
|
-import com.ruoyi.generator.domain.Community.CommunityCommentLike;
|
|
|
|
-import com.ruoyi.generator.domain.Community.CommunityCommentReply;
|
|
|
|
-import com.ruoyi.generator.mapper.community.CommunityArticleCommentMapper;
|
|
|
|
-import com.ruoyi.generator.mapper.community.CommunityArticleMapper;
|
|
|
|
-import com.ruoyi.generator.mapper.community.CommunityCommentLikeMapper;
|
|
|
|
-import com.ruoyi.generator.mapper.community.CommunityCommentReplyMapper;
|
|
|
|
-import com.ruoyi.generator.service.ICommunityArticleCommentService;
|
|
|
|
-import com.ruoyi.generator.service.ICommunityArticleService;
|
|
|
|
-import com.ruoyi.generator.service.ICommunityCommentReplyService;
|
|
|
|
|
|
+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.CommunityArticleCommentVo;
|
|
import com.ruoyi.generator.vo.CommunityCommentRaffleVo;
|
|
import com.ruoyi.generator.vo.CommunityCommentRaffleVo;
|
|
import com.ruoyi.generator.vo.CommunityCommentReplyVo;
|
|
import com.ruoyi.generator.vo.CommunityCommentReplyVo;
|
|
@@ -35,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -82,6 +75,27 @@ public class CommunityCommentController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private CommunityCommentReplyMapper communityCommentReplyMapper;
|
|
private CommunityCommentReplyMapper communityCommentReplyMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommunityArticleCollectMapper communityArticleCollectMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommunityArticleCollectServiceImpl articleCollectService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommunityArticleRecommendMapper communityArticleRecommendMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommunityArticleRecommendServiceImpl communityArticleRecommendServiceImpl;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private CommunityCommentLikeServiceImpl commentLikeService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private CommunityUserLikeServiceImpl userLikeService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CommunityUserLikeMapper communityUserLikeMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取文章评论
|
|
* 获取文章评论
|
|
*/
|
|
*/
|
|
@@ -463,4 +477,72 @@ public class CommunityCommentController extends BaseController {
|
|
Long userId = SecurityUtils.getUserId();
|
|
Long userId = SecurityUtils.getUserId();
|
|
return success(communityArticleCommentService.getCommentInfoByUserId(userId));
|
|
return success(communityArticleCommentService.getCommentInfoByUserId(userId));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取当前登录用户被推荐和收藏的信息
|
|
|
|
+ *
|
|
|
|
+ * @return 推荐和收藏
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/getLikeAndCollect")
|
|
|
|
+ @ApiOperation("获取当前登录用户被推荐和收藏的信息")
|
|
|
|
+ public AjaxResult getLikeAndCollect() {
|
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
|
+ return success(communityArticleCollectMapper.selectRecommendAndCollectByUserId(userId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取当前登录用户新增关注列表
|
|
|
|
+ *
|
|
|
|
+ * @return 获取当前登录用户新增关注列表
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/getLikeList")
|
|
|
|
+ @ApiOperation("获取当前登录用户新增关注列表")
|
|
|
|
+ public AjaxResult getLikeList() {
|
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
|
+ return success(communityUserLikeMapper.selectLikeByUserId(userId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 用户点击通知后,更新通知消息已读
|
|
|
|
+ *
|
|
|
|
+ * @return 更新结果
|
|
|
|
+ */
|
|
|
|
+ @PutMapping("/updateMsgRead")
|
|
|
|
+ @ApiOperation("用户点击通知后,更新通知消息已读")
|
|
|
|
+ public AjaxResult updateMsgRead(String type, String id) {
|
|
|
|
+ switch (type) {
|
|
|
|
+ case "0":
|
|
|
|
+ //文章推荐
|
|
|
|
+ communityArticleRecommendServiceImpl.update(new UpdateWrapper<CommunityArticleRecommend>()
|
|
|
|
+ .set("is_read", true)
|
|
|
|
+ .eq("id", id));
|
|
|
|
+ break;
|
|
|
|
+ case "1":
|
|
|
|
+ //文章收藏
|
|
|
|
+ articleCollectService.update(new UpdateWrapper<CommunityArticleCollect>()
|
|
|
|
+ .set("is_read", true)
|
|
|
|
+ .eq("id", id));
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ //评论点赞
|
|
|
|
+ commentLikeService.update(new UpdateWrapper<CommunityCommentLike>()
|
|
|
|
+ .set("is_read", true)
|
|
|
|
+ .eq("id", id));
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ //回复点赞
|
|
|
|
+ communityCommentReplyService.update(new UpdateWrapper<CommunityCommentReply>()
|
|
|
|
+ .set("is_read", true)
|
|
|
|
+ .eq("id", id));
|
|
|
|
+ break;
|
|
|
|
+ case "4":
|
|
|
|
+ //新增关注已读
|
|
|
|
+ userLikeService.update(new UpdateWrapper<CommunityUserLike>()
|
|
|
|
+ .set("is_read", true)
|
|
|
|
+ .eq("id", id));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return success();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|