mirror of
https://github.com/201206030/novel-plus.git
synced 2025-06-24 04:46:37 +00:00
bug修复
This commit is contained in:
@ -53,6 +53,7 @@ public class StarterListener implements ServletContextListener {
|
||||
//这里只做老书更新
|
||||
book.setCrawlLastTime(currentDate);
|
||||
book.setId(needUpdateBook.getId());
|
||||
book.setPicUrl(needUpdateBook.getPicUrl());
|
||||
//查询已存在的章节
|
||||
Map<Integer, BookIndex> existBookIndexMap = bookService.queryExistBookIndexMap(needUpdateBook.getId());
|
||||
//解析章节目录
|
||||
|
@ -6,7 +6,9 @@ import com.java2nb.novel.entity.BookContent;
|
||||
import com.java2nb.novel.entity.BookIndex;
|
||||
import com.java2nb.novel.mapper.*;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.utils.Constants;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.mybatis.dynamic.sql.Constant;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -20,6 +22,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.crawlBookId;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.crawlSourceId;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.picUrl;
|
||||
import static com.java2nb.novel.mapper.CrawlSourceDynamicSqlSupport.id;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
|
||||
@ -165,6 +168,10 @@ public class BookServiceImpl implements BookService {
|
||||
book.setUpdateTime(currentDate);
|
||||
book.setBookName(null);
|
||||
book.setAuthorName(null);
|
||||
if(book.getPicUrl()!=null && book.getPicUrl().startsWith(Constants.LOCAL_PIC_PREFIX)) {
|
||||
//本地图片则不更新
|
||||
book.setPicUrl(null);
|
||||
}
|
||||
bookMapper.updateByPrimaryKeySelective(book);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.java2nb.novel.utils;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
/**
|
||||
* 本地图片保存前缀
|
||||
* */
|
||||
public static final String LOCAL_PIC_PREFIX = "/localPic/";
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
|
||||
<select id="queryNeedUpdateBook" resultType="com.java2nb.novel.entity.Book">
|
||||
|
||||
select id,crawl_source_id,crawl_book_id,crawl_last_time
|
||||
select id,crawl_source_id,crawl_book_id,crawl_last_time,pic_url
|
||||
from book where last_index_update_time > #{startDate}
|
||||
order by crawl_last_time
|
||||
limit ${limit}
|
||||
|
Reference in New Issue
Block a user