|
@@ -1,5 +1,7 @@
|
|
|
package com.jd.brume.controller
|
|
|
|
|
|
+import cn.hutool.core.codec.Base64
|
|
|
+
|
|
|
import javax.annotation.Resource
|
|
|
import javax.validation.constraints.NotNull
|
|
|
|
|
@@ -142,7 +144,7 @@ class UserController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改用户信息
|
|
|
+ * 修改密码
|
|
|
* @param userVo
|
|
|
* @return
|
|
|
*/
|
|
@@ -150,25 +152,30 @@ class UserController {
|
|
|
def updatePwd(@Validated(UpdatePwdGroup) UserVo userVo) {
|
|
|
if (StrUtil.isNotBlank(userVo.password)) {
|
|
|
if (userVo.password != userVo.repeatPass) return new Result().msg(100, '密码输入不一致')
|
|
|
+ userVo.password = Base64.decodeStr(userVo.password);
|
|
|
userVo.password = SMUtil.sm2Encrypt(userVo.password)
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(userVo.oldPass)) {
|
|
|
- userVo.oldPass = SMUtil.sm2Encrypt(userVo.oldPass)
|
|
|
+ userVo.oldPass = Base64.decodeStr(userVo.oldPass);
|
|
|
+ def userEntity = userService.lambdaQuery().select(UserSelect.pwd).eq(UserFunc.userId(), userVo.userId).one();
|
|
|
+ def decrypt = SMUtil.sm2Decrypt(userEntity.getPassword())
|
|
|
+ if(!decrypt.equals(userVo.oldPass)){
|
|
|
+ return new Result().msg(100, '旧密码输入错误')
|
|
|
+ }
|
|
|
}
|
|
|
- def count = userService.count(Wrappers.lambdaQuery().eq(UserFunc.userId(), userVo.userId).eq(UserFunc.password(), userVo.oldPass))
|
|
|
- if (count < 1) return new Result().msg(100, '旧密码输入错误')
|
|
|
|
|
|
UserEntity user = new UserEntity(userId: userVo.userId, password: userVo.password)
|
|
|
return new Result().ok(userService.updateById(user))
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * ���û���Ϣ
|
|
|
+ * 修改手机号
|
|
|
* @param userVo
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping('updateTel')
|
|
|
def updateTel(@Validated(UpdateTelGroup) UserVo userVo) {
|
|
|
+ userVo.phone = Base64.decodeStr(userVo.phone);
|
|
|
UserEntity user = new UserEntity(userId: userVo.userId, phone: userVo.phone)
|
|
|
return new Result().ok(userService.updateById(user))
|
|
|
}
|