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
3db76b3b
Commit
3db76b3b
authored
Jul 27, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
主题推荐优化
parent
c62301b5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+7
-13
VisitSummaryService.java
...java/com/tanpu/community/service/VisitSummaryService.java
+8
-0
No files found.
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
3db76b3b
package
com
.
tanpu
.
community
.
service
;
package
com
.
tanpu
.
community
.
service
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.qo.ThemeAnalysDO
;
import
com.tanpu.community.api.beans.qo.ThemeAnalysDO
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNew
;
...
@@ -70,19 +68,15 @@ public class RankService {
...
@@ -70,19 +68,15 @@ public class RankService {
Map
<
String
,
Integer
>
bookCountMap
=
collectionService
.
getCountMapByType
(
themeIds
,
CollectionTypeEnum
.
COLLECT_THEME
);
Map
<
String
,
Integer
>
bookCountMap
=
collectionService
.
getCountMapByType
(
themeIds
,
CollectionTypeEnum
.
COLLECT_THEME
);
Map
<
String
,
Integer
>
commentCountMap
=
commentService
.
getCountMapByThemeIds
(
themeIds
);
Map
<
String
,
Integer
>
commentCountMap
=
commentService
.
getCountMapByThemeIds
(
themeIds
);
Map
<
String
,
Integer
>
forwardCountMap
=
themeService
.
getForwardCountMap
(
themeIds
);
Map
<
String
,
Integer
>
forwardCountMap
=
themeService
.
getForwardCountMap
(
themeIds
);
Map
<
String
,
Integer
>
visitCountMap
=
visitSummaryService
.
getCountMapByThemeIds
(
themeIds
,
VisitTypeEnum
.
THEME_PAGE_VIEW
);
Map
<
String
,
Integer
>
visitCountMap
=
visitSummaryService
.
getCountMapByTargetIds
(
themeIds
,
VisitTypeEnum
.
THEME_PAGE_VIEW
);
for
(
ThemeAnalysDO
theme
:
themeAnalysDOS
)
{
for
(
ThemeAnalysDO
theme
:
themeAnalysDOS
)
{
String
themeId
=
theme
.
getThemeId
();
String
themeId
=
theme
.
getThemeId
();
Integer
likeCount
=
likeCountMap
.
getOrDefault
(
themeId
,
0
);
theme
.
setCommentCount
(
commentCountMap
.
getOrDefault
(
themeId
,
0
));
Integer
bookCount
=
bookCountMap
.
getOrDefault
(
themeId
,
0
);
theme
.
setLikeCount
(
likeCountMap
.
getOrDefault
(
themeId
,
0
));
Integer
commentCount
=
commentCountMap
.
getOrDefault
(
themeId
,
0
);
theme
.
setForwardCount
(
forwardCountMap
.
getOrDefault
(
themeId
,
0
));
Integer
forwardCount
=
forwardCountMap
.
getOrDefault
(
themeId
,
0
);
theme
.
setCollectCount
(
bookCountMap
.
getOrDefault
(
themeId
,
0
));
Integer
viewCount
=
visitCountMap
.
getOrDefault
(
themeId
,
0
);
theme
.
setViewCount
(
visitCountMap
.
getOrDefault
(
themeId
,
0
));
theme
.
setCommentCount
(
commentCount
);
theme
.
setLikeCount
(
likeCount
);
theme
.
setForwardCount
(
forwardCount
);
theme
.
setCollectCount
(
bookCount
);
theme
.
setViewCount
(
viewCount
);
//查询用户质量
//查询用户质量
String
authorId
=
theme
.
getAuthorId
();
String
authorId
=
theme
.
getAuthorId
();
UserInfoNew
authorInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CACHE_FEIGN_USER_INFO
,
authorId
),
UserInfoNew
authorInfo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
CACHE_FEIGN_USER_INFO
,
authorId
),
...
...
community-service/src/main/java/com/tanpu/community/service/VisitSummaryService.java
View file @
3db76b3b
...
@@ -36,6 +36,14 @@ public class VisitSummaryService {
...
@@ -36,6 +36,14 @@ public class VisitSummaryService {
.
stream
().
map
(
VisitSummaryEntity:
:
getRefId
).
distinct
().
collect
(
Collectors
.
toList
());
.
stream
().
map
(
VisitSummaryEntity:
:
getRefId
).
distinct
().
collect
(
Collectors
.
toList
());
return
ListUtils
.
subtract
(
refIds
,
visited
);
return
ListUtils
.
subtract
(
refIds
,
visited
);
}
}
public
List
<
String
>
queryUseVisited
(
String
userId
)
{
List
<
String
>
visited
=
visitSummaryMapper
.
selectList
(
new
LambdaQueryWrapper
<
VisitSummaryEntity
>()
.
eq
(
VisitSummaryEntity:
:
getVisitorId
,
userId
))
.
stream
().
map
(
VisitSummaryEntity:
:
getRefId
).
distinct
().
collect
(
Collectors
.
toList
());
return
visited
;
}
@Transactional
@Transactional
public
void
insertOrUpdateDur
(
VisitSummaryEntity
vs
)
{
public
void
insertOrUpdateDur
(
VisitSummaryEntity
vs
)
{
...
...
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