Commit 2121adca authored by 王亚雷's avatar 王亚雷

粉丝/关注列表

parent 0007e300
...@@ -11,6 +11,7 @@ import com.tanpu.community.api.beans.req.comment.QueryCommentReq; ...@@ -11,6 +11,7 @@ import com.tanpu.community.api.beans.req.comment.QueryCommentReq;
import com.tanpu.community.api.beans.req.comment.ReportCommentReq; import com.tanpu.community.api.beans.req.comment.ReportCommentReq;
import com.tanpu.community.api.beans.req.page.Page; import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.manager.CommentManager; import com.tanpu.community.manager.CommentManager;
import com.tanpu.community.util.HttpServletHelper;
import com.tanpu.community.util.PageUtils; import com.tanpu.community.util.PageUtils;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -31,6 +32,8 @@ public class CommentController { ...@@ -31,6 +32,8 @@ public class CommentController {
@Resource @Resource
private UserHolder userHolder; private UserHolder userHolder;
@Resource
private HttpServletHelper httpServletHelper;
@ApiOperation("发表评论") @ApiOperation("发表评论")
@AuthLogin @AuthLogin
...@@ -45,7 +48,7 @@ public class CommentController { ...@@ -45,7 +48,7 @@ public class CommentController {
@PostMapping(value = "/queryComment") @PostMapping(value = "/queryComment")
@ResponseBody @ResponseBody
public CommonResp<Page<CommentQo>> queryComment(@Validated @RequestBody QueryCommentReq req) { public CommonResp<Page<CommentQo>> queryComment(@Validated @RequestBody QueryCommentReq req) {
String selfUserId = userHolder.getUserId(); String selfUserId = httpServletHelper.getCurrentUserId();
List<CommentQo> result = commentManager.queryComments(req.getThemeId(), selfUserId); List<CommentQo> result = commentManager.queryComments(req.getThemeId(), selfUserId);
return CommonResp.success(PageUtils.page(req.getPage(), result)); return CommonResp.success(PageUtils.page(req.getPage(), result));
} }
......
...@@ -19,6 +19,7 @@ import com.tanpu.community.util.HttpServletHelper; ...@@ -19,6 +19,7 @@ import com.tanpu.community.util.HttpServletHelper;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -45,13 +46,15 @@ public class HomePageController { ...@@ -45,13 +46,15 @@ public class HomePageController {
@Resource @Resource
private UserHolder userHolder; private UserHolder userHolder;
@Resource
private HttpServletHelper httpServletHelper;
// 用户信息查询 (供圈子服务调用) // 用户信息查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 查询") @ApiOperation(value = "个人中心 查询")
@GetMapping(value = "/queryUserInfoNew") @GetMapping(value = "/queryUserInfoNew")
public CommonResp<UserInfoResp> queryUsersListNew(@RequestParam(value = "userId") String userId) { public CommonResp<UserInfoResp> queryUsersListNew(@RequestParam(value = "userId") String userId) {
String selfUserId = userHolder.getUserId(); String selfUserId = httpServletHelper.getCurrentUserId();
return CommonResp.success(homePageManager.queryUsersInfo(selfUserId, userId)); return CommonResp.success(homePageManager.queryUsersInfo(selfUserId, userId));
} }
...@@ -75,7 +78,11 @@ public class HomePageController { ...@@ -75,7 +78,11 @@ public class HomePageController {
@ApiOperation("查询关注/粉丝列表") @ApiOperation("查询关注/粉丝列表")
@ResponseBody @ResponseBody
public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) { public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String selfUserId = userHolder.getUserId(); String selfUserId = httpServletHelper.getCurrentUserId();
// 为空查询当前用户自己的粉丝/关注列表
if (StringUtils.isEmpty(req.getUserId()) && StringUtils.isNotEmpty(selfUserId)) {
req.setUserId(selfUserId);
}
return CommonResp.success(homePageManager.queryFollow(req, selfUserId)); return CommonResp.success(homePageManager.queryFollow(req, selfUserId));
} }
...@@ -93,7 +100,7 @@ public class HomePageController { ...@@ -93,7 +100,7 @@ public class HomePageController {
@ApiOperation("用户的帖子列表") @ApiOperation("用户的帖子列表")
@ResponseBody @ResponseBody
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req) { public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req) {
String selfUserId = userHolder.getUserId(); String selfUserId = httpServletHelper.getCurrentUserId();
return CommonResp.success(themeManager.queryThemesByUser(req, selfUserId)); return CommonResp.success(themeManager.queryThemesByUser(req, selfUserId));
} }
......
...@@ -9,8 +9,10 @@ import com.tanpu.community.api.beans.req.theme.*; ...@@ -9,8 +9,10 @@ import com.tanpu.community.api.beans.req.theme.*;
import com.tanpu.community.api.beans.resp.CreateThemeResp; import com.tanpu.community.api.beans.resp.CreateThemeResp;
import com.tanpu.community.api.beans.resp.ThemeListResp; import com.tanpu.community.api.beans.resp.ThemeListResp;
import com.tanpu.community.manager.ThemeManager; import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.util.HttpServletHelper;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -26,6 +28,8 @@ public class ThemeController { ...@@ -26,6 +28,8 @@ public class ThemeController {
private ThemeManager themeManager; private ThemeManager themeManager;
@Resource @Resource
private UserHolder userHolder; private UserHolder userHolder;
@Resource
private HttpServletHelper httpServletHelper;
@AuthLogin @AuthLogin
@ApiOperation("发表主题") @ApiOperation("发表主题")
...@@ -40,6 +44,10 @@ public class ThemeController { ...@@ -40,6 +44,10 @@ public class ThemeController {
@PostMapping(value = "/list") @PostMapping(value = "/list")
@ResponseBody @ResponseBody
public CommonResp<ThemeListResp> selectInterestList(@Validated @RequestBody ThemeListReq req) { public CommonResp<ThemeListResp> selectInterestList(@Validated @RequestBody ThemeListReq req) {
String selfUserId = httpServletHelper.getCurrentUserId();
if (StringUtils.isEmpty(req.getUserId())) {
req.setUserId(selfUserId);
}
ThemeListResp result = themeManager.queryList(req, req.getUserId()); ThemeListResp result = themeManager.queryList(req, req.getUserId());
return CommonResp.success(result); return CommonResp.success(result);
} }
...@@ -49,6 +57,10 @@ public class ThemeController { ...@@ -49,6 +57,10 @@ public class ThemeController {
@ResponseBody @ResponseBody
public CommonResp<ThemeQo> getDetail(@RequestParam(value = "themeId") String themeId, public CommonResp<ThemeQo> getDetail(@RequestParam(value = "themeId") String themeId,
@RequestParam(value = "userId", required = false) String userId) { @RequestParam(value = "userId", required = false) String userId) {
String selfUserId = httpServletHelper.getCurrentUserId();
if (StringUtils.isEmpty(userId)) {
userId = selfUserId;
}
return themeManager.getThemeDetail(themeId, userId); return themeManager.getThemeDetail(themeId, userId);
} }
......
...@@ -255,10 +255,6 @@ public class HomePageManager { ...@@ -255,10 +255,6 @@ public class HomePageManager {
Integer pageSize = req.page.pageSize; Integer pageSize = req.page.pageSize;
Integer pageNumber = req.page.pageNumber; Integer pageNumber = req.page.pageNumber;
// 为空查询当前用户自己的粉丝/关注列表
if (StringUtils.isEmpty(req.getUserId()) && StringUtils.isNotEmpty(userId)) {
req.setUserId(userId);
}
Page<String> userIdsPage = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ? Page<String> userIdsPage = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ?
followRelService.queryFansByIdolId(req.userId, pageNumber, pageSize) followRelService.queryFansByIdolId(req.userId, pageNumber, pageSize)
: followRelService.queryIdolsByFansId(req.userId, pageNumber, pageSize); : followRelService.queryIdolsByFansId(req.userId, pageNumber, pageSize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment