Skip to content

Commit

Permalink
v3.6.0发布
Browse files Browse the repository at this point in the history
  • Loading branch information
x201206030 committed Aug 17, 2021
1 parent e7897c9 commit 80b393f
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 53 deletions.
4 changes: 2 additions & 2 deletions novel-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion novel-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion novel-crawl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion novel-front/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}")
Expand All @@ -44,146 +47,142 @@ 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();
}

/**
* 查询章节相关信息
* */
*/
@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));
}


/**
*分页查询书籍评论列表
* */
* 分页查询书籍评论列表
*/
@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)));
}






}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public interface BookService {
* @param bookIndexId 目录ID
* @return 书籍内容
* */
@Deprecated
BookContent queryBookContent(Long bookIndexId);

/**
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.java2nb</groupId>
<artifactId>novel</artifactId>
<version>3.5.4</version>
<version>3.6.0</version>
<modules>
<module>novel-common</module>
<module>novel-front</module>
Expand Down

0 comments on commit 80b393f

Please sign in to comment.