|
@@ -3,6 +3,8 @@ package com.tzld.longarticle.recommend.server;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.longArticle.LongArticleTitleAudit;
|
|
|
+import com.tzld.longarticle.recommend.server.repository.longArticle.LongArticleTitleAuditRepository;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.recall.RecallService;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.Score;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreParam;
|
|
@@ -13,6 +15,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
@SpringBootTest(classes = Application.class)
|
|
@@ -24,6 +27,8 @@ public class ScoreStrategyTest {
|
|
|
ViewCountRateStrategy viewCountRateStrategy;
|
|
|
@Resource
|
|
|
RecallService recallService;
|
|
|
+ @Resource
|
|
|
+ LongArticleTitleAuditRepository titleAuditRepository;
|
|
|
|
|
|
@Test
|
|
|
public void viewMultiplierStrategy() {
|
|
@@ -59,4 +64,24 @@ public class ScoreStrategyTest {
|
|
|
//hisArticleList = hisArticleList.stream().filter(o -> o.getPublishTimestamp() < 1729267200).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void viewCountRateStra22tegy() {
|
|
|
+ int per = 0;
|
|
|
+ List<String> auditUser = Arrays.asList("a","b","c","d","e","f","g","h","i","j");
|
|
|
+ List<LongArticleTitleAudit> contentIds = titleAuditRepository.getByAuditAccountIsNull();
|
|
|
+ int perNum = contentIds.size() / auditUser.size();
|
|
|
+ List<LongArticleTitleAudit> saveList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < contentIds.size(); i++) {
|
|
|
+ if ((i+1) % perNum == 0) {
|
|
|
+ if (per == auditUser.size() - 1)
|
|
|
+ per = 0;
|
|
|
+ else
|
|
|
+ per++;
|
|
|
+ }
|
|
|
+ LongArticleTitleAudit audit = contentIds.get(i);
|
|
|
+ audit.setAuditAccount(auditUser.get(per));
|
|
|
+ titleAuditRepository.save(audit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|