Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
8ef1fbcd
Commit
8ef1fbcd
authored
Jun 17, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
请求封装req对象
parent
2b17e820
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
22 deletions
+70
-22
TopicBriefInfoDTO.java
...java/com/tanpu/community/api/beans/TopicBriefInfoDTO.java
+11
-0
TopicController.java
.../java/com/tanpu/community/controller/TopicController.java
+22
-22
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+7
-0
TopicConcealReq.java
.../com/tanpu/community/model/req/topic/TopicConcealReq.java
+10
-0
TopicModifyMountReq.java
.../tanpu/community/model/req/topic/TopicModifyMountReq.java
+10
-0
TopicTopReq.java
...java/com/tanpu/community/model/req/topic/TopicTopReq.java
+10
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/TopicBriefInfoDTO.java
0 → 100644
View file @
8ef1fbcd
package
com
.
tanpu
.
community
.
api
.
beans
;
import
lombok.Data
;
@Data
public
class
TopicBriefInfoDTO
{
private
String
topicId
;
private
String
title
;
private
Long
discussionAmount
;
}
community-service/src/main/java/com/tanpu/community/controller/TopicController.java
View file @
8ef1fbcd
package
com
.
tanpu
.
community
.
controller
;
package
com
.
tanpu
.
community
.
controller
;
import
com.
alibaba.fastjson.JSONObject
;
import
com.
tanpu.community.api.beans.TopicBriefInfoDTO
;
import
com.tanpu.community.api.beans.TopicDTO
;
import
com.tanpu.community.api.beans.TopicDTO
;
import
com.tanpu.community.controller.convert.TopicConverter
;
import
com.tanpu.community.controller.convert.TopicConverter
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.manager.TopicManager
;
import
com.tanpu.community.manager.TopicManager
;
import
com.tanpu.community.model.req.topic.TopicConcealReq
;
import
com.tanpu.community.model.req.topic.TopicModifyMountReq
;
import
com.tanpu.community.model.req.topic.TopicTopReq
;
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.apache.commons.lang3.StringUtils
;
...
@@ -23,11 +26,19 @@ public class TopicController {
...
@@ -23,11 +26,19 @@ public class TopicController {
@Autowired
@Autowired
private
TopicManager
topicManager
;
private
TopicManager
topicManager
;
@PostMapping
(
value
=
"/admin/queryTopicDetailList"
)
@GetMapping
(
value
=
"/queryTopicInfoList"
)
@ApiOperation
(
"APP全部话题页面,可搜索"
)
@ResponseBody
public
List
<
TopicBriefInfoDTO
>
getTopicBriefInfoList
(){
List
<
TopicBriefInfoDTO
>
allTopic
=
topicManager
.
getBreifInfoTopic
();
return
allTopic
;
}
@GetMapping
(
value
=
"/admin/queryTopicDetailList"
)
@ApiOperation
(
"查询所有的主题详情"
)
@ApiOperation
(
"查询所有的主题详情"
)
@ResponseBody
@ResponseBody
public
List
<
TopicDTO
>
getAllTopicList
(
@RequestBody
String
content
){
public
List
<
TopicDTO
>
getAllTopicList
(){
JSONObject
params
=
JSONObject
.
parseObject
(
content
);
List
<
TopicEntity
>
allTopic
=
topicManager
.
getAllTopic
();
List
<
TopicEntity
>
allTopic
=
topicManager
.
getAllTopic
();
List
<
TopicDTO
>
topicDTOS
=
TopicConverter
.
convertToDTOs
(
allTopic
);
List
<
TopicDTO
>
topicDTOS
=
TopicConverter
.
convertToDTOs
(
allTopic
);
//获取浏览数据:浏览、发帖、回帖
//获取浏览数据:浏览、发帖、回帖
...
@@ -37,8 +48,7 @@ public class TopicController {
...
@@ -37,8 +48,7 @@ public class TopicController {
@PostMapping
(
value
=
"/admin/queryTopicNameList"
)
@PostMapping
(
value
=
"/admin/queryTopicNameList"
)
@ApiOperation
(
"查询所有的主题名称列表"
)
@ApiOperation
(
"查询所有的主题名称列表"
)
@ResponseBody
@ResponseBody
public
List
<
String
>
getTopicNameList
(
@RequestBody
String
content
){
public
List
<
String
>
getTopicNameList
(){
JSONObject
params
=
JSONObject
.
parseObject
(
content
);
List
<
TopicEntity
>
allTopic
=
topicManager
.
getAllTopic
();
List
<
TopicEntity
>
allTopic
=
topicManager
.
getAllTopic
();
List
<
String
>
topictitiles
=
allTopic
.
stream
().
map
(
TopicEntity:
:
getTopicTitle
).
collect
(
Collectors
.
toList
());
List
<
String
>
topictitiles
=
allTopic
.
stream
().
map
(
TopicEntity:
:
getTopicTitle
).
collect
(
Collectors
.
toList
());
//获取浏览数据:浏览、发帖、回帖
//获取浏览数据:浏览、发帖、回帖
...
@@ -69,34 +79,24 @@ public class TopicController {
...
@@ -69,34 +79,24 @@ public class TopicController {
@PostMapping
(
value
=
"/admin/setTop"
)
@PostMapping
(
value
=
"/admin/setTop"
)
@ApiOperation
(
"顶置/取消顶置主题"
)
@ApiOperation
(
"顶置/取消顶置主题"
)
@ResponseBody
@ResponseBody
public
String
setTopTopic
(
@RequestParam
String
topicId
,
@RequestParam
boolean
setTop
)
throws
MissingServletRequestParameterException
{
public
String
setTopTopic
(
@RequestBody
TopicTopReq
req
)
throws
MissingServletRequestParameterException
{
if
(
StringUtils
.
isEmpty
(
topicId
)){
topicManager
.
setTopTopic
(
req
.
getTopicId
(),
req
.
isTop
());
throw
new
MissingServletRequestParameterException
(
"topicId"
,
"String"
);
}
topicManager
.
setTopTopic
(
topicId
,
setTop
);
return
"success"
;
return
"success"
;
}
}
@PostMapping
(
value
=
"/admin/setConceal"
)
@PostMapping
(
value
=
"/admin/setConceal"
)
@ApiOperation
(
"隐藏/显示主题"
)
@ApiOperation
(
"隐藏/显示主题"
)
@ResponseBody
@ResponseBody
public
String
setConceal
(
@RequestParam
String
topicId
,
@RequestParam
boolean
setConceal
)
throws
MissingServletRequestParameterException
{
public
String
setConceal
(
@RequestBody
TopicConcealReq
req
)
throws
MissingServletRequestParameterException
{
if
(
StringUtils
.
isEmpty
(
topicId
)){
topicManager
.
setTopicConceal
(
req
.
getTopicId
(),
req
.
isConceal
());
throw
new
MissingServletRequestParameterException
(
"topicId"
,
"String"
);
}
topicManager
.
setTopicConceal
(
topicId
,
setConceal
);
return
"success"
;
return
"success"
;
}
}
@PostMapping
(
value
=
"/admin/modifyViewNum"
)
@PostMapping
(
value
=
"/admin/modifyViewNum"
)
@ApiOperation
(
"主题浏览数调整"
)
@ApiOperation
(
"主题浏览数调整"
)
@ResponseBody
@ResponseBody
public
String
modifyViewNum
(
@RequestParam
String
topicId
,
@RequestParam
Long
modifyMount
)
throws
MissingServletRequestParameterException
{
public
String
modifyViewNum
(
@RequestBody
TopicModifyMountReq
req
)
throws
MissingServletRequestParameterException
{
if
(
StringUtils
.
isEmpty
(
topicId
)){
topicManager
.
modifyPV
(
req
.
getTopicId
(),
req
.
getModifyMount
());
throw
new
MissingServletRequestParameterException
(
"topicId"
,
"String"
);
}
//修改浏览量
topicManager
.
modifyPV
(
topicId
,
modifyMount
);
return
"success"
;
return
"success"
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
8ef1fbcd
package
com
.
tanpu
.
community
.
manager
;
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.TopicBriefInfoDTO
;
import
com.tanpu.community.api.beans.TopicDTO
;
import
com.tanpu.community.api.beans.TopicDTO
;
import
com.tanpu.community.api.constants.RedisKeyConstant
;
import
com.tanpu.community.api.constants.RedisKeyConstant
;
import
com.tanpu.community.api.constants.TopicStatusEnum
;
import
com.tanpu.community.api.constants.TopicStatusEnum
;
...
@@ -106,4 +107,10 @@ public class TopicManager {
...
@@ -106,4 +107,10 @@ public class TopicManager {
}
}
}
}
public
List
<
TopicBriefInfoDTO
>
getBreifInfoTopic
()
{
topicService
.
queryTopicList
();
return
null
;
}
}
}
community-service/src/main/java/com/tanpu/community/model/req/topic/TopicConcealReq.java
0 → 100644
View file @
8ef1fbcd
package
com
.
tanpu
.
community
.
model
.
req
.
topic
;
import
lombok.Data
;
@Data
public
class
TopicConcealReq
{
private
String
topicId
;
private
boolean
isConceal
;
}
community-service/src/main/java/com/tanpu/community/model/req/topic/TopicModifyMountReq.java
0 → 100644
View file @
8ef1fbcd
package
com
.
tanpu
.
community
.
model
.
req
.
topic
;
import
lombok.Data
;
@Data
public
class
TopicModifyMountReq
{
private
String
topicId
;
private
Long
modifyMount
;
}
community-service/src/main/java/com/tanpu/community/model/req/topic/TopicTopReq.java
0 → 100644
View file @
8ef1fbcd
package
com
.
tanpu
.
community
.
model
.
req
.
topic
;
import
lombok.Data
;
@Data
public
class
TopicTopReq
{
private
String
topicId
;
private
boolean
isTop
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment