mirror of
https://github.com/201206030/novel.git
synced 2025-06-14 19:58:30 +00:00
fix bug
This commit is contained in:
parent
bc445548ce
commit
5ec0f39b89
@ -42,8 +42,19 @@ public class Network2LocalPicSchedule {
|
|||||||
|
|
||||||
log.info("Network2LocalPicSchedule。。。。。。。。。。。。");
|
log.info("Network2LocalPicSchedule。。。。。。。。。。。。");
|
||||||
|
|
||||||
|
Integer offset = 0, limit = 100;
|
||||||
bookService.networkPicToLocal();
|
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() {
|
public void networkPicToLocal(Book book) {
|
||||||
Integer offset = 0, limit = 100;
|
try {
|
||||||
List<Book> networkPicBooks;
|
book.setPicUrl(FileUtil.network2Local(book.getPicUrl(), picSavePath));
|
||||||
do {
|
bookMapper.updateByPrimaryKeySelective(book);
|
||||||
networkPicBooks = queryNetworkPicBooks(limit, offset);
|
} catch (Exception e) {
|
||||||
for (Book book : networkPicBooks) {
|
log.error(e.getMessage(), e);
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user