Commit 31e44573 authored by 张辰's avatar 张辰

rank_log add round

parent bf4c7437
...@@ -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;
} }
......
...@@ -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();
} }
...@@ -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);
} }
......
...@@ -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
......
...@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment