|
|
|
@ -48,11 +48,11 @@ public class SysUserSavePasswordService extends CrudService<SysUserPassword> imp
|
|
|
|
|
@Override
|
|
|
|
|
public void updatePassword(Long userId, String password, String newPwd) {
|
|
|
|
|
SysUser user = userService.getSysUserById(userId);
|
|
|
|
|
ValidatorBean.checkNotNull(user,"不存在的用户信息");
|
|
|
|
|
ValidatorBean.checkNotNull(user, "不存在的用户信息");
|
|
|
|
|
|
|
|
|
|
SysUserPassword userPassword = userPasswordRDao.getById(user.getUserLoginPasswordId());
|
|
|
|
|
ValidatorBean.checkNotNull(userPassword,"不存在的用户密码信息");
|
|
|
|
|
if(StringUtils.equals(userPassword.getUserPassword(),password)){
|
|
|
|
|
ValidatorBean.checkNotNull(userPassword, "不存在的用户密码信息");
|
|
|
|
|
if (StringUtils.equals(userPassword.getUserPassword(), password)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
@ -66,10 +66,10 @@ public class SysUserSavePasswordService extends CrudService<SysUserPassword> imp
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updatePassword(String loginName, String password, String newPwd) {
|
|
|
|
|
SysUser user= userService.getSysUserByLoginName(loginName);
|
|
|
|
|
SysUser user = userService.getSysUserByLoginName(loginName);
|
|
|
|
|
SysUserPassword userPassword = userPasswordRDao.getById(user.getUserLoginPasswordId());
|
|
|
|
|
ValidatorBean.checkNotNull(userPassword,"不存在的用户密码信息");
|
|
|
|
|
if(StringUtils.equals(userPassword.getUserPassword(),password)){
|
|
|
|
|
ValidatorBean.checkNotNull(userPassword, "不存在的用户密码信息");
|
|
|
|
|
if (StringUtils.equals(userPassword.getUserPassword(), password)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
|
|
|
|
@ -84,26 +84,51 @@ public class SysUserSavePasswordService extends CrudService<SysUserPassword> imp
|
|
|
|
|
@Override
|
|
|
|
|
public void updatePassword(Long userId, String password) {
|
|
|
|
|
SysUser user = userService.getSysUserById(userId);
|
|
|
|
|
ValidatorBean.checkNotNull(user,"不存在的用户信息");
|
|
|
|
|
ValidatorBean.checkNotNull(user, "不存在的用户信息");
|
|
|
|
|
user.setUserLoginPassword(password);
|
|
|
|
|
userPasswordUtil.checkPasswordSave(user);
|
|
|
|
|
|
|
|
|
|
userPasswordRDao.updateByProperties(
|
|
|
|
|
new String[]{"userId","isDeleted"},
|
|
|
|
|
new Object[]{user.getId(),CommonEnumUtil.IS_DEAL.NO.getValue()},
|
|
|
|
|
new String[]{"isDeleted","modifyDatetime","modifyUser"},
|
|
|
|
|
new String[]{"userId", "isDeleted"},
|
|
|
|
|
new Object[]{user.getId(), CommonEnumUtil.IS_DEAL.NO.getValue()},
|
|
|
|
|
new String[]{"isDeleted", "modifyDatetime", "modifyUser"},
|
|
|
|
|
new Object[]{
|
|
|
|
|
CommonEnumUtil.IS_DEAL.YES.getValue(), TimeTool.getNowTime(true), AuthUtil.getSessionUser().getUserName()});
|
|
|
|
|
|
|
|
|
|
SysUserPassword pwd = new SysUserPassword();
|
|
|
|
|
pwd.setUserId(userId);
|
|
|
|
|
pwd.setUserPassword(SysUserPasswordUtil.encoder(password));
|
|
|
|
|
ConvertBean.serviceModelInitialize(pwd,AuthUtil.getSessionUser());
|
|
|
|
|
ConvertBean.serviceModelInitialize(pwd, AuthUtil.getSessionUser());
|
|
|
|
|
SysUserPassword save = userPasswordRDao.save(pwd);
|
|
|
|
|
|
|
|
|
|
user.setUserLoginPasswordId(save.getId());
|
|
|
|
|
user.setUserPasswordLastModifyTime(TimeTool.getNowTime(true));
|
|
|
|
|
ConvertBean.serviceModelUpdate(user,AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
ConvertBean.serviceModelUpdate(user, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
userService.updateSysUser(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updatePasswordWizoutSession(String loginName, String password, String newPwd) {
|
|
|
|
|
SysUser user = userService.validatePasswordByLoginNameAndReturnUser(loginName, password);
|
|
|
|
|
user.setUserLoginPassword(password);
|
|
|
|
|
userPasswordUtil.checkPasswordSave(user);
|
|
|
|
|
|
|
|
|
|
userPasswordRDao.updateByProperties(
|
|
|
|
|
new String[]{"userId", "isDeleted"},
|
|
|
|
|
new Object[]{user.getId(), CommonEnumUtil.IS_DEAL.NO.getValue()},
|
|
|
|
|
new String[]{"isDeleted", "modifyDatetime", "modifyUser"},
|
|
|
|
|
new Object[]{
|
|
|
|
|
CommonEnumUtil.IS_DEAL.YES.getValue(), TimeTool.getNowTime(true), loginName});
|
|
|
|
|
|
|
|
|
|
SysUserPassword pwd = new SysUserPassword();
|
|
|
|
|
pwd.setUserId(user.getId());
|
|
|
|
|
pwd.setUserPassword(SysUserPasswordUtil.encoder(newPwd));
|
|
|
|
|
ConvertBean.serviceModelInitialize(pwd, loginName);
|
|
|
|
|
SysUserPassword save = userPasswordRDao.save(pwd);
|
|
|
|
|
|
|
|
|
|
user.setUserLoginPasswordId(save.getId());
|
|
|
|
|
user.setUserPasswordLastModifyTime(TimeTool.getNowTime(true));
|
|
|
|
|
ConvertBean.serviceModelUpdate(user, loginName);
|
|
|
|
|
userService.updateSysUser(user);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|