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
a5c966b5
Commit
a5c966b5
authored
Jul 27, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复话题主题列表
parent
0e210072
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+14
-13
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
a5c966b5
...
@@ -187,17 +187,24 @@ public class ThemeManager {
...
@@ -187,17 +187,24 @@ public class ThemeManager {
public
ThemeListResp
queryThemes
(
ThemeListReq
req
,
String
userId
)
{
public
ThemeListResp
queryThemes
(
ThemeListReq
req
,
String
userId
)
{
Integer
pageStart
=
(
req
.
page
.
pageNumber
-
1
)
*
req
.
page
.
pageSize
;
Integer
pageStart
=
(
req
.
page
.
pageNumber
-
1
)
*
req
.
page
.
pageSize
;
Integer
pageSize
=
req
.
page
.
pageSize
;
Integer
pageSize
=
req
.
page
.
pageSize
;
Integer
realSize
=
req
.
page
.
pageSize
*
2
;
Integer
querySize
=
pageSize
*
2
;
List
<
ThemeEntity
>
themes
=
new
ArrayList
<>();
List
<
ThemeEntity
>
themes
=
new
ArrayList
<>();
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
//推荐
//推荐
List
<
String
>
recmdIds
=
recommendService
.
getRecommendThemes
(
pageStart
,
real
Size
,
userId
);
List
<
String
>
recmdIds
=
recommendService
.
getRecommendThemes
(
pageStart
,
query
Size
,
userId
);
//去重已看过(查看正文)
//去重已看过(查看正文)
recmdIds
=
visitSummaryService
.
filterUserNotVisited
(
userId
,
recmdIds
);
recmdIds
=
visitSummaryService
.
filterUserNotVisited
(
userId
,
recmdIds
);
themes
=
themeService
.
queryByThemeIds
(
recmdIds
);
themes
=
themeService
.
queryByThemeIds
(
recmdIds
);
themes
=
RankUtils
.
sortThemeEntityByIds
(
themes
,
recmdIds
);
themes
=
RankUtils
.
sortThemeEntityByIds
(
themes
,
recmdIds
);
// filter用户自己的
themes
=
themes
.
stream
().
filter
(
t
->
{
return
!
userId
.
equals
(
t
.
getAuthorId
())
&&
!
req
.
excludeIds
.
contains
(
t
.
getThemeId
());
}).
collect
(
Collectors
.
toList
());
// todo pageNo pageSize
themes
=
BizUtils
.
subList
(
themes
,
0
,
req
.
page
.
pageSize
);
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
//TODO 临时埋点,接入新埋点后删除
//TODO 临时埋点,接入新埋点后删除
if
(
CollectionUtils
.
isEmpty
(
req
.
getExcludeIds
()))
{
if
(
CollectionUtils
.
isEmpty
(
req
.
getExcludeIds
()))
{
...
@@ -224,12 +231,6 @@ public class ThemeManager {
...
@@ -224,12 +231,6 @@ public class ThemeManager {
themes
=
themeService
.
queryNewestByTopic
(
req
.
topicId
,
req
.
page
.
pageNumber
,
pageSize
);
themes
=
themeService
.
queryNewestByTopic
(
req
.
topicId
,
req
.
page
.
pageNumber
,
pageSize
);
}
}
// filter用户自己的
themes
=
themes
.
stream
().
filter
(
t
->
{
return
!
userId
.
equals
(
t
.
getAuthorId
())
&&
!
req
.
excludeIds
.
contains
(
t
.
getThemeId
());
}).
collect
(
Collectors
.
toList
());
// todo pageNo pageSize
themes
=
BizUtils
.
subList
(
themes
,
0
,
req
.
page
.
pageSize
);
ThemeListResp
resp
=
new
ThemeListResp
();
ThemeListResp
resp
=
new
ThemeListResp
();
resp
.
excludeIds
=
req
.
excludeIds
;
resp
.
excludeIds
=
req
.
excludeIds
;
...
@@ -277,7 +278,7 @@ public class ThemeManager {
...
@@ -277,7 +278,7 @@ public class ThemeManager {
private
void
buildThemeExtraInfoByUser
(
String
userId
,
ThemeQo
themeQo
)
{
private
void
buildThemeExtraInfoByUser
(
String
userId
,
ThemeQo
themeQo
)
{
String
themeId
=
themeQo
.
getThemeId
();
String
themeId
=
themeQo
.
getThemeId
();
//是否关注作者
//是否关注作者
themeQo
.
setFollow
(
followRelService
.
checkFollow
(
themeQo
.
getAuthorId
(),
userId
));
themeQo
.
setFollow
(
followRelService
.
checkFollow
(
themeQo
.
getAuthorId
(),
userId
));
//是否点赞
//是否点赞
CollectionEntity
likeEntity
=
collectionService
.
getNotDeleteTargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
CollectionEntity
likeEntity
=
collectionService
.
getNotDeleteTargetCollection
(
themeId
,
userId
,
CollectionTypeEnum
.
LIKE_THEME
);
themeQo
.
setHasLiked
(
likeEntity
!=
null
);
themeQo
.
setHasLiked
(
likeEntity
!=
null
);
...
@@ -466,7 +467,7 @@ public class ThemeManager {
...
@@ -466,7 +467,7 @@ public class ThemeManager {
List
<
CommentEntity
>
commentEntities
=
commentService
.
queryCommentsByUserId
(
req
.
getUserId
(),
req
.
getLastId
(),
req
.
getPageSize
());
List
<
CommentEntity
>
commentEntities
=
commentService
.
queryCommentsByUserId
(
req
.
getUserId
(),
req
.
getLastId
(),
req
.
getPageSize
());
//当前用户信息
//当前用户信息
UserInfoNew
userInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CACHE_FEIGN_USER_INFO
,
req
.
getUserId
()),
UserInfoNew
userInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CACHE_FEIGN_USER_INFO
,
req
.
getUserId
()),
60
*
10
,
()
->
this
.
getUserInfo
(
req
.
getUserId
())
,
UserInfoNew
.
class
);
60
*
10
,
()
->
this
.
getUserInfo
(
req
.
getUserId
())
,
UserInfoNew
.
class
);
Set
<
String
>
replyThemeIds
=
commentEntities
.
stream
().
map
(
CommentEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
Set
<
String
>
replyThemeIds
=
commentEntities
.
stream
().
map
(
CommentEntity:
:
getThemeId
).
collect
(
Collectors
.
toSet
());
if
(
CollectionUtils
.
isEmpty
(
replyThemeIds
))
{
if
(
CollectionUtils
.
isEmpty
(
replyThemeIds
))
{
return
commentThemeList
;
return
commentThemeList
;
...
@@ -500,12 +501,12 @@ public class ThemeManager {
...
@@ -500,12 +501,12 @@ public class ThemeManager {
.
content
(
Collections
.
singletonList
(
commentContent
))
.
content
(
Collections
.
singletonList
(
commentContent
))
.
commentId
(
commentEntity
.
getCommentId
())
.
commentId
(
commentEntity
.
getCommentId
())
.
themeType
(
ThemeTypeEnum
.
RES_COMMENT
.
getCode
())
.
themeType
(
ThemeTypeEnum
.
RES_COMMENT
.
getCode
())
.
follow
(
followRelService
.
checkFollow
(
userId
,
userId
))
.
follow
(
followRelService
.
checkFollow
(
userId
,
userId
))
.
build
();
.
build
();
//原主题包装到formerThemeQo中
//原主题包装到formerThemeQo中
ThemeQo
themeQo
=
themeMap
.
get
(
themeId
);
ThemeQo
themeQo
=
themeMap
.
get
(
themeId
);
if
(
themeQo
!=
null
)
{
if
(
themeQo
!=
null
)
{
FormerThemeQo
f
=
ConvertUtil
.
themeQo2FormerThemeQo
(
themeQo
);
FormerThemeQo
f
=
ConvertUtil
.
themeQo2FormerThemeQo
(
themeQo
);
commentThemeQo
.
setFormerTheme
(
f
);
commentThemeQo
.
setFormerTheme
(
f
);
}
}
...
@@ -515,7 +516,7 @@ public class ThemeManager {
...
@@ -515,7 +516,7 @@ public class ThemeManager {
}
}
private
UserInfoNew
getUserInfo
(
String
authorId
){
private
UserInfoNew
getUserInfo
(
String
authorId
)
{
CommonResp
<
UserInfoNew
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
authorId
);
CommonResp
<
UserInfoNew
>
userInfoNewCommonResp
=
feignClientForFatools
.
queryUsersListNew
(
authorId
);
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
if
(
userInfoNewCommonResp
.
isNotSuccess
())
{
throw
new
BizException
(
"内部接口调用失败"
);
throw
new
BizException
(
"内部接口调用失败"
);
...
...
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