...
|
...
|
@@ -70,8 +70,9 @@ public class YohoNowDataSynService { |
|
|
public final int size=50;
|
|
|
private Boolean isStop =false;
|
|
|
|
|
|
public String synArticle(long begTime, long endTime) {
|
|
|
public synchronized String synArticle(long begTime, long endTime) {
|
|
|
int total = postsRepository.selectTotal(begTime,endTime);
|
|
|
logger.info("synArticle.total is {}", total);
|
|
|
for(int offset=0;offset<total;offset+=size){
|
|
|
List<Posts> postsList = postsRepository.selectByTime(begTime,endTime,offset,size);
|
|
|
if(postsList.isEmpty()){
|
...
|
...
|
@@ -83,7 +84,7 @@ public class YohoNowDataSynService { |
|
|
Map<Integer,List<PostsBlock>> postsBlockMap = BeanConvertUtils.listToListMap(postsBlocks,Integer.class,"postsId");
|
|
|
Map<Integer,PostsPraiseTotal> postsPraiseTotalMap = BeanConvertUtils.listToMap(praiseTotals,Integer.class,"postsId");
|
|
|
List<PublicArticle> pArticles = buildPublicArticles(postsList,postsBlockMap,postsPraiseTotalMap);
|
|
|
logger.info("before synArticle.size is {}",pArticles.size());
|
|
|
logger.info("before synArticle.size is {}, offset is {}",pArticles.size(), offset);
|
|
|
publicArticleRepository.saveAll(pArticles);
|
|
|
publicArticleRepository.flush();
|
|
|
//文章审核表同步
|
...
|
...
|
|