|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.msdw.tms.controller; |
|
|
|
package com.msdw.tms.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.system.UserInfo; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.msdw.tms.api.UserControllerApi; |
|
|
|
import com.msdw.tms.api.UserControllerApi; |
|
|
|
import com.msdw.tms.common.utils.PageUtils; |
|
|
|
import com.msdw.tms.common.utils.PageUtils; |
|
|
|
import com.msdw.tms.common.utils.R; |
|
|
|
import com.msdw.tms.common.utils.R; |
|
|
@ -7,6 +9,7 @@ import com.msdw.tms.entity.UserEntity; |
|
|
|
import com.msdw.tms.entity.vo.UserEntityVo; |
|
|
|
import com.msdw.tms.entity.vo.UserEntityVo; |
|
|
|
import com.msdw.tms.service.UserService; |
|
|
|
import com.msdw.tms.service.UserService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
@ -78,6 +81,30 @@ public class UserController implements UserControllerApi { |
|
|
|
return R.ok(); |
|
|
|
return R.ok(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 校验密码 |
|
|
|
|
|
|
|
* @param entity 封装用户id和输入的原密码和新密码 |
|
|
|
|
|
|
|
* @return R 响应的状态信息 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
|
|
|
@PostMapping("/examinePassword") |
|
|
|
|
|
|
|
public R examinePassword(@RequestBody UserEntityVo entity){ |
|
|
|
|
|
|
|
Integer userid = entity.getUserid();//用户id
|
|
|
|
|
|
|
|
String password = entity.getPassword();//用户输入的当前密码
|
|
|
|
|
|
|
|
String newPassword = entity.getNewPassword();//获取用户输入的新密码
|
|
|
|
|
|
|
|
UserEntity byId = userService.getById(userid);//获取用户个人信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserEntity user = new UserEntity();//用于封装数据
|
|
|
|
|
|
|
|
if (password.equals(byId.getPassword())==true){ |
|
|
|
|
|
|
|
user.setUserid(userid).setPassword(newPassword); |
|
|
|
|
|
|
|
boolean b = userService.updateById(user); |
|
|
|
|
|
|
|
if (b==true){ |
|
|
|
|
|
|
|
return R.ok(); |
|
|
|
|
|
|
|
}else{return R.error("更新密码失败,请稍后重试");} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return R.error(403,"原密码错误,更新密码失败!!!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|