mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-26 17:20:52 +00:00
部分代码重构
This commit is contained in:
parent
4939bcf418
commit
3520200a87
@ -16,108 +16,107 @@ import org.springframework.stereotype.Service;
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EhCacheServiceImpl implements CacheService {
|
||||
|
||||
private final CacheManager cacheManager ;
|
||||
|
||||
|
||||
/**
|
||||
* 获得一个Cache,没有则创建一个。
|
||||
* @return
|
||||
*/
|
||||
private Cache getCache(){
|
||||
|
||||
Cache cache = cacheManager.getCache("util_cache");
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String get(String key) {
|
||||
Element element = getCache().get(key);
|
||||
return element==null?null:(String)element.getObjectValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String key, String value) {
|
||||
Element element = new Element(key, value);
|
||||
Cache cache = getCache();
|
||||
//不过期
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String key, String value, long timeout) {
|
||||
Element element = new Element(key, value);
|
||||
element.setTimeToLive((int) timeout);
|
||||
Cache cache = getCache();
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(String key) {
|
||||
getCache().remove(key);
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 获得一个Cache,没有则创建一个。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Cache getCache() {
|
||||
|
||||
@Override
|
||||
public boolean contains(String key) {
|
||||
return getCache().isKeyInCache(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expire(String key, long timeout) {
|
||||
Element element = getCache().get(key);
|
||||
if (element != null) {
|
||||
Object value = element.getValue();
|
||||
element = new Element(key, value);
|
||||
element.setTimeToLive((int)timeout);
|
||||
Cache cache = getCache();
|
||||
cache.put(element);
|
||||
}
|
||||
}
|
||||
Cache cache = cacheManager.getCache("util_cache");
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据key获取缓存的Object类型数据
|
||||
*/
|
||||
@Override
|
||||
public Object getObject(String key) {
|
||||
Element element = getCache().get(key);
|
||||
return element==null?null:element.getObjectValue();
|
||||
}
|
||||
@Override
|
||||
public String get(String key) {
|
||||
Element element = getCache().get(key);
|
||||
return element == null ? null : (String) element.getObjectValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String key, String value) {
|
||||
Element element = new Element(key, value);
|
||||
Cache cache = getCache();
|
||||
//不过期
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(String key, String value, long timeout) {
|
||||
Element element = new Element(key, value);
|
||||
element.setTimeToLive((int) timeout);
|
||||
Cache cache = getCache();
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(String key) {
|
||||
getCache().remove(key);
|
||||
|
||||
|
||||
/**
|
||||
* 设置Object类型的缓存
|
||||
*/
|
||||
@Override
|
||||
public void setObject(String key, Object value) {
|
||||
Element element = new Element(key, value);
|
||||
Cache cache = getCache();
|
||||
//不过期
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(String key) {
|
||||
return getCache().isKeyInCache(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expire(String key, long timeout) {
|
||||
Element element = getCache().get(key);
|
||||
if (element != null) {
|
||||
Object value = element.getValue();
|
||||
element = new Element(key, value);
|
||||
element.setTimeToLive((int) timeout);
|
||||
Cache cache = getCache();
|
||||
cache.put(element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置一个有过期时间的Object类型的缓存,单位秒
|
||||
*/
|
||||
@Override
|
||||
public void setObject(String key, Object value, long timeout) {
|
||||
Element element = new Element(key, value);
|
||||
element.setTimeToLive((int) timeout);
|
||||
Cache cache = getCache();
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
/**
|
||||
* 根据key获取缓存的Object类型数据
|
||||
*/
|
||||
@Override
|
||||
public Object getObject(String key) {
|
||||
Element element = getCache().get(key);
|
||||
return element == null ? null : element.getObjectValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置Object类型的缓存
|
||||
*/
|
||||
@Override
|
||||
public void setObject(String key, Object value) {
|
||||
Element element = new Element(key, value);
|
||||
Cache cache = getCache();
|
||||
//不过期
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置一个有过期时间的Object类型的缓存,单位秒
|
||||
*/
|
||||
@Override
|
||||
public void setObject(String key, Object value, long timeout) {
|
||||
Element element = new Element(key, value);
|
||||
element.setTimeToLive((int) timeout);
|
||||
Cache cache = getCache();
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class BeanUtil {
|
||||
* @return 新集合
|
||||
* */
|
||||
@SneakyThrows
|
||||
public static <T> List<T> copyList(List source,Class<T> targetClass){
|
||||
public static <T> List<T> copyList(List<? super T> source,Class<T> targetClass){
|
||||
List<T> target = new ArrayList<>(source.size());
|
||||
for( int i = 0 ; i < source.size() ; i++){
|
||||
Object sourceItem = source.get(i);
|
||||
|
@ -1,13 +1,10 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.core.bean.ResultBean;
|
||||
import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.entity.CrawlSingleTask;
|
||||
import com.java2nb.novel.entity.CrawlSource;
|
||||
import com.java2nb.novel.service.CrawlService;
|
||||
import com.java2nb.novel.vo.CrawlSingleTaskVO;
|
||||
import com.java2nb.novel.vo.CrawlSourceVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -26,7 +23,7 @@ public class CrawlController {
|
||||
* 新增爬虫源
|
||||
* */
|
||||
@PostMapping("addCrawlSource")
|
||||
public ResultBean addCrawlSource(CrawlSource source){
|
||||
public ResultBean<Void> addCrawlSource(CrawlSource source){
|
||||
crawlService.addCrawlSource(source);
|
||||
|
||||
return ResultBean.ok();
|
||||
@ -37,7 +34,7 @@ public class CrawlController {
|
||||
* 爬虫源分页列表查询
|
||||
* */
|
||||
@GetMapping("listCrawlByPage")
|
||||
public ResultBean listCrawlByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
|
||||
public ResultBean<PageBean<CrawlSource>> listCrawlByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
|
||||
|
||||
return ResultBean.ok(crawlService.listCrawlByPage(page,pageSize));
|
||||
}
|
||||
@ -46,7 +43,7 @@ public class CrawlController {
|
||||
* 开启或停止爬虫
|
||||
* */
|
||||
@PostMapping("openOrCloseCrawl")
|
||||
public ResultBean openOrCloseCrawl(Integer sourceId,Byte sourceStatus){
|
||||
public ResultBean<Void> openOrCloseCrawl(Integer sourceId,Byte sourceStatus){
|
||||
|
||||
crawlService.openOrCloseCrawl(sourceId,sourceStatus);
|
||||
|
||||
@ -57,7 +54,7 @@ public class CrawlController {
|
||||
* 新增单本采集任务
|
||||
* */
|
||||
@PostMapping("addCrawlSingleTask")
|
||||
public ResultBean addCrawlSingleTask(CrawlSingleTask singleTask){
|
||||
public ResultBean<Void> addCrawlSingleTask(CrawlSingleTask singleTask){
|
||||
crawlService.addCrawlSingleTask(singleTask);
|
||||
|
||||
return ResultBean.ok();
|
||||
@ -68,7 +65,7 @@ public class CrawlController {
|
||||
* 单本采集任务分页列表查询
|
||||
* */
|
||||
@GetMapping("listCrawlSingleTaskByPage")
|
||||
public ResultBean listCrawlSingleTaskByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
|
||||
public ResultBean<PageBean<CrawlSingleTask>> listCrawlSingleTaskByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize){
|
||||
|
||||
return ResultBean.ok(crawlService.listCrawlSingleTaskByPage(page,pageSize));
|
||||
}
|
||||
@ -77,7 +74,7 @@ public class CrawlController {
|
||||
* 删除采集任务
|
||||
* */
|
||||
@DeleteMapping("delCrawlSingleTask/{id}")
|
||||
public ResultBean delCrawlSingleTask(@PathVariable("id") Long id){
|
||||
public ResultBean<Void> delCrawlSingleTask(@PathVariable("id") Long id){
|
||||
|
||||
crawlService.delCrawlSingleTask(id);
|
||||
|
||||
|
@ -1,18 +1,11 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.entity.BookContent;
|
||||
import com.java2nb.novel.entity.BookIndex;
|
||||
import com.java2nb.novel.entity.News;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ public class RuleBean {
|
||||
private String statusPatten;
|
||||
private String scorePatten;
|
||||
private String visitCountPatten;
|
||||
private String descStart;;
|
||||
private String descStart;
|
||||
private String descEnd;
|
||||
private String updateTimePatten;
|
||||
private String updateTimeFormatPatten;
|
||||
|
@ -8,12 +8,10 @@ import com.java2nb.novel.entity.CrawlSource;
|
||||
import com.java2nb.novel.service.CrawlService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,7 @@ public interface BookService {
|
||||
* 更新一下最后一次的抓取时间
|
||||
* @param bookId 小说ID
|
||||
* */
|
||||
@Deprecated
|
||||
void updateCrawlLastTime(Long bookId);
|
||||
|
||||
/**
|
||||
|
@ -1,11 +1,9 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.core.crawl.RuleBean;
|
||||
import com.java2nb.novel.entity.CrawlSingleTask;
|
||||
import com.java2nb.novel.entity.CrawlSource;
|
||||
import com.java2nb.novel.vo.CrawlSourceVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -64,7 +62,7 @@ public interface CrawlService {
|
||||
* 根据分类ID和规则解析分类列表
|
||||
* @param catId 分类ID
|
||||
* @param ruleBean 规则对象
|
||||
* @param sourceId
|
||||
* @param sourceId 爬虫源ID
|
||||
*/
|
||||
void parseBookList(int catId, RuleBean ruleBean, Integer sourceId);
|
||||
|
||||
|
@ -176,19 +176,4 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最后的章节
|
||||
* */
|
||||
private BookIndex queryLastIndex(Long bookId) {
|
||||
return bookIndexMapper.queryLastIndex(bookId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小说总字数
|
||||
* */
|
||||
private Integer queryTotalWordCount(Long bookId) {
|
||||
|
||||
return bookMapper.queryTotalWordCount(bookId);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.java2nb.novel.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.core.cache.CacheKey;
|
||||
import com.java2nb.novel.core.cache.CacheService;
|
||||
@ -16,9 +14,13 @@ import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.core.utils.IdWorker;
|
||||
import com.java2nb.novel.core.utils.SpringUtil;
|
||||
import com.java2nb.novel.core.utils.ThreadUtil;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.entity.CrawlSingleTask;
|
||||
import com.java2nb.novel.entity.CrawlSource;
|
||||
import com.java2nb.novel.mapper.*;
|
||||
import com.java2nb.novel.mapper.CrawlSingleTaskDynamicSqlSupport;
|
||||
import com.java2nb.novel.mapper.CrawlSingleTaskMapper;
|
||||
import com.java2nb.novel.mapper.CrawlSourceDynamicSqlSupport;
|
||||
import com.java2nb.novel.mapper.CrawlSourceMapper;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.CrawlService;
|
||||
import com.java2nb.novel.vo.CrawlSingleTaskVO;
|
||||
@ -30,18 +32,14 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.java2nb.novel.core.utils.HttpUtil.getByHttpClient;
|
||||
import static com.java2nb.novel.core.utils.HttpUtil.getByHttpClientWithChrome;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.crawlBookId;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.crawlSourceId;
|
||||
import static com.java2nb.novel.mapper.CrawlSourceDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
|
||||
|
||||
/**
|
||||
@ -122,11 +120,7 @@ public class CrawlServiceImpl implements CrawlService {
|
||||
//按分类开始爬虫解析任务
|
||||
for (int i = 1; i < 8; i++) {
|
||||
final int catId = i;
|
||||
Thread thread = new Thread(() -> {
|
||||
|
||||
parseBookList(catId, ruleBean, sourceId);
|
||||
|
||||
});
|
||||
Thread thread = new Thread(() -> CrawlServiceImpl.this.parseBookList(catId, ruleBean, sourceId));
|
||||
thread.start();
|
||||
//thread加入到监控缓存中
|
||||
threadIds.add(thread.getId());
|
||||
|
@ -2,14 +2,15 @@ package com.java2nb.novel.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.java2nb.novel.entity.CrawlSingleTask;
|
||||
import com.java2nb.novel.entity.CrawlSource;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class CrawlSingleTaskVO extends CrawlSingleTask {
|
||||
|
||||
|
@ -3,13 +3,14 @@ package com.java2nb.novel.vo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.java2nb.novel.entity.CrawlSource;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.annotation.Generated;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class CrawlSourceVO extends CrawlSource{
|
||||
|
||||
|
@ -1,22 +1,21 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.core.bean.ResultBean;
|
||||
import com.java2nb.novel.core.bean.UserDetails;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.exception.BusinessException;
|
||||
import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.entity.Author;
|
||||
import com.java2nb.novel.entity.AuthorIncome;
|
||||
import com.java2nb.novel.entity.AuthorIncomeDetail;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.FriendLinkService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -36,7 +35,7 @@ public class AuthorController extends BaseController{
|
||||
* 校验笔名是否存在
|
||||
* */
|
||||
@GetMapping("checkPenName")
|
||||
public ResultBean checkPenName(String penName){
|
||||
public ResultBean<Boolean> checkPenName(String penName){
|
||||
|
||||
return ResultBean.ok(authorService.checkPenName(penName));
|
||||
}
|
||||
@ -45,7 +44,7 @@ public class AuthorController extends BaseController{
|
||||
* 作家发布小说分页列表查询
|
||||
* */
|
||||
@GetMapping("listBookByPage")
|
||||
public ResultBean listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize ,HttpServletRequest request){
|
||||
public ResultBean<PageBean<Book>> listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize , HttpServletRequest request){
|
||||
|
||||
return ResultBean.ok(bookService.listBookPageByUserId(getUserDetails(request).getId(),page,pageSize));
|
||||
}
|
||||
@ -54,7 +53,7 @@ public class AuthorController extends BaseController{
|
||||
* 发布小说
|
||||
* */
|
||||
@PostMapping("addBook")
|
||||
public ResultBean addBook(@RequestParam("bookDesc") String bookDesc,Book book,HttpServletRequest request){
|
||||
public ResultBean<Void> addBook(@RequestParam("bookDesc") String bookDesc,Book book,HttpServletRequest request){
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
@ -72,7 +71,7 @@ public class AuthorController extends BaseController{
|
||||
* 更新小说状态,上架或下架
|
||||
* */
|
||||
@PostMapping("updateBookStatus")
|
||||
public ResultBean updateBookStatus(Long bookId,Byte status,HttpServletRequest request){
|
||||
public ResultBean<Void> updateBookStatus(Long bookId,Byte status,HttpServletRequest request){
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
//更新小说状态,上架或下架
|
||||
@ -87,7 +86,7 @@ public class AuthorController extends BaseController{
|
||||
* 删除章节
|
||||
*/
|
||||
@DeleteMapping("deleteIndex/{indexId}")
|
||||
public ResultBean deleteIndex(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
public ResultBean<Void> deleteIndex(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
@ -101,7 +100,7 @@ public class AuthorController extends BaseController{
|
||||
* 更新章节名
|
||||
*/
|
||||
@PostMapping("updateIndexName")
|
||||
public ResultBean updateIndexName(Long indexId, String indexName, HttpServletRequest request) {
|
||||
public ResultBean<Void> updateIndexName(Long indexId, String indexName, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
@ -118,7 +117,7 @@ public class AuthorController extends BaseController{
|
||||
* 发布章节内容
|
||||
*/
|
||||
@PostMapping("addBookContent")
|
||||
public ResultBean addBookContent(Long bookId, String indexName, String content,Byte isVip, HttpServletRequest request) {
|
||||
public ResultBean<Void> addBookContent(Long bookId, String indexName, String content,Byte isVip, HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
content = content.replaceAll("\\n", "<br>")
|
||||
@ -133,7 +132,7 @@ public class AuthorController extends BaseController{
|
||||
* 查询章节内容
|
||||
*/
|
||||
@GetMapping("queryIndexContent/{indexId}")
|
||||
public ResultBean queryIndexContent(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
public ResultBean<String> queryIndexContent(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
@ -149,7 +148,7 @@ public class AuthorController extends BaseController{
|
||||
* 更新章节内容
|
||||
*/
|
||||
@PostMapping("updateBookContent")
|
||||
public ResultBean updateBookContent(Long indexId, String indexName, String content, HttpServletRequest request) {
|
||||
public ResultBean<Void> updateBookContent(Long indexId, String indexName, String content, HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
content = content.replaceAll("\\n", "<br>")
|
||||
@ -164,7 +163,7 @@ public class AuthorController extends BaseController{
|
||||
* 修改小说封面
|
||||
*/
|
||||
@PostMapping("updateBookPic")
|
||||
public ResultBean updateBookPic(@RequestParam("bookId") Long bookId,@RequestParam("bookPic") String bookPic,HttpServletRequest request) {
|
||||
public ResultBean<Void> updateBookPic(@RequestParam("bookId") Long bookId,@RequestParam("bookPic") String bookPic,HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
bookService.updateBookPic(bookId,bookPic, author.getId());
|
||||
return ResultBean.ok();
|
||||
@ -175,12 +174,12 @@ public class AuthorController extends BaseController{
|
||||
* 作家日收入统计数据分页列表查询
|
||||
* */
|
||||
@GetMapping("listIncomeDailyByPage")
|
||||
public ResultBean listIncomeDailyByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
@RequestParam(value = "startTime",defaultValue = "2020-05-01") Date startTime,
|
||||
@RequestParam(value = "endTime",defaultValue = "2030-01-01") Date endTime,
|
||||
HttpServletRequest request){
|
||||
public ResultBean<PageBean<AuthorIncomeDetail>> listIncomeDailyByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
@RequestParam(value = "startTime",defaultValue = "2020-05-01") Date startTime,
|
||||
@RequestParam(value = "endTime",defaultValue = "2030-01-01") Date endTime,
|
||||
HttpServletRequest request){
|
||||
|
||||
return ResultBean.ok(authorService.listIncomeDailyByPage(page,pageSize,getUserDetails(request).getId(),bookId,startTime,endTime));
|
||||
}
|
||||
@ -190,10 +189,10 @@ public class AuthorController extends BaseController{
|
||||
* 作家月收入统计数据分页列表查询
|
||||
* */
|
||||
@GetMapping("listIncomeMonthByPage")
|
||||
public ResultBean listIncomeMonthByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
HttpServletRequest request){
|
||||
public ResultBean<PageBean<AuthorIncome>> listIncomeMonthByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
HttpServletRequest request){
|
||||
|
||||
return ResultBean.ok(authorService.listIncomeMonthByPage(page,pageSize,getUserDetails(request).getId(),bookId));
|
||||
}
|
||||
|
@ -6,7 +6,11 @@ import com.java2nb.novel.core.bean.ResultBean;
|
||||
import com.java2nb.novel.core.bean.UserDetails;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.entity.BookCategory;
|
||||
import com.java2nb.novel.entity.BookComment;
|
||||
import com.java2nb.novel.entity.BookIndex;
|
||||
import com.java2nb.novel.vo.BookCommentVO;
|
||||
import com.java2nb.novel.vo.BookSettingVO;
|
||||
import com.java2nb.novel.vo.BookSpVO;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.vo.BookVO;
|
||||
@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -41,7 +46,7 @@ public class BookController extends BaseController{
|
||||
* 查询首页小说设置列表数据
|
||||
* */
|
||||
@GetMapping("listBookSetting")
|
||||
public ResultBean listBookSetting(){
|
||||
public ResultBean<Map<Byte, List<BookSettingVO>>> listBookSetting(){
|
||||
return ResultBean.ok(bookService.listBookSettingVO());
|
||||
}
|
||||
|
||||
@ -49,7 +54,7 @@ public class BookController extends BaseController{
|
||||
* 查询首页点击榜单数据
|
||||
* */
|
||||
@GetMapping("listClickRank")
|
||||
public ResultBean listClickRank(){
|
||||
public ResultBean<List<Book>> listClickRank(){
|
||||
return ResultBean.ok(bookService.listClickRank());
|
||||
}
|
||||
|
||||
@ -57,7 +62,7 @@ public class BookController extends BaseController{
|
||||
* 查询首页新书榜单数据
|
||||
* */
|
||||
@GetMapping("listNewRank")
|
||||
public ResultBean listNewRank(){
|
||||
public ResultBean<List<Book>> listNewRank(){
|
||||
return ResultBean.ok(bookService.listNewRank());
|
||||
}
|
||||
|
||||
@ -65,7 +70,7 @@ public class BookController extends BaseController{
|
||||
* 查询首页更新榜单数据
|
||||
* */
|
||||
@GetMapping("listUpdateRank")
|
||||
public ResultBean listUpdateRank(){
|
||||
public ResultBean<List<BookVO>> listUpdateRank(){
|
||||
return ResultBean.ok(bookService.listUpdateRank());
|
||||
}
|
||||
|
||||
@ -73,7 +78,7 @@ public class BookController extends BaseController{
|
||||
* 查询小说分类列表
|
||||
* */
|
||||
@GetMapping("listBookCategory")
|
||||
public ResultBean listBookCategory(){
|
||||
public ResultBean<List<BookCategory>> listBookCategory(){
|
||||
return ResultBean.ok(bookService.listBookCategory());
|
||||
}
|
||||
|
||||
@ -81,7 +86,7 @@ public class BookController extends BaseController{
|
||||
* 分页搜索
|
||||
* */
|
||||
@GetMapping("searchByPage")
|
||||
public ResultBean searchByPage(BookSpVO bookSP, @RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize){
|
||||
public ResultBean<?> searchByPage(BookSpVO bookSP, @RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize){
|
||||
return ResultBean.ok(bookService.searchByPage(bookSP,page,pageSize));
|
||||
}
|
||||
|
||||
@ -89,7 +94,7 @@ public class BookController extends BaseController{
|
||||
* 查询小说详情信息
|
||||
* */
|
||||
@GetMapping("queryBookDetail/{id}")
|
||||
public ResultBean queryBookDetail(@PathVariable("id") Long id){
|
||||
public ResultBean<Book> queryBookDetail(@PathVariable("id") Long id){
|
||||
return ResultBean.ok(bookService.queryBookDetail(id));
|
||||
}
|
||||
|
||||
@ -98,7 +103,7 @@ public class BookController extends BaseController{
|
||||
* 查询小说排行信息
|
||||
* */
|
||||
@GetMapping("listRank")
|
||||
public ResultBean listRank(@RequestParam(value = "type",defaultValue = "0") Byte type,@RequestParam(value = "limit",defaultValue = "30") Integer limit){
|
||||
public ResultBean<List<Book>> listRank(@RequestParam(value = "type",defaultValue = "0") Byte type,@RequestParam(value = "limit",defaultValue = "30") Integer limit){
|
||||
return ResultBean.ok(bookService.listRank(type,limit));
|
||||
}
|
||||
|
||||
@ -106,7 +111,7 @@ public class BookController extends BaseController{
|
||||
* 增加点击次数
|
||||
* */
|
||||
@PostMapping("addVisitCount")
|
||||
public ResultBean addVisitCount(Long bookId){
|
||||
public ResultBean<Void> addVisitCount(Long bookId){
|
||||
if(enableMq == 1) {
|
||||
rabbitTemplate.convertAndSend("ADD-BOOK-VISIT-EXCHANGE", null, bookId);
|
||||
}else {
|
||||
@ -119,7 +124,7 @@ public class BookController extends BaseController{
|
||||
* 查询章节相关信息
|
||||
* */
|
||||
@GetMapping("queryBookIndexAbout")
|
||||
public ResultBean queryBookIndexAbout(Long bookId,Long lastBookIndexId) {
|
||||
public ResultBean<Map<String,Object>> queryBookIndexAbout(Long bookId,Long lastBookIndexId) {
|
||||
Map<String,Object> data = new HashMap<>(2);
|
||||
data.put("bookIndexCount",bookService.queryIndexCount(bookId));
|
||||
String lastBookContent = bookService.queryBookContent(lastBookIndexId).getContent();
|
||||
@ -134,7 +139,7 @@ public class BookController extends BaseController{
|
||||
* 根据分类id查询同类推荐书籍
|
||||
* */
|
||||
@GetMapping("listRecBookByCatId")
|
||||
public ResultBean listRecBookByCatId(Integer catId) {
|
||||
public ResultBean<List<Book>> listRecBookByCatId(Integer catId) {
|
||||
return ResultBean.ok(bookService.listRecBookByCatId(catId));
|
||||
}
|
||||
|
||||
@ -143,7 +148,7 @@ public class BookController extends BaseController{
|
||||
*分页查询书籍评论列表
|
||||
* */
|
||||
@GetMapping("listCommentByPage")
|
||||
public ResultBean listCommentByPage(@RequestParam("bookId") Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize) {
|
||||
public ResultBean<PageBean<BookCommentVO>> listCommentByPage(@RequestParam("bookId") Long bookId, @RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize) {
|
||||
return ResultBean.ok(bookService.listCommentByPage(null,bookId,page,pageSize));
|
||||
}
|
||||
|
||||
@ -151,7 +156,7 @@ public class BookController extends BaseController{
|
||||
* 新增评价
|
||||
* */
|
||||
@PostMapping("addBookComment")
|
||||
public ResultBean addBookComment(BookComment comment, HttpServletRequest request) {
|
||||
public ResultBean<?> addBookComment(BookComment comment, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -164,7 +169,7 @@ public class BookController extends BaseController{
|
||||
* 根据小说ID查询小说前十条最新更新目录集合
|
||||
* */
|
||||
@GetMapping("queryNewIndexList")
|
||||
public ResultBean queryNewIndexList(Long bookId){
|
||||
public ResultBean<List<BookIndex>> queryNewIndexList(Long bookId){
|
||||
return ResultBean.ok(bookService.queryIndexList(bookId,"index_num desc",1,10));
|
||||
}
|
||||
|
||||
@ -172,7 +177,7 @@ public class BookController extends BaseController{
|
||||
* 目录页
|
||||
* */
|
||||
@GetMapping("/queryIndexList")
|
||||
public ResultBean indexList(Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,@RequestParam(value = "orderBy",defaultValue = "index_num desc") String orderBy) {
|
||||
public ResultBean<PageBean<BookIndex>> indexList(Long bookId,@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,@RequestParam(value = "orderBy",defaultValue = "index_num desc") String orderBy) {
|
||||
return ResultBean.ok(new PageBean<>(bookService.queryIndexList(bookId,orderBy,page,pageSize)));
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class CacheController {
|
||||
* @param type 缓存类型,1:首页书籍推荐,2:首页新闻,3:首页友情链接
|
||||
* */
|
||||
@GetMapping("refresh/{pass}/{type}")
|
||||
public ResultBean refreshCache(@PathVariable("type") Byte type, @PathVariable("pass") String pass){
|
||||
public ResultBean<Void> refreshCache(@PathVariable("type") Byte type, @PathVariable("pass") String pass){
|
||||
if(!cacheManagerPass.equals(pass)){
|
||||
return ResultBean.fail(ResponseStatus.PASSWORD_ERROR);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.java2nb.novel.core.bean.ResultBean;
|
||||
import com.java2nb.novel.entity.FriendLink;
|
||||
import com.java2nb.novel.service.FriendLinkService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -9,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@ -24,7 +27,7 @@ public class FriendLinkController {
|
||||
* 查询首页友情链接
|
||||
* */
|
||||
@GetMapping("listIndexLink")
|
||||
public ResultBean listIndexLink(){
|
||||
public ResultBean<List<FriendLink>> listIndexLink(){
|
||||
return ResultBean.ok(friendLinkService.listIndexLink());
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -47,7 +47,6 @@ public class PayController extends BaseController {
|
||||
if (userDetails == null) {
|
||||
//未登录,跳转到登陆页面
|
||||
httpResponse.sendRedirect("/user/login.html?originUrl=/pay/aliPay?payAmount="+payAmount);
|
||||
return;
|
||||
}else {
|
||||
//创建充值订单
|
||||
Long outTradeNo = orderService.createPayOrder((byte)1,payAmount,userDetails.getId());
|
||||
@ -92,11 +91,10 @@ public class PayController extends BaseController {
|
||||
PrintWriter out = httpResponse.getWriter();
|
||||
|
||||
//获取支付宝POST过来反馈信息
|
||||
Map<String,String> params = new HashMap<String,String>();
|
||||
Map<String,String> params = new HashMap<>();
|
||||
Map<String,String[]> requestParams = request.getParameterMap();
|
||||
for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext();) {
|
||||
String name = (String) iter.next();
|
||||
String[] values = (String[]) requestParams.get(name);
|
||||
for (String name : requestParams.keySet()) {
|
||||
String[] values = requestParams.get(name);
|
||||
String valueStr = "";
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||
@ -119,13 +117,13 @@ public class PayController extends BaseController {
|
||||
if(signVerified) {
|
||||
//验证成功
|
||||
//商户订单号
|
||||
String outTradeNo = new String(request.getParameter("out_trade_no").getBytes("ISO-8859-1"),"UTF-8");
|
||||
String outTradeNo = new String(request.getParameter("out_trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
|
||||
//支付宝交易号
|
||||
String tradeNo = new String(request.getParameter("trade_no").getBytes("ISO-8859-1"),"UTF-8");
|
||||
String tradeNo = new String(request.getParameter("trade_no").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
|
||||
//交易状态
|
||||
String tradeStatus = new String(request.getParameter("trade_status").getBytes("ISO-8859-1"),"UTF-8");
|
||||
String tradeStatus = new String(request.getParameter("trade_status").getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
||||
|
||||
//更新订单状态
|
||||
orderService.updatePayOrder(Long.parseLong(outTradeNo), tradeNo, tradeStatus);
|
||||
|
@ -41,7 +41,7 @@ public class UserController extends BaseController {
|
||||
* 登陆
|
||||
*/
|
||||
@PostMapping("login")
|
||||
public ResultBean login(User user) {
|
||||
public ResultBean<Map<String, Object>> login(User user) {
|
||||
|
||||
//登陆
|
||||
UserDetails userDetails = userService.login(user);
|
||||
@ -58,7 +58,7 @@ public class UserController extends BaseController {
|
||||
* 注册
|
||||
*/
|
||||
@PostMapping("register")
|
||||
public ResultBean register(@Validated({AddGroup.class}) User user, @RequestParam(value = "velCode", defaultValue = "") String velCode) {
|
||||
public ResultBean<?> register(@Validated({AddGroup.class}) User user, @RequestParam(value = "velCode", defaultValue = "") String velCode) {
|
||||
|
||||
|
||||
//判断验证码是否正确
|
||||
@ -81,7 +81,7 @@ public class UserController extends BaseController {
|
||||
* 刷新token
|
||||
*/
|
||||
@PostMapping("refreshToken")
|
||||
public ResultBean refreshToken(HttpServletRequest request) {
|
||||
public ResultBean<?> refreshToken(HttpServletRequest request) {
|
||||
String token = getToken(request);
|
||||
if (jwtTokenUtil.canRefresh(token)) {
|
||||
token = jwtTokenUtil.refreshToken(token);
|
||||
@ -102,7 +102,7 @@ public class UserController extends BaseController {
|
||||
* 查询小说是否已加入书架
|
||||
*/
|
||||
@GetMapping("queryIsInShelf")
|
||||
public ResultBean queryIsInShelf(Long bookId, HttpServletRequest request) {
|
||||
public ResultBean<?> queryIsInShelf(Long bookId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -114,7 +114,7 @@ public class UserController extends BaseController {
|
||||
* 加入书架
|
||||
* */
|
||||
@PostMapping("addToBookShelf")
|
||||
public ResultBean addToBookShelf(Long bookId,Long preContentId, HttpServletRequest request) {
|
||||
public ResultBean<Void> addToBookShelf(Long bookId,Long preContentId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -127,7 +127,7 @@ public class UserController extends BaseController {
|
||||
* 移出书架
|
||||
* */
|
||||
@DeleteMapping("removeFromBookShelf/{bookId}")
|
||||
public ResultBean removeFromBookShelf(@PathVariable("bookId") Long bookId, HttpServletRequest request) {
|
||||
public ResultBean<?> removeFromBookShelf(@PathVariable("bookId") Long bookId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -140,7 +140,7 @@ public class UserController extends BaseController {
|
||||
* 分页查询书架
|
||||
* */
|
||||
@GetMapping("listBookShelfByPage")
|
||||
public ResultBean listBookShelfByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) {
|
||||
public ResultBean<?> listBookShelfByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -152,7 +152,7 @@ public class UserController extends BaseController {
|
||||
* 分页查询阅读记录
|
||||
* */
|
||||
@GetMapping("listReadHistoryByPage")
|
||||
public ResultBean listReadHistoryByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) {
|
||||
public ResultBean<?> listReadHistoryByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize,HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -164,7 +164,7 @@ public class UserController extends BaseController {
|
||||
* 添加阅读记录
|
||||
* */
|
||||
@PostMapping("addReadHistory")
|
||||
public ResultBean addReadHistory(Long bookId,Long preContentId, HttpServletRequest request) {
|
||||
public ResultBean<?> addReadHistory(Long bookId,Long preContentId, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -177,7 +177,7 @@ public class UserController extends BaseController {
|
||||
* 添加反馈
|
||||
* */
|
||||
@PostMapping("addFeedBack")
|
||||
public ResultBean addFeedBack(String content, HttpServletRequest request) {
|
||||
public ResultBean<?> addFeedBack(String content, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -190,7 +190,7 @@ public class UserController extends BaseController {
|
||||
* 分页查询我的反馈列表
|
||||
* */
|
||||
@GetMapping("listUserFeedBackByPage")
|
||||
public ResultBean listUserFeedBackByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize, HttpServletRequest request){
|
||||
public ResultBean<?> listUserFeedBackByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize, HttpServletRequest request){
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -202,7 +202,7 @@ public class UserController extends BaseController {
|
||||
* 查询个人信息
|
||||
* */
|
||||
@GetMapping("userInfo")
|
||||
public ResultBean userInfo(HttpServletRequest request) {
|
||||
public ResultBean<?> userInfo(HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -214,7 +214,7 @@ public class UserController extends BaseController {
|
||||
* 更新个人信息
|
||||
* */
|
||||
@PostMapping("updateUserInfo")
|
||||
public ResultBean updateUserInfo(@Validated({UpdateGroup.class}) User user, HttpServletRequest request) {
|
||||
public ResultBean<?> updateUserInfo(@Validated({UpdateGroup.class}) User user, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -234,7 +234,7 @@ public class UserController extends BaseController {
|
||||
* 更新密码
|
||||
* */
|
||||
@PostMapping("updatePassword")
|
||||
public ResultBean updatePassword(String oldPassword,String newPassword1,String newPassword2,HttpServletRequest request) {
|
||||
public ResultBean<?> updatePassword(String oldPassword,String newPassword1,String newPassword2,HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -250,7 +250,7 @@ public class UserController extends BaseController {
|
||||
* 分页查询用户书评
|
||||
* */
|
||||
@GetMapping("listCommentByPage")
|
||||
public ResultBean listCommentByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,HttpServletRequest request) {
|
||||
public ResultBean<?> listCommentByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize,HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
@ -263,7 +263,7 @@ public class UserController extends BaseController {
|
||||
* 购买小说章节
|
||||
* */
|
||||
@PostMapping("buyBookIndex")
|
||||
public ResultBean buyBookIndex(UserBuyRecord buyRecord, HttpServletRequest request) {
|
||||
public ResultBean<?> buyBookIndex(UserBuyRecord buyRecord, HttpServletRequest request) {
|
||||
UserDetails userDetails = getUserDetails(request);
|
||||
if (userDetails == null) {
|
||||
return ResultBean.fail(ResponseStatus.NO_LOGIN);
|
||||
|
@ -30,7 +30,7 @@ public class EsConfig {
|
||||
String uri = uris[i];
|
||||
String scheme = uri.substring(0,uri.indexOf(":")).trim();
|
||||
String hostname = uri.substring(uri.indexOf("://")+3,uri.lastIndexOf(":")).trim();
|
||||
Integer port = Integer.parseInt(uri.substring(uri.lastIndexOf(":")+1).trim());
|
||||
int port = Integer.parseInt(uri.substring(uri.lastIndexOf(":")+1).trim());
|
||||
hosts[i] = new HttpHost(hostname,port,scheme);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class FilterConfig{
|
||||
private String urlPatterns;
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<NovelFilter> filterRegist() {
|
||||
public FilterRegistrationBean<NovelFilter> filterRegister() {
|
||||
FilterRegistrationBean<NovelFilter> frBean = new FilterRegistrationBean<>();
|
||||
frBean.setFilter(new NovelFilter());
|
||||
frBean.addUrlPatterns("/*");
|
||||
@ -41,9 +41,9 @@ public class FilterConfig{
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean xssFilterRegistration()
|
||||
public FilterRegistrationBean<XssFilter> xssFilterRegistration()
|
||||
{
|
||||
FilterRegistrationBean registration = new FilterRegistrationBean();
|
||||
FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>();
|
||||
//
|
||||
registration.setDispatcherTypes(DispatcherType.REQUEST);
|
||||
//过滤器类(继承Filter)
|
||||
|
@ -38,7 +38,7 @@ public class NovelFilter implements Filter {
|
||||
//缓存10天
|
||||
resp.setDateHeader("expires", System.currentTimeMillis()+60*60*24*10*1000);
|
||||
OutputStream out = resp.getOutputStream();
|
||||
InputStream input = new FileInputStream(new File(picSavePath + requestUri));
|
||||
InputStream input = new FileInputStream(picSavePath + requestUri);
|
||||
byte[] b = new byte[4096];
|
||||
for (int n; (n = input.read(b)) != -1; ) {
|
||||
out.write(b, 0, n);
|
||||
|
@ -6,8 +6,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -34,12 +34,10 @@ public class XssFilter implements Filter {
|
||||
String tempEnabled = filterConfig.getInitParameter("enabled");
|
||||
if (StringUtils.isNotBlank(tempExcludes)) {
|
||||
String[] url = tempExcludes.split(",");
|
||||
for (int i = 0; url != null && i < url.length; i++) {
|
||||
excludes.add(url[i]);
|
||||
}
|
||||
excludes.addAll(Arrays.asList(url));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(tempEnabled)) {
|
||||
enabled = Boolean.valueOf(tempEnabled);
|
||||
enabled = Boolean.parseBoolean(tempEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,8 +46,7 @@ public class XssFilter implements Filter {
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
{
|
||||
HttpServletRequest req = (HttpServletRequest) request;
|
||||
HttpServletResponse resp = (HttpServletResponse) response;
|
||||
if (handleExcludeURL(req, resp)) {
|
||||
if (handleExcludeURL(req)) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
@ -57,7 +54,7 @@ public class XssFilter implements Filter {
|
||||
chain.doFilter(xssRequest, response);
|
||||
}
|
||||
|
||||
private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) {
|
||||
private boolean handleExcludeURL(HttpServletRequest request) {
|
||||
if (!enabled) {
|
||||
return true;
|
||||
}
|
||||
|
@ -58,8 +58,8 @@ public class MonthIncomeStaSchedule {
|
||||
//2.查询作家作品
|
||||
List<Book> books = bookService.queryBookList(authorId);
|
||||
|
||||
Long totalPreTaxIncome = 0L;
|
||||
Long totalAfterTaxIncome = 0L;
|
||||
long totalPreTaxIncome = 0L;
|
||||
long totalAfterTaxIncome = 0L;
|
||||
for (Book book : books) {
|
||||
|
||||
Long bookId = book.getId();
|
||||
@ -70,14 +70,14 @@ public class MonthIncomeStaSchedule {
|
||||
|
||||
BigDecimal monthIncomeShare = new BigDecimal(monthIncome)
|
||||
.multiply(authorIncomeConfig.getShareProportion());
|
||||
Long preTaxIncome = monthIncomeShare
|
||||
long preTaxIncome = monthIncomeShare
|
||||
.multiply(authorIncomeConfig.getExchangeProportion())
|
||||
.multiply(new BigDecimal(100))
|
||||
.longValue();
|
||||
|
||||
totalPreTaxIncome += preTaxIncome;
|
||||
|
||||
Long afterTaxIncome = monthIncomeShare
|
||||
long afterTaxIncome = monthIncomeShare
|
||||
.multiply(authorIncomeConfig.getTaxRate())
|
||||
.multiply(authorIncomeConfig.getExchangeProportion())
|
||||
.multiply(new BigDecimal(100))
|
||||
|
@ -12,12 +12,12 @@ public class ThreadLocalUtil {
|
||||
/**
|
||||
* 存储当前线程访问的模板目录
|
||||
* */
|
||||
private static ThreadLocal<String> templateDir = new ThreadLocal<>();
|
||||
private static final ThreadLocal<String> templateDir = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 存储当前会话的sessionID
|
||||
* */
|
||||
private static ThreadLocal<String> clientId = new ThreadLocal<>();
|
||||
private static final ThreadLocal<String> clientId = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 设置当前应该访问的模板目录
|
||||
|
@ -26,12 +26,12 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
String[] values = super.getParameterValues(name);
|
||||
if (values != null) {
|
||||
int length = values.length;
|
||||
String[] escapseValues = new String[length];
|
||||
String[] escapeValues = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
escapseValues[i] = values[i].replaceAll("<", "<").replaceAll(">", ">");
|
||||
escapeValues[i] = values[i].replaceAll("<", "<").replaceAll(">", ">");
|
||||
}
|
||||
return escapseValues;
|
||||
return escapeValues;
|
||||
}
|
||||
return values;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.entity.Author;
|
||||
import com.java2nb.novel.entity.AuthorIncome;
|
||||
import com.java2nb.novel.entity.AuthorIncomeDetail;
|
||||
import com.java2nb.novel.entity.FriendLink;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -1,12 +1,11 @@
|
||||
package com.java2nb.novel.service;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.vo.BookSpVO;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.vo.BookCommentVO;
|
||||
import com.java2nb.novel.vo.BookSettingVO;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.vo.BookSpVO;
|
||||
import com.java2nb.novel.vo.BookVO;
|
||||
|
||||
import java.util.Date;
|
||||
@ -32,7 +31,7 @@ public interface BookService {
|
||||
|
||||
/**
|
||||
* 查询首页新书榜单数据
|
||||
* @return
|
||||
* @return 小说列表
|
||||
* */
|
||||
List<Book> listNewRank();
|
||||
|
||||
@ -49,7 +48,7 @@ public interface BookService {
|
||||
* @param pageSize 分页大小
|
||||
* @return 小说集合分页信息
|
||||
* */
|
||||
PageBean searchByPage(BookSpVO params, int page, int pageSize);
|
||||
PageBean<?> searchByPage(BookSpVO params, int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 查询小说分类列表
|
||||
@ -163,6 +162,7 @@ public interface BookService {
|
||||
* @param workDirection 作品方向
|
||||
* @return 作者ID
|
||||
* */
|
||||
@Deprecated
|
||||
Long getOrCreateAuthorIdByName(String authorName, Byte workDirection);
|
||||
|
||||
|
||||
@ -180,6 +180,7 @@ public interface BookService {
|
||||
* @param bookId 小说ID
|
||||
* @return 目录号集合
|
||||
* */
|
||||
@Deprecated
|
||||
List<Integer> queryIndexNumByBookId(Long bookId);
|
||||
|
||||
/**
|
||||
|
@ -2,24 +2,26 @@ package com.java2nb.novel.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.java2nb.novel.core.bean.PageBean;
|
||||
import com.java2nb.novel.core.cache.CacheKey;
|
||||
import com.java2nb.novel.core.cache.CacheService;
|
||||
import com.java2nb.novel.core.config.BookPriceProperties;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.exception.BusinessException;
|
||||
import com.java2nb.novel.core.utils.*;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.core.utils.Constants;
|
||||
import com.java2nb.novel.core.utils.IdWorker;
|
||||
import com.java2nb.novel.core.utils.StringUtil;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.entity.*;
|
||||
import com.java2nb.novel.mapper.*;
|
||||
import com.java2nb.novel.vo.BookSpVO;
|
||||
import com.java2nb.novel.service.AuthorService;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.FileService;
|
||||
import com.java2nb.novel.service.SearchService;
|
||||
import com.java2nb.novel.vo.BookCommentVO;
|
||||
import com.java2nb.novel.vo.BookSettingVO;
|
||||
import com.java2nb.novel.vo.BookSpVO;
|
||||
import com.java2nb.novel.vo.BookVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
@ -27,7 +29,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mybatis.dynamic.sql.SortSpecification;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategy;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -36,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.orderbyhelper.OrderByHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -187,7 +189,7 @@ public class BookServiceImpl implements BookService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageBean searchByPage(BookSpVO params, int page, int pageSize) {
|
||||
public PageBean<?> searchByPage(BookSpVO params, int page, int pageSize) {
|
||||
|
||||
|
||||
if (params.getUpdatePeriod() != null) {
|
||||
@ -214,7 +216,7 @@ public class BookServiceImpl implements BookService {
|
||||
if (StringUtils.isNotBlank(params.getSort())) {
|
||||
OrderByHelper.orderBy(params.getSort() + " desc");
|
||||
}
|
||||
return new PageBean(bookMapper.searchByPage(params));
|
||||
return new PageBean<>(bookMapper.searchByPage(params));
|
||||
|
||||
|
||||
}
|
||||
@ -565,7 +567,7 @@ public class BookServiceImpl implements BookService {
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
|
||||
//计算价格
|
||||
int bookPrice = new BigDecimal(wordCount).multiply(bookPriceConfig.getValue()).divide(bookPriceConfig.getWordCount(),0,BigDecimal.ROUND_DOWN).intValue();
|
||||
int bookPrice = new BigDecimal(wordCount).multiply(bookPriceConfig.getValue()).divide(bookPriceConfig.getWordCount(),0, RoundingMode.DOWN).intValue();
|
||||
|
||||
//更新小说目录表
|
||||
int indexNum = 0;
|
||||
@ -625,7 +627,7 @@ public class BookServiceImpl implements BookService {
|
||||
List<BookIndex> bookIndices = bookIndexMapper.selectMany(
|
||||
select(BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.wordCount)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategy.MYBATIS3));
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategies.MYBATIS3));
|
||||
if (bookIndices.size() > 0) {
|
||||
BookIndex bookIndex = bookIndices.get(0);
|
||||
//获取小说ID
|
||||
@ -636,7 +638,7 @@ public class BookServiceImpl implements BookService {
|
||||
.from(book)
|
||||
.where(id, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
if (books.size() > 0) {
|
||||
Book book = books.get(0);
|
||||
int wordCount = book.getWordCount();
|
||||
@ -659,7 +661,7 @@ public class BookServiceImpl implements BookService {
|
||||
.orderBy(BookIndexDynamicSqlSupport.indexNum.descending())
|
||||
.limit(1)
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
if (lastBookIndices.size() > 0) {
|
||||
BookIndex lastBookIndex = lastBookIndices.get(0);
|
||||
lastIndexId = lastBookIndex.getId();
|
||||
@ -699,7 +701,7 @@ public class BookServiceImpl implements BookService {
|
||||
List<BookIndex> bookIndices = bookIndexMapper.selectMany(
|
||||
select(BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.wordCount)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategy.MYBATIS3));
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategies.MYBATIS3));
|
||||
if (bookIndices.size() > 0) {
|
||||
BookIndex bookIndex = bookIndices.get(0);
|
||||
//获取小说ID
|
||||
@ -710,7 +712,7 @@ public class BookServiceImpl implements BookService {
|
||||
.from(book)
|
||||
.where(id, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
if (books.size() > 0) {
|
||||
Book book = books.get(0);
|
||||
//作者ID相同,表明该小说是登录用户发布,可以修改
|
||||
@ -724,7 +726,7 @@ public class BookServiceImpl implements BookService {
|
||||
.equalTo(new Date())
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId))
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
|
||||
|
||||
}
|
||||
@ -740,7 +742,7 @@ public class BookServiceImpl implements BookService {
|
||||
List<BookIndex> bookIndices = bookIndexMapper.selectMany(
|
||||
select(BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.wordCount)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategy.MYBATIS3));
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategies.MYBATIS3));
|
||||
if (bookIndices.size() > 0) {
|
||||
BookIndex bookIndex = bookIndices.get(0);
|
||||
//获取小说ID
|
||||
@ -751,7 +753,7 @@ public class BookServiceImpl implements BookService {
|
||||
.from(book)
|
||||
.where(id, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
if (books.size() > 0) {
|
||||
Book book = books.get(0);
|
||||
//作者ID相同,表明该小说是登录用户发布
|
||||
@ -761,7 +763,7 @@ public class BookServiceImpl implements BookService {
|
||||
.from(bookContent)
|
||||
.where(BookContentDynamicSqlSupport.indexId, isEqualTo(indexId))
|
||||
.limit(1)
|
||||
.build().render(RenderingStrategy.MYBATIS3))
|
||||
.build().render(RenderingStrategies.MYBATIS3))
|
||||
.get(0).getContent();
|
||||
}
|
||||
|
||||
@ -778,7 +780,7 @@ public class BookServiceImpl implements BookService {
|
||||
List<BookIndex> bookIndices = bookIndexMapper.selectMany(
|
||||
select(BookIndexDynamicSqlSupport.bookId, BookIndexDynamicSqlSupport.wordCount)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategy.MYBATIS3));
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId)).build().render(RenderingStrategies.MYBATIS3));
|
||||
if (bookIndices.size() > 0) {
|
||||
BookIndex bookIndex = bookIndices.get(0);
|
||||
//获取小说ID
|
||||
@ -789,7 +791,7 @@ public class BookServiceImpl implements BookService {
|
||||
.from(book)
|
||||
.where(id, isEqualTo(bookId))
|
||||
.build()
|
||||
.render(RenderingStrategy.MYBATIS3));
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
if (books.size() > 0) {
|
||||
Book book = books.get(0);
|
||||
//作者ID相同,表明该小说是登录用户发布,可以修改
|
||||
@ -798,11 +800,11 @@ public class BookServiceImpl implements BookService {
|
||||
int wordCount = StringUtil.getStrValidWordCount(content);
|
||||
|
||||
//计算价格
|
||||
int bookPrice = new BigDecimal(wordCount).divide(bookPriceConfig.getWordCount()).multiply(bookPriceConfig.getValue()).intValue();
|
||||
int bookPrice = new BigDecimal(wordCount).multiply(bookPriceConfig.getValue()).divide(bookPriceConfig.getWordCount(),0,RoundingMode.DOWN).intValue();
|
||||
|
||||
|
||||
//更新小说目录表
|
||||
int update = bookIndexMapper.update(
|
||||
bookIndexMapper.update(
|
||||
update(BookIndexDynamicSqlSupport.bookIndex)
|
||||
.set(BookIndexDynamicSqlSupport.indexName)
|
||||
.equalTo(indexName)
|
||||
@ -813,7 +815,7 @@ public class BookServiceImpl implements BookService {
|
||||
.set(BookIndexDynamicSqlSupport.updateTime)
|
||||
.equalTo(currentDate)
|
||||
.where(BookIndexDynamicSqlSupport.id, isEqualTo(indexId))
|
||||
.build().render(RenderingStrategy.MYBATIS3));
|
||||
.build().render(RenderingStrategies.MYBATIS3));
|
||||
|
||||
//更新小说内容表
|
||||
bookContentMapper.update(
|
||||
@ -821,7 +823,7 @@ public class BookServiceImpl implements BookService {
|
||||
.set(BookContentDynamicSqlSupport.content)
|
||||
.equalTo(content)
|
||||
.where(BookContentDynamicSqlSupport.indexId, isEqualTo(indexId))
|
||||
.build().render(RenderingStrategy.MYBATIS3));
|
||||
.build().render(RenderingStrategies.MYBATIS3));
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user