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
3d62a020
Commit
3d62a020
authored
Jul 08, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口调整
parent
c4ed5301
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
55 deletions
+77
-55
TopicDO.java
.../src/main/java/com/tanpu/community/api/beans/TopicDO.java
+1
-1
TopicDetailQo.java
.../java/com/tanpu/community/api/beans/qo/TopicDetailQo.java
+0
-3
ThemeListByTopicReq.java
...pu/community/api/beans/req/theme/ThemeListByTopicReq.java
+19
-0
ThemeListReq.java
...com/tanpu/community/api/beans/req/theme/ThemeListReq.java
+2
-0
AdminController.java
.../java/com/tanpu/community/controller/AdminController.java
+11
-11
CommentController.java
...ava/com/tanpu/community/controller/CommentController.java
+2
-2
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+18
-9
TopicController.java
.../java/com/tanpu/community/controller/TopicController.java
+5
-15
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+5
-0
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+8
-8
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+6
-6
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/TopicD
T
O.java
→
community-api/src/main/java/com/tanpu/community/api/beans/TopicDO.java
View file @
3d62a020
...
...
@@ -9,7 +9,7 @@ import java.time.LocalDateTime;
@Data
@ApiModel
(
value
=
"TopicDTO对象"
,
description
=
"话题"
)
public
class
TopicD
T
O
implements
Serializable
{
public
class
TopicDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/TopicDetailQo.java
View file @
3d62a020
...
...
@@ -2,8 +2,6 @@ package com.tanpu.community.api.beans.qo;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.List
;
public
class
TopicDetailQo
{
@ApiModelProperty
(
value
=
"id"
)
...
...
@@ -18,5 +16,4 @@ public class TopicDetailQo {
@ApiModelProperty
(
value
=
"讨论量"
)
private
Integer
disscussCount
;
private
List
<
ThemeQo
>
themes
;
}
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ThemeListByTopicReq.java
0 → 100644
View file @
3d62a020
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
ThemeListByTopicReq
{
@ApiModelProperty
(
value
=
"当前浏览的最后一个themeId"
)
private
String
lastId
;
@ApiModelProperty
(
value
=
"页面大小"
)
private
Integer
PageSize
;
@ApiModelProperty
(
value
=
"类型,1:最热 2:最新"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"话题Id"
)
private
String
topicId
;
}
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ThemeListReq.java
View file @
3d62a020
...
...
@@ -10,6 +10,8 @@ public class ThemeListReq {
private
String
lastId
;
@ApiModelProperty
(
value
=
"页面大小"
)
private
Integer
PageSize
;
@ApiModelProperty
(
value
=
"类型,1:推荐 2:关注"
)
private
Integer
type
;
}
community-service/src/main/java/com/tanpu/community/controller/AdminController.java
View file @
3d62a020
...
...
@@ -2,7 +2,7 @@ package com.tanpu.community.controller;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.community.api.beans.TopicD
T
O
;
import
com.tanpu.community.api.beans.TopicDO
;
import
com.tanpu.community.api.beans.TopicDataAnalysDTO
;
import
com.tanpu.community.api.beans.req.topic.TopicConcealReq
;
import
com.tanpu.community.api.beans.req.topic.TopicModifyMountReq
;
...
...
@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@Slf4j
@RequestMapping
(
value
=
"/api/admin"
)
@RequestMapping
(
value
=
"/api/admin
/topic
"
)
public
class
AdminController
{
...
...
@@ -27,7 +27,7 @@ public class AdminController {
@Autowired
private
UserHolder
userHolder
;
@GetMapping
(
value
=
"/
insertTopic
"
)
@GetMapping
(
value
=
"/
add
"
)
@ApiOperation
(
"新增话题"
)
@ResponseBody
public
CommonResp
<
Void
>
addTopic
(
@RequestParam
String
topicTitle
){
...
...
@@ -37,17 +37,17 @@ public class AdminController {
}
@ApiOperation
(
"单个话题详细数据"
)
@PostMapping
(
"/
topic/
detailData"
)
@PostMapping
(
"/detailData"
)
@ResponseBody
public
CommonResp
<
TopicD
T
O
>
selectOne
(
@RequestParam
String
topicId
)
throws
MissingServletRequestParameterException
{
public
CommonResp
<
TopicDO
>
selectOne
(
@RequestParam
String
topicId
)
throws
MissingServletRequestParameterException
{
if
(
StringUtils
.
isEmpty
(
topicId
)){
throw
new
MissingServletRequestParameterException
(
"topicId"
,
"String"
);
}
TopicD
TO
topicDTO
=
topicManager
.
getDetail
(
topicId
);
return
CommonResp
.
success
(
topicD
T
O
);
TopicD
O
topicDO
=
topicManager
.
getDetail
(
topicId
);
return
CommonResp
.
success
(
topicDO
);
}
@PostMapping
(
value
=
"/
topic/
setTop"
)
@PostMapping
(
value
=
"/setTop"
)
@ApiOperation
(
"顶置/取消顶置话题"
)
@ResponseBody
public
CommonResp
<
Void
>
setTopTopic
(
@RequestBody
TopicTopReq
req
)
throws
MissingServletRequestParameterException
{
...
...
@@ -55,7 +55,7 @@ public class AdminController {
return
CommonResp
.
success
();
}
@PostMapping
(
value
=
"/
topic/
setConceal"
)
@PostMapping
(
value
=
"/setConceal"
)
@ApiOperation
(
"隐藏/显示话题"
)
@ResponseBody
public
CommonResp
<
Void
>
setConceal
(
@RequestBody
TopicConcealReq
req
)
throws
MissingServletRequestParameterException
{
...
...
@@ -63,7 +63,7 @@ public class AdminController {
return
CommonResp
.
success
();
}
@PostMapping
(
value
=
"/
topic/
modifyViewNum"
)
@PostMapping
(
value
=
"/modifyViewNum"
)
@ApiOperation
(
"话题浏览数调整(后台管理)"
)
@ResponseBody
public
CommonResp
<
Void
>
modifyViewNum
(
@RequestBody
TopicModifyMountReq
req
)
throws
MissingServletRequestParameterException
{
...
...
@@ -71,7 +71,7 @@ public class AdminController {
return
CommonResp
.
success
();
}
@PostMapping
(
value
=
"/
topic/
dataAnalyse"
)
@PostMapping
(
value
=
"/dataAnalyse"
)
@ApiOperation
(
"话题数据分析"
)
@ResponseBody
public
CommonResp
<
TopicDataAnalysDTO
>
dataAnalyse
(
@RequestParam
String
topicId
)
throws
MissingServletRequestParameterException
{
...
...
community-service/src/main/java/com/tanpu/community/controller/CommentController.java
View file @
3d62a020
...
...
@@ -42,7 +42,7 @@ public class CommentController {
@ApiOperation
(
"点赞评论"
)
@PostMapping
(
value
=
"/likeComment"
)
@ResponseBody
public
CommonResp
likeComment
(
@RequestParam
String
theme
Id
){
public
CommonResp
<
Void
>
likeComment
(
@RequestParam
String
comment
Id
){
//todo
String
userId
=
"liujm"
;
return
CommonResp
.
success
();
...
...
@@ -51,7 +51,7 @@ public class CommentController {
@ApiOperation
(
"举报评论"
)
@PostMapping
(
value
=
"/reportComment"
)
@ResponseBody
public
CommonResp
reportComment
(
@RequestParam
String
theme
Id
){
public
CommonResp
<
Void
>
reportComment
(
@RequestParam
String
comment
Id
){
//todo
String
userId
=
"liujm"
;
return
CommonResp
.
success
();
...
...
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
3d62a020
...
...
@@ -6,6 +6,7 @@ import com.tanpu.community.api.beans.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
;
...
...
@@ -37,20 +38,28 @@ public class ThemeController {
return
CommonResp
.
success
();
}
@ApiOperation
(
"圈子首页-推荐"
)
@GetMapping
(
value
=
"/recommendList"
)
@ApiOperation
(
"圈子首页-推荐/关注"
)
@GetMapping
(
value
=
"/list"
)
@ResponseBody
public
List
<
ThemeQo
>
select
HotList
(
ThemeListReq
req
)
{
public
List
<
ThemeQo
>
select
InterestList
(
@RequestBody
ThemeListReq
req
)
{
String
userId
=
"liujm"
;
return
themeManager
.
selectHotThemes
(
req
,
userId
);
if
(
req
.
getType
()==
1
){
return
themeManager
.
selectHotThemes
(
req
,
userId
);
}
else
{
return
themeManager
.
selectInterestThemes
(
req
,
userId
);
}
}
@ApiOperation
(
"圈子首页-关注"
)
@GetMapping
(
value
=
"/followList"
)
@ApiOperation
(
"话题详情页-最新/最热"
)
@GetMapping
(
value
=
"/listByTopic"
)
@ResponseBody
public
List
<
ThemeQo
>
selectInterestList
(
ThemeListReq
req
)
{
String
userId
=
"liujm012"
;
return
themeManager
.
selectInterestThemes
(
req
,
userId
);
public
CommonResp
<
List
<
ThemeQo
>>
getThemeMainText
(
@RequestBody
ThemeListByTopicReq
req
)
{
String
userId
=
"liujm"
;
List
<
ThemeQo
>
result
=
themeManager
.
queryByTopic
(
req
,
userId
);
return
CommonResp
.
success
(
result
);
}
...
...
community-service/src/main/java/com/tanpu/community/controller/TopicController.java
View file @
3d62a020
...
...
@@ -2,18 +2,16 @@ package com.tanpu.community.controller;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.community.api.beans.qo.T
heme
Qo
;
import
com.tanpu.community.api.beans.qo.T
opicDetail
Qo
;
import
com.tanpu.community.api.beans.qo.TopicTitileQo
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
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.annotation.*
;
import
java.util.List
;
@RestController
@Slf4j
@RequestMapping
(
value
=
"/api/topic"
)
...
...
@@ -34,23 +32,15 @@ public class TopicController {
return
CommonResp
.
success
(
allTopic
);
}
@GetMapping
(
value
=
"/
hotThemes
"
)
@ApiOperation
(
"话题详情页"
)
@GetMapping
(
value
=
"/
detailPage
"
)
@ApiOperation
(
"话题详情页
顶部
"
)
@ResponseBody
public
CommonResp
<
List
<
ThemeQo
>
>
gethotThemes
(
@RequestParam
String
topicId
){
public
CommonResp
<
TopicDetailQo
>
gethotThemes
(
@RequestParam
String
topicId
){
//todo
return
CommonResp
.
success
();
}
@GetMapping
(
value
=
"/latestThemes"
)
@ApiOperation
(
"话题详情页"
)
@ResponseBody
public
CommonResp
<
List
<
ThemeQo
>>
getlatestThemes
(
@RequestParam
String
topicId
){
//todo
return
CommonResp
.
success
();
}
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
3d62a020
...
...
@@ -7,6 +7,7 @@ import com.tanpu.community.api.beans.qo.AttachmentQo;
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.api.enums.BlockTypeEnum
;
import
com.tanpu.community.api.enums.CollectionTypeEnum
;
...
...
@@ -322,4 +323,8 @@ public class ThemeManager {
return
start
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
));
}
public
List
<
ThemeQo
>
queryByTopic
(
ThemeListByTopicReq
req
,
String
userId
)
{
//TODO
return
null
;
}
}
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
3d62a020
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.TopicD
T
O
;
import
com.tanpu.community.api.beans.TopicDO
;
import
com.tanpu.community.api.beans.TopicDataAnalysDTO
;
import
com.tanpu.community.api.beans.qo.TopicTitileQo
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
...
...
@@ -49,7 +49,7 @@ public class TopicManager {
}
//话题详情列表
public
List
<
TopicD
T
O
>
getAllTopicDetail
()
{
public
List
<
TopicDO
>
getAllTopicDetail
()
{
return
ConvertUtil
.
topicEntitiesToDTOs
(
topicService
.
queryAll
());
}
...
...
@@ -93,16 +93,16 @@ public class TopicManager {
}
}
public
TopicD
T
O
getDetail
(
String
topicId
)
{
public
TopicDO
getDetail
(
String
topicId
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
)
{
throw
new
BizException
(
"找不到话题,id:"
+
topicId
);
}
TopicD
TO
topicDT
O
=
ConvertUtil
.
topicEntityToDTO
(
topicEntity
);
topicD
T
O
.
setViewCount
(
redisService
.
getInteger
(
RedisKeyConstant
.
TOPIC_TOTAL_VIEW_COUNT_
+
topicId
));
topicD
T
O
.
setLikeCount
(
redisService
.
getInteger
(
RedisKeyConstant
.
TOPIC_LIKE_COUNT_
+
topicId
));
topicD
T
O
.
setUserCount
(
redisService
.
getInteger
(
RedisKeyConstant
.
TOPIC_USER_COUNT_
+
topicId
));
return
topicD
T
O
;
TopicD
O
topicD
O
=
ConvertUtil
.
topicEntityToDTO
(
topicEntity
);
topicDO
.
setViewCount
(
redisService
.
getInteger
(
RedisKeyConstant
.
TOPIC_TOTAL_VIEW_COUNT_
+
topicId
));
topicDO
.
setLikeCount
(
redisService
.
getInteger
(
RedisKeyConstant
.
TOPIC_LIKE_COUNT_
+
topicId
));
topicDO
.
setUserCount
(
redisService
.
getInteger
(
RedisKeyConstant
.
TOPIC_USER_COUNT_
+
topicId
));
return
topicDO
;
}
public
void
modifyViewCount
(
String
topicId
,
Long
modifyMount
)
{
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
3d62a020
package
com
.
tanpu
.
community
.
util
;
import
com.tanpu.community.api.beans.qo.TopicTitileQo
;
import
com.tanpu.community.api.beans.TopicD
T
O
;
import
com.tanpu.community.api.beans.TopicDO
;
import
com.tanpu.community.api.beans.qo.CommentLv2Qo
;
import
com.tanpu.community.api.beans.qo.CommentQo
;
import
com.tanpu.community.api.beans.qo.FollowQo
;
...
...
@@ -41,10 +41,10 @@ public class ConvertUtil {
}
public
static
TopicD
T
O
topicEntityToDTO
(
TopicEntity
topicEntity
)
{
TopicD
TO
topicDTO
=
new
TopicDT
O
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicD
T
O
);
return
topicD
T
O
;
public
static
TopicDO
topicEntityToDTO
(
TopicEntity
topicEntity
)
{
TopicD
O
topicDO
=
new
TopicD
O
();
BeanUtils
.
copyProperties
(
topicEntity
,
topicDO
);
return
topicDO
;
}
public
static
TopicTitileQo
topicToBriefInfoDTO
(
TopicEntity
topicEntity
)
{
...
...
@@ -72,7 +72,7 @@ public class ConvertUtil {
return
entities
.
stream
().
map
(
ConvertUtil:
:
commentLv2Entity2Qo
).
collect
(
Collectors
.
toList
());
}
public
static
List
<
TopicD
T
O
>
topicEntitiesToDTOs
(
List
<
TopicEntity
>
topicEntities
)
{
public
static
List
<
TopicDO
>
topicEntitiesToDTOs
(
List
<
TopicEntity
>
topicEntities
)
{
return
topicEntities
.
stream
().
map
(
ConvertUtil:
:
topicEntityToDTO
).
collect
(
Collectors
.
toList
());
}
...
...
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