diff --git a/novel-admin/pom.xml b/novel-admin/pom.xml index 0fed5545..46d059c0 100644 --- a/novel-admin/pom.xml +++ b/novel-admin/pom.xml @@ -5,7 +5,7 @@ com.java2nb novel-admin - 3.5.4 + 3.6.0 jar novel-admin @@ -106,7 +106,7 @@ org.apache.shiro shiro-spring - 1.7.0 + 1.3.2 diff --git a/novel-common/pom.xml b/novel-common/pom.xml index 74b08d7f..f2233f5f 100644 --- a/novel-common/pom.xml +++ b/novel-common/pom.xml @@ -5,7 +5,7 @@ novel com.java2nb - 3.5.4 + 3.6.0 4.0.0 diff --git a/novel-crawl/pom.xml b/novel-crawl/pom.xml index 10710b95..48efbe19 100644 --- a/novel-crawl/pom.xml +++ b/novel-crawl/pom.xml @@ -5,7 +5,7 @@ novel com.java2nb - 3.5.4 + 3.6.0 4.0.0 diff --git a/novel-front/pom.xml b/novel-front/pom.xml index 66fa4596..da5eeac6 100644 --- a/novel-front/pom.xml +++ b/novel-front/pom.xml @@ -5,7 +5,7 @@ novel com.java2nb - 3.5.4 + 3.6.0 4.0.0 diff --git a/novel-front/src/main/java/com/java2nb/novel/controller/BookController.java b/novel-front/src/main/java/com/java2nb/novel/controller/BookController.java index 5bd317a0..6bd02873 100644 --- a/novel-front/src/main/java/com/java2nb/novel/controller/BookController.java +++ b/novel-front/src/main/java/com/java2nb/novel/controller/BookController.java @@ -9,6 +9,7 @@ import com.java2nb.novel.entity.BookCategory; import com.java2nb.novel.entity.BookComment; import com.java2nb.novel.entity.BookIndex; +import com.java2nb.novel.service.BookContentService; import com.java2nb.novel.vo.BookCommentVO; import com.java2nb.novel.vo.BookSettingVO; import com.java2nb.novel.vo.BookSpVO; @@ -32,10 +33,12 @@ @RestController @Slf4j @RequiredArgsConstructor -public class BookController extends BaseController{ +public class BookController extends BaseController { private final BookService bookService; + private final BookContentService bookContentService; + private final RabbitTemplate rabbitTemplate; @Value("${spring.rabbitmq.enable}") @@ -44,77 +47,77 @@ public class BookController extends BaseController{ /** * 查询首页小说设置列表数据 - * */ + */ @GetMapping("listBookSetting") - public ResultBean>> listBookSetting(){ + public ResultBean>> listBookSetting() { return ResultBean.ok(bookService.listBookSettingVO()); } /** * 查询首页点击榜单数据 - * */ + */ @GetMapping("listClickRank") - public ResultBean> listClickRank(){ + public ResultBean> listClickRank() { return ResultBean.ok(bookService.listClickRank()); } /** * 查询首页新书榜单数据 - * */ + */ @GetMapping("listNewRank") - public ResultBean> listNewRank(){ + public ResultBean> listNewRank() { return ResultBean.ok(bookService.listNewRank()); } /** * 查询首页更新榜单数据 - * */ + */ @GetMapping("listUpdateRank") - public ResultBean> listUpdateRank(){ + public ResultBean> listUpdateRank() { return ResultBean.ok(bookService.listUpdateRank()); } /** * 查询小说分类列表 - * */ + */ @GetMapping("listBookCategory") - public ResultBean> listBookCategory(){ + public ResultBean> listBookCategory() { return ResultBean.ok(bookService.listBookCategory()); } /** * 分页搜索 - * */ + */ @GetMapping("searchByPage") - 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)); + 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)); } /** * 查询小说详情信息 - * */ + */ @GetMapping("queryBookDetail/{id}") - public ResultBean queryBookDetail(@PathVariable("id") Long id){ + public ResultBean queryBookDetail(@PathVariable("id") Long id) { return ResultBean.ok(bookService.queryBookDetail(id)); } /** * 查询小说排行信息 - * */ + */ @GetMapping("listRank") - public ResultBean> listRank(@RequestParam(value = "type",defaultValue = "0") Byte type,@RequestParam(value = "limit",defaultValue = "30") Integer limit){ - return ResultBean.ok(bookService.listRank(type,limit)); + public ResultBean> listRank(@RequestParam(value = "type", defaultValue = "0") Byte type, @RequestParam(value = "limit", defaultValue = "30") Integer limit) { + return ResultBean.ok(bookService.listRank(type, limit)); } /** * 增加点击次数 - * */ + */ @PostMapping("addVisitCount") - public ResultBean addVisitCount(Long bookId){ - if(enableMq == 1) { + public ResultBean addVisitCount(Long bookId) { + if (enableMq == 1) { rabbitTemplate.convertAndSend("ADD-BOOK-VISIT-EXCHANGE", null, bookId); - }else { + } else { bookService.addVisitCount(bookId, 1); } return ResultBean.ok(); @@ -122,22 +125,22 @@ public ResultBean addVisitCount(Long bookId){ /** * 查询章节相关信息 - * */ + */ @GetMapping("queryBookIndexAbout") - public ResultBean> queryBookIndexAbout(Long bookId,Long lastBookIndexId) { - Map data = new HashMap<>(2); - data.put("bookIndexCount",bookService.queryIndexCount(bookId)); - String lastBookContent = bookService.queryBookContent(lastBookIndexId).getContent(); - if(lastBookContent.length()>42){ - lastBookContent=lastBookContent.substring(0,42); + public ResultBean> queryBookIndexAbout(Long bookId, Long lastBookIndexId) { + Map data = new HashMap<>(2); + data.put("bookIndexCount", bookService.queryIndexCount(bookId)); + String lastBookContent = bookContentService.queryBookContent(bookId,lastBookIndexId).getContent(); + if (lastBookContent.length() > 42) { + lastBookContent = lastBookContent.substring(0, 42); } - data.put("lastBookContent",lastBookContent); + data.put("lastBookContent", lastBookContent); return ResultBean.ok(data); } /** * 根据分类id查询同类推荐书籍 - * */ + */ @GetMapping("listRecBookByCatId") public ResultBean> listRecBookByCatId(Integer catId) { return ResultBean.ok(bookService.listRecBookByCatId(catId)); @@ -145,45 +148,41 @@ public ResultBean> listRecBookByCatId(Integer catId) { /** - *分页查询书籍评论列表 - * */ + * 分页查询书籍评论列表 + */ @GetMapping("listCommentByPage") public ResultBean> 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)); + return ResultBean.ok(bookService.listCommentByPage(null, bookId, page, pageSize)); } /** * 新增评价 - * */ + */ @PostMapping("addBookComment") public ResultBean addBookComment(BookComment comment, HttpServletRequest request) { UserDetails userDetails = getUserDetails(request); if (userDetails == null) { return ResultBean.fail(ResponseStatus.NO_LOGIN); } - bookService.addBookComment(userDetails.getId(),comment); + bookService.addBookComment(userDetails.getId(), comment); return ResultBean.ok(); } /** * 根据小说ID查询小说前十条最新更新目录集合 - * */ + */ @GetMapping("queryNewIndexList") - public ResultBean> queryNewIndexList(Long bookId){ - return ResultBean.ok(bookService.queryIndexList(bookId,"index_num desc",1,10)); + public ResultBean> queryNewIndexList(Long bookId) { + return ResultBean.ok(bookService.queryIndexList(bookId, "index_num desc", 1, 10)); } /** * 目录页 - * */ + */ @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) { - return ResultBean.ok(new PageBean<>(bookService.queryIndexList(bookId,orderBy,page,pageSize))); + 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) { + return ResultBean.ok(new PageBean<>(bookService.queryIndexList(bookId, orderBy, page, pageSize))); } - - - - } diff --git a/novel-front/src/main/java/com/java2nb/novel/service/BookService.java b/novel-front/src/main/java/com/java2nb/novel/service/BookService.java index 02247d3d..36b279eb 100644 --- a/novel-front/src/main/java/com/java2nb/novel/service/BookService.java +++ b/novel-front/src/main/java/com/java2nb/novel/service/BookService.java @@ -101,6 +101,7 @@ public interface BookService { * @param bookIndexId 目录ID * @return 书籍内容 * */ + @Deprecated BookContent queryBookContent(Long bookIndexId); /** diff --git a/pom.xml b/pom.xml index 4b466417..05469054 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.java2nb novel - 3.5.4 + 3.6.0 novel-common novel-front