| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.qiniu.util.Md5; |
| | | import com.ycl.jxkg.domain.entity.UserEventLog; |
| | | import com.ycl.jxkg.domain.form.StudentUpdatePwdForm; |
| | | import com.ycl.jxkg.domain.form.UpdatePwdForm; |
| | | import com.ycl.jxkg.enums.RoleEnum; |
| | | import com.ycl.jxkg.enums.UserStatusEnum; |
| | |
| | | .set(User::getLastUpdatePasswordTime, new Date()) |
| | | .update(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateStudentPassword(StudentUpdatePwdForm form) { |
| | | User user = baseMapper.selectById(form.getUserId()); |
| | | if(user ==null){ |
| | | throw new RuntimeException("用户不存在"); |
| | | } |
| | | if(authenticationService.authUser(user,user.getUserName(),form.getOldPassword())){ |
| | | //密码正确 |
| | | new LambdaUpdateChainWrapper<>(baseMapper) |
| | | .eq(User::getId, form.getUserId()) |
| | | .set(User::getPassword, authenticationService.pwdEncode(form.getNewPassword())) |
| | | .set(User::getLastUpdatePasswordTime, new Date()) |
| | | .update(); |
| | | }else { |
| | | //密码错误 |
| | | throw new RuntimeException("旧密码错误,请确认后重新输入"); |
| | | } |
| | | } |
| | | } |