From b52b6de80e6fd805b2d70f16f276f09727adfe69 Mon Sep 17 00:00:00 2001
From: liujiming <liujm@wealthgrow.cn>
Date: Thu, 5 Aug 2021 13:51:04 +0800
Subject: [PATCH] rank log round

---
 .../dao/mapper/community/RankLogMapper.java   |  7 +++---
 .../community/service/RankLogService.java     |  8 ++++++-
 .../src/main/resources/application-dev.yml    | 24 +++++++++----------
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/community-service/src/main/java/com/tanpu/community/dao/mapper/community/RankLogMapper.java b/community-service/src/main/java/com/tanpu/community/dao/mapper/community/RankLogMapper.java
index 69e0297..8d416f0 100644
--- a/community-service/src/main/java/com/tanpu/community/dao/mapper/community/RankLogMapper.java
+++ b/community-service/src/main/java/com/tanpu/community/dao/mapper/community/RankLogMapper.java
@@ -2,6 +2,7 @@ package com.tanpu.community.dao.mapper.community;
 
 import com.tanpu.community.dao.entity.community.RankLogEntity;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 /**
@@ -14,6 +15,6 @@ import org.apache.ibatis.annotations.Select;
  */
 public interface RankLogMapper extends BaseMapper<RankLogEntity> {
 
-    @Select("select max(round) from rank_log")
-    Long selectMaxRound();
-}
+    @Select("select max(round) from rank_log where type = #{type}")
+    Long selectMaxRound(@Param("type") Integer type);
+}
\ No newline at end of file
diff --git a/community-service/src/main/java/com/tanpu/community/service/RankLogService.java b/community-service/src/main/java/com/tanpu/community/service/RankLogService.java
index ba5143b..1a3783d 100644
--- a/community-service/src/main/java/com/tanpu/community/service/RankLogService.java
+++ b/community-service/src/main/java/com/tanpu/community/service/RankLogService.java
@@ -30,7 +30,7 @@ public class RankLogService {
             return;
         }
 
-        Long round = rankLogMapper.selectMaxRound();
+        Long round = rankLogMapper.selectMaxRound(RankLogTypeEnum.TOPIC.getCode());
         round = round == null ? 0L : round + 1;
 
         //分页插入
@@ -55,6 +55,10 @@ public class RankLogService {
         if (CollectionUtils.isEmpty(themeList)) {
             return;
         }
+
+        Long round = rankLogMapper.selectMaxRound(RankLogTypeEnum.THEME.getCode());
+        round = round == null ? 0L : round + 1;
+
         //分页插入
         for (int i = 0; i * pageSize < themeList.size(); i++) {
             int pageStart = i * pageSize;
@@ -66,8 +70,10 @@ public class RankLogService {
                     .content(JsonUtil.toJson(sublist))
                     .pageNumber(i + 1)
                     .pageSize(sublist.size())
+                    .round(round)
                     .build();
             rankLogMapper.insert(entity);
         }
     }
+
 }
diff --git a/community-service/src/main/resources/application-dev.yml b/community-service/src/main/resources/application-dev.yml
index 98e8442..20b58da 100644
--- a/community-service/src/main/resources/application-dev.yml
+++ b/community-service/src/main/resources/application-dev.yml
@@ -101,16 +101,16 @@ recommend:
 
 rank:
   theme:
-    viewRate: 0.11
-    forwardRate: 31
-    commentRate: 21
-    likeRaten: 11
-    collectRate: 31
-    userWeightRate: 0.91
-    initialWeight: 1.011
-    timeRate: 0.21
+    viewRate: 0.1
+    forwardRate: 3
+    commentRate: 2
+    likeRaten: 1
+    collectRate: 3
+    userWeightRate: 0.9
+    initialWeight: 1.0
+    timeRate: 0.2
   topic:
-    viewRate: 21
-    discussRate: 31
-    themeRate: 31
-    timeRate: 11
+    viewRate: 2
+    discussRate: 3
+    themeRate: 3
+    timeRate: 1
-- 
2.18.1