merge master
This commit is contained in:
@@ -5,12 +5,12 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.app.service.UserService;
|
||||
import com.peanut.modules.book.entity.BookClockEntryEntity;
|
||||
import com.peanut.modules.book.entity.BookClockInChatEntity;
|
||||
import com.peanut.modules.book.entity.UserEntity;
|
||||
import com.peanut.modules.book.entity.BookClockEntryChatEntity;
|
||||
import com.peanut.modules.book.entity.MyUserEntity;
|
||||
import com.peanut.modules.book.service.BookClockEntryChatService;
|
||||
import com.peanut.modules.book.service.BookClockEntryService;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
import com.peanut.modules.book.vo.ClockInCommentVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -36,7 +36,7 @@ public class BookClockForumController {
|
||||
private BookClockEntryService bookClockEntryService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private MyUserService userService;
|
||||
|
||||
/**
|
||||
* 获取论坛内容
|
||||
@@ -66,7 +66,7 @@ public class BookClockForumController {
|
||||
@RequestMapping(path = "/getChatList", method = RequestMethod.GET)
|
||||
public R getChatList(@RequestParam("entryId") Integer entryId,
|
||||
@RequestParam(value = "userId", required = false) Integer userId) {
|
||||
QueryWrapper<BookClockInChatEntity> queryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<BookClockEntryChatEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("entry_id", entryId);
|
||||
queryWrapper.eq("fid", 0);
|
||||
if (userId != null) {
|
||||
@@ -74,25 +74,25 @@ public class BookClockForumController {
|
||||
}
|
||||
queryWrapper.orderByAsc("fid", "create_time");
|
||||
List<ClockInCommentVo> resultList = new ArrayList<>();
|
||||
List<BookClockInChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper);
|
||||
for (BookClockInChatEntity entity : chatEntityList) {
|
||||
List<BookClockEntryChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper);
|
||||
for (BookClockEntryChatEntity entity : chatEntityList) {
|
||||
List<String> imageList = JSON.parseObject(entity.getImages(), new TypeReference<List<String>>() {
|
||||
});
|
||||
entity.setImageList(imageList);
|
||||
ClockInCommentVo vo = new ClockInCommentVo();
|
||||
BeanUtil.copyProperties(entity, vo);
|
||||
UserEntity user = userService.getById(entity.getUserId());
|
||||
MyUserEntity user = userService.getById(entity.getUserId());
|
||||
vo.setNickName(user.getNickname());
|
||||
vo.setAvatar(user.getAvatar());
|
||||
QueryWrapper<BookClockInChatEntity> subQueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<BookClockEntryChatEntity> subQueryWrapper = new QueryWrapper<>();
|
||||
subQueryWrapper.eq("fid", entity.getId());
|
||||
List<BookClockInChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
|
||||
List<BookClockEntryChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
|
||||
List<ClockInCommentVo> subCommentList = new ArrayList<>();
|
||||
for (BookClockInChatEntity subChat : subClockInChatList) {
|
||||
for (BookClockEntryChatEntity subChat : subClockInChatList) {
|
||||
ClockInCommentVo subVo = new ClockInCommentVo();
|
||||
BeanUtil.copyProperties(subChat, subVo);
|
||||
UserEntity subChatUser = userService.getById(subChat.getUserId());
|
||||
UserEntity pUser = userService.getById(subChat.getPuserId());
|
||||
MyUserEntity subChatUser = userService.getById(subChat.getUserId());
|
||||
MyUserEntity pUser = userService.getById(subChat.getPuserId());
|
||||
subVo.setPuserNickName(pUser.getNickname());
|
||||
subVo.setPuserAvatar(pUser.getAvatar());
|
||||
subVo.setAvatar(subChatUser.getAvatar());
|
||||
@@ -114,7 +114,7 @@ public class BookClockForumController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(path = "/addChat", method = RequestMethod.POST)
|
||||
public R addChat(@RequestBody BookClockInChatEntity chat) {
|
||||
public R addChat(@RequestBody BookClockEntryChatEntity chat) {
|
||||
List<String> imageList = chat.getImageList();
|
||||
if (imageList != null) {
|
||||
String images = JSON.toJSON(imageList).toString();
|
||||
|
||||
@@ -685,7 +685,9 @@ public class BookController {
|
||||
|
||||
LambdaQueryWrapper<BookEntity> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(BookEntity::getDelFlag,0);
|
||||
wrapper1.in(BookEntity::getId,bookIds);
|
||||
if(bookIds.size()>0){
|
||||
wrapper1.in(BookEntity::getId,bookIds);
|
||||
}
|
||||
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1);
|
||||
|
||||
return R.ok().put("page",bookEntityPage);
|
||||
|
||||
@@ -6,7 +6,6 @@ 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.app.service.UserService;
|
||||
import com.peanut.modules.book.dao.BookForumArticlesDao;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
@@ -32,7 +31,7 @@ public class BookForumArticlesServiceController {
|
||||
@Autowired
|
||||
private BookForumArticlesDao bookForumArticlesDao;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private MyUserService userService;
|
||||
|
||||
/**
|
||||
* 列表 (开始时间倒叙) 后台get请求
|
||||
@@ -71,6 +70,7 @@ public class BookForumArticlesServiceController {
|
||||
wrapper.leftJoin(AuthorEntity.class,AuthorEntity::getId,BookEntity::getAuthorId);
|
||||
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getState,0);
|
||||
Page<BookForumArticlesEntity> bookForumArticlesEntityPage = bookForumArticlesDao.selectJoinPage(new Page<>(page, limit), BookForumArticlesEntity.class, wrapper);
|
||||
|
||||
for (BookForumArticlesEntity b : bookForumArticlesEntityPage.getRecords()){
|
||||
@@ -102,6 +102,7 @@ public class BookForumArticlesServiceController {
|
||||
wrapper.leftJoin(AuthorEntity.class,AuthorEntity::getId,BookEntity::getAuthorId);
|
||||
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getState,0);
|
||||
wrapper.orderByDesc(BookForumArticlesEntity::getContlike);
|
||||
Page<BookForumArticlesEntity> bookForumArticlesEntityPage = bookForumArticlesDao.selectJoinPage(new Page<>(page, limit), BookForumArticlesEntity.class, wrapper);
|
||||
|
||||
@@ -130,7 +131,7 @@ public class BookForumArticlesServiceController {
|
||||
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
|
||||
for (BookEntity b :bookEntityPage.getRecords()){
|
||||
b.setForums(bookForumArticlesService.getForumsLimit(b.getId(), 4));
|
||||
b.setForums(userService.getForumsLimit(b.getId(), 4));
|
||||
|
||||
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
|
||||
}
|
||||
@@ -152,11 +153,12 @@ public class BookForumArticlesServiceController {
|
||||
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getState,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.setForums(userService.getForumsLimit(b.getId(), 4));
|
||||
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
|
||||
}
|
||||
|
||||
@@ -173,15 +175,16 @@ public class BookForumArticlesServiceController {
|
||||
@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";
|
||||
String existSql = "select 1 from book_forum_articles where book.id = bookid and del_flag = 0";
|
||||
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookEntity::getDelFlag,0);
|
||||
wrapper.eq(BookEntity::getState,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.setForums(userService.getForumsLimit(b.getId(), 4));
|
||||
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
|
||||
}
|
||||
|
||||
@@ -228,7 +231,7 @@ public class BookForumArticlesServiceController {
|
||||
wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime);
|
||||
Page<BookForumArticlesEntity> bookForumArticlesEntityPage = bookForumArticlesService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
for (BookForumArticlesEntity b:bookForumArticlesEntityPage.getRecords()){
|
||||
UserEntity byId = userService.getById(b.getUserid());
|
||||
MyUserEntity byId = userService.getById(b.getUserid());
|
||||
b.setUser(byId);
|
||||
b.setComment(bookForumCommenService.getCommentsLimit(b.getId(),3));
|
||||
}
|
||||
|
||||
@@ -227,6 +227,84 @@ public class BuyOrderController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* app 端 取消订单
|
||||
*/
|
||||
@RequestMapping("/appDelete")
|
||||
@Transactional
|
||||
public R appDelete(@RequestParam("orderId") Integer orderId) {
|
||||
|
||||
//1. 判断订单状态
|
||||
BuyOrder byId = buyOrderService.getById(orderId);
|
||||
if (byId != null) {
|
||||
//2. 判断当前订单是否存在优惠券 进行 回显
|
||||
Integer couponId = byId.getCouponId();
|
||||
if (couponId != null) {
|
||||
|
||||
CouponHistoryEntity byId1 = couponHistoryService.getById(couponId);
|
||||
byId1.setUseStatus(0);
|
||||
couponHistoryService.updateById(byId1);
|
||||
}
|
||||
// 库存回滚
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetail>()
|
||||
.eq("order_id", byId.getOrderId()));
|
||||
for (BuyOrderDetail buyOrderDetailEntity : buyOrderDetailEntities) {
|
||||
Integer productId = buyOrderDetailEntity.getProductId();
|
||||
ShopProductEntity product = shopProductService.getById(productId);
|
||||
product.setProductStock(product.getProductStock() + buyOrderDetailEntity.getQuantity());
|
||||
shopProductService.updateById(product);
|
||||
}
|
||||
buyOrderService.removeById(orderId);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 充值专用订单生成接口
|
||||
*/
|
||||
@RequestMapping("/rechargeSave")
|
||||
@Transactional
|
||||
public R rechargeSave(@RequestBody BuyOrder buyOrder) throws IOException {
|
||||
String timeId = IdWorker.getTimeId().substring(0, 32);
|
||||
buyOrder.setOrderSn(timeId);
|
||||
buyOrderService.save(buyOrder);
|
||||
//下单微信支付预付款订单
|
||||
BuyOrder buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new LambdaQueryWrapper<BuyOrder>().eq(BuyOrder::getOrderSn, timeId));
|
||||
WechatPaymentInfo paymentInfo = new WechatPaymentInfo();
|
||||
paymentInfo.setOrderSn(buyOrderEntity.getOrderSn());
|
||||
paymentInfo.setBuyOrderId(Integer.valueOf(buyOrderEntity.getProductId()));
|
||||
paymentInfo.setTotalAmount(buyOrderEntity.getRealMoney());
|
||||
wxpayService.prepay(paymentInfo);
|
||||
return R.ok().put("orderSn", timeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getOrderDetail")
|
||||
public R getOrderDetail(@RequestParam Integer orderId) {
|
||||
LambdaQueryWrapper<BuyOrder> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BuyOrder::getOrderId, orderId);
|
||||
BuyOrder one = buyOrderService.getOne(wrapper);
|
||||
if (one.equals(null)) {
|
||||
return R.error("order error:order is null");
|
||||
}
|
||||
//添加用户信息
|
||||
one.setUser(myUserService.getById(one.getUserId()));
|
||||
//添加商品信息
|
||||
LambdaQueryWrapper<BuyOrderDetail> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(BuyOrderDetail::getOrderId, orderId);
|
||||
List<BuyOrderDetail> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(wrapper1);
|
||||
one.setProducts(buyOrderDetailEntities);
|
||||
|
||||
return R.ok().put("detail", one);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*
|
||||
|
||||
@@ -9,10 +9,13 @@ import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.MD5Utils;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.to.PageIdDto;
|
||||
import com.peanut.modules.sys.service.SysUserTokenService;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
@@ -71,6 +74,23 @@ public class MyUserController {
|
||||
return R.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param p
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getUserList")
|
||||
public R getUserList(@RequestBody PageIdDto p){
|
||||
LambdaQueryWrapper<MyUserEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
if(!p.getKey().equals(null)){
|
||||
wrapper.eq(MyUserEntity::getTel,p.getKey()).or().eq(MyUserEntity::getName,p.getKey());
|
||||
}
|
||||
wrapper.eq(MyUserEntity::getDelFlag,0);
|
||||
Page<MyUserEntity> myUserEntityPage = userService.getBaseMapper().selectPage(new Page<MyUserEntity>(p.getPage(), p.getLimit()), wrapper);
|
||||
|
||||
return R.ok().put("user",myUserEntityPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
|
||||
Reference in New Issue
Block a user