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
d1eb9131
Commit
d1eb9131
authored
Nov 22, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
降低话题rank频率,提升排序范围
parent
e12a4449
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
15 deletions
+17
-15
OfflineActivitySimpleResp.java
...pi/beans/vo/feign/activity/OfflineActivitySimpleResp.java
+2
-2
ConJobManager.java
.../main/java/com/tanpu/community/manager/ConJobManager.java
+2
-12
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+3
-1
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+10
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/vo/feign/activity/OfflineActivitySimpleResp.java
View file @
d1eb9131
...
@@ -54,10 +54,10 @@ public class OfflineActivitySimpleResp {
...
@@ -54,10 +54,10 @@ public class OfflineActivitySimpleResp {
@ApiModelProperty
(
value
=
"主办方名称"
)
@ApiModelProperty
(
value
=
"主办方名称"
)
private
String
sponsorName
;
private
String
sponsorName
;
@ApiModelProperty
(
value
=
"报名状态 1未开始 2报名中 3报名结束"
)
@ApiModelProperty
(
value
=
"报名状态 1未开始 2报名中 3报名结束
99 活动结束
"
)
private
Integer
signState
;
private
Integer
signState
;
@ApiModelProperty
(
value
=
"报名状态文案 未开始 报名中 报名结束"
)
@ApiModelProperty
(
value
=
"报名状态文案 未开始 报名中 报名结束
活动结束
"
)
private
String
signStateName
;
private
String
signStateName
;
...
...
community-service/src/main/java/com/tanpu/community/manager/ConJobManager.java
View file @
d1eb9131
...
@@ -27,27 +27,17 @@ public class ConJobManager {
...
@@ -27,27 +27,17 @@ public class ConJobManager {
@Autowired
@Autowired
private
RecommendService
recommendService
;
private
RecommendService
recommendService
;
/**
* 定时统计 话题 访问数据,并刷到redis
*/
@Scheduled
(
cron
=
"*/10 * * * * ?"
)
public
void
topicVisitorStats
()
{
String
topicId
=
"123"
;
Integer
detailVisitTimes
=
visitLogService
.
queryTopicDetailVisit
(
topicId
);
redisService
.
set
(
"topicVisitorStats"
,
detailVisitTimes
);
}
/**
/**
* 定时统计主题、话题排行
* 定时统计主题、话题排行
*/
*/
@Scheduled
(
cron
=
"
*
/30 * * * * ?"
)
@Scheduled
(
cron
=
"
20
/30 * * * * ?"
)
public
void
themeRank
()
{
public
void
themeRank
()
{
rankService
.
rankThemes
();
rankService
.
rankThemes
();
rankService
.
rankTopics
();
rankService
.
rankTopics
();
}
}
/**
/**
* 定时
统计主题、话题排行
* 定时
查询最新的主题
*/
*/
@Scheduled
(
cron
=
"*/5 * * * * ?"
)
@Scheduled
(
cron
=
"*/5 * * * * ?"
)
public
void
getThemeNewest
()
{
public
void
getThemeNewest
()
{
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
d1eb9131
...
@@ -95,8 +95,10 @@ public class RankService {
...
@@ -95,8 +95,10 @@ public class RankService {
public
void
rankThemes
()
{
public
void
rankThemes
()
{
LocalDateTime
start
=
LocalDateTime
.
now
();
LocalDateTime
start
=
LocalDateTime
.
now
();
//
7天内所有主题进行热度值排序
//
90天内所有主题进行热度值排序-> 提升排序范围,降低频率
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryRecentdays
(
60
);
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryRecentdays
(
60
);
//话题热门补偿
themeEntities
.
addAll
(
themeService
.
queryThemeHaveTopic
(
180
));
if
(
CollectionUtils
.
isEmpty
(
themeEntities
))
{
if
(
CollectionUtils
.
isEmpty
(
themeEntities
))
{
return
;
return
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
d1eb9131
...
@@ -68,6 +68,16 @@ public class ThemeService {
...
@@ -68,6 +68,16 @@ public class ThemeService {
return
themeMapper
.
selectList
(
queryWrapper
);
return
themeMapper
.
selectList
(
queryWrapper
);
}
}
public
List
<
ThemeEntity
>
queryThemeHaveTopic
(
Integer
days
){
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
())
.
ne
(
ThemeEntity:
:
getTopicId
,
""
)
.
gt
(
ThemeEntity:
:
getCreateTime
,
TimeUtils
.
getDaysBefore
(
days
))
.
orderByDesc
(
ThemeEntity:
:
getId
);
return
themeMapper
.
selectList
(
queryWrapper
);
}
//最新的n条主题
//最新的n条主题
public
List
<
ThemeEntity
>
queryLatestThemes
(
Integer
n
)
{
public
List
<
ThemeEntity
>
queryLatestThemes
(
Integer
n
)
{
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
...
...
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