v3.6.0发布

This commit is contained in:
xiongxiaoyang 2021-08-17 21:07:33 +08:00
parent e7897c988a
commit 80b393fdda
7 changed files with 53 additions and 53 deletions

View File

@ -5,7 +5,7 @@
<groupId>com.java2nb</groupId> <groupId>com.java2nb</groupId>
<artifactId>novel-admin</artifactId> <artifactId>novel-admin</artifactId>
<version>3.5.4</version> <version>3.6.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>novel-admin</name> <name>novel-admin</name>
@ -106,7 +106,7 @@
<dependency> <dependency>
<groupId>org.apache.shiro</groupId> <groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId> <artifactId>shiro-spring</artifactId>
<version>1.7.0</version> <version>1.3.2</version>
</dependency> </dependency>
<!-- shiro ehcache --> <!-- shiro ehcache -->
<dependency> <dependency>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>novel</artifactId> <artifactId>novel</artifactId>
<groupId>com.java2nb</groupId> <groupId>com.java2nb</groupId>
<version>3.5.4</version> <version>3.6.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>novel</artifactId> <artifactId>novel</artifactId>
<groupId>com.java2nb</groupId> <groupId>com.java2nb</groupId>
<version>3.5.4</version> <version>3.6.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>novel</artifactId> <artifactId>novel</artifactId>
<groupId>com.java2nb</groupId> <groupId>com.java2nb</groupId>
<version>3.5.4</version> <version>3.6.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -9,6 +9,7 @@ import com.java2nb.novel.entity.Book;
import com.java2nb.novel.entity.BookCategory; import com.java2nb.novel.entity.BookCategory;
import com.java2nb.novel.entity.BookComment; import com.java2nb.novel.entity.BookComment;
import com.java2nb.novel.entity.BookIndex; import com.java2nb.novel.entity.BookIndex;
import com.java2nb.novel.service.BookContentService;
import com.java2nb.novel.vo.BookCommentVO; import com.java2nb.novel.vo.BookCommentVO;
import com.java2nb.novel.vo.BookSettingVO; import com.java2nb.novel.vo.BookSettingVO;
import com.java2nb.novel.vo.BookSpVO; import com.java2nb.novel.vo.BookSpVO;
@ -32,10 +33,12 @@ import java.util.Map;
@RestController @RestController
@Slf4j @Slf4j
@RequiredArgsConstructor @RequiredArgsConstructor
public class BookController extends BaseController{ public class BookController extends BaseController {
private final BookService bookService; private final BookService bookService;
private final BookContentService bookContentService;
private final RabbitTemplate rabbitTemplate; private final RabbitTemplate rabbitTemplate;
@Value("${spring.rabbitmq.enable}") @Value("${spring.rabbitmq.enable}")
@ -44,77 +47,77 @@ public class BookController extends BaseController{
/** /**
* 查询首页小说设置列表数据 * 查询首页小说设置列表数据
* */ */
@GetMapping("listBookSetting") @GetMapping("listBookSetting")
public ResultBean<Map<Byte, List<BookSettingVO>>> listBookSetting(){ public ResultBean<Map<Byte, List<BookSettingVO>>> listBookSetting() {
return ResultBean.ok(bookService.listBookSettingVO()); return ResultBean.ok(bookService.listBookSettingVO());
} }
/** /**
* 查询首页点击榜单数据 * 查询首页点击榜单数据
* */ */
@GetMapping("listClickRank") @GetMapping("listClickRank")
public ResultBean<List<Book>> listClickRank(){ public ResultBean<List<Book>> listClickRank() {
return ResultBean.ok(bookService.listClickRank()); return ResultBean.ok(bookService.listClickRank());
} }
/** /**
* 查询首页新书榜单数据 * 查询首页新书榜单数据
* */ */
@GetMapping("listNewRank") @GetMapping("listNewRank")
public ResultBean<List<Book>> listNewRank(){ public ResultBean<List<Book>> listNewRank() {
return ResultBean.ok(bookService.listNewRank()); return ResultBean.ok(bookService.listNewRank());
} }
/** /**
* 查询首页更新榜单数据 * 查询首页更新榜单数据
* */ */
@GetMapping("listUpdateRank") @GetMapping("listUpdateRank")
public ResultBean<List<BookVO>> listUpdateRank(){ public ResultBean<List<BookVO>> listUpdateRank() {
return ResultBean.ok(bookService.listUpdateRank()); return ResultBean.ok(bookService.listUpdateRank());
} }
/** /**
* 查询小说分类列表 * 查询小说分类列表
* */ */
@GetMapping("listBookCategory") @GetMapping("listBookCategory")
public ResultBean<List<BookCategory>> listBookCategory(){ public ResultBean<List<BookCategory>> listBookCategory() {
return ResultBean.ok(bookService.listBookCategory()); return ResultBean.ok(bookService.listBookCategory());
} }
/** /**
* 分页搜索 * 分页搜索
* */ */
@GetMapping("searchByPage") @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)); return ResultBean.ok(bookService.searchByPage(bookSP, page, pageSize));
} }
/** /**
* 查询小说详情信息 * 查询小说详情信息
* */ */
@GetMapping("queryBookDetail/{id}") @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)); return ResultBean.ok(bookService.queryBookDetail(id));
} }
/** /**
* 查询小说排行信息 * 查询小说排行信息
* */ */
@GetMapping("listRank") @GetMapping("listRank")
public ResultBean<List<Book>> 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)); return ResultBean.ok(bookService.listRank(type, limit));
} }
/** /**
* 增加点击次数 * 增加点击次数
* */ */
@PostMapping("addVisitCount") @PostMapping("addVisitCount")
public ResultBean<Void> addVisitCount(Long bookId){ public ResultBean<Void> addVisitCount(Long bookId) {
if(enableMq == 1) { if (enableMq == 1) {
rabbitTemplate.convertAndSend("ADD-BOOK-VISIT-EXCHANGE", null, bookId); rabbitTemplate.convertAndSend("ADD-BOOK-VISIT-EXCHANGE", null, bookId);
}else { } else {
bookService.addVisitCount(bookId, 1); bookService.addVisitCount(bookId, 1);
} }
return ResultBean.ok(); return ResultBean.ok();
@ -122,22 +125,22 @@ public class BookController extends BaseController{
/** /**
* 查询章节相关信息 * 查询章节相关信息
* */ */
@GetMapping("queryBookIndexAbout") @GetMapping("queryBookIndexAbout")
public ResultBean<Map<String,Object>> queryBookIndexAbout(Long bookId,Long lastBookIndexId) { public ResultBean<Map<String, Object>> queryBookIndexAbout(Long bookId, Long lastBookIndexId) {
Map<String,Object> data = new HashMap<>(2); Map<String, Object> data = new HashMap<>(2);
data.put("bookIndexCount",bookService.queryIndexCount(bookId)); data.put("bookIndexCount", bookService.queryIndexCount(bookId));
String lastBookContent = bookService.queryBookContent(lastBookIndexId).getContent(); String lastBookContent = bookContentService.queryBookContent(bookId,lastBookIndexId).getContent();
if(lastBookContent.length()>42){ if (lastBookContent.length() > 42) {
lastBookContent=lastBookContent.substring(0,42); lastBookContent = lastBookContent.substring(0, 42);
} }
data.put("lastBookContent",lastBookContent); data.put("lastBookContent", lastBookContent);
return ResultBean.ok(data); return ResultBean.ok(data);
} }
/** /**
* 根据分类id查询同类推荐书籍 * 根据分类id查询同类推荐书籍
* */ */
@GetMapping("listRecBookByCatId") @GetMapping("listRecBookByCatId")
public ResultBean<List<Book>> listRecBookByCatId(Integer catId) { public ResultBean<List<Book>> listRecBookByCatId(Integer catId) {
return ResultBean.ok(bookService.listRecBookByCatId(catId)); return ResultBean.ok(bookService.listRecBookByCatId(catId));
@ -145,45 +148,41 @@ public class BookController extends BaseController{
/** /**
*分页查询书籍评论列表 * 分页查询书籍评论列表
* */ */
@GetMapping("listCommentByPage") @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) { 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") @PostMapping("addBookComment")
public ResultBean<?> addBookComment(BookComment comment, HttpServletRequest request) { public ResultBean<?> addBookComment(BookComment comment, HttpServletRequest request) {
UserDetails userDetails = getUserDetails(request); UserDetails userDetails = getUserDetails(request);
if (userDetails == null) { if (userDetails == null) {
return ResultBean.fail(ResponseStatus.NO_LOGIN); return ResultBean.fail(ResponseStatus.NO_LOGIN);
} }
bookService.addBookComment(userDetails.getId(),comment); bookService.addBookComment(userDetails.getId(), comment);
return ResultBean.ok(); return ResultBean.ok();
} }
/** /**
* 根据小说ID查询小说前十条最新更新目录集合 * 根据小说ID查询小说前十条最新更新目录集合
* */ */
@GetMapping("queryNewIndexList") @GetMapping("queryNewIndexList")
public ResultBean<List<BookIndex>> queryNewIndexList(Long bookId){ public ResultBean<List<BookIndex>> queryNewIndexList(Long bookId) {
return ResultBean.ok(bookService.queryIndexList(bookId,"index_num desc",1,10)); return ResultBean.ok(bookService.queryIndexList(bookId, "index_num desc", 1, 10));
} }
/** /**
* 目录页 * 目录页
* */ */
@GetMapping("/queryIndexList") @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) { 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))); return ResultBean.ok(new PageBean<>(bookService.queryIndexList(bookId, orderBy, page, pageSize)));
} }
} }

View File

@ -101,6 +101,7 @@ public interface BookService {
* @param bookIndexId 目录ID * @param bookIndexId 目录ID
* @return 书籍内容 * @return 书籍内容
* */ * */
@Deprecated
BookContent queryBookContent(Long bookIndexId); BookContent queryBookContent(Long bookIndexId);
/** /**

View File

@ -5,7 +5,7 @@
<groupId>com.java2nb</groupId> <groupId>com.java2nb</groupId>
<artifactId>novel</artifactId> <artifactId>novel</artifactId>
<version>3.5.4</version> <version>3.6.0</version>
<modules> <modules>
<module>novel-common</module> <module>novel-common</module>
<module>novel-front</module> <module>novel-front</module>