merge and modify config file
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.BookClockinCommentEntity;
|
||||
import com.peanut.modules.book.entity.BookClockinPunchEntity;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.entity.MyUserEntity;
|
||||
import com.peanut.modules.book.dao.UserEbookBuyDao;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.BookClockinCommentService;
|
||||
import com.peanut.modules.book.service.BookClockinPunchService;
|
||||
import com.peanut.modules.book.service.BookService;
|
||||
@@ -25,6 +26,8 @@ private BookService bookService;
|
||||
private MyUserService myUserService;
|
||||
@Autowired
|
||||
private BookClockinCommentService bookClockinCommentService;
|
||||
@Autowired
|
||||
private UserEbookBuyDao userEbookBuyDao;
|
||||
|
||||
|
||||
|
||||
@@ -136,6 +139,42 @@ private BookClockinCommentService bookClockinCommentService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户打卡已购图书
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/myClockBooks")
|
||||
public R myClockBooks(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
|
||||
MPJLambdaWrapper<UserEbookBuyEntity> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAll(BookEntity.class);
|
||||
wrapper.leftJoin(BookEntity.class,BookEntity::getId,UserEbookBuyEntity::getBookId);
|
||||
wrapper.eq(UserEbookBuyEntity::getUserId,userId);
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getClockIn,1);
|
||||
Page<BookEntity> userBookEntityPage = userEbookBuyDao.selectJoinPage(new Page<BookEntity>(page, limit), BookEntity.class, wrapper);
|
||||
return R.ok().put("page",userBookEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打卡推荐图书
|
||||
* @param userId
|
||||
* @param limit
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getBestClockBooks")
|
||||
public R getBestClockBooks(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
|
||||
String not_ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getClockIn,1);
|
||||
wrapper.notExists(not_ex_sql);
|
||||
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
return R.ok().put("page",bookEntityPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,8 @@ public class BookController {
|
||||
private ShopProductService shopProductService;
|
||||
@Autowired
|
||||
private ShopProudictBookService shopProudictBookService;
|
||||
@Autowired
|
||||
private ShopProductToLabelService shopProductToLabelService;
|
||||
final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10);
|
||||
|
||||
/**
|
||||
@@ -82,6 +84,21 @@ public class BookController {
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取精品图书
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getJPBooks")
|
||||
public R getJPBooks(){
|
||||
LambdaQueryWrapper<ShopProductToLabelEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ShopProductToLabelEntity::getSplId,5);//精选图书
|
||||
wrapper.eq(ShopProductToLabelEntity::getDelFlag,0);
|
||||
List<Integer> pIds = shopProductToLabelService.getBaseMapper().selectList(wrapper).stream().map(ShopProductToLabelEntity::getProductId).collect(Collectors.toList());
|
||||
|
||||
List<ShopProductEntity> shopProductEntities = shopProductService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProductEntity>().in(ShopProductEntity::getProductId, pIds));
|
||||
return R.ok().put("Products",shopProductEntities);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,6 +138,56 @@ public class BookForumArticlesServiceController {
|
||||
return R.ok().put("page",bookEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 书集----已购图书
|
||||
* @param userId
|
||||
* @param limit
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getHasForumsAndBook")
|
||||
public R getHasForumsAndBook(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
|
||||
String ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
|
||||
String existSql = "select 1 from book_forum_articles where book.id = bookid";
|
||||
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.exists(ex_sql);
|
||||
wrapper.exists(existSql);
|
||||
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
for (BookEntity b : bookEntityPage.getRecords()){
|
||||
b.setForums(bookForumArticlesService.getForumsLimit(b.getId(), 4));
|
||||
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
|
||||
}
|
||||
|
||||
return R.ok().put("page",bookEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 书集----推荐图书
|
||||
* @param userId
|
||||
* @param limit
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getBestForumsAndBook")
|
||||
public R getBestForumsAndBook(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
|
||||
String ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
|
||||
String existSql = "select 1 from book_forum_articles where book.id = bookid";
|
||||
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.notExists(ex_sql);
|
||||
wrapper.exists(existSql);
|
||||
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
for (BookEntity b : bookEntityPage.getRecords()){
|
||||
b.setForums(bookForumArticlesService.getForumsLimit(b.getId(), 4));
|
||||
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
|
||||
}
|
||||
|
||||
return R.ok().put("page",bookEntityPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞书评帖子
|
||||
* @param forum_id
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
||||
@@ -85,6 +86,9 @@ public class BuyOrderController {
|
||||
*/
|
||||
private static final String ORDER_STATUS_TO_BE_RECEIVED = "2";
|
||||
|
||||
@Autowired
|
||||
private ShopProudictBookService shopProudictBookService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@@ -263,6 +267,15 @@ public class BuyOrderController {
|
||||
transactionDetailsEntity.setOrderType("购买健康超市用品!");
|
||||
transactionDetailsService.save(transactionDetailsEntity);
|
||||
|
||||
//购买成功后,添加书到个人表中
|
||||
List<Integer> pros = products.stream().map(BuyOrderDetailEntity::getProductId).collect(Collectors.toList());
|
||||
for (Integer s : pros){
|
||||
List<Integer> collect = shopProudictBookService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProudictBookEntity>()
|
||||
.eq(ShopProudictBookEntity::getProudictId, s)
|
||||
.eq(ShopProudictBookEntity::getDelFlag, 0)).stream().map(ShopProudictBookEntity::getBookId).collect(Collectors.toList());
|
||||
userEbookBuyService.addBookForUser(buyOrder.getUserId(),collect);
|
||||
}
|
||||
|
||||
}else{
|
||||
return R.error("余额不足!");
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class ShopProductLabelController {
|
||||
|
||||
@Autowired
|
||||
private ShopProductLabelService shopProductLabelService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductToLabelService shopProductToLabelService;
|
||||
@Autowired
|
||||
@@ -92,7 +91,7 @@ public class ShopProductLabelController {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 废除
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@@ -113,6 +112,7 @@ public class ShopProductLabelController {
|
||||
MPJLambdaWrapper<ShopProductToLabelEntity> shopProductEntityMPJLambdaWrapper = new MPJLambdaWrapper<ShopProductToLabelEntity>();
|
||||
shopProductEntityMPJLambdaWrapper.selectAll(ShopProductEntity.class);
|
||||
shopProductEntityMPJLambdaWrapper.leftJoin(ShopProductEntity.class,ShopProductEntity::getProductId,ShopProductToLabelEntity::getProductId);
|
||||
shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getSplId,splId);
|
||||
shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getDelFlag,0);
|
||||
shopProductEntityMPJLambdaWrapper.eq(ShopProductEntity::getDelFlag,0);
|
||||
Page<ShopProductEntity> shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page<ShopProductEntity>(page, limit), ShopProductEntity.class, shopProductEntityMPJLambdaWrapper);
|
||||
|
||||
Reference in New Issue
Block a user