mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
fix bug
This commit is contained in:
parent
bc445548ce
commit
5ec0f39b89
@ -42,8 +42,19 @@ public class Network2LocalPicSchedule {
|
||||
|
||||
log.info("Network2LocalPicSchedule。。。。。。。。。。。。");
|
||||
|
||||
|
||||
bookService.networkPicToLocal();
|
||||
Integer offset = 0, limit = 100;
|
||||
List<Book> networkPicBooks;
|
||||
do {
|
||||
networkPicBooks = bookService.queryNetworkPicBooks(limit, offset);
|
||||
for (Book book : networkPicBooks) {
|
||||
try {
|
||||
bookService.networkPicToLocal(book);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
offset += limit;
|
||||
} while (networkPicBooks.size() > 0);
|
||||
|
||||
|
||||
}
|
||||
|
@ -150,22 +150,16 @@ public class BookService {
|
||||
|
||||
/**
|
||||
* 网络图片转本地
|
||||
*
|
||||
* @param book
|
||||
*/
|
||||
public void networkPicToLocal() {
|
||||
Integer offset = 0, limit = 100;
|
||||
List<Book> networkPicBooks;
|
||||
do {
|
||||
networkPicBooks = queryNetworkPicBooks(limit, offset);
|
||||
for (Book book : networkPicBooks) {
|
||||
try {
|
||||
book.setPicUrl(FileUtil.network2Local(book.getPicUrl(), picSavePath));
|
||||
bookMapper.updateByPrimaryKeySelective(book);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
offset += limit;
|
||||
} while (networkPicBooks.size() > 0);
|
||||
public void networkPicToLocal(Book book) {
|
||||
try {
|
||||
book.setPicUrl(FileUtil.network2Local(book.getPicUrl(), picSavePath));
|
||||
bookMapper.updateByPrimaryKeySelective(book);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user