...
|
...
|
@@ -191,7 +191,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
List<GrassArticlePraise> grassArticlePraiseList = grassArticlePraiseRepository.findAllByArticleIdInAndCreateTimeAfter(grassArticleIds, DATA_BEGIN_TIME);
|
|
|
logger.info("syncPraiseByArticlePage find grassArticlePraise num is {}", grassArticlePraiseList.size());
|
|
|
List<PublicUserPraise> needSyncData = buildPublicUserPraise(publicArticleIdAndGrassIdMap, nowArticleIdAndpublicArticleIdMap,grassArticlePraiseList);
|
|
|
publicUserPraiseRepository.saveAll(needSyncData);
|
|
|
if(!CollectionUtils.isEmpty(needSyncData)){
|
|
|
publicUserPraiseRepository.saveAll(needSyncData);
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(200);
|
|
|
} catch (InterruptedException e) {
|
...
|
...
|
@@ -276,7 +278,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
Map<Integer, Integer> publicArticleIdAndGrassIdMap = getGrassArticleIdAndPublicIdMap(grassArticleIds);
|
|
|
|
|
|
List<PublicUserPraise> needSyncData = buildPublicUserPraise(publicArticleIdAndGrassIdMap,nowArticleIdAndpublicArticleIdMap, grassArticlePraiseList);
|
|
|
publicUserPraiseRepository.saveAll(needSyncData);
|
|
|
if(!CollectionUtils.isEmpty(needSyncData)){
|
|
|
publicUserPraiseRepository.saveAll(needSyncData);
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(200);
|
|
|
} catch (InterruptedException e) {
|
...
|
...
|
@@ -327,7 +331,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
List<UserFavoriteArticle> userFavoriteArticleList = userFavoriteArticleRepository.findAllByArticleIdInAndCreateTimeAfter(grassArticleIds, DATA_BEGIN_TIME);
|
|
|
logger.info("syncFavoriteByArticlePage find userFavoriteArticle num is {}", userFavoriteArticleList.size());
|
|
|
List<PublicUserFavorite> needSyncData = buildPublicUserFavorite(publicArticleIdAndGrassIdMap,nowArticleIdAndpublicArticleIdMap, userFavoriteArticleList);
|
|
|
publicUserFavoriteRepository.saveAll(needSyncData);
|
|
|
if(!CollectionUtils.isEmpty(needSyncData)){
|
|
|
publicUserFavoriteRepository.saveAll(needSyncData);
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(200);
|
|
|
} catch (InterruptedException e) {
|
...
|
...
|
@@ -403,7 +409,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
Map<Integer, Integer> publicArticleIdAndGrassIdMap = getGrassArticleIdAndPublicIdMap(grassArticleIds);
|
|
|
|
|
|
List<PublicUserFavorite> needSyncData = buildPublicUserFavorite(publicArticleIdAndGrassIdMap,nowArticleIdAndpublicArticleIdMap, userFavoriteArticleList);
|
|
|
publicUserFavoriteRepository.saveAll(needSyncData);
|
|
|
if(!CollectionUtils.isEmpty(needSyncData)){
|
|
|
publicUserFavoriteRepository.saveAll(needSyncData);
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(200);
|
|
|
} catch (InterruptedException e) {
|
...
|
...
|
@@ -444,7 +452,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
startTime, endTime, DATA_BEGIN_TIME, pageReq);
|
|
|
|
|
|
List<PublicUserAttention> needSyncData = buildPublicUserAttention(grassUserAttentionList);
|
|
|
publicUserAttentionRepository.saveAll(needSyncData);
|
|
|
if(!CollectionUtils.isEmpty(needSyncData)){
|
|
|
publicUserAttentionRepository.saveAll(needSyncData);
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(200);
|
|
|
} catch (InterruptedException e) {
|
...
|
...
|
@@ -694,7 +704,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
!rootIds.contains(grassArticleComment.getParentId())).collect(Collectors.toList());
|
|
|
|
|
|
syncPublicUserCommentList = buildChildrenComments(publicArticleIdAndGrassIdMap, needSync, commentRootIdAndPublicId, rootIdMap);
|
|
|
|
|
|
if(CollectionUtils.isEmpty(syncPublicUserCommentList)){
|
|
|
return;
|
|
|
}
|
|
|
List<PublicUserComment> publicUserCommentList = publicUserCommentRepository.saveAll(syncPublicUserCommentList);
|
|
|
buildAndSaveChildrenComment(publicArticleIdAndGrassIdMap, publicUserCommentList, nextSync, rootIdMap);
|
|
|
}
|
...
|
...
|
@@ -721,11 +733,12 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
|
|
|
syncPublicUserCommentList = buildChildrenComments(publicArticleIdAndGrassIdMap, needSync, relateIdMap, relateIdMap);
|
|
|
|
|
|
//新同步的数据id对应关系 直接加到map中来
|
|
|
List<PublicUserComment> publicUserCommentList = publicUserCommentRepository.saveAll(syncPublicUserCommentList);
|
|
|
if(CollectionUtils.isEmpty(publicUserCommentList)){
|
|
|
if(CollectionUtils.isEmpty(syncPublicUserCommentList)){
|
|
|
return;
|
|
|
}
|
|
|
//新同步的数据id对应关系 直接加到map中来
|
|
|
List<PublicUserComment> publicUserCommentList = publicUserCommentRepository.saveAll(syncPublicUserCommentList);
|
|
|
|
|
|
publicUserCommentList.forEach(publicUserComment -> {
|
|
|
relateIdMap.put(publicUserComment.getRelateId(), publicUserComment.getId());
|
|
|
});
|
...
|
...
|
@@ -860,7 +873,9 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
});
|
|
|
|
|
|
List<PublicUserPraise> needSyncData = buildPublicUserPraise(relateIdMap, grassCommentPraiseList);
|
|
|
publicUserPraiseRepository.saveAll(needSyncData);
|
|
|
if(!CollectionUtils.isEmpty(needSyncData)){
|
|
|
publicUserPraiseRepository.saveAll(needSyncData);
|
|
|
}
|
|
|
try {
|
|
|
Thread.sleep(200);
|
|
|
} catch (InterruptedException e) {
|
...
|
...
|
|