|
@@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
-import com.tzld.longarticle.recommend.server.common.enums.ArticleTypeEnum;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.Article;
|
|
@@ -14,8 +14,8 @@ import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRe
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleDetailInfoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository;
|
|
|
-import com.tzld.longarticle.recommend.server.service.RecommendService;
|
|
|
-import com.tzld.longarticle.recommend.server.service.recall.RecallService;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.RecommendService;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.recall.RecallService;
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
@@ -24,6 +24,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -524,4 +525,28 @@ public class RecommendTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void account() {
|
|
|
+ List<String> ghIds = Arrays.asList("gh_d7fa1998b4e1","gh_52100b6803fb","gh_8d7fc54d5026");
|
|
|
+ List<String> accountNames = Arrays.asList("生活超读","灵读生活","生活情感读");
|
|
|
+ List<Integer> fans = Arrays.asList(85759,103083,79214);
|
|
|
+ List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeLessThanAndTypeEquals(
|
|
|
+ Arrays.asList("gh_02f5bca5b5d9"), 1729353600L, ArticleTypeEnum.QUNFA.getVal());
|
|
|
+ for (int i = 0; i < ghIds.size(); i++) {
|
|
|
+ String ghId = ghIds.get(i);
|
|
|
+ String accountName = accountNames.get(i);
|
|
|
+ Integer fanCount = fans.get(i);
|
|
|
+ Double rate = fanCount / 233474.0;
|
|
|
+ for (Article article : articleList) {
|
|
|
+ Article saveItem = new Article();
|
|
|
+ BeanUtils.copyProperties(article, saveItem);
|
|
|
+ saveItem.setGhId(ghId);
|
|
|
+ saveItem.setAccountName(accountName);
|
|
|
+ saveItem.setShowViewCount((int) (article.getShowViewCount() * rate));
|
|
|
+ saveItem.setWxSn(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ articleRepository.save(saveItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|