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
014b3442
Commit
014b3442
authored
Feb 22, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2.3.1' into 'dev'
话题排序 See merge request
!62
parents
b2911793
db65dc1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+3
-1
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+9
-2
VisitLogService.java
...ain/java/com/tanpu/community/service/VisitLogService.java
+14
-0
No files found.
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
014b3442
...
...
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -163,7 +164,8 @@ public class RankService {
// 统计话题下的所有主题数据
List
<
String
>
topicIds
=
topicRankQos
.
stream
().
map
(
TopicRankQo:
:
getTopicId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Integer
>
topicViewMap
=
visitLogService
.
getCountMapByTargetIds
(
topicIds
,
PageEnum
.
COMM_VISIT_TOPIC_DETAIL
.
getId
());
Map
<
String
,
Integer
>
topicViewMap
=
visitLogService
.
getCountMapByTargetIds
(
topicIds
,
Arrays
.
asList
(
PageEnum
.
COMM_VISIT_TOPIC_DETAIL_HOT
.
getId
(),
PageEnum
.
COMM_VISIT_TOPIC_DETAIL_NEW
.
getId
(),
PageEnum
.
COMM_VISIT_TOPIC_DETAIL
.
getId
()));
for
(
TopicRankQo
topic
:
topicRankQos
)
{
List
<
String
>
themeIds
=
themeService
.
queryThemeIdsByTopic
(
topic
.
getTopicId
());
if
(
CollectionUtils
.
isEmpty
(
themeIds
))
{
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
014b3442
...
...
@@ -12,6 +12,7 @@ import com.tanpu.community.api.beans.qo.ThemeQo;
import
com.tanpu.community.api.beans.qo.TopicFollowQo
;
import
com.tanpu.community.api.beans.req.comment.CreateCommentReq
;
import
com.tanpu.community.api.beans.req.theme.ThemeContentReq
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.enums.DeleteTagEnum
;
import
com.tanpu.community.api.enums.ThemeTypeEnum
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
...
...
@@ -49,6 +50,8 @@ public class ThemeService {
private
RedisHelper
redisHelper
;
@Resource
private
VisitLogMapper
visitLogMapper
;
@Resource
private
FeignService
feignService
;
@Transactional
public
void
insertTheme
(
ThemeEntity
themeEntity
)
{
...
...
@@ -337,6 +340,7 @@ public class ThemeService {
ThemeEntity
themeEntity
=
themeMapper
.
queryOneByTopicIdOrderByUpdateTimeDesc
(
topicId
);
if
(
themeEntity
!=
null
)
{
ThemeQo
themeQo
=
ConvertUtil
.
themeEntityToQo
(
themeEntity
);
topic
.
setLastTheme
(
getUserName
(
themeQo
.
getAuthorId
())
+
":"
+
themeQo
.
content
.
get
(
0
).
getValue
());
topic
.
setLastThemeTime
(
TimeUtils
.
formatTopicListTime
(
themeEntity
.
getUpdateTime
()));
...
...
@@ -357,7 +361,10 @@ public class ThemeService {
}
private
String
getUserName
(
String
authorId
)
{
return
"理财师Jack"
;
UserInfoResp
userInfoById
=
feignService
.
getUserInfoById
(
authorId
);
if
(
StringUtils
.
isNotBlank
(
userInfoById
.
getNickName
())){
return
userInfoById
.
getNickName
();
}
return
"理财师"
;
}
}
community-service/src/main/java/com/tanpu/community/service/VisitLogService.java
View file @
014b3442
...
...
@@ -139,6 +139,20 @@ public class VisitLogService {
.
collect
(
Collectors
.
toMap
(
TimesCountEntity:
:
getId
,
TimesCountEntity:
:
getTimes
));
}
//统计行为集合的浏览量
public
Map
<
String
,
Integer
>
getCountMapByTargetIds
(
List
<
String
>
refIds
,
List
<
String
>
refTypes
)
{
if
(
CollectionUtils
.
isEmpty
(
refIds
))
{
return
new
HashMap
<>();
}
LambdaQueryWrapper
<
VisitLogEntity
>
wrapper
=
(
new
LambdaQueryWrapper
<
VisitLogEntity
>()
.
in
(
VisitLogEntity:
:
getRefId
,
refIds
))
.
eq
(
VisitLogEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
)
.
in
(
VisitLogEntity:
:
getRefType
,
refTypes
)
.
groupBy
(
VisitLogEntity:
:
getRefId
);
return
visitLogMapper
.
selectCountByThemeIds
(
wrapper
).
stream
()
.
collect
(
Collectors
.
toMap
(
TimesCountEntity:
:
getId
,
TimesCountEntity:
:
getTimes
));
}
// 查询讨论区最近浏览
public
Integer
queryLastTopicVisit
(
String
theme
)
{
return
visitLogMapper
.
selectCount
(
new
LambdaQueryWrapper
<
VisitLogEntity
>()
...
...
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