userentity bug

This commit is contained in:
wangjinlei
2023-10-18 12:41:22 +08:00
parent 59f46eb2aa
commit 8f7f785ba9
21 changed files with 75 additions and 239 deletions

View File

@@ -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;

View File

@@ -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("注册")

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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();
// }
}

View File

@@ -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.BookClockEntryChatEntity;
import com.peanut.modules.book.entity.UserEntity;
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;
/**
* 获取论坛内容
@@ -81,7 +81,7 @@ public class BookClockForumController {
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<BookClockEntryChatEntity> subQueryWrapper = new QueryWrapper<>();
@@ -91,8 +91,8 @@ public class BookClockForumController {
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());

View File

@@ -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请求
@@ -132,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()));
}
@@ -159,7 +158,7 @@ public class BookForumArticlesServiceController {
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()));
}
@@ -185,7 +184,7 @@ public class BookForumArticlesServiceController {
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()));
}
@@ -232,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));
}

View File

@@ -263,7 +263,7 @@ public class BuyOrderController {
BuyOrderEntity buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new LambdaQueryWrapper<BuyOrderEntity>().eq(BuyOrderEntity::getOrderSn, timeId));
WechatPaymentInfo paymentInfo = new WechatPaymentInfo();
paymentInfo.setOrderSn(buyOrderEntity.getOrderSn());
paymentInfo.setBuyOrderId(buyOrderEntity.getOrderId());
paymentInfo.setBuyOrderId(Integer.valueOf(buyOrderEntity.getProductId()));
paymentInfo.setTotalAmount(buyOrderEntity.getRealMoney());
wxpayService.prepay(paymentInfo);
return R.ok().put("orderSn", timeId);

View File

@@ -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);
}
/**
* 信息

View File

@@ -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> {
}

View File

@@ -102,7 +102,7 @@ public class BookForumArticlesEntity {
//说话的人
@TableField(exist = false)
private UserEntity user;
private MyUserEntity user;

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -9,6 +9,8 @@ public class PageIdDto implements Serializable {
private Integer id;
private String key;
private Integer limit;
private Integer page;

View File

@@ -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.BuyOrderEntity;
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;