diff --git a/src/main/java/com/peanut/modules/app/controller/AppLoginController.java b/src/main/java/com/peanut/modules/app/controller/AppLoginController.java index e8cb935d..eb3db18a 100644 --- a/src/main/java/com/peanut/modules/app/controller/AppLoginController.java +++ b/src/main/java/com/peanut/modules/app/controller/AppLoginController.java @@ -9,22 +9,13 @@ package com.peanut.modules.app.controller; -import com.peanut.common.utils.R; -import com.peanut.common.validator.ValidatorUtils; -import com.peanut.modules.app.form.LoginForm; -import com.peanut.modules.app.service.UserService; import com.peanut.modules.app.utils.JwtUtils; +import com.peanut.modules.book.service.MyUserService; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.HashMap; -import java.util.Map; - /** * APP登录授权 * @@ -35,7 +26,7 @@ import java.util.Map; @Api("APP登录接口") public class AppLoginController { @Autowired - private UserService userService; + private MyUserService userService; @Autowired private JwtUtils jwtUtils; diff --git a/src/main/java/com/peanut/modules/app/controller/AppRegisterController.java b/src/main/java/com/peanut/modules/app/controller/AppRegisterController.java index d57b5045..8fda6a98 100644 --- a/src/main/java/com/peanut/modules/app/controller/AppRegisterController.java +++ b/src/main/java/com/peanut/modules/app/controller/AppRegisterController.java @@ -9,21 +9,12 @@ package com.peanut.modules.app.controller; -import com.peanut.common.utils.R; -import com.peanut.common.validator.ValidatorUtils; -import com.peanut.modules.app.form.RegisterForm; -import com.peanut.modules.app.service.UserService; +import com.peanut.modules.book.service.MyUserService; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.apache.commons.codec.digest.DigestUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.Date; - /** * 注册 * @@ -34,7 +25,7 @@ import java.util.Date; @Api("APP注册接口") public class AppRegisterController { @Autowired - private UserService userService; + private MyUserService userService; // @PostMapping("register") // @ApiOperation("注册") diff --git a/src/main/java/com/peanut/modules/app/controller/AppTestController.java b/src/main/java/com/peanut/modules/app/controller/AppTestController.java index c794fe08..b407c32c 100644 --- a/src/main/java/com/peanut/modules/app/controller/AppTestController.java +++ b/src/main/java/com/peanut/modules/app/controller/AppTestController.java @@ -12,7 +12,7 @@ package com.peanut.modules.app.controller; import com.peanut.common.utils.R; import com.peanut.modules.app.annotation.Login; import com.peanut.modules.app.annotation.LoginUser; -import com.peanut.modules.book.entity.UserEntity; +import com.peanut.modules.book.entity.MyUserEntity; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; @@ -33,7 +33,7 @@ public class AppTestController { @Login @GetMapping("userInfo") @ApiOperation("获取用户信息") - public R userInfo(@LoginUser UserEntity user){ + public R userInfo(@LoginUser MyUserEntity user){ return R.ok().put("user", user); } diff --git a/src/main/java/com/peanut/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java b/src/main/java/com/peanut/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java index 24b59279..f3a0ad11 100644 --- a/src/main/java/com/peanut/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java +++ b/src/main/java/com/peanut/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java @@ -8,10 +8,10 @@ package com.peanut.modules.app.resolver; -import com.peanut.modules.app.service.UserService; import com.peanut.modules.app.annotation.LoginUser; import com.peanut.modules.app.interceptor.AuthorizationInterceptor; -import com.peanut.modules.book.entity.UserEntity; +import com.peanut.modules.book.entity.MyUserEntity; +import com.peanut.modules.book.service.MyUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.MethodParameter; import org.springframework.stereotype.Component; @@ -29,11 +29,11 @@ import org.springframework.web.method.support.ModelAndViewContainer; @Component public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver { @Autowired - private UserService userService; + private MyUserService userService; @Override public boolean supportsParameter(MethodParameter parameter) { - return parameter.getParameterType().isAssignableFrom(UserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class); + return parameter.getParameterType().isAssignableFrom(MyUserEntity.class) && parameter.hasParameterAnnotation(LoginUser.class); } @Override @@ -46,7 +46,7 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu } //获取用户信息 - UserEntity user = userService.getById((Long)object); + MyUserEntity user = userService.getById((Long)object); return user; } diff --git a/src/main/java/com/peanut/modules/app/service/UserService.java b/src/main/java/com/peanut/modules/app/service/UserService.java deleted file mode 100644 index 0c2b900c..00000000 --- a/src/main/java/com/peanut/modules/app/service/UserService.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2016-2019 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - -package com.peanut.modules.app.service; - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.app.form.LoginForm; -import com.peanut.modules.book.entity.UserEntity; - -/** - * 用户 - * - * @author Mark sunlightcs@gmail.com - */ -public interface UserService extends IService { - -// UserEntity queryByMobile(String mobile); -// -// /** -// * 用户登录 -// * @param form 登录表单 -// * @return 返回用户ID -// */ -// long login(LoginForm form); -} diff --git a/src/main/java/com/peanut/modules/app/service/impl/UserServiceImpl.java b/src/main/java/com/peanut/modules/app/service/impl/UserServiceImpl.java deleted file mode 100644 index 01f7dc1f..00000000 --- a/src/main/java/com/peanut/modules/app/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2016-2019 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - -package com.peanut.modules.app.service.impl; - - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.peanut.common.exception.RRException; -import com.peanut.common.validator.Assert; -import com.peanut.modules.book.dao.UserDao; -import com.peanut.modules.app.form.LoginForm; -import com.peanut.modules.app.service.UserService; -import com.peanut.modules.book.entity.UserEntity; -import org.apache.commons.codec.digest.DigestUtils; -import org.springframework.stereotype.Service; - - -@Service("userService") -public class UserServiceImpl extends ServiceImpl implements UserService { - - -// public UserEntity queryByMobile(String mobile) { -// return baseMapper.selectOne(new QueryWrapper().eq("mobile", mobile)); -// } - - -// public long login(LoginForm form) { -// UserEntity user = queryByMobile(form.getMobile()); -// Assert.isNull(user, "手机号或密码错误"); -// -// //密码错误 -// if(!user.getPassword().equals(DigestUtils.sha256Hex(form.getPassword()))){ -// throw new RRException("手机号或密码错误"); -// } -// -// return user.getUserId(); -// } -} diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java b/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java index c01e6340..c26aaf7d 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java @@ -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 queryWrapper = new QueryWrapper<>(); + QueryWrapper 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 resultList = new ArrayList<>(); - List chatEntityList = bookClockEntryChatService.list(queryWrapper); - for (BookClockInChatEntity entity : chatEntityList) { + List chatEntityList = bookClockEntryChatService.list(queryWrapper); + for (BookClockEntryChatEntity entity : chatEntityList) { List imageList = JSON.parseObject(entity.getImages(), new TypeReference>() { }); 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 subQueryWrapper = new QueryWrapper<>(); + QueryWrapper subQueryWrapper = new QueryWrapper<>(); subQueryWrapper.eq("fid", entity.getId()); - List subClockInChatList = bookClockEntryChatService.list(subQueryWrapper); + List subClockInChatList = bookClockEntryChatService.list(subQueryWrapper); List 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 imageList = chat.getImageList(); if (imageList != null) { String images = JSON.toJSON(imageList).toString(); diff --git a/src/main/java/com/peanut/modules/book/controller/BookController.java b/src/main/java/com/peanut/modules/book/controller/BookController.java index 2acb04c2..ae58446e 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookController.java @@ -685,7 +685,9 @@ public class BookController { LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); wrapper1.eq(BookEntity::getDelFlag,0); - wrapper1.in(BookEntity::getId,bookIds); + if(bookIds.size()>0){ + wrapper1.in(BookEntity::getId,bookIds); + } Page bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1); return R.ok().put("page",bookEntityPage); diff --git a/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java b/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java index 903884d5..ef0c6b76 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookForumArticlesServiceController.java @@ -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 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 bookForumArticlesEntityPage = bookForumArticlesDao.selectJoinPage(new Page<>(page, limit), BookForumArticlesEntity.class, wrapper); @@ -130,7 +131,7 @@ public class BookForumArticlesServiceController { Page 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 wrapper = new LambdaQueryWrapper<>(); wrapper.eq(BookEntity::getDelFlag,0); + wrapper.eq(BookEntity::getState,0); wrapper.exists(ex_sql); wrapper.exists(existSql); Page 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 wrapper = new LambdaQueryWrapper<>(); wrapper.eq(BookEntity::getDelFlag,0); + wrapper.eq(BookEntity::getState,0); wrapper.notExists(ex_sql); wrapper.exists(existSql); Page 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 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)); } diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index 30e28193..6d99dc78 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -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 buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() + .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().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 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 wrapper1 = new LambdaQueryWrapper<>(); + wrapper1.eq(BuyOrderDetail::getOrderId, orderId); + List buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(wrapper1); + one.setProducts(buyOrderDetailEntities); + + return R.ok().put("detail", one); + } + /** * 获取订单详情 * diff --git a/src/main/java/com/peanut/modules/book/controller/MyUserController.java b/src/main/java/com/peanut/modules/book/controller/MyUserController.java index eddee072..430e3797 100644 --- a/src/main/java/com/peanut/modules/book/controller/MyUserController.java +++ b/src/main/java/com/peanut/modules/book/controller/MyUserController.java @@ -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 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 myUserEntityPage = userService.getBaseMapper().selectPage(new Page(p.getPage(), p.getLimit()), wrapper); + + return R.ok().put("user",myUserEntityPage); + } + /** * 信息 diff --git a/src/main/java/com/peanut/modules/book/dao/BookClockEntryChatDao.java b/src/main/java/com/peanut/modules/book/dao/BookClockEntryChatDao.java index c9a7d83f..43c572b9 100644 --- a/src/main/java/com/peanut/modules/book/dao/BookClockEntryChatDao.java +++ b/src/main/java/com/peanut/modules/book/dao/BookClockEntryChatDao.java @@ -1,9 +1,9 @@ package com.peanut.modules.book.dao; import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.book.entity.BookClockInChatEntity; +import com.peanut.modules.book.entity.BookClockEntryChatEntity; import org.apache.ibatis.annotations.Mapper; @Mapper -public interface BookClockEntryChatDao extends MPJBaseMapper { +public interface BookClockEntryChatDao extends MPJBaseMapper { } diff --git a/src/main/java/com/peanut/modules/book/dao/UserDao.java b/src/main/java/com/peanut/modules/book/dao/UserDao.java deleted file mode 100644 index 7d68d222..00000000 --- a/src/main/java/com/peanut/modules/book/dao/UserDao.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2016-2019 人人开源 All rights reserved. - * - * https://www.renren.io - * - * 版权所有,侵权必究! - */ - -package com.peanut.modules.book.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.github.yulichang.base.MPJBaseMapper; -import com.peanut.modules.book.entity.UserEntity; -import org.apache.ibatis.annotations.Mapper; - -/** - * 用户 - * - * @author Mark sunlightcs@gmail.com - */ -@Mapper -public interface UserDao extends MPJBaseMapper { - -} diff --git a/src/main/java/com/peanut/modules/book/entity/BookClockInChatEntity.java b/src/main/java/com/peanut/modules/book/entity/BookClockEntryChatEntity.java similarity index 93% rename from src/main/java/com/peanut/modules/book/entity/BookClockInChatEntity.java rename to src/main/java/com/peanut/modules/book/entity/BookClockEntryChatEntity.java index 3c9d6e24..f000c4e7 100644 --- a/src/main/java/com/peanut/modules/book/entity/BookClockInChatEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/BookClockEntryChatEntity.java @@ -12,7 +12,7 @@ import java.util.List; @Data @TableName("book_clock_entry_chat") -public class BookClockInChatEntity implements Serializable { +public class BookClockEntryChatEntity implements Serializable { private static final long serialVersionUID = 1L; @TableId diff --git a/src/main/java/com/peanut/modules/book/entity/BookForumArticlesEntity.java b/src/main/java/com/peanut/modules/book/entity/BookForumArticlesEntity.java index f70b9bb1..aae90e9e 100644 --- a/src/main/java/com/peanut/modules/book/entity/BookForumArticlesEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/BookForumArticlesEntity.java @@ -102,7 +102,7 @@ public class BookForumArticlesEntity { //说话的人 @TableField(exist = false) - private UserEntity user; + private MyUserEntity user; diff --git a/src/main/java/com/peanut/modules/book/entity/BookForumCommentEntity.java b/src/main/java/com/peanut/modules/book/entity/BookForumCommentEntity.java index 1447a28c..3a417aa9 100644 --- a/src/main/java/com/peanut/modules/book/entity/BookForumCommentEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/BookForumCommentEntity.java @@ -70,11 +70,11 @@ public class BookForumCommentEntity { //发言者 @TableField(exist = false) - private UserEntity user; + private MyUserEntity user; //对谁说 @TableField(exist = false) - private UserEntity puser; + private MyUserEntity puser; //子对话 @TableField(exist = false) diff --git a/src/main/java/com/peanut/modules/book/entity/BuyOrder.java b/src/main/java/com/peanut/modules/book/entity/BuyOrder.java index 226e5730..70190195 100644 --- a/src/main/java/com/peanut/modules/book/entity/BuyOrder.java +++ b/src/main/java/com/peanut/modules/book/entity/BuyOrder.java @@ -169,4 +169,7 @@ public class BuyOrder implements Serializable { @TableField(exist = false) private Long timestamp; + + @TableField(exist = false) + private MyUserEntity user; } diff --git a/src/main/java/com/peanut/modules/book/entity/UserEntity.java b/src/main/java/com/peanut/modules/book/entity/UserEntity.java deleted file mode 100644 index b4ddc3c2..00000000 --- a/src/main/java/com/peanut/modules/book/entity/UserEntity.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.peanut.modules.book.entity; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.math.BigDecimal; -import java.util.Date; - -@Data -@TableName("user") -public class UserEntity { - - private static final long serialVersionUID = 1L; - - @TableId - @TableField("id") - private Integer id; - - private String name; - - private Integer age; - - private Integer sex; - - private String avatar; - - private String nickname; - - private String tel; - - private String password; - - private String vip; - - @TableField("vip_start_time") - private Date vipStartTime; - - @TableField("vip_validtime") - private Date vipValidtime; - - @TableField("peanut_coin") - private BigDecimal peanutCoin; - - @TableField("read_time") - private Date readTime; - - @TableField("last_login_time") - private Date lastLoginTime; - - @TableField("yljk_oid") - private String yljkOid; - - @TableField("create_time") - private Date createTime; - - @TableField("update_time") - private Date updateTime; - - @TableField("del_flag") - private Integer delFlag; - - private String remark; -} diff --git a/src/main/java/com/peanut/modules/book/service/BookClockEntryChatService.java b/src/main/java/com/peanut/modules/book/service/BookClockEntryChatService.java index d6eb3352..c91fa49e 100644 --- a/src/main/java/com/peanut/modules/book/service/BookClockEntryChatService.java +++ b/src/main/java/com/peanut/modules/book/service/BookClockEntryChatService.java @@ -1,7 +1,7 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.modules.book.entity.BookClockInChatEntity; +import com.peanut.modules.book.entity.BookClockEntryChatEntity; -public interface BookClockEntryChatService extends IService { +public interface BookClockEntryChatService extends IService { } diff --git a/src/main/java/com/peanut/modules/book/service/BookForumArticlesService.java b/src/main/java/com/peanut/modules/book/service/BookForumArticlesService.java index bbf88dc6..bc9d7518 100644 --- a/src/main/java/com/peanut/modules/book/service/BookForumArticlesService.java +++ b/src/main/java/com/peanut/modules/book/service/BookForumArticlesService.java @@ -13,8 +13,6 @@ public interface BookForumArticlesService extends IService params); - List getForumsLimit(Integer book_id,Integer limit); - Integer getForumsCount(Integer book_id); } diff --git a/src/main/java/com/peanut/modules/book/service/MyUserService.java b/src/main/java/com/peanut/modules/book/service/MyUserService.java index 52d1c9d7..80569337 100644 --- a/src/main/java/com/peanut/modules/book/service/MyUserService.java +++ b/src/main/java/com/peanut/modules/book/service/MyUserService.java @@ -3,11 +3,13 @@ package com.peanut.modules.book.service; import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; +import com.peanut.modules.book.entity.BookForumArticlesEntity; import com.peanut.modules.book.entity.MyUserEntity; import com.peanut.modules.book.entity.UserAppAuthorEntity; import org.springframework.context.annotation.Lazy; import javax.persistence.Entity; +import java.util.List; import java.util.Map; /** @@ -30,6 +32,8 @@ public interface MyUserService extends IService { //电子书针对听书鉴权 boolean bookAuthen(Integer bookId,Integer userId); + List getForumsLimit(Integer book_id, Integer limit); + //会员开通 电话 开通 期限 boolean openMember(Integer customerId,Integer openMonth); diff --git a/src/main/java/com/peanut/modules/book/service/PayWechatOrderService.java b/src/main/java/com/peanut/modules/book/service/PayWechatOrderService.java index 1f0d6c7d..1d73b6d9 100644 --- a/src/main/java/com/peanut/modules/book/service/PayWechatOrderService.java +++ b/src/main/java/com/peanut/modules/book/service/PayWechatOrderService.java @@ -18,5 +18,7 @@ public interface PayWechatOrderService extends IService { PageUtils queryPage(Map params); void add(String orderSn,String prepayId); + + void addForPoint(String orderSn,String prepayId,Integer buyOrderId); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookClockEntryChatImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookClockEntryChatImpl.java index 85c51fc6..8ffdac07 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BookClockEntryChatImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BookClockEntryChatImpl.java @@ -2,10 +2,10 @@ package com.peanut.modules.book.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.modules.book.dao.BookClockEntryChatDao; -import com.peanut.modules.book.entity.BookClockInChatEntity; +import com.peanut.modules.book.entity.BookClockEntryChatEntity; import com.peanut.modules.book.service.BookClockEntryChatService; import org.springframework.stereotype.Service; @Service("bookClockEntryChatService") -public class BookClockEntryChatImpl extends ServiceImpl implements BookClockEntryChatService { +public class BookClockEntryChatImpl extends ServiceImpl implements BookClockEntryChatService { } diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookForumArticlesServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookForumArticlesServiceImpl.java index 910ce131..b0c72aef 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BookForumArticlesServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BookForumArticlesServiceImpl.java @@ -6,28 +6,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; -import com.peanut.modules.app.service.UserService; import com.peanut.modules.book.dao.BookForumArticlesDao; -import com.peanut.modules.book.entity.AuthorEntity; -import com.peanut.modules.book.entity.BookEntity; import com.peanut.modules.book.entity.BookForumArticlesEntity; -import com.peanut.modules.book.entity.PublisherEntity; -import com.peanut.modules.book.service.AuthorService; import com.peanut.modules.book.service.BookForumArticlesService; -import com.peanut.modules.book.service.BookService; -import com.peanut.modules.book.service.PublisherService; +import com.peanut.modules.book.service.MyUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Arrays; import java.util.List; import java.util.Map; @Service public class BookForumArticlesServiceImpl extends ServiceImpl implements BookForumArticlesService { - @Autowired - UserService userService; + @Override @@ -61,20 +53,6 @@ public class BookForumArticlesServiceImpl extends ServiceImpl getForumsLimit(Integer book_id,Integer limit) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(BookForumArticlesEntity::getDelflag,0); - wrapper.eq(BookForumArticlesEntity::getBookid,book_id); - wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime); - wrapper.last("limit "+limit); - List bookForumArticlesEntities = this.getBaseMapper().selectList(wrapper); - //补充说话的人的用户信息 - for (BookForumArticlesEntity b : bookForumArticlesEntities){ - b.setUser(userService.getById(b.getUserid())); - } - return bookForumArticlesEntities; - } @Override public Integer getForumsCount(Integer book_id) { diff --git a/src/main/java/com/peanut/modules/book/service/impl/BookForumCommenServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BookForumCommenServiceImpl.java index f6bcee8f..a3b9cb4a 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BookForumCommenServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BookForumCommenServiceImpl.java @@ -6,10 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; -import com.peanut.modules.app.service.UserService; import com.peanut.modules.book.dao.BookForumCommentDao; import com.peanut.modules.book.entity.BookForumCommentEntity; import com.peanut.modules.book.service.BookForumCommenService; +import com.peanut.modules.book.service.MyUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,7 +20,7 @@ import java.util.Map; public class BookForumCommenServiceImpl extends ServiceImpl implements BookForumCommenService { @Autowired - private UserService userService; + private MyUserService userService; @Override public PageUtils queryPage(Map params) { diff --git a/src/main/java/com/peanut/modules/book/service/impl/MyUserServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/MyUserServiceImpl.java index 78506583..da379880 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/MyUserServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/MyUserServiceImpl.java @@ -8,6 +8,7 @@ import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody; import com.aliyun.tea.TeaException; import com.aliyun.teautil.Common; import com.aliyun.teautil.models.RuntimeOptions; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.google.common.collect.Maps; import com.peanut.common.utils.*; @@ -55,6 +56,8 @@ public class MyUserServiceImpl extends ServiceImpl impl private CouponHistoryService couponHistoryService; @Autowired private MyUserDao myUserDao; + @Autowired + private BookForumArticlesService bookForumArticlesService; @Override public PageUtils queryPage(Map params) { @@ -145,6 +148,21 @@ public class MyUserServiceImpl extends ServiceImpl impl return true; } + @Override + public List getForumsLimit(Integer book_id,Integer limit) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BookForumArticlesEntity::getDelflag,0); + wrapper.eq(BookForumArticlesEntity::getBookid,book_id); + wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime); + wrapper.last("limit "+limit); + List bookForumArticlesEntities = bookForumArticlesService.getBaseMapper().selectList(wrapper); + //补充说话的人的用户信息 + for (BookForumArticlesEntity b : bookForumArticlesEntities){ + b.setUser(this.getById(b.getUserid())); + } + return bookForumArticlesEntities; + } + diff --git a/src/main/java/com/peanut/modules/book/service/impl/PayWechatOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/PayWechatOrderServiceImpl.java index 185160fb..a99fe849 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/PayWechatOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/PayWechatOrderServiceImpl.java @@ -50,4 +50,22 @@ public class PayWechatOrderServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq("order_sn", orderSn); + BuyOrderEntity buyOrder = buyOrderService.getOne(wrapper); + PayWechatOrderEntity entity = new PayWechatOrderEntity(); + entity.setCustomerId(buyOrder.getUserId()); + entity.setCreateTime(new Date()); + entity.setOrderSn(buyOrder.getOrderSn()); + entity.setPrepayId(prepayId); + entity.setTotalAmount(buyOrder.getRealMoney()); + entity.setSystemLog("预支付完成"); + entity.setPayType(buyOrder.getOrderType()); + entity.setOrderId(buyOrder.getOrderSn()); + entity.setBuyOrderId(buyOrderId); + this.save(entity); + + } } \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/to/PageIdDto.java b/src/main/java/com/peanut/modules/book/to/PageIdDto.java index 169b0372..dfd63bff 100644 --- a/src/main/java/com/peanut/modules/book/to/PageIdDto.java +++ b/src/main/java/com/peanut/modules/book/to/PageIdDto.java @@ -9,6 +9,8 @@ public class PageIdDto implements Serializable { private Integer id; + private String key; + private Integer limit; private Integer page; diff --git a/src/main/java/com/peanut/modules/pay/IOSPay/service/impl/OrderServiceImpl.java b/src/main/java/com/peanut/modules/pay/IOSPay/service/impl/OrderServiceImpl.java index ca969be2..202ff5b6 100644 --- a/src/main/java/com/peanut/modules/pay/IOSPay/service/impl/OrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/pay/IOSPay/service/impl/OrderServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.common.utils.ExcludeEmptyQueryWrapper; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; -import com.peanut.modules.app.service.UserService; import com.peanut.modules.book.entity.BookBuyConfigEntity; import com.peanut.modules.book.entity.BuyOrder; import com.peanut.modules.book.entity.MyUserEntity; @@ -37,7 +36,7 @@ public class OrderServiceImpl extends ServiceImpl