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
5f86daad
Commit
5f86daad
authored
Jul 08, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口调整
parent
82501221
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
102 additions
and
43 deletions
+102
-43
ImagesDTO.java
...rc/main/java/com/tanpu/community/api/beans/ImagesDTO.java
+19
-0
CreateThemeReq.java
...m/tanpu/community/api/beans/req/theme/CreateThemeReq.java
+2
-2
ThemeContentReq.java
.../tanpu/community/api/beans/req/theme/ThemeContentReq.java
+5
-2
ThemeListReq.java
...com/tanpu/community/api/beans/req/theme/ThemeListReq.java
+5
-1
ThemeController.java
.../java/com/tanpu/community/controller/ThemeController.java
+5
-7
TopicController.java
.../java/com/tanpu/community/controller/TopicController.java
+2
-2
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+15
-11
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+1
-1
FollowRelService.java
...in/java/com/tanpu/community/service/FollowRelService.java
+3
-2
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+44
-14
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+1
-1
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/ImagesDTO.java
0 → 100644
View file @
5f86daad
package
com
.
tanpu
.
community
.
api
.
beans
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
value
=
"讨论多图存储对象,等同于newsFeedRes"
)
public
class
ImagesDTO
{
private
Integer
productType
;
@ApiModelProperty
(
"关联id"
)
private
String
relIdl
;
@ApiModelProperty
(
"关联类型 产品:88 直播:3 短视频:6 图片:122"
)
private
Integer
relType
;
private
String
remark
;
}
community-api/src/main/java/com/tanpu/community/api/beans/req/CreateThemeReq.java
→
community-api/src/main/java/com/tanpu/community/api/beans/req/
theme/
CreateThemeReq.java
View file @
5f86daad
package
com
.
tanpu
.
community
.
api
.
beans
.
req
;
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -22,7 +22,7 @@ public class CreateThemeReq {
@NotEmpty
(
message
=
"内容不能为空"
)
@ApiModelProperty
(
value
=
"文本内容"
)
private
String
content
;
private
ThemeContentReq
content
;
@ApiModelProperty
(
value
=
"所属的话题id"
)
private
String
topicId
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ThemeContentReq.java
View file @
5f86daad
package
com
.
tanpu
.
community
.
api
.
beans
.
req
.
theme
;
import
com.tanpu.community.api.beans.ImagesDTO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@Data
@ApiModel
(
value
=
"主题内容"
)
public
class
ThemeContentReq
{
...
...
@@ -14,6 +17,6 @@ public class ThemeContentReq {
@ApiModelProperty
(
value
=
"文本的值是内容,附件的值为id"
)
private
String
value
;
@ApiModelProperty
(
value
=
"
类型为6时,传入图片列表
"
)
private
String
[]
imgList
;
@ApiModelProperty
(
value
=
"
图片列表,类型为6时此项有值
"
)
private
List
<
ImagesDTO
>
images
;
}
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ThemeListReq.java
View file @
5f86daad
...
...
@@ -4,12 +4,16 @@ package com.tanpu.community.api.beans.req.theme;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
@Data
public
class
ThemeListReq
{
@ApiModelProperty
(
value
=
"当前浏览的最后一个themeId"
)
@ApiModelProperty
(
value
=
"当前浏览的最后一个themeId
,可以为空
"
)
private
String
lastId
;
@NotEmpty
(
message
=
"PageSize不能为空"
)
@ApiModelProperty
(
value
=
"页面大小"
)
private
Integer
PageSize
;
@NotEmpty
(
message
=
"主题类型不能为空"
)
@ApiModelProperty
(
value
=
"类型,1:推荐 2:关注"
)
private
Integer
type
;
...
...
community-service/src/main/java/com/tanpu/community/controller/ThemeController.java
View file @
5f86daad
...
...
@@ -5,7 +5,7 @@ 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.
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
;
...
...
@@ -43,13 +43,11 @@ public class ThemeController {
@ApiOperation
(
"圈子首页-推荐/关注"
)
@GetMapping
(
value
=
"/list"
)
@ResponseBody
public
List
<
ThemeQo
>
selectInterestList
(
@RequestBody
ThemeListReq
req
)
{
public
CommonResp
<
List
<
ThemeQo
>
>
selectInterestList
(
@RequestBody
ThemeListReq
req
)
{
String
userId
=
"liujm"
;
if
(
req
.
getType
()==
1
){
return
themeManager
.
selectHotThemes
(
req
,
userId
);
}
else
{
return
themeManager
.
selectInterestThemes
(
req
,
userId
);
}
List
<
ThemeQo
>
result
=
req
.
getType
()==
1
?
themeManager
.
selectHotThemes
(
req
,
userId
)
:
themeManager
.
selectInterestThemes
(
req
,
userId
);
return
CommonResp
.
success
(
result
);
}
...
...
community-service/src/main/java/com/tanpu/community/controller/TopicController.java
View file @
5f86daad
...
...
@@ -46,9 +46,9 @@ public class TopicController {
@GetMapping
(
value
=
"/titleList"
)
@ApiOperation
(
"首页顶部话题
列表
"
)
@ApiOperation
(
"首页顶部话题
标题列
"
)
@ResponseBody
public
CommonResp
<
List
<
TopicHotQo
>>
get
HomePage
(
@RequestParam
String
topicId
){
public
CommonResp
<
List
<
TopicHotQo
>>
get
TitleList
(
){
//todo
return
CommonResp
.
success
();
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
5f86daad
...
...
@@ -6,7 +6,7 @@ import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
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.
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
;
...
...
@@ -105,7 +105,7 @@ public class ThemeManager {
// 返回推荐主题文章
public
List
<
ThemeQo
>
selectHotThemes
(
ThemeListReq
req
,
String
userId
)
{
// TODO:推荐
List
<
ThemeEntity
>
themeEntities
=
themeService
.
selectAll
();
List
<
ThemeEntity
>
themeEntities
=
themeService
.
selectAll
(
req
.
getLastId
(),
req
.
getPageSize
()
);
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
return
themeQos
;
}
...
...
@@ -114,7 +114,14 @@ public class ThemeManager {
// 返回关注主题
public
List
<
ThemeQo
>
selectInterestThemes
(
ThemeListReq
req
,
String
userId
)
{
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
List
<
ThemeEntity
>
themeEntities
=
themeService
.
selectByFans
(
fansList
);
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryByFans
(
fansList
,
req
.
getLastId
(),
req
.
getPageSize
());
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
return
themeQos
;
}
public
List
<
ThemeQo
>
queryByTopic
(
ThemeListByTopicReq
req
,
String
userId
)
{
//TODO
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryByTopic
(
req
.
getTopicId
(),
req
.
getLastId
(),
req
.
getPageSize
());
List
<
ThemeQo
>
themeQos
=
convertEntityToQo
(
themeEntities
,
userId
);
return
themeQos
;
}
...
...
@@ -122,7 +129,7 @@ public class ThemeManager {
//返回正文
public
MainTextQo
getMainText
(
String
themeId
,
String
userId
)
{
ThemeEntity
themeEntity
=
themeService
.
select
ById
(
themeId
);
ThemeEntity
themeEntity
=
themeService
.
query
ById
(
themeId
);
if
(
themeEntity
==
null
)
{
throw
new
BizException
(
"找不到帖子id:"
+
themeId
);
}
...
...
@@ -144,7 +151,7 @@ public class ThemeManager {
//转发
public
void
forward
(
ForwardThemeReq
req
,
String
userId
)
{
ThemeEntity
targetTheme
=
themeService
.
select
ById
(
req
.
getFormerThemeId
());
ThemeEntity
targetTheme
=
themeService
.
query
ById
(
req
.
getFormerThemeId
());
ThemeEntity
newTheme
=
ThemeEntity
.
builder
()
.
content
(
req
.
getContent
())
.
topicId
(
req
.
getTopicId
())
...
...
@@ -187,9 +194,9 @@ public class ThemeManager {
// 屏蔽(主题)
public
void
blockTheme
(
String
themeId
,
String
userId
)
{
blackListService
.
addBlock
(
themeId
,
userId
,
BlockTypeEnum
.
THEME
);
BlackListEntity
selectOne
=
blackListService
.
selectOne
(
themeService
.
select
ById
(
themeId
).
getAuthorId
(),
userId
,
BlockTypeEnum
.
USER
.
getCode
());
BlackListEntity
selectOne
=
blackListService
.
selectOne
(
themeService
.
query
ById
(
themeId
).
getAuthorId
(),
userId
,
BlockTypeEnum
.
USER
.
getCode
());
if
(
selectOne
==
null
)
{
blackListService
.
addBlock
(
themeService
.
select
ById
(
themeId
).
getAuthorId
(),
userId
,
BlockTypeEnum
.
USER
);
blackListService
.
addBlock
(
themeService
.
query
ById
(
themeId
).
getAuthorId
(),
userId
,
BlockTypeEnum
.
USER
);
}
}
...
...
@@ -323,8 +330,5 @@ 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 @
5f86daad
...
...
@@ -125,7 +125,7 @@ public class TopicManager {
for
(
TopicEntity
topic
:
topicEntities
)
{
String
topicId
=
topic
.
getTopicId
();
Long
viewCountModify
=
topic
.
getviewCntAdjust
();
List
<
ThemeEntity
>
themeEntities
=
themeService
.
selectByTopic
(
topicId
);
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryByTopic
(
topicId
,
null
,
null
);
List
<
String
>
themeIds
=
themeEntities
.
stream
().
map
(
ThemeEntity:
:
getThemeId
).
collect
(
Collectors
.
toList
());
Integer
likeCountByThemeIds
=
collectionService
.
getCountByTypeAndIds
(
themeIds
,
CollectionTypeEnum
.
LIKE_THEME
);
Integer
bookCountByThemeIds
=
collectionService
.
getCountByTypeAndIds
(
themeIds
,
CollectionTypeEnum
.
BOOK_THEME
);
...
...
community-service/src/main/java/com/tanpu/community/service/FollowRelService.java
View file @
5f86daad
...
...
@@ -25,8 +25,9 @@ public class FollowRelService {
// @Cacheable(value = "tempCache", keyGenerator = "communityKeyGenerator")
public
List
<
String
>
queryFansByIdolId
(
String
idolId
)
{
return
followRelMapper
.
selectList
(
new
LambdaQueryWrapper
<
FollowRelEntity
>()
.
eq
(
FollowRelEntity:
:
getFollowId
,
idolId
))
LambdaQueryWrapper
<
FollowRelEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
FollowRelEntity
>()
.
eq
(
FollowRelEntity:
:
getFollowId
,
idolId
);
return
followRelMapper
.
selectList
(
queryWrapper
)
.
stream
().
map
(
FollowRelEntity:
:
getFollowerId
).
collect
(
Collectors
.
toList
());
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
5f86daad
package
com
.
tanpu
.
community
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.uuid.UuidGenHelper
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.mapper.community.ThemeMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -22,33 +24,61 @@ public class ThemeService {
@Autowired
private
UuidGenHelper
uuidGenHelper
;
public
void
insertTheme
(
ThemeEntity
themeEntity
){
public
void
insertTheme
(
ThemeEntity
themeEntity
)
{
themeEntity
.
setThemeId
(
uuidGenHelper
.
getUuidStr
());
themeMapper
.
insert
(
themeEntity
);
}
//根据id返回主题详情
public
ThemeEntity
selectById
(
String
themeId
)
{
public
ThemeEntity
queryById
(
String
themeId
)
{
return
themeMapper
.
selectById
(
themeId
);
}
//根据话题查询主题
public
List
<
ThemeEntity
>
selectByTopic
(
String
topidId
){
return
themeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getTopicId
,
topidId
));
public
List
<
ThemeEntity
>
queryByTopic
(
String
topidId
,
String
lastId
,
Integer
pageSize
)
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getTopicId
,
topidId
);
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryById
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
getUpdateTime
,
lastEntity
.
getUpdateTime
());
}
if
(
pageSize
!=
null
){
queryWrapper
.
last
(
"limit "
+
pageSize
);
}
return
themeMapper
.
selectList
(
queryWrapper
);
}
//查询列表中用户的主题
public
List
<
ThemeEntity
>
selectByFans
(
List
<
String
>
fansList
)
{
return
themeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
in
(
ThemeEntity:
:
getAuthorId
,
fansList
)
.
orderByDesc
(
ThemeEntity:
:
getUpdateTime
));
//关注的主题列表
public
List
<
ThemeEntity
>
queryByFans
(
List
<
String
>
fansList
,
String
lastId
,
Integer
pageSize
)
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
in
(
ThemeEntity:
:
getAuthorId
,
fansList
)
.
orderByDesc
(
ThemeEntity:
:
getUpdateTime
);
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryById
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
getUpdateTime
,
lastEntity
.
getUpdateTime
());
}
queryWrapper
.
last
(
"limit "
+
pageSize
);
return
themeMapper
.
selectList
(
queryWrapper
);
}
//查询列表中用户的主题
public
List
<
ThemeEntity
>
selectAll
()
{
return
themeMapper
.
selectList
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
orderByDesc
(
ThemeEntity:
:
getUpdateTime
));
public
List
<
ThemeEntity
>
selectAll
(
String
lastId
,
Integer
pageSize
)
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
orderByDesc
(
ThemeEntity:
:
getUpdateTime
);
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryById
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
getUpdateTime
,
lastEntity
.
getUpdateTime
());
}
queryWrapper
.
last
(
"limit "
+
pageSize
);
return
themeMapper
.
selectList
(
queryWrapper
);
}
//查询对应话题的发表用户集合
...
...
@@ -60,7 +90,7 @@ public class ThemeService {
public
Integer
getForwardCountById
(
String
themeId
)
{
return
themeMapper
.
selectCount
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getThemeId
,
themeId
)
.
eq
(
ThemeEntity:
:
getThemeId
,
themeId
)
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
));
}
}
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
5f86daad
...
...
@@ -6,7 +6,7 @@ import com.tanpu.community.api.beans.qo.CommentLv2Qo;
import
com.tanpu.community.api.beans.qo.CommentQo
;
import
com.tanpu.community.api.beans.qo.FollowQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.CreateThemeReq
;
import
com.tanpu.community.api.beans.req.
theme.
CreateThemeReq
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.dao.entity.community.*
;
import
org.springframework.beans.BeanUtils
;
...
...
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