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
package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.req.topic.TopicConcealReq;
import com.tanpu.community.api.beans.req.topic.TopicTopReq;
import com.tanpu.community.manager.TopicManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.*;
@RestController
@Slf4j
@RequestMapping(value = "/api/admin/topic")
public class AdminController {
@Autowired
private TopicManager topicManager;
@Autowired
private UserHolder userHolder;
@GetMapping(value="/add")
@ApiOperation("新增话题")
@ResponseBody
public CommonResp<Void> addTopic(@RequestParam String topicTitle){
String userId = userHolder.getUserId();
topicManager.insertTopic(topicTitle,userId);
return CommonResp.success();
}
//
// @ApiOperation("单个话题详细数据")
// @GetMapping("/detailData")
// @ResponseBody
// public CommonResp<TopicDO> selectOne(@RequestParam String topicId) throws MissingServletRequestParameterException {
// if (StringUtils.isEmpty(topicId)){
// throw new MissingServletRequestParameterException("topicId","String");
// }
// TopicDO topicDO =topicManager.getDetail(topicId);
// return CommonResp.success(topicDO);
// }
@PostMapping(value = "/setTop")
@ApiOperation("顶置/取消顶置话题")
@ResponseBody
public CommonResp<Void> setTopTopic(@RequestBody TopicTopReq req) throws MissingServletRequestParameterException {
topicManager.setTopTopic(req.getTopicId(),req.isTop());
return CommonResp.success();
}
@PostMapping(value = "/setConceal")
@ApiOperation("隐藏/显示话题")
@ResponseBody
public CommonResp<Void> setConceal(@RequestBody TopicConcealReq req) throws MissingServletRequestParameterException {
topicManager.setTopicConceal(req.getTopicId(),req.isConceal());
return CommonResp.success();
}
//
// @PostMapping(value = "/modifyViewNum")
// @ApiOperation("话题浏览数调整(后台管理)")
// @ResponseBody
// public CommonResp<Void> modifyViewNum(@RequestBody TopicModifyMountReq req) throws MissingServletRequestParameterException {
// topicManager.modifyViewCount(req.getTopicId(),req.getModifyMount());
// return CommonResp.success();
// }
//
// @GetMapping(value = "/dataAnalyse")
// @ApiOperation("话题数据分析")
// @ResponseBody
// public CommonResp<TopicDataAnalysDTO> dataAnalyse(@RequestParam String topicId) throws MissingServletRequestParameterException {
// TopicDataAnalysDTO result =topicManager.queryDataAnalysis(topicId);
// return CommonResp.success(result);
// }
}