mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
fix: 修复单本小说采集即使没有采集到内容仍然标记状态为采集成功的问题
This commit is contained in:
parent
b2eb6686e9
commit
78969f9fd1
@ -139,7 +139,7 @@ public class CrawlParser {
|
|||||||
handler.handle(book);
|
handler.handle(book);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean, Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) {
|
public static boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean, Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) {
|
||||||
|
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ public class CrawlParser {
|
|||||||
setBookContentList(contentList);
|
setBookContentList(contentList);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,6 +285,7 @@ public class CrawlParser {
|
|||||||
setBookIndexList(new ArrayList<>(0));
|
setBookIndexList(new ArrayList<>(0));
|
||||||
setBookContentList(new ArrayList<>(0));
|
setBookContentList(new ArrayList<>(0));
|
||||||
}});
|
}});
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,15 +302,16 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
book.setCrawlLastTime(new Date());
|
book.setCrawlLastTime(new Date());
|
||||||
book.setId(IdWorker.INSTANCE.nextId());
|
book.setId(IdWorker.INSTANCE.nextId());
|
||||||
//解析章节目录
|
//解析章节目录
|
||||||
CrawlParser.parseBookIndexAndContent(bookId, book, ruleBean, new HashMap<>(0), chapter -> {
|
boolean parseIndexContentResult = CrawlParser.parseBookIndexAndContent(bookId, book, ruleBean, new HashMap<>(0), chapter -> {
|
||||||
bookService.saveBookAndIndexAndContent(book, chapter.getBookIndexList(), chapter.getBookContentList());
|
bookService.saveBookAndIndexAndContent(book, chapter.getBookIndexList(), chapter.getBookContentList());
|
||||||
});
|
});
|
||||||
|
parseResult.set(parseIndexContentResult);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//只更新书籍的爬虫相关字段
|
//只更新书籍的爬虫相关字段
|
||||||
bookService.updateCrawlProperties(existBook.getId(), sourceId, bookId);
|
bookService.updateCrawlProperties(existBook.getId(), sourceId, bookId);
|
||||||
|
parseResult.set(true);
|
||||||
}
|
}
|
||||||
parseResult.set(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return parseResult.get();
|
return parseResult.get();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user