|
|
|
@ -18,6 +18,7 @@ import com.glxp.api.util.PasswordUtils;
|
|
|
|
|
import com.glxp.api.util.StringUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -132,7 +133,10 @@ public class AuthUserController extends BaseController {
|
|
|
|
|
//修改用户信息
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/admin/auth/admin/updateUser")
|
|
|
|
|
public BaseResponse updateUser(@RequestBody UpdateUserRequset updateUserRequset) {
|
|
|
|
|
public BaseResponse updateUser(@RequestBody @Valid UpdateUserRequset updateUserRequset, BindingResult bindingResult) {
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
AuthAdmin authAdmin = customerService.getUserBean();
|
|
|
|
|
System.out.println(updateUserRequset.toString());
|
|
|
|
|
if (StrUtil.isEmpty(updateUserRequset.getPassWord())) {
|
|
|
|
@ -172,7 +176,7 @@ public class AuthUserController extends BaseController {
|
|
|
|
|
oldPassWords.add(pwd);
|
|
|
|
|
// 使用String.join()方法将List转换为逗号分隔的字符串
|
|
|
|
|
String commaSeparatedPasswords = String.join(",", oldPassWords);
|
|
|
|
|
updateUserRequset.setOldPassword(commaSeparatedPasswords);
|
|
|
|
|
updateUserRequset.setOldPassWord(commaSeparatedPasswords);
|
|
|
|
|
updateUserRequset.setNewPassword(pwd);
|
|
|
|
|
authAdminService.updateUser(updateUserRequset);
|
|
|
|
|
return ResultVOUtils.success("修改成功");
|
|
|
|
@ -197,10 +201,10 @@ public class AuthUserController extends BaseController {
|
|
|
|
|
return ResultVOUtils.error(500, "请输入确认密码!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (updateUserRequset.getNewPassword().equals(updateUserRequset.getOldPassword())) {
|
|
|
|
|
if (updateUserRequset.getNewPassword().equals(updateUserRequset.getOldPassWord())) {
|
|
|
|
|
return ResultVOUtils.error(500, "新密码与旧密码重复!请重新修改!");
|
|
|
|
|
}
|
|
|
|
|
if (updateUserRequset.getNewPassword().equals(updateUserRequset.getConfirmPassword()) && updateUserRequset.getOldPassword().equals(authAdmin.getPassWord())) {
|
|
|
|
|
if (updateUserRequset.getNewPassword().equals(updateUserRequset.getConfirmPassword()) && updateUserRequset.getOldPassWord().equals(authAdmin.getPassWord())) {
|
|
|
|
|
String newPwd = PasswordUtils.authAdminPwd(updateUserRequset.getNewPassword());
|
|
|
|
|
authAdmin.setPassWord(newPwd);
|
|
|
|
|
authAdmin.setLastUpdatePwdTime(new Date());
|
|
|
|
|