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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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.qo.feign.jifen.OfflineActivityListReq;
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.api.beans.req.page.Pageable;
import com.tanpu.community.api.beans.resp.Customer;
import com.tanpu.community.api.beans.resp.HomeSettingsResp;
import com.tanpu.community.api.beans.vo.feign.activity.OfflineActivitySimpleResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNewChief;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.feign.activity.FeignClientForActivity;
import com.tanpu.community.manager.HomePageManager;
import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.service.HotRecommendService;
import com.tanpu.community.util.HttpServletHelper;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
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;
@Resource
private HttpServletHelper httpServletHelper;
@Resource
private HotRecommendService hotRecommendService;
@Resource
private FeignClientForActivity feignClientForActivity;
// 用户信息查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 查询")
@GetMapping(value = "/queryUserInfoNew")
public CommonResp<UserInfoResp> queryUsersListNew(@RequestParam(value = "userId") String userId) {
String selfUserId = httpServletHelper.getCurrentUserId();
return CommonResp.success(homePageManager.queryUsersInfo(selfUserId, userId));
}
// 理财师客户列表查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 理财师客户列表查询")
@GetMapping(value = "/queryUserCustomerList")
@AuthLogin
public CommonResp<List<Customer>> queryUserCustomerList() {
String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryUserCustomerList(userId));
}
@ApiOperation(value = "探普 首席投顾列表查询")
@GetMapping(value = "/queryChiefFinancialAdviserList")
public CommonResp<Page<UserInfoNewChief>> queryChiefFinancialAdviserList(@ApiParam(value = "分页对象", required = true) Pageable page) {
return CommonResp.success(homePageManager.queryChiefFinancialAdviserList(page));
}
@PostMapping(value = "/followList")
@ApiOperation("查询关注/粉丝列表")
@ResponseBody
public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String selfUserId = userHolder.getUserId();
// 为空查询当前用户自己的粉丝/关注列表
if (StringUtils.isEmpty(req.getUserId()) && StringUtils.isNotEmpty(selfUserId)) {
req.setUserId(selfUserId);
}
return CommonResp.success(homePageManager.queryFollow(req, selfUserId));
}
@PostMapping(value = "/addIdol")
@ApiOperation("关注/取消关注他人")
@ResponseBody
@AuthLogin
public CommonResp addIdol(@RequestBody FollowRelReq req) {
String userId = userHolder.getUserId();
homePageManager.addFollowRel(req, userId);
return CommonResp.success();
}
@PostMapping(value = "/themeList")
@ApiOperation("用户的帖子列表")
@ResponseBody
public CommonResp<List<ThemeQo>> likeList(@Validated @RequestBody QueryRecordThemeReq req) {
String selfUserId = httpServletHelper.getCurrentUserId();
return CommonResp.success(themeManager.queryThemesByUser(req, selfUserId));
}
@ApiOperation(value = "首页功能展示配置v2.2.10")
@GetMapping(value = "/getHomeSettings")
public CommonResp<HomeSettingsResp> getHomeSettings() {
return hotRecommendService.getHomeSettings();
}
@PostMapping(value = "/queryCorpActivityList")
@ApiOperation("机构活动列表")
public CommonResp<Page<OfflineActivitySimpleResp>> queryCorpActivityList(@RequestBody OfflineActivityListReq req) {
return feignClientForActivity.queryCorpActivityList(req);
}
}