merge master
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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("注册")
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
|
||||
// UserEntity queryByMobile(String mobile);
|
||||
//
|
||||
// /**
|
||||
// * 用户登录
|
||||
// * @param form 登录表单
|
||||
// * @return 返回用户ID
|
||||
// */
|
||||
// long login(LoginForm form);
|
||||
}
|
||||
@@ -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<UserDao, UserEntity> implements UserService {
|
||||
|
||||
|
||||
// public UserEntity queryByMobile(String mobile) {
|
||||
// return baseMapper.selectOne(new QueryWrapper<UserEntity>().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();
|
||||
// }
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
|
||||
@@ -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<BookClockInChatEntity> {
|
||||
public interface BookClockEntryChatDao extends MPJBaseMapper<BookClockEntryChatEntity> {
|
||||
}
|
||||
|
||||
@@ -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<UserEntity> {
|
||||
|
||||
}
|
||||
@@ -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
|
||||
@@ -102,7 +102,7 @@ public class BookForumArticlesEntity {
|
||||
|
||||
//说话的人
|
||||
@TableField(exist = false)
|
||||
private UserEntity user;
|
||||
private MyUserEntity user;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -169,4 +169,7 @@ public class BuyOrder implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long timestamp;
|
||||
|
||||
@TableField(exist = false)
|
||||
private MyUserEntity user;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<BookClockInChatEntity> {
|
||||
public interface BookClockEntryChatService extends IService<BookClockEntryChatEntity> {
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ public interface BookForumArticlesService extends IService<BookForumArticlesEn
|
||||
PageUtils queryPages(Map<String, Object> params);
|
||||
|
||||
|
||||
List<BookForumArticlesEntity> getForumsLimit(Integer book_id,Integer limit);
|
||||
|
||||
Integer getForumsCount(Integer book_id);
|
||||
|
||||
}
|
||||
|
||||
@@ -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<MyUserEntity> {
|
||||
//电子书针对听书鉴权
|
||||
boolean bookAuthen(Integer bookId,Integer userId);
|
||||
|
||||
List<BookForumArticlesEntity> getForumsLimit(Integer book_id, Integer limit);
|
||||
|
||||
|
||||
//会员开通 电话 开通 期限
|
||||
boolean openMember(Integer customerId,Integer openMonth);
|
||||
|
||||
@@ -18,5 +18,7 @@ public interface PayWechatOrderService extends IService<PayWechatOrderEntity> {
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
void add(String orderSn,String prepayId);
|
||||
|
||||
void addForPoint(String orderSn,String prepayId,Integer buyOrderId);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<BookClockEntryChatDao, BookClockInChatEntity> implements BookClockEntryChatService {
|
||||
public class BookClockEntryChatImpl extends ServiceImpl<BookClockEntryChatDao, BookClockEntryChatEntity> implements BookClockEntryChatService {
|
||||
}
|
||||
|
||||
@@ -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<BookForumArticlesDao, BookForumArticlesEntity> implements BookForumArticlesService {
|
||||
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -61,20 +53,6 @@ public class BookForumArticlesServiceImpl extends ServiceImpl<BookForumArticlesD
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookForumArticlesEntity> getForumsLimit(Integer book_id,Integer limit) {
|
||||
LambdaQueryWrapper<BookForumArticlesEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
|
||||
wrapper.eq(BookForumArticlesEntity::getBookid,book_id);
|
||||
wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime);
|
||||
wrapper.last("limit "+limit);
|
||||
List<BookForumArticlesEntity> bookForumArticlesEntities = this.getBaseMapper().selectList(wrapper);
|
||||
//补充说话的人的用户信息
|
||||
for (BookForumArticlesEntity b : bookForumArticlesEntities){
|
||||
b.setUser(userService.getById(b.getUserid()));
|
||||
}
|
||||
return bookForumArticlesEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getForumsCount(Integer book_id) {
|
||||
|
||||
@@ -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<BookForumCommentDao, BookForumCommentEntity> implements BookForumCommenService {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private MyUserService userService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
|
||||
@@ -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<MyUserDao, MyUserEntity> impl
|
||||
private CouponHistoryService couponHistoryService;
|
||||
@Autowired
|
||||
private MyUserDao myUserDao;
|
||||
@Autowired
|
||||
private BookForumArticlesService bookForumArticlesService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
@@ -145,6 +148,21 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookForumArticlesEntity> getForumsLimit(Integer book_id,Integer limit) {
|
||||
LambdaQueryWrapper<BookForumArticlesEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(BookForumArticlesEntity::getDelflag,0);
|
||||
wrapper.eq(BookForumArticlesEntity::getBookid,book_id);
|
||||
wrapper.orderByDesc(BookForumArticlesEntity::getCreateTime);
|
||||
wrapper.last("limit "+limit);
|
||||
List<BookForumArticlesEntity> bookForumArticlesEntities = bookForumArticlesService.getBaseMapper().selectList(wrapper);
|
||||
//补充说话的人的用户信息
|
||||
for (BookForumArticlesEntity b : bookForumArticlesEntities){
|
||||
b.setUser(this.getById(b.getUserid()));
|
||||
}
|
||||
return bookForumArticlesEntities;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,4 +50,22 @@ public class PayWechatOrderServiceImpl extends ServiceImpl<PayWechatOrderDao, Pa
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addForPoint(String orderSn, String prepayId, Integer buyOrderId) {
|
||||
QueryWrapper<BuyOrderEntity> 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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ public class PageIdDto implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String key;
|
||||
|
||||
private Integer limit;
|
||||
|
||||
private Integer page;
|
||||
|
||||
@@ -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<PayIOSOrderMapper,IosPayOrderE
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private MyUserService userService;
|
||||
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
|
||||
@@ -58,6 +58,11 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
log.info("请求参数:{}", paramMap);
|
||||
JSONObject responseJson = wxPayUtil.doPostWexinV3(wechatPayConfig.getPayUrl(), json.toJSONString());
|
||||
String prepayId = responseJson.getString("prepay_id");
|
||||
payWechatOrderService.add(paymentInfo.getOrderSn(), prepayId);
|
||||
if (paymentInfo.getBuyOrderId() == null) {
|
||||
payWechatOrderService.add(paymentInfo.getOrderSn(), prepayId);
|
||||
} else {
|
||||
payWechatOrderService.addForPoint(paymentInfo.getOrderSn(), prepayId, paymentInfo.getBuyOrderId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ spring:
|
||||
redis:
|
||||
open: false # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: 59.110.212.44
|
||||
host: 39.106.36.183
|
||||
port: 6379
|
||||
password: Jgll2015 # 密码(默认为空)
|
||||
timeout: 6000000ms # 连接超时时长(毫秒)
|
||||
@@ -72,5 +72,5 @@ aliyun:
|
||||
server:
|
||||
port: 9200
|
||||
|
||||
redisAddress: redis://59.110.212.44:6379
|
||||
redisAddress: redis://39.106.36.183:6379
|
||||
redisPassword: Jgll2015
|
||||
@@ -1,11 +1,12 @@
|
||||
package com;
|
||||
|
||||
import com.peanut.modules.pay.weChatPay.config.WechatPayConfig;
|
||||
import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.PrivateKey;
|
||||
@SpringBootTest
|
||||
public class VxApiTest {
|
||||
@@ -32,5 +33,13 @@ public class VxApiTest {
|
||||
System.out.println(mchId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mytest(){
|
||||
WechatPaymentInfo wechatPaymentInfo = new WechatPaymentInfo();
|
||||
wechatPaymentInfo.setTotalAmount(new BigDecimal(56));
|
||||
wechatPaymentInfo.setOrderSn("testtest");
|
||||
System.out.println(wechatPaymentInfo.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user