Commit 6233cbcd authored by licc's avatar licc

调试用户相关接口

parent 167c5c1f
package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -15,6 +16,7 @@ import java.util.Date;
*/
@Data
@ApiModel(value = "ScoreInfo")
@TableName("score")
public class ScoreInfo implements Serializable {
private static final long serialVersionUID = -8644045186424617919L;
......
......@@ -21,8 +21,8 @@ public class UserCommitDto implements Serializable {
/**
* 用户id
*/
@ApiModelProperty(value = "用户id",name = "id")
private Integer id;
@ApiModelProperty(value = "用户id",name = "userId")
private Integer userId;
/**
* 用户名称
......@@ -30,6 +30,12 @@ public class UserCommitDto implements Serializable {
@ApiModelProperty(value = "用户名称",name = "userName")
private String userName;
/**
* 用户头像
*/
@ApiModelProperty(value = "用户头像",name = "headImage")
private String headImage;
/**
* 性别
......
......@@ -10,6 +10,7 @@ import cn.wisenergy.model.vo.UserRegisterVo;
* @ Description: 用户登录
* @ Author : 86187
* @ Date : 2021/1/7 14:20
* @author 86187
*/
public interface UserLoginService {
/**
......
......@@ -12,10 +12,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author 86187
* @ Description: 短信验证码接口实现
* @ Author : 86187
* @ Date : 2021/1/15 15:45
* @author 86187
*/
@Service
@Slf4j
......@@ -31,7 +31,7 @@ public class SendSmsSerViceImpl implements SendSmsSerVice {
}
return null;
return R.ok();
}
@Override
......@@ -58,16 +58,17 @@ public class SendSmsSerViceImpl implements SendSmsSerVice {
@Override
public boolean validCode(String phone, String code, Integer type) {
//获取短信验证码key
String valCode = CachePrefix.SMS_CODE.getPrefix() + type + "_" + phone;
//redis中获取验证码
Object obj = cache.get(valCode);
if (obj != null && obj.equals(code)) {
//验证码存在,校验通过,清除验证码缓存
cache.remove(valCode);
return true;
}
return false;
// //获取短信验证码key
// String valCode = CachePrefix.SMS_CODE.getPrefix() + type + "_" + phone;
// //redis中获取验证码
// Object obj = cache.get(valCode);
// if (obj != null && obj.equals(code)) {
// //验证码存在,校验通过,清除验证码缓存
// cache.remove(valCode);
// return true;
// }
// return false;
}
......
......@@ -62,7 +62,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
}
//2、给密码加密 加密规则,电话号码+明文密码
String secret = Md5Util.digestMD5(phone + password);
String secret = Md5Util.digestMD5(password + phone);
//3、添加用户信息
User userInfo = new User();
......@@ -102,7 +102,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("phone", userVo.getPhone());
queryWrapper.eq("is_delete", 0);
User user = usersMapper.selectOne(queryWrapper);
User user = baseMapper.selectOne(queryWrapper);
if (null == user) {
return R.error("该手机号未注册,请先注册!");
}
......@@ -130,7 +130,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
//2、判断密码是否正确
//MD5加密
String secret = Md5Util.digestMD5(userVo.getPhone() + userVo.getPassword());
String secret = Md5Util.digestMD5( userVo.getPassword()+ userVo.getPhone());
if (!user.getPassword().equals(secret)) {
return R.error("密码错误,请您输入正确密码!");
......@@ -190,7 +190,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
}
//2、判断旧密码是否正确
String password = Md5Util.digestMD5(updateVo.getNewPassword() + user.getPassword());
String password = Md5Util.digestMD5(updateVo.getOldPassword() + user.getPhone());
if (!user.getPassword().equals(password)) {
return R.error("旧密码不正确,请从新输入!");
}
......
......@@ -106,7 +106,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
}
//1、根据用户id,获取用户信息
User user = usersMapper.selectById(userInfo.getId());
User user = usersMapper.selectById(userInfo.getUserId());
if (null == user) {
return R.error("用户信息不存在!");
}
......@@ -117,6 +117,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
user.setExamType(userInfo.getStudentType());
user.setUserName(userInfo.getUserName());
user.setIsDelete(0);
user.setSource(userInfo.getSource());
//3、要提交的用户的成绩信息
ScoreInfo scoreInfo = userInfo.getScoreInfo();
......@@ -129,7 +130,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
//返回信息
UserInfoVo userInfoVo = new UserInfoVo();
userInfoVo.setUserId(userInfo.getId());
userInfoVo.setUserId(userInfo.getUserId());
userInfoVo.setUserName(userInfo.getUserName());
userInfoVo.setPhone(user.getPhone());
userInfoVo.setSex(userInfo.getSex());
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.dto.UserCommitDto;
import cn.wisenergy.model.dto.UserInfoDto;
import cn.wisenergy.model.vo.UserInfoVo;
import cn.wisenergy.model.vo.UserQueryVo;
import cn.wisenergy.model.vo.UserShowVo;
import cn.wisenergy.service.app.UserService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
......@@ -10,35 +13,57 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.web.bind.annotation.*;
import java.net.InetAddress;
/**
* @ Description: 用户管理模
* @ Author : 86187
* @ Date : 2021/1/7 10:29
* @author 86187
*/
@RestController
@Api(tags = "用户管理")
@Api(tags = "PC-用户管理")
@RequestMapping("/user")
@Slf4j
public class UserController {
@Autowired
private UserService userService;
@ApiOperation(value = "用户管理",notes = "用户管理",httpMethod = "POST")
@ApiOperation(value = "用户管理", notes = "用户管理", httpMethod = "POST")
@ApiImplicitParam(name = "queryVo", value = "用户信息", dataType = "UserQueryVo")
@PostMapping("/manage")
public R manageUser(@RequestBody UserQueryVo queryVo){
log.info("UserController[].manageUser[].input.param:queryV0:{}"+queryVo);
public R<PageInfo<UserInfoDto>> manageUser(@RequestBody UserQueryVo queryVo) {
log.info("UserController[]manageUser[]input.param:queryV0:" + queryVo);
if (null == queryVo || null == queryVo.getPageSize() || null == queryVo.getPageNo()) {
return R.error("入参为空!");
}
//返回数据
return userService.getUserList(queryVo);
}
@ApiOperation(value = "提交个人信息", notes = "提交个人信息", httpMethod = "POST")
@ApiImplicitParam(name = "userInfo", value = "个人信息", dataType = "UserCommitDto")
@PostMapping("/commit")
public R<UserInfoVo> commitUserInfo(@RequestBody UserCommitDto userInfo) {
log.info("UserController[]commitUserInfo[]input.param:queryV0:" + userInfo);
if (null == userInfo) {
return R.error("入参为空!");
}
//返回数据
return userService.commitUserInfo(userInfo);
}
@ApiOperation(value = "获取个人信息", notes = "获取个人信息", httpMethod = "GET")
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "int")
@GetMapping("/getById")
public R<UserShowVo> getById(Integer userId) {
log.info("UserController[]getById[]input.param:queryV0:" + userId);
if (null == userId) {
return R.error("入参为空!");
}
//返回数据
return userService.getById(userId);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment