1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.AuthLogin;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.api.beans.req.homepage.FollowRelReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.manager.HomePageManager;
import com.tanpu.community.manager.ThemeManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@Slf4j
@RequestMapping(value = "/api/homepage")
public class HomePageController {
@Autowired
private HomePageManager homePageManager;
@Autowired
private ThemeManager themeManager;
@Resource
private UserHolder userHolder;
@PostMapping(value = "/editInfo")
@ApiOperation("编辑圈子个人资料")
@ResponseBody
public CommonResp<String> editUserInfo(@Validated @RequestBody HomePageReq req){
String userId="liujm";
// homePageManager.editUserInfo(req,userId);
return CommonResp.success("修改成功");
}
@PostMapping(value = "/followList")
@ApiOperation("查询关注/粉丝列表")
@ResponseBody
@AuthLogin
public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryFollow(req,userId));
}
@PostMapping(value = "/addIdol")
@ApiOperation("关注/取消关注他人")
@ResponseBody
public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId();
homePageManager.addFollowRel(req,userId);
return CommonResp.success();
}
@PostMapping(value = "/themeList")
@ApiOperation("用户的帖子列表")
@ResponseBody
@AuthLogin
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req){
String userId = userHolder.getUserId();
return CommonResp.success(themeManager.queryThemesByUser(req,userId));
}
// @PostMapping(value = "/commentThemeList")
// @ApiOperation("用户评论过的帖子列表")
// @ResponseBody
// public CommonResp<List<ThemeQo>> commentThemeList(@RequestBody QueryRecordThemeReq req){
// String userId="123";
//
// return CommonResp.success(themeManager.queryThemesByUser(req,userId));
// }
}