...
|
...
|
@@ -162,25 +162,17 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncPraiseByArticle(Integer startTime, Integer endTime){
|
|
|
logger.info("syncPraiseByArticle begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
Long startTimeLong = (long)startTime * 1000;
|
|
|
Long endTimeLong = (long)endTime * 1000;
|
|
|
int total = grassArticleRepository.countByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(startTimeLong, endTimeLong,needSyncArticleType,needSyncArticleStatus);
|
|
|
logger.info("syncPraiseByArticle get grassArticle count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncPraiseByArticlePage(startTimeLong, endTimeLong, indexPage, pageSize);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncPraiseByArticlePage(startTimeLong, endTimeLong, index, pageSize);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void syncPraiseByArticlePage(Long startTime, Long endTime, int indexPage, int pageSize){
|
...
|
...
|
@@ -290,23 +282,15 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncPraiseBySelf(Integer startTime, Integer endTime){
|
|
|
logger.info("syncPraiseBySelf begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
int total = grassArticlePraiseRepository.countByCreateTimeBetween(startTime, endTime);
|
|
|
logger.info("syncPraiseBySelf get grassArticlePraise count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncPraiseBySelfPage(startTime, endTime, indexPage, pageSize);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncPraiseBySelfPage(startTime, endTime, index, pageSize);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void syncPraiseBySelfPage(int startTime, int endTime, int indexPage, int pageSize){
|
...
|
...
|
@@ -340,25 +324,17 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncFavoriteByArticle(Integer startTime, Integer endTime){
|
|
|
logger.info("syncFavoriteByArticle begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
Long startTimeLong = (long)startTime * 1000;
|
|
|
Long endTimeLong = (long)endTime * 1000;
|
|
|
int pageSize = 100;
|
|
|
int total = grassArticleRepository.countByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(startTimeLong, endTimeLong,needSyncArticleType,needSyncArticleStatus);
|
|
|
logger.info("syncFavoriteByArticle get grassArticle count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncFavoriteByArticlePage(startTimeLong, endTimeLong, indexPage, pageSize);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncFavoriteByArticlePage(startTimeLong, endTimeLong, index, pageSize);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void syncFavoriteByArticlePage(Long startTime, Long endTime, int indexPage, int pageSize){
|
...
|
...
|
@@ -421,23 +397,15 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncFavoriteBySelf(Integer startTime, Integer endTime){
|
|
|
logger.info("syncFavoriteBySelf begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
int total = userFavoriteArticleRepository.countByCreateTimeBetween(startTime, endTime);
|
|
|
logger.info("syncFavoriteBySelf get grassArticlePraise count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncFavoriteBySelfPage(startTime, endTime, indexPage, pageSize);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncFavoriteBySelfPage(startTime, endTime, index, pageSize);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void syncFavoriteBySelfPage(int startTime, int endTime, int indexPage, int pageSize){
|
...
|
...
|
@@ -471,23 +439,15 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncUserAttention(Integer startTime, Integer endTime){
|
|
|
logger.info("syncUserAttention begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
int total = grassUserAttentionRepository.countByCreateTimeBetween(startTime, endTime);
|
|
|
logger.info("syncUserAttention get attention count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncUserAttentionPage(startTime, endTime, indexPage, pageSize);
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncUserAttentionPage(startTime, endTime, index, pageSize);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void syncUserAttentionPage(int startTime, int endTime, int indexPage, int pageSize){
|
...
|
...
|
@@ -594,24 +554,17 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncCommentsByArticle(Integer startTime, Integer endTime){
|
|
|
logger.info("syncCommentsByArticle begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
Long startTimeLong = (long)startTime * 1000;
|
|
|
Long endTimeLong = (long)endTime * 1000;
|
|
|
int total = grassArticleRepository.countByCreateTimeAfterAndCreateTimeBeforeAndArticleTypeInAndAuthStatusIn(startTimeLong, endTimeLong,needSyncArticleType,needSyncArticleStatus);
|
|
|
logger.info("syncCommentsByArticle get grassArticle count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncCommentsByArticlePage(startTimeLong, endTimeLong, indexPage, pageSize);
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncCommentsByArticlePage(startTimeLong, endTimeLong, index, pageSize);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -624,21 +577,13 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncCommentsBySelf(Integer startTime, Integer endTime){
|
|
|
logger.info("syncCommentsBySelf begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
int total = grassArticleCommentRepository.countByCreateTimeBetween(startTime, endTime);
|
|
|
logger.info("syncCommentsBySelf get grassArticlePraise count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncCommentsBySelfPage(startTime, endTime, indexPage, pageSize);
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncCommentsBySelfPage(startTime, endTime, index, pageSize);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -927,21 +872,13 @@ public class GrassInteractiveDataSyncServiceImpl implements IGrassInteractiveDat |
|
|
*/
|
|
|
private void syncCommentPraise(Integer startTime, Integer endTime){
|
|
|
logger.info("syncCommentPraise begin, startTime is {}, endTime is {}", startTime, endTime);
|
|
|
ExecutorService es = Executors.newFixedThreadPool(2);
|
|
|
int pageSize = 100;
|
|
|
int total = grassCommentPraiseRepository.countByCreateTimeBetween(startTime, endTime);
|
|
|
logger.info("syncCommentPraise get commentPraise count is {}", total);
|
|
|
int totalPage = total % pageSize ==0 ? total / pageSize : (total / pageSize)+1;
|
|
|
try{
|
|
|
//每次查询100条,增加detail
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
int indexPage = index;
|
|
|
es.execute(() -> {
|
|
|
syncCommentPraisePage(startTime, endTime, indexPage, pageSize);
|
|
|
});
|
|
|
}
|
|
|
}finally {
|
|
|
es.shutdown();
|
|
|
for (int index=0; index < totalPage; index++) {
|
|
|
syncCommentPraisePage(startTime, endTime, index, pageSize);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|