mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-26 17:20:52 +00:00
v3.6.0发布
This commit is contained in:
parent
e7897c988a
commit
80b393fdda
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.java2nb</groupId>
|
||||
<artifactId>novel-admin</artifactId>
|
||||
<version>3.5.4</version>
|
||||
<version>3.6.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>novel-admin</name>
|
||||
@ -106,7 +106,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<!-- shiro ehcache -->
|
||||
<dependency>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>3.5.4</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>3.5.4</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>3.5.4</version>
|
||||
<version>3.6.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -9,6 +9,7 @@ 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.service.BookContentService;
|
||||
import com.java2nb.novel.vo.BookCommentVO;
|
||||
import com.java2nb.novel.vo.BookSettingVO;
|
||||
import com.java2nb.novel.vo.BookSpVO;
|
||||
@ -32,10 +33,12 @@ import java.util.Map;
|
||||
@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<Map<Byte, List<BookSettingVO>>> listBookSetting(){
|
||||
public ResultBean<Map<Byte, List<BookSettingVO>>> listBookSetting() {
|
||||
return ResultBean.ok(bookService.listBookSettingVO());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询首页点击榜单数据
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listClickRank")
|
||||
public ResultBean<List<Book>> listClickRank(){
|
||||
public ResultBean<List<Book>> listClickRank() {
|
||||
return ResultBean.ok(bookService.listClickRank());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询首页新书榜单数据
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listNewRank")
|
||||
public ResultBean<List<Book>> listNewRank(){
|
||||
public ResultBean<List<Book>> listNewRank() {
|
||||
return ResultBean.ok(bookService.listNewRank());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询首页更新榜单数据
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listUpdateRank")
|
||||
public ResultBean<List<BookVO>> listUpdateRank(){
|
||||
public ResultBean<List<BookVO>> listUpdateRank() {
|
||||
return ResultBean.ok(bookService.listUpdateRank());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小说分类列表
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listBookCategory")
|
||||
public ResultBean<List<BookCategory>> listBookCategory(){
|
||||
public ResultBean<List<BookCategory>> 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<Book> queryBookDetail(@PathVariable("id") Long id){
|
||||
public ResultBean<Book> queryBookDetail(@PathVariable("id") Long id) {
|
||||
return ResultBean.ok(bookService.queryBookDetail(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询小说排行信息
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listRank")
|
||||
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));
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加点击次数
|
||||
* */
|
||||
*/
|
||||
@PostMapping("addVisitCount")
|
||||
public ResultBean<Void> addVisitCount(Long bookId){
|
||||
if(enableMq == 1) {
|
||||
public ResultBean<Void> 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 class BookController extends BaseController{
|
||||
|
||||
/**
|
||||
* 查询章节相关信息
|
||||
* */
|
||||
*/
|
||||
@GetMapping("queryBookIndexAbout")
|
||||
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();
|
||||
if(lastBookContent.length()>42){
|
||||
lastBookContent=lastBookContent.substring(0,42);
|
||||
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 = 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<List<Book>> listRecBookByCatId(Integer catId) {
|
||||
return ResultBean.ok(bookService.listRecBookByCatId(catId));
|
||||
@ -145,45 +148,41 @@ public class BookController extends BaseController{
|
||||
|
||||
|
||||
/**
|
||||
*分页查询书籍评论列表
|
||||
* */
|
||||
* 分页查询书籍评论列表
|
||||
*/
|
||||
@GetMapping("listCommentByPage")
|
||||
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));
|
||||
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<List<BookIndex>> queryNewIndexList(Long bookId){
|
||||
return ResultBean.ok(bookService.queryIndexList(bookId,"index_num desc",1,10));
|
||||
public ResultBean<List<BookIndex>> queryNewIndexList(Long bookId) {
|
||||
return ResultBean.ok(bookService.queryIndexList(bookId, "index_num desc", 1, 10));
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录页
|
||||
* */
|
||||
*/
|
||||
@GetMapping("/queryIndexList")
|
||||
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)));
|
||||
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)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ public interface BookService {
|
||||
* @param bookIndexId 目录ID
|
||||
* @return 书籍内容
|
||||
* */
|
||||
@Deprecated
|
||||
BookContent queryBookContent(Long bookIndexId);
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user