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
9c7bc12b
Commit
9c7bc12b
authored
Jul 22, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主题推荐算法重设计
parent
fa48c452
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+1
-1
RecommendService.java
...in/java/com/tanpu/community/service/RecommendService.java
+11
-3
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
9c7bc12b
...
...
@@ -180,7 +180,6 @@ public class ThemeManager {
List
<
String
>
recommendThemeIds
=
recommendService
.
getRecommendThemes
(
req
.
getLastId
(),
req
.
getPageSize
(),
userId
);
themeEntities
=
themeService
.
queryByThemeIds
(
recommendThemeIds
);
themeEntities
=
RankUtils
.
sortThemeEntityByIds
(
themeEntities
,
recommendThemeIds
);
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
//关注
if
(
StringUtils
.
isEmpty
(
req
.
getLastId
()))
{
...
...
@@ -197,6 +196,7 @@ public class ThemeManager {
themeEntities
=
themeService
.
queryByThemeIdsExcludeUser
(
rankThemeIds
,
null
,
req
.
getLastId
(),
req
.
getPageSize
());
themeEntities
=
RankUtils
.
sortThemeEntityByIds
(
themeEntities
,
rankThemeIds
);
}
else
if
(
ThemeListTypeEnum
.
TOPIC_LATEST
.
getCode
().
equals
(
req
.
getType
()))
{
//根据话题查询最新
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
throw
new
BizException
(
"TopicId为空"
);
...
...
community-service/src/main/java/com/tanpu/community/service/RecommendService.java
View file @
9c7bc12b
...
...
@@ -66,9 +66,17 @@ public class RecommendService {
Set
<
String
>
returnedIds
=
(
StringUtils
.
isEmpty
(
lastId
))
?
new
HashSet
<>()
:
returnedIdsMap
.
get
(
userId
);
List
<
String
>
result
=
new
ArrayList
<>();
getResultList
(
hotThemeIds
,
0
,
newThemeIds
,
0
,
recThemeIds
,
0
,
returnedIds
,
result
,
pageSize
);
returnedIdsMap
.
put
(
userId
,
returnedIds
);
return
result
.
stream
().
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
result
=
result
.
stream
().
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
//记录已返回主题id
if
(
StringUtils
.
isEmpty
(
lastId
)){
returnedIdsMap
.
put
(
userId
,
new
HashSet
<>(
result
));
}
else
{
HashSet
<
String
>
newSet
=
new
HashSet
<>();
newSet
.
addAll
(
returnedIdsMap
.
get
(
userId
));
newSet
.
addAll
(
result
);
returnedIdsMap
.
put
(
userId
,
newSet
);
}
return
result
;
}
public
List
<
ThemeAnalysDO
>
getRecentThemeList
()
{
...
...
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