|
@@ -134,11 +134,8 @@ public class DataFlushService {
|
|
|
log.info("flushLongArticlesCrawlerVideos flushNum:{}", flushNum);
|
|
|
}
|
|
|
|
|
|
- public void flushLongArticlesVideos(Integer pageNum) {
|
|
|
+ public void flushLongArticlesVideos(Integer pageNum, Long id) {
|
|
|
int pageSize = 1000;
|
|
|
- if (pageNum == null) {
|
|
|
- pageNum = 1;
|
|
|
- }
|
|
|
List<LongArticlesText> kimiTitleList = crawlerBaseMapper.getLongArticlesText();
|
|
|
Map<String, LongArticlesText> kimiTitleMap = kimiTitleList.stream().collect(
|
|
|
Collectors.toMap(LongArticlesText::getContentId, o -> o, (existing, replacement) -> replacement));
|
|
@@ -146,9 +143,12 @@ public class DataFlushService {
|
|
|
int totalPage = count / pageSize + 1;
|
|
|
int longArticlesTextFlushNum = 0;
|
|
|
int longArticlesMatchVideosFlushNum = 0;
|
|
|
- while (pageNum <= totalPage) {
|
|
|
- int offset = (pageNum - 1) * pageSize;
|
|
|
- List<LongArticlesVideo> list = crawlerBaseMapper.pageLongArticlesVideos(offset, pageSize);
|
|
|
+ while (true) {
|
|
|
+ List<LongArticlesVideo> list = crawlerBaseMapper.pageLongArticlesVideos(id, pageSize);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ id = list.stream().mapToLong(LongArticlesVideo::getId).max().getAsLong();
|
|
|
List<LongArticlesText> batchSaveLongArticlesTextList = new ArrayList<>();
|
|
|
List<LongArticlesMatchVideos> batchSaveLongArticlesMatchVideosList = new ArrayList<>();
|
|
|
Set<String> existsIdSet = new HashSet<>();
|
|
@@ -184,7 +184,7 @@ public class DataFlushService {
|
|
|
longArticlesMatchVideos.setTraceId(longArticlesVideo.getTraceId());
|
|
|
longArticlesMatchVideos.setGhId(longArticlesVideo.getGhId());
|
|
|
longArticlesMatchVideos.setAccountName(longArticlesVideo.getAccountName());
|
|
|
- longArticlesMatchVideos.setContentStatus(longArticlesVideo.getContentStatus());
|
|
|
+ longArticlesMatchVideos.setContentStatus(4);
|
|
|
longArticlesMatchVideos.setSuccessStatus(longArticlesVideo.getSuccess());
|
|
|
longArticlesMatchVideos.setRequestTimestamp(longArticlesVideo.getRequestTimeStamp());
|
|
|
longArticlesMatchVideos.setUpdateTime(longArticlesVideo.getUpdateTime());
|
|
@@ -217,7 +217,8 @@ public class DataFlushService {
|
|
|
longArticlesMatchVideosFlushNum += batchSaveLongArticlesMatchVideosList.size();
|
|
|
}
|
|
|
}
|
|
|
- log.info("flushLongArticlesVideos pageNum:{} totalPage:{}", pageNum, totalPage);
|
|
|
+ log.info("flushLongArticlesVideos pageNum:{} totalPage:{} id:{} longArticlesMatchVideosFlushNum:{}",
|
|
|
+ pageNum, totalPage, id, longArticlesMatchVideosFlushNum);
|
|
|
pageNum++;
|
|
|
}
|
|
|
log.info("flushLongArticlesVideos longArticlesTextFlushNum:{} longArticlesMatchVideosFlushNum:{}",
|