From eb947705462d4b9e6ede596646a257f7e2218675 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Wed, 28 May 2025 09:03:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=B5=B7=E5=A4=96=E8=AF=BB?= =?UTF-8?q?=E4=B9=A6=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BookAbroadController.java | 118 ------- .../bookAbroad/controller/HomeController.java | 304 ------------------ .../controller/OrderController.java | 87 ----- .../service/BookAbroadCommentLikeService.java | 7 - .../service/BookAbroadCommentService.java | 7 - .../service/BookAbroadLableService.java | 7 - .../service/BookAbroadToLableService.java | 7 - .../BookAbroadCommentLikeServiceImpl.java | 13 - .../impl/BookAbroadCommentServiceImpl.java | 13 - .../impl/BookAbroadLableServiceImpl.java | 13 - .../impl/BookAbroadToLableServiceImpl.java | 13 - .../common/dao/BookAbroadCommentDao.java | 9 - .../common/dao/BookAbroadCommentLikeDao.java | 9 - .../common/dao/BookAbroadLableDao.java | 9 - .../common/dao/BookAbroadToLableDao.java | 9 - .../common/entity/BookAbroadComment.java | 41 --- .../common/entity/BookAbroadCommentLike.java | 22 -- .../common/entity/BookAbroadLable.java | 59 ---- .../common/entity/BookAbroadToLable.java | 40 --- .../controller/BookAbroadController.java | 185 ----------- .../service/BookAbroadCommentLikeService.java | 7 - .../service/BookAbroadCommentService.java | 7 - .../service/BookAbroadLableService.java | 7 - .../service/BookAbroadToLableService.java | 7 - .../BookAbroadCommentLikeServiceImpl.java | 13 - .../impl/BookAbroadCommentServiceImpl.java | 13 - .../impl/BookAbroadLableServiceImpl.java | 13 - .../impl/BookAbroadToLableServiceImpl.java | 13 - 28 files changed, 1052 deletions(-) delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/controller/BookAbroadController.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/controller/OrderController.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentLikeService.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentService.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadLableService.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadToLableService.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentLikeServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadLableServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadToLableServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/common/dao/BookAbroadCommentDao.java delete mode 100644 src/main/java/com/peanut/modules/common/dao/BookAbroadCommentLikeDao.java delete mode 100644 src/main/java/com/peanut/modules/common/dao/BookAbroadLableDao.java delete mode 100644 src/main/java/com/peanut/modules/common/dao/BookAbroadToLableDao.java delete mode 100644 src/main/java/com/peanut/modules/common/entity/BookAbroadComment.java delete mode 100644 src/main/java/com/peanut/modules/common/entity/BookAbroadCommentLike.java delete mode 100644 src/main/java/com/peanut/modules/common/entity/BookAbroadLable.java delete mode 100644 src/main/java/com/peanut/modules/common/entity/BookAbroadToLable.java delete mode 100644 src/main/java/com/peanut/modules/master/controller/BookAbroadController.java delete mode 100644 src/main/java/com/peanut/modules/master/service/BookAbroadCommentLikeService.java delete mode 100644 src/main/java/com/peanut/modules/master/service/BookAbroadCommentService.java delete mode 100644 src/main/java/com/peanut/modules/master/service/BookAbroadLableService.java delete mode 100644 src/main/java/com/peanut/modules/master/service/BookAbroadToLableService.java delete mode 100644 src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentLikeServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/master/service/impl/BookAbroadLableServiceImpl.java delete mode 100644 src/main/java/com/peanut/modules/master/service/impl/BookAbroadToLableServiceImpl.java diff --git a/src/main/java/com/peanut/modules/bookAbroad/controller/BookAbroadController.java b/src/main/java/com/peanut/modules/bookAbroad/controller/BookAbroadController.java deleted file mode 100644 index 93ebd330..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/controller/BookAbroadController.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.peanut.modules.bookAbroad.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.peanut.common.utils.R; -import com.peanut.common.utils.ShiroUtils; -import com.peanut.modules.bookAbroad.service.BookAbroadCommentLikeService; -import com.peanut.modules.bookAbroad.service.BookAbroadCommentService; -import com.peanut.modules.bookAbroad.service.BookAbroadLableService; -import com.peanut.modules.bookAbroad.service.BookAbroadToLableService; -import com.peanut.modules.common.entity.*; -import com.peanut.modules.common.service.MyUserService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Slf4j -@RestController("bookAbroad") -@RequestMapping("bookAbroad") -public class BookAbroadController { - - @Autowired - private MyUserService userService; - @Autowired - private BookAbroadCommentService bookAbroadCommentService; - @Autowired - private BookAbroadCommentLikeService bookAbroadCommentLikeService; - - //评论 - @RequestMapping("/insertBookAbroadComment") - public R insertBookAbroadComment(@RequestBody BookAbroadComment comment){ - comment.setUserId(ShiroUtils.getUId()); - bookAbroadCommentService.save(comment); - return R.ok(); - } - - //评论树 - @RequestMapping("/getBookAbroadCommentTree") - public R getBookAbroadCommentTree(@RequestBody Map params) { - int current = Integer.parseInt(params.get("current").toString())-1; - int limit = Integer.parseInt(params.get("limit").toString()); - List comments = bookAbroadCommentService.list(new LambdaQueryWrapper() - .eq(BookAbroadComment::getBookId,params.get("bookId")) - .orderByDesc(BookAbroadComment::getId)); - int commentsCount = comments.stream().filter((bookAbroadComment) -> bookAbroadComment.getPid() == 0).collect(Collectors.toList()).size(); - List commentsTree = comments.stream() - .filter((bookAbroadComment) -> bookAbroadComment.getPid() == 0) - .map((comment)->{ - comment.setIsLike(bookAbroadCommentLikeService.count(new LambdaQueryWrapper() - .eq(BookAbroadCommentLike::getCommentId,comment.getId()) - .eq(BookAbroadCommentLike::getUserId,ShiroUtils.getUId()))); - comment.setLikeCount(bookAbroadCommentLikeService.count(new LambdaQueryWrapper() - .eq(BookAbroadCommentLike::getCommentId,comment.getId()))); - comment.setUserEntity(userService.getOne(new LambdaQueryWrapper() - .select(MyUserEntity::getId,MyUserEntity::getName,MyUserEntity::getNickname,MyUserEntity::getAvatar) - .eq(MyUserEntity::getId,comment.getUserId()))); - comment.setChildren(getLabelChildrens(comment,comments)); - return comment; }) - .sorted((comment1,comment2)->{ - return comment2.getLikeCount() - comment1.getLikeCount();}) - .collect(Collectors.toList()) - .subList(current*limit,((current*limit)+limit) getLabelChildrens(BookAbroadComment root,List all){ - List children = all.stream().filter(bookAbroadComment -> { - return root.getId().equals(bookAbroadComment.getPid()); - }).map(bookAbroadComment -> { - bookAbroadComment.setIsLike(bookAbroadCommentLikeService.count(new LambdaQueryWrapper() - .eq(BookAbroadCommentLike::getCommentId,bookAbroadComment.getId()) - .eq(BookAbroadCommentLike::getUserId,ShiroUtils.getUId()))); - bookAbroadComment.setLikeCount(bookAbroadCommentLikeService.count(new LambdaQueryWrapper() - .eq(BookAbroadCommentLike::getCommentId,bookAbroadComment.getId()))); - bookAbroadComment.setUserEntity(userService.getOne(new LambdaQueryWrapper() - .select(MyUserEntity::getId,MyUserEntity::getName,MyUserEntity::getNickname,MyUserEntity::getAvatar) - .eq(MyUserEntity::getId,bookAbroadComment.getUserId()))); - bookAbroadComment.setChildren(getLabelChildrens(bookAbroadComment, all)); - return bookAbroadComment; - }).collect(Collectors.toList()); - return children; - } - //删除评论 - @RequestMapping("/delBookAbroadComment") - public R delBookAbroadComment(@RequestBody Map params){ - bookAbroadCommentService.removeById(params.get("commentId").toString()); - return R.ok(); - } - //点赞 - @RequestMapping("/insertBookAbroadCommentLike") - public R insertBookAbroadCommentLike(@RequestBody BookAbroadCommentLike commentLike){ - int count = bookAbroadCommentLikeService.count(new LambdaQueryWrapper() - .eq(BookAbroadCommentLike::getCommentId,commentLike.getCommentId()) - .eq(BookAbroadCommentLike::getUserId,ShiroUtils.getUId())); - if (count > 0) { - return R.error("已点赞"); - } - commentLike.setUserId(ShiroUtils.getUId()); - bookAbroadCommentLikeService.save(commentLike); - return R.ok(); - } - //取消点赞 - @RequestMapping("/delBookAbroadCommentLike") - public R delBookAbroadCommentLike(@RequestBody Map params){ - bookAbroadCommentLikeService.remove(new LambdaQueryWrapper() - .eq(BookAbroadCommentLike::getCommentId,params.get("commentId")) - .eq(BookAbroadCommentLike::getUserId,ShiroUtils.getUId())); - return R.ok(); - } - - - -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java b/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java deleted file mode 100644 index d26e5ccf..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.peanut.modules.bookAbroad.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.github.yulichang.wrapper.MPJLambdaWrapper; -import com.peanut.common.utils.DateUtil; -import com.peanut.common.utils.R; -import com.peanut.common.utils.ShiroUtils; -import com.peanut.modules.book.service.*; -import com.peanut.modules.common.entity.*; -import com.peanut.modules.master.service.BookAbroadToLableService; -import com.peanut.modules.bookAbroad.service.BookAbroadLableService; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.apache.http.client.utils.DateUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.*; -import java.util.stream.Collectors; - -@Slf4j -@RestController("bookAbroadHome") -@RequestMapping("bookAbroad/home") -public class HomeController { - - @Autowired - private BookReadRateService bookReadRateService; - @Autowired - private UserEbookBuyService userEbookBuyService; - @Autowired - private BookListeningService bookListeningService; - @Autowired - private BookService bookService; - @Autowired - private BookAbroadLableService lableService; - @Autowired - private BookAbroadToLableService toLableService; - @Autowired - private AuthorService authorService; - @Autowired - private BookChapterService bookChapterService; - @Autowired - private BookChapterContentService bookChapterContentService; - @Autowired - private BuyOrderService buyOrderService; - - //我的图书 - @RequestMapping("/getMyBooks") - public R getMyBooks(@RequestBody Map params){ - MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); - wrapper.leftJoin(BookEntity.class,BookEntity::getId,UserEbookBuyEntity::getBookId); - wrapper.eq(UserEbookBuyEntity::getUserId,ShiroUtils.getUId()); - wrapper.select(BookEntity::getId,BookEntity::getName,BookEntity::getImages); - wrapper.groupBy(UserEbookBuyEntity::getBookId); - Page p = userEbookBuyService.pageMaps(new Page<>( - Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper); - List> list = p.getRecords(); - for (Map map:list) { - BookReadRateEntity brr = bookReadRateService.getOne(new LambdaQueryWrapper() - .eq(BookReadRateEntity::getUserId, ShiroUtils.getUId()) - .eq(BookReadRateEntity::getBookId,map.get("id"))); - map.put("precent",brr==null?"0":brr.getPrecent()==null?"0":brr.getPrecent()); - map.put("sort",brr==null?0:brr.getUpdateTime()==null?0:brr.getUpdateTime().getTime()); - } - list = list.stream().sorted((map1,map2)->{ - return Long.compare((Long) map2.get("sort"),(Long) map1.get("sort")); - }).collect(Collectors.toList()); - p.setRecords(list); - return R.ok().put("page",p); - } - - //推荐图书 - @RequestMapping("/getRecommendBooks") - public R getRecommendBooks(){ - //查询已购买图书 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(UserEbookBuyEntity::getUserId,ShiroUtils.getUId()); - wrapper.groupBy(UserEbookBuyEntity::getBookId); - Set bookIds = userEbookBuyService.getBaseMapper().selectList(wrapper).stream() - .map(UserEbookBuyEntity::getBookId).collect(Collectors.toSet()); - //查询未购买图书 - List noBooks = bookService.list(new LambdaQueryWrapper() - .eq(BookEntity::getState,1) - .eq(BookEntity::getBookType,0) - .notIn(BookEntity::getId,bookIds.size()==0?0:bookIds) - .last("limit 2")); - Set books = new HashSet<>(); - //查询阅读进度 - List readRateList = bookReadRateService.list(new LambdaQueryWrapper() - .eq(BookReadRateEntity::getUserId,ShiroUtils.getUId()) - .orderByDesc(BookReadRateEntity::getUpdateTime)); - //根据阅读记录,查询同标签下书籍 - if (readRateList.size()>0){ - //书籍绑定的标签 - List tolableBookList = toLableService.list(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getBookId,readRateList.get(0).getBookId())); - for (BookAbroadToLable tolableBook : tolableBookList) { - //标签下的书籍 - List tolableLableList = toLableService.list(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getLableId,tolableBook.getLableId())); - for (BookAbroadToLable tolableLable : tolableLableList) { - if (bookIds.add(tolableLable.getBookId())) { - books.add(bookService.getById(tolableLable.getBookId())); - if (books.size()==2){ - break; - } - } - } - } - } - //补充标签未填满位置 - if (books.size()!=2){ - int surplus = 2-books.size(); - for (int i=0;i params) { - List list = lableService.list(new LambdaQueryWrapper() - .eq(BookAbroadLable::getPid,0) - .eq(BookAbroadLable::getType,params.get("type"))); - return R.ok().put("lableList",list); - } - - //获取子标签 - @RequestMapping("/getBookAbroadLableListByPid") - public R getBookAbroadLableListByPid(@RequestBody Map params) { - List list = lableService.list(new LambdaQueryWrapper() - .eq(BookAbroadLable::getPid,params.get("pid"))); - return R.ok().put("lableList",list); - } - - //通过标签获取绑定图书 - @RequestMapping("/getAbroadBookListByLable") - public R getAbroadBookListByLable(@RequestBody Map params) { - MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); - wrapper.leftJoin(BookEntity.class,BookEntity::getId,BookAbroadToLable::getBookId); - wrapper.selectAs(BookAbroadToLable::getId,"toLableId"); - wrapper.selectAs(BookEntity::getId,"bookId"); - wrapper.selectAs(BookEntity::getAbroadPrice,"abroadPrice"); - wrapper.select(BookEntity::getImages); - wrapper.select(BookEntity::getName); - wrapper.eq(BookAbroadToLable::getLableId,params.get("lableId")); - wrapper.orderByAsc(BookAbroadToLable::getSort); - List> list = toLableService.listMaps(wrapper); - for (Map map : list) { - int readCount = bookReadRateService.count(new LambdaQueryWrapper() - .eq(BookReadRateEntity::getBookId,map.get("bookId"))); - int buyCount = userEbookBuyService.count(new LambdaQueryWrapper() - .eq(UserEbookBuyEntity::getBookId,map.get("bookId"))); - int listenCount = bookListeningService.count(new LambdaQueryWrapper() - .eq(BookListeningEntity::getBookId,map.get("bookId"))); - map.put("readCount",readCount); - map.put("buyCount",buyCount); - map.put("listenCount",listenCount); - } - return R.ok().put("bookList",list); - } - - //图书详情 - @RequestMapping("/getBookInfo") - public R getBookInfo(@RequestBody Map params) { - BookEntity bookEntity = bookService.getById(params.get("bookId").toString()); - bookEntity.setAuthor(authorService.getById(bookEntity.getAuthorId())); - bookEntity.setIsBuy(false); - int count = userEbookBuyService.count(new LambdaQueryWrapper() - .eq(UserEbookBuyEntity::getUserId,ShiroUtils.getUId()) - .eq(UserEbookBuyEntity::getBookId,params.get("bookId"))); - if (count > 0) { - bookEntity.setIsBuy(true); - } - return R.ok().put("bookInfo",bookEntity); - } - - //图书章节 - @RequestMapping("/getBookChapter") - public R getBookChapter(@RequestBody Map params) { - List chapterList = bookChapterService.list(new LambdaQueryWrapper() - .eq(BookChapterEntity::getBookId,params.get("bookId")) - .orderByAsc(BookChapterEntity::getId)); - return R.ok().put("chapterList",chapterList); - } - - //章节内容 - @RequestMapping("/getBookChapterContent") - public R getBookChapterContent(@RequestBody Map params) { - List contentPage = bookChapterContentService.list(new LambdaQueryWrapper() - .eq(BookChapterContentEntity::getBookChatperId,params.get("chapterId")) - .orderByAsc(BookChapterContentEntity::getNumber)); - return R.ok().put("contentPage",contentPage); - } - - //听书时章节内容 - @RequestMapping("/getBookChapterContentListen") - public R getBookChapterContentListen(@RequestBody Map params) { - List bccs = bookChapterContentService.list(new LambdaQueryWrapper() - .eq(BookChapterContentEntity::getBookChatperId,params.get("chapterId")) - .notLike(BookChapterContentEntity::getContent,"http") - .orderByAsc(BookChapterContentEntity::getNumber)); - //给每段话加上在总音频开始的秒数 - double startInt = 0; - for (BookChapterContentEntity bcc : bccs) { - if (StringUtils.isNotBlank(bcc.getVoicesSize())){ - bcc.setVoicesStart((int) startInt); - startInt+=Double.parseDouble(bcc.getVoicesSize()); - } - } - return R.ok().put("bookChapterContents",bccs); - } - - //已读\已买人数 - @RequestMapping("/getBookReadCount") - public R getBookReadCount(@RequestBody Map params){ - int readCount = bookReadRateService.count(new LambdaQueryWrapper() - .eq(BookReadRateEntity::getBookId,params.get("bookId"))); - int buyCount = userEbookBuyService.count(new LambdaQueryWrapper() - .eq(UserEbookBuyEntity::getBookId,params.get("bookId"))); - int listenCount = bookListeningService.count(new LambdaQueryWrapper() - .eq(BookListeningEntity::getBookId,params.get("bookId"))); - return R.ok().put("readCount",readCount).put("buyCount",buyCount).put("listenCount",listenCount); - } - - //获取当前书的阅读记录 - @RequestMapping("/getBookReadRate") - public R getBookReadRate(@RequestBody Map params){ - BookReadRateEntity brr = bookReadRateService.getOne(new LambdaQueryWrapper() - .eq(BookReadRateEntity::getUserId,ShiroUtils.getUId()) - .eq(BookReadRateEntity::getBookId,params.get("bookId"))); - return R.ok().put("bookReadRate",brr); - } - - //新增阅读记录 - @RequestMapping("/insertBookReadRate") - public R insertBookReadRate(@RequestBody BookReadRateEntity bookReadRate){ - //计算百分比 - int count = bookChapterContentService.count(new LambdaQueryWrapper() - .eq(BookChapterContentEntity::getBookId,bookReadRate.getBookId())); - BookChapterContentEntity bcc = bookChapterContentService.getById(bookReadRate.getContentId()); - int pre = bcc.getNumber()*100/count; - bookReadRate.setPrecent(pre); - BookReadRateEntity brr = bookReadRateService.getOne(new LambdaQueryWrapper() - .eq(BookReadRateEntity::getUserId,ShiroUtils.getUId()) - .eq(BookReadRateEntity::getBookId,bookReadRate.getBookId())); - if (brr==null){ - bookReadRate.setUserId(ShiroUtils.getUId()); - bookReadRateService.save(bookReadRate); - }else { - brr.setChapterId(bookReadRate.getChapterId()); - brr.setChapterName(bookReadRate.getChapterName()); - brr.setContentId(bookReadRate.getContentId()); - brr.setPrecent(bookReadRate.getPrecent()); - brr.setUpdateTime(new Date()); - bookReadRateService.updateById(brr); - } - return R.ok(); - } - - //相关图书 - @RequestMapping("/getRecommendBook") - public R getRecommendBook(@RequestBody Map params){ - Set bookList = new HashSet<>(); - //书籍绑定的标签 - List tolableBookList = toLableService.list(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getBookId,params.get("bookId"))); - for (BookAbroadToLable tolableBook : tolableBookList) { - //标签下的书籍 - List tolableLableList = toLableService.list(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getLableId,tolableBook.getLableId())); - for (BookAbroadToLable tolableLable : tolableLableList) { - bookList.add(bookService.getById(tolableLable.getBookId())); - } - } - return R.ok().put("bookList",bookList); - } - - //订单列表 - @RequestMapping("/getAbroadOrderList") - public R getAbroadOrderList(@RequestBody Map params){ - Page orders = buyOrderService.page(new Page<>( - Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),new LambdaQueryWrapper() - .eq(BuyOrder::getUserId,ShiroUtils.getUId()) - .eq(BuyOrder::getCome,3) - .eq(BuyOrder::getOrderType,"abroadBook") - .eq(BuyOrder::getOrderStatus,"3")); - for (BuyOrder bo:orders.getRecords()){ - if ("abroadBook".equals(bo.getOrderType())){ - bo.setBookEntity(bookService.getById(bo.getAbroadBookId())); - } - } - return R.ok().put("orders",orders); - } - - - - -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/controller/OrderController.java b/src/main/java/com/peanut/modules/bookAbroad/controller/OrderController.java deleted file mode 100644 index d4bb5dbd..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/controller/OrderController.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.peanut.modules.bookAbroad.controller; - -import com.baomidou.mybatisplus.core.toolkit.IdWorker; -import com.github.promeg.pinyinhelper.Pinyin; -import com.peanut.common.utils.R; -import com.peanut.common.utils.ShiroUtils; -import com.peanut.config.Constants; -import com.peanut.modules.book.service.BuyOrderService; -import com.peanut.modules.book.service.TransactionDetailsService; -import com.peanut.modules.book.service.UserEbookBuyService; -import com.peanut.modules.common.entity.BookEntity; -import com.peanut.modules.common.entity.BuyOrder; -import com.peanut.modules.common.entity.MyUserEntity; -import com.peanut.modules.common.service.BookService; -import com.peanut.modules.common.service.MyUserService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -@Slf4j -@RestController("bookAbroadOrder") -@RequestMapping("bookAbroad/order") -public class OrderController { - - @Autowired - private BookService bookService; - @Autowired - private MyUserService myUserService; - @Autowired - private BuyOrderService buyOrderService; - @Autowired - private TransactionDetailsService transactionDetailsService; - @Autowired - private UserEbookBuyService userEbookBuyService; - - //海外读书下单 - @RequestMapping("/placeOrder") - @Transactional - public R createOrder(@RequestBody BuyOrder buyOrder){ - buyOrder.setUserId(ShiroUtils.getUId()); - buyOrder.setCome(3);//3 海外读书 - BookEntity bookEntity = bookService.getById(buyOrder.getAbroadBookId()); - BigDecimal totalPrice = buyOrder.getOrderMoney(); - //校验价格 - if (totalPrice.compareTo(new BigDecimal(0))<=0){ - return R.error("订单价格不能为0"); - } - if (totalPrice.compareTo(bookEntity.getAbroadPrice())!=0){ - return R.error("订单价格异常"); - } - buyOrder.setRealMoney(totalPrice); - buyOrder.setRemark("Purchase the e-book '"+ Pinyin.toPinyin(bookEntity.getName(), " ").toLowerCase()+"'"); - buyOrder.setOrderStatus("0"); - buyOrder.setOrderType("abroadBook"); - String timeId = IdWorker.getTimeId().substring(0, 32); - buyOrder.setOrderSn(timeId); - buyOrderService.save(buyOrder); - // 1. 虚拟币支付 - if (Constants.PAYMENT_METHOD_VIRTUAL.equals(buyOrder.getPaymentMethod())) { - MyUserEntity user = ShiroUtils.getUser(); - if (user.getPeanutCoin().compareTo(totalPrice)>=0){ - //更新虚拟币 - user.setPeanutCoin(user.getPeanutCoin().subtract(totalPrice)); - myUserService.updateById(user); - //更新订单状态 - buyOrderService.updateOrderStatus(user.getId(), buyOrder.getOrderSn(), "2"); - //记录用户虚拟币消费 - transactionDetailsService.recordTransaction(buyOrder, user, totalPrice); - //开通电子书权限 - userEbookBuyService.addBookForUser(user.getId(), Arrays.asList(buyOrder.getAbroadBookId())); - }else { - return R.error(500, "天医币余额不足!"); - } - } - Map result = new HashMap<>(); - result.put("orderSn", buyOrder.getOrderSn()); - return R.ok(result); - } - -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentLikeService.java b/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentLikeService.java deleted file mode 100644 index 089dac0b..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentLikeService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.bookAbroad.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadCommentLike; - -public interface BookAbroadCommentLikeService extends IService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentService.java b/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentService.java deleted file mode 100644 index 97b5b472..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadCommentService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.bookAbroad.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadComment; - -public interface BookAbroadCommentService extends IService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadLableService.java b/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadLableService.java deleted file mode 100644 index 6ad338ab..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadLableService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.bookAbroad.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadLable; - -public interface BookAbroadLableService extends IService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadToLableService.java b/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadToLableService.java deleted file mode 100644 index 5c8f344b..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/BookAbroadToLableService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.bookAbroad.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadToLable; - -public interface BookAbroadToLableService extends IService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentLikeServiceImpl.java b/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentLikeServiceImpl.java deleted file mode 100644 index 4a4e1a62..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentLikeServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.bookAbroad.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.bookAbroad.service.BookAbroadCommentLikeService; -import com.peanut.modules.common.dao.BookAbroadCommentLikeDao; -import com.peanut.modules.common.entity.BookAbroadCommentLike; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("bookAbroadCommentLikeService") -public class BookAbroadCommentLikeServiceImpl extends ServiceImpl implements BookAbroadCommentLikeService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentServiceImpl.java b/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentServiceImpl.java deleted file mode 100644 index c8607aff..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadCommentServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.bookAbroad.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.common.dao.BookAbroadCommentDao; -import com.peanut.modules.common.entity.BookAbroadComment; -import com.peanut.modules.bookAbroad.service.BookAbroadCommentService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("bookAbroadComment") -public class BookAbroadCommentServiceImpl extends ServiceImpl implements BookAbroadCommentService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadLableServiceImpl.java b/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadLableServiceImpl.java deleted file mode 100644 index 47b1906f..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadLableServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.bookAbroad.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.common.dao.BookAbroadLableDao; -import com.peanut.modules.common.entity.BookAbroadLable; -import com.peanut.modules.bookAbroad.service.BookAbroadLableService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("bookAbroadLableService") -public class BookAbroadLableServiceImpl extends ServiceImpl implements BookAbroadLableService { -} diff --git a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadToLableServiceImpl.java b/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadToLableServiceImpl.java deleted file mode 100644 index 6dc39134..00000000 --- a/src/main/java/com/peanut/modules/bookAbroad/service/impl/BookAbroadToLableServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.bookAbroad.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.bookAbroad.service.BookAbroadToLableService; -import com.peanut.modules.common.dao.BookAbroadToLableDao; -import com.peanut.modules.common.entity.BookAbroadToLable; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("bookAbroadToLableService") -public class BookAbroadToLableServiceImpl extends ServiceImpl implements BookAbroadToLableService { -} diff --git a/src/main/java/com/peanut/modules/common/dao/BookAbroadCommentDao.java b/src/main/java/com/peanut/modules/common/dao/BookAbroadCommentDao.java deleted file mode 100644 index 8d3fa968..00000000 --- a/src/main/java/com/peanut/modules/common/dao/BookAbroadCommentDao.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.peanut.modules.common.dao; - -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.common.entity.BookAbroadComment; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookAbroadCommentDao extends MPJBaseMapper { -} diff --git a/src/main/java/com/peanut/modules/common/dao/BookAbroadCommentLikeDao.java b/src/main/java/com/peanut/modules/common/dao/BookAbroadCommentLikeDao.java deleted file mode 100644 index 067a3f58..00000000 --- a/src/main/java/com/peanut/modules/common/dao/BookAbroadCommentLikeDao.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.peanut.modules.common.dao; - -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.common.entity.BookAbroadCommentLike; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookAbroadCommentLikeDao extends MPJBaseMapper { -} diff --git a/src/main/java/com/peanut/modules/common/dao/BookAbroadLableDao.java b/src/main/java/com/peanut/modules/common/dao/BookAbroadLableDao.java deleted file mode 100644 index 067cf01c..00000000 --- a/src/main/java/com/peanut/modules/common/dao/BookAbroadLableDao.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.peanut.modules.common.dao; - -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.common.entity.BookAbroadLable; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookAbroadLableDao extends MPJBaseMapper { -} diff --git a/src/main/java/com/peanut/modules/common/dao/BookAbroadToLableDao.java b/src/main/java/com/peanut/modules/common/dao/BookAbroadToLableDao.java deleted file mode 100644 index 585f13b9..00000000 --- a/src/main/java/com/peanut/modules/common/dao/BookAbroadToLableDao.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.peanut.modules.common.dao; - -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.common.entity.BookAbroadToLable; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface BookAbroadToLableDao extends MPJBaseMapper { -} diff --git a/src/main/java/com/peanut/modules/common/entity/BookAbroadComment.java b/src/main/java/com/peanut/modules/common/entity/BookAbroadComment.java deleted file mode 100644 index 7fa06a8b..00000000 --- a/src/main/java/com/peanut/modules/common/entity/BookAbroadComment.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.peanut.modules.common.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -//海外书籍评论 -@Data -@TableName("book_abroad_comment") -public class BookAbroadComment implements Serializable { - private static final long serialVersionUID = 1L; - @TableId - private Integer id; - //父id - private Integer pid; - //书籍id - private Integer bookId; - //用户id - private Integer userId; - //评论内容 - private String content; - //创建时间 - private Date createTime; - @TableLogic - private Integer delFlag; - - @TableField(exist = false) - private int isLike; - @TableField(exist = false) - private int likeCount; - @TableField(exist = false) - private MyUserEntity userEntity; - @TableField(exist = false) - private List children; -} diff --git a/src/main/java/com/peanut/modules/common/entity/BookAbroadCommentLike.java b/src/main/java/com/peanut/modules/common/entity/BookAbroadCommentLike.java deleted file mode 100644 index ae4ae4d7..00000000 --- a/src/main/java/com/peanut/modules/common/entity/BookAbroadCommentLike.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.peanut.modules.common.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import java.io.Serializable; - -//海外书籍评论点赞 -@Data -@TableName("book_abroad_comment_like") -public class BookAbroadCommentLike implements Serializable { - private static final long serialVersionUID = 1L; - @TableId - private Integer id; - //评论id - private Integer commentId; - //用户id - private Integer userId; - @TableLogic - private Integer delFlag; -} diff --git a/src/main/java/com/peanut/modules/common/entity/BookAbroadLable.java b/src/main/java/com/peanut/modules/common/entity/BookAbroadLable.java deleted file mode 100644 index 3c72c420..00000000 --- a/src/main/java/com/peanut/modules/common/entity/BookAbroadLable.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.peanut.modules.common.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -//海外书籍分类 -@Data -@TableName("book_abroad_lable") -public class BookAbroadLable implements Serializable { - private static final long serialVersionUID = 1L; - @TableId - private Integer id; - - /** - * 父id - */ - private Integer pid; - - /** - * 类型0分类标签 1营销标签 - */ - private Integer type; - - /** - * 标题 - */ - private String title; - - /** - * 标题 - */ - private String etitle; - - /** - * 0否1是 - */ - private Integer isLast; - - /** - * 权重 - */ - private Integer sort; - - /** - * 创建时间 - */ - private Date createTime; - - @TableLogic - private Integer delFlag; - @TableField(exist = false) - private List children; -} diff --git a/src/main/java/com/peanut/modules/common/entity/BookAbroadToLable.java b/src/main/java/com/peanut/modules/common/entity/BookAbroadToLable.java deleted file mode 100644 index 91ecf46d..00000000 --- a/src/main/java/com/peanut/modules/common/entity/BookAbroadToLable.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.peanut.modules.common.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; - -//海外书籍分类绑定表 -@Data -@TableName("book_abroad_to_lable") -public class BookAbroadToLable implements Serializable { - private static final long serialVersionUID = 1L; - @TableId - private Integer id; - - /** - * 书籍id - */ - private Integer bookId; - - /** - * 标签id - */ - private Integer lableId; - - /** - * 权重 - */ - private Integer sort; - - /** - * 创建时间 - */ - private Date createTime; - - @TableLogic - private Integer delFlag; -} diff --git a/src/main/java/com/peanut/modules/master/controller/BookAbroadController.java b/src/main/java/com/peanut/modules/master/controller/BookAbroadController.java deleted file mode 100644 index 9fe55008..00000000 --- a/src/main/java/com/peanut/modules/master/controller/BookAbroadController.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.peanut.modules.master.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.github.yulichang.wrapper.MPJLambdaWrapper; -import com.peanut.common.utils.R; -import com.peanut.modules.book.service.BookService; -import com.peanut.modules.common.entity.*; -import com.peanut.modules.master.service.*; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Slf4j -@RestController("masterBookAbroad") -@RequestMapping("master/bookAbroad") -public class BookAbroadController { - - @Autowired - private BookAbroadCommentService bookAbroadCommentService; - @Autowired - private com.peanut.modules.bookAbroad.service.BookAbroadLableService labelService; - @Autowired - private com.peanut.modules.bookAbroad.service.BookAbroadToLableService toLableService; - @Autowired - private BookService bookService; - - //评论列表 - @RequestMapping("/getBookAbroadCommentList") - public R getBookAbroadCommentList(@RequestBody Map params) { - Page comments = bookAbroadCommentService.page( - new Page<>(Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), - new LambdaQueryWrapper().like(BookAbroadComment::getContent,params.get("content"))); - return R.ok().put("comments",comments); - } - //删除评论 - @RequestMapping("/delBookAbroadComment") - public R delBookAbroadComment(@RequestBody Map params){ - bookAbroadCommentService.removeById(params.get("commentId").toString()); - return R.ok(); - } - - //新增标签 - @RequestMapping("/insertBookAbroadLable") - public R insertBookAbroadLable(@RequestBody BookAbroadLable lable){ - labelService.save(lable); - return R.ok().put("bookAbroadLable",lable); - } - - //标签详情 - @RequestMapping("/bookAbroadLableInfo") - public R bookAbroadLableInfo(@RequestBody Map params){ - BookAbroadLable lable = labelService.getById(params.get("id").toString()); - return R.ok().put("lable",lable); - } - - //修改标签 - @RequestMapping("/updateBookAbroadLable") - public R updateBookAbroadLable(@RequestBody BookAbroadLable lable){ - BookAbroadLable oldLable = labelService.getById(lable.getId()); - if (oldLable.getIsLast()!=lable.getIsLast()) { - int count = toLableService.count(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getLableId,lable.getId())); - if (count > 0){ - return R.error("存在绑定书籍,删除后再操作"); - } - } - labelService.updateById(lable); - return R.ok(); - } - - //删除标签 - @RequestMapping("/delBookAbroadLable") - public R delBookAbroadLable(@RequestBody Map params){ - BookAbroadLable oldLable = labelService.getById(params.get("id").toString()); - if (oldLable.getIsLast()!=1){ - return R.error("不是最下级,禁止删除"); - } - int count = toLableService.count(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getLableId,params.get("id").toString())); - if (count > 0){ - return R.error("存在绑定书籍,删除后再操作"); - } - labelService.removeById(oldLable.getId()); - return R.ok(); - } - - //绑定图书和标签 - @RequestMapping("/insertBookAbroadToLable") - public R insertBookAbroadToLable(@RequestBody BookAbroadToLable toLable){ - BookAbroadLable oldLable = labelService.getById(toLable.getLableId()); - if (oldLable.getIsLast()!=1){ - return R.error("不是最下级,禁止绑定"); - } - int count = toLableService.count(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getBookId,toLable.getBookId()) - .eq(BookAbroadToLable::getLableId,toLable.getLableId())); - if (count > 0) { - return R.error("已存在"); - } - toLableService.save(toLable); - return R.ok(); - } - - //解绑 - @RequestMapping("/delBookAbroadToLable") - public R delBookAbroadToLable(@RequestBody Map params){ - String[] strings = params.get("ids").toString().split(","); - toLableService.removeByIds(Arrays.asList(strings)); - return R.ok(); - } - - //标签可绑定图书 - @RequestMapping("/getBookListCanToLable") - public R getBookListCanToLable(@RequestBody Map params) { - List collect = toLableService.list(new LambdaQueryWrapper() - .eq(BookAbroadToLable::getLableId, params.get("lableId"))) - .stream().map(BookAbroadToLable::getBookId).collect(Collectors.toList()); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (collect.size() != 0){ - wrapper.notIn(BookEntity::getId,collect); - } - wrapper.like(StringUtils.isNotBlank(params.get("bookName").toString()),BookEntity::getTitle,params.get("bookName")); - Page page = bookService.page(new Page<>(Long.valueOf(params.get("current").toString()),Long.valueOf(params.get("limit").toString())), wrapper); - return R.ok().put("page",page); - } - - //通过标签获取绑定图书 - @RequestMapping("/getAbroadBookListByLable") - public R getAbroadBookListByLable(@RequestBody Map params) { - MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); - wrapper.leftJoin(BookEntity.class,BookEntity::getId,BookAbroadToLable::getBookId); - wrapper.selectAs(BookAbroadToLable::getId,"id"); - wrapper.select(BookEntity::getName); - wrapper.select(BookAbroadToLable::getSort); - wrapper.select(BookAbroadToLable::getBookId); - wrapper.eq(BookAbroadToLable::getLableId,params.get("lableId")); - wrapper.orderByAsc(BookAbroadToLable::getSort); - return R.ok().put("bookList",toLableService.listMaps(wrapper)); - } - - //修改排序 - @RequestMapping("/updateToLableSort") - public R updateToLableSort(@RequestBody Map params){ - BookAbroadToLable toLable = toLableService.getById(params.get("toLableId").toString()); - toLable.setSort(Integer.parseInt(params.get("sort").toString())); - toLableService.updateById(toLable); - return R.ok(); - } - - //标签树 - @RequestMapping("/getLableTree") - public R getLableTree(@RequestBody Map params) { - List labels = labelService.list(new LambdaQueryWrapper() - .eq(BookAbroadLable::getType,params.get("type"))); - List labelsTree = labels.stream().filter((bookAbroadLable) -> - bookAbroadLable.getPid() == 0 - ).map((label)->{ - label.setChildren(getLabelChildrens(label,labels)); - return label; - }).sorted((label1,label2)->{ - return (label1.getSort() == null? 0 : label1.getSort()) - (label2.getSort()==null?0:label2.getSort()); - }).collect(Collectors.toList()); - return R.ok().put("labelsTree",labelsTree); - } - - private List getLabelChildrens(BookAbroadLable root,List all){ - List children = all.stream().filter(bookAbroadLable -> { - return root.getId().equals(bookAbroadLable.getPid()); - }).map(bookAbroadLable -> { - bookAbroadLable.setChildren(getLabelChildrens(bookAbroadLable, all)); - return bookAbroadLable; - }).sorted((label1,label2)->{ - return (label1.getSort()==null?0:label1.getSort()) - (label2.getSort()==null?0:label2.getSort()); - }).collect(Collectors.toList()); - return children; - } -} diff --git a/src/main/java/com/peanut/modules/master/service/BookAbroadCommentLikeService.java b/src/main/java/com/peanut/modules/master/service/BookAbroadCommentLikeService.java deleted file mode 100644 index 37165c44..00000000 --- a/src/main/java/com/peanut/modules/master/service/BookAbroadCommentLikeService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.master.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadCommentLike; - -public interface BookAbroadCommentLikeService extends IService { -} diff --git a/src/main/java/com/peanut/modules/master/service/BookAbroadCommentService.java b/src/main/java/com/peanut/modules/master/service/BookAbroadCommentService.java deleted file mode 100644 index b124a6a4..00000000 --- a/src/main/java/com/peanut/modules/master/service/BookAbroadCommentService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.master.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadComment; - -public interface BookAbroadCommentService extends IService { -} diff --git a/src/main/java/com/peanut/modules/master/service/BookAbroadLableService.java b/src/main/java/com/peanut/modules/master/service/BookAbroadLableService.java deleted file mode 100644 index 46090dcd..00000000 --- a/src/main/java/com/peanut/modules/master/service/BookAbroadLableService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.master.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadLable; - -public interface BookAbroadLableService extends IService { -} diff --git a/src/main/java/com/peanut/modules/master/service/BookAbroadToLableService.java b/src/main/java/com/peanut/modules/master/service/BookAbroadToLableService.java deleted file mode 100644 index 92ca23ac..00000000 --- a/src/main/java/com/peanut/modules/master/service/BookAbroadToLableService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.peanut.modules.master.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.common.entity.BookAbroadToLable; - -public interface BookAbroadToLableService extends IService { -} diff --git a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentLikeServiceImpl.java b/src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentLikeServiceImpl.java deleted file mode 100644 index 70ae1e9a..00000000 --- a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentLikeServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.master.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.common.dao.BookAbroadCommentLikeDao; -import com.peanut.modules.common.entity.BookAbroadCommentLike; -import com.peanut.modules.master.service.BookAbroadCommentLikeService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("masterBookAbroadCommentLikeService") -public class BookAbroadCommentLikeServiceImpl extends ServiceImpl implements BookAbroadCommentLikeService { -} diff --git a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentServiceImpl.java b/src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentServiceImpl.java deleted file mode 100644 index 4033933e..00000000 --- a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadCommentServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.master.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.common.dao.BookAbroadCommentDao; -import com.peanut.modules.common.entity.BookAbroadComment; -import com.peanut.modules.master.service.BookAbroadCommentService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("masterBookAbroadCommentService") -public class BookAbroadCommentServiceImpl extends ServiceImpl implements BookAbroadCommentService { -} diff --git a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadLableServiceImpl.java b/src/main/java/com/peanut/modules/master/service/impl/BookAbroadLableServiceImpl.java deleted file mode 100644 index dc00eaa8..00000000 --- a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadLableServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.master.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.common.dao.BookAbroadLableDao; -import com.peanut.modules.common.entity.BookAbroadLable; -import com.peanut.modules.master.service.BookAbroadLableService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("masterBookAbroadLableService") -public class BookAbroadLableServiceImpl extends ServiceImpl implements BookAbroadLableService { -} diff --git a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadToLableServiceImpl.java b/src/main/java/com/peanut/modules/master/service/impl/BookAbroadToLableServiceImpl.java deleted file mode 100644 index af06abef..00000000 --- a/src/main/java/com/peanut/modules/master/service/impl/BookAbroadToLableServiceImpl.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.peanut.modules.master.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.modules.common.dao.BookAbroadToLableDao; -import com.peanut.modules.common.entity.BookAbroadToLable; -import com.peanut.modules.master.service.BookAbroadToLableService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service("masterBookAbroadToLableService") -public class BookAbroadToLableServiceImpl extends ServiceImpl implements BookAbroadToLableService { -}