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
package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
import com.tanpu.community.api.beans.qo.MainTextQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeListByTopicReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.service.FollowRelService;
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 java.util.List;
@RestController
@Slf4j
@RequestMapping(value = "/api/theme")
public class ThemeController {
@Autowired
private ThemeManager themeManager;
@Autowired
private FollowRelService followRelService;
@ApiOperation("发表主题")
@PostMapping(value = "/publish")
@ResponseBody
public CommonResp<Void> publishTheme(@Validated @RequestBody CreateThemeReq req) {
String userId = "liujm";
themeManager.publishTheme(req, userId);
return CommonResp.success();
}
@ApiOperation("圈子首页-推荐/关注")
@GetMapping(value = "/list")
@ResponseBody
public List<ThemeQo> selectInterestList(@RequestBody ThemeListReq req) {
String userId = "liujm";
if (req.getType()==1){
return themeManager.selectHotThemes(req,userId);
}else {
return themeManager.selectInterestThemes(req,userId);
}
}
@ApiOperation("话题详情页-最新/最热")
@GetMapping(value = "/listByTopic")
@ResponseBody
public CommonResp<List<ThemeQo>> getThemeMainText(@RequestBody ThemeListByTopicReq req) {
String userId = "liujm";
List<ThemeQo> result= themeManager.queryByTopic(req,userId);
return CommonResp.success(result);
}
@ApiOperation("主题正文")
@GetMapping(value = "/detail")
@ResponseBody
public CommonResp<MainTextQo> getThemeMainText(@RequestParam String topicId) {
String userId = "liujm";
MainTextQo mainTextQo = themeManager.getMainText(topicId,userId);
return CommonResp.success(mainTextQo);
}
@ApiOperation("转发主题")
@PostMapping(value = "/forward")
@ResponseBody
public CommonResp forwardTheme(@Validated @RequestBody ForwardThemeReq forwardThemeReq) {
String userId = "liujm";
themeManager.forward(forwardThemeReq, userId);
return CommonResp.success();
}
@ApiOperation("点赞主题")
@GetMapping(value = "/like")
@ResponseBody
public CommonResp likeOnTheme(@RequestParam String themeId) {
String user = "liujm";
themeManager.like(themeId, user);
return CommonResp.success();
}
@ApiOperation("分享主题")
@GetMapping(value = "/share")
@ResponseBody
public CommonResp shareTheme(String themeId) {
return CommonResp.success();
}
@ApiOperation("收藏主题")
@GetMapping(value = "/collect")
@ResponseBody
public CommonResp bookTheme(String themeId) {
String user = "liujm";
// themeManager.book(themeId,user);
return CommonResp.success();
}
@ApiOperation("举报主题")
@GetMapping(value = "/report")
@ResponseBody
public CommonResp complaintTheme(@RequestParam String themeId) {
return CommonResp.failed("功能暂未开放");
}
@ApiOperation("屏蔽")
@GetMapping(value = "/block")
@ResponseBody
public CommonResp concealTheme(String themeId) {
String user = "liujm";
// themeManager.blockContent(themeId,user);
return CommonResp.success();
}
}