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
31e44573
Commit
31e44573
authored
Aug 05, 2021
by
张辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rank_log add round
parent
bf4c7437
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
0 deletions
+23
-0
RankLogEntity.java
...m/tanpu/community/dao/entity/community/RankLogEntity.java
+10
-0
RankLogMapper.java
...m/tanpu/community/dao/mapper/community/RankLogMapper.java
+3
-0
RankLogService.java
...main/java/com/tanpu/community/service/RankLogService.java
+5
-0
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+2
-0
application-dev.yml
community-service/src/main/resources/application-dev.yml
+3
-0
No files found.
community-service/src/main/java/com/tanpu/community/dao/entity/community/RankLogEntity.java
View file @
31e44573
...
@@ -54,6 +54,8 @@ public class RankLogEntity implements Serializable {
...
@@ -54,6 +54,8 @@ public class RankLogEntity implements Serializable {
@ApiModelProperty
(
value
=
"排序时间"
)
@ApiModelProperty
(
value
=
"排序时间"
)
private
LocalDateTime
rankTime
;
private
LocalDateTime
rankTime
;
private
Long
round
;
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
...
@@ -125,6 +127,14 @@ public class RankLogEntity implements Serializable {
...
@@ -125,6 +127,14 @@ public class RankLogEntity implements Serializable {
this
.
rankTime
=
rankTime
;
this
.
rankTime
=
rankTime
;
}
}
public
Long
getRound
()
{
return
round
;
}
public
void
setRound
(
Long
round
)
{
this
.
round
=
round
;
}
public
LocalDateTime
getCreateTime
()
{
public
LocalDateTime
getCreateTime
()
{
return
createTime
;
return
createTime
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/dao/mapper/community/RankLogMapper.java
View file @
31e44573
...
@@ -2,6 +2,7 @@ package com.tanpu.community.dao.mapper.community;
...
@@ -2,6 +2,7 @@ package com.tanpu.community.dao.mapper.community;
import
com.tanpu.community.dao.entity.community.RankLogEntity
;
import
com.tanpu.community.dao.entity.community.RankLogEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Select
;
/**
/**
* <p>
* <p>
...
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
*/
public
interface
RankLogMapper
extends
BaseMapper
<
RankLogEntity
>
{
public
interface
RankLogMapper
extends
BaseMapper
<
RankLogEntity
>
{
@Select
(
"select max(round) from rank_log"
)
Long
selectMaxRound
();
}
}
community-service/src/main/java/com/tanpu/community/service/RankLogService.java
View file @
31e44573
...
@@ -29,6 +29,10 @@ public class RankLogService {
...
@@ -29,6 +29,10 @@ public class RankLogService {
if
(
CollectionUtils
.
isEmpty
(
rankList
))
{
if
(
CollectionUtils
.
isEmpty
(
rankList
))
{
return
;
return
;
}
}
Long
round
=
rankLogMapper
.
selectMaxRound
();
round
=
round
==
null
?
0L
:
round
+
1
;
//分页插入
//分页插入
for
(
int
i
=
0
;
i
*
pageSize
<
rankList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
*
pageSize
<
rankList
.
size
();
i
++)
{
int
pageStart
=
i
*
pageSize
;
int
pageStart
=
i
*
pageSize
;
...
@@ -40,6 +44,7 @@ public class RankLogService {
...
@@ -40,6 +44,7 @@ public class RankLogService {
.
content
(
JsonUtil
.
toJson
(
sublist
))
.
content
(
JsonUtil
.
toJson
(
sublist
))
.
pageNumber
(
i
+
1
)
.
pageNumber
(
i
+
1
)
.
pageSize
(
sublist
.
size
())
.
pageSize
(
sublist
.
size
())
.
round
(
round
)
.
build
();
.
build
();
rankLogMapper
.
insert
(
entity
);
rankLogMapper
.
insert
(
entity
);
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
31e44573
...
@@ -252,6 +252,8 @@ public class RankService {
...
@@ -252,6 +252,8 @@ public class RankService {
}
}
// todo 这里用户层面只考虑了用户的gradelevel,后续可以为用户的历史贴子打分。根据用户发表的历史帖子的质量,为用户评分。例如,历史帖子的关注度,用户的粉丝数量。
// todo 可以考虑一下话题的热度。
private
void
calculateThemeScore
(
ThemeAnalysDO
theme
)
{
private
void
calculateThemeScore
(
ThemeAnalysDO
theme
)
{
// 质量=帖子质量+用户质量
// 质量=帖子质量+用户质量
double
w
=
theme
.
getViewCount
()
*
viewRate
double
w
=
theme
.
getViewCount
()
*
viewRate
...
...
community-service/src/main/resources/application-dev.yml
View file @
31e44573
...
@@ -64,8 +64,11 @@ spring.kafka:
...
@@ -64,8 +64,11 @@ spring.kafka:
spring
:
spring
:
sleuth
:
sleuth
:
enabled
:
false
enabled
:
false
sampler.probability
:
1.0
zipkin
:
zipkin
:
enabled
:
false
enabled
:
false
base-url
:
http://tracing-analysis-dc-sh.aliyuncs.com/adapt_f582gdhpd0@141b989b3abcccb_f582gdhpd0@53df7ad2afe8301_prod
sender.type
:
web
aliyun
:
aliyun
:
oss
:
oss
:
...
...
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