userentity bug
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();
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user