Compare commits
No commits in common. "abc03976f633b6c3807cab2421805046c5d665df" and "c4da5decd41eb30e3a456686564488699eed0c53" have entirely different histories.
abc03976f6
...
c4da5decd4
|
|
@ -395,9 +395,16 @@ public class UserUpdateExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updatePasswordFromApp(AppUserUpdatePassWordCmd cmd) {
|
||||
UserUpdatePassWordCmd userUpdatePassWordCmd = new UserUpdatePassWordCmd();
|
||||
BeanUtils.copyProperties(cmd, userUpdatePassWordCmd);
|
||||
executeUpdatePassword(userUpdatePassWordCmd);
|
||||
//新密码和旧密码不能相同
|
||||
if (cmd.getPassword().equals(cmd.getNewPassword())) {
|
||||
throw new BizException("新密码不能与旧密码相同");
|
||||
}
|
||||
UserE userE = new UserE();
|
||||
userE.checkPassword(cmd.getNewPassword(), cmd.getConfirmPassword());
|
||||
|
||||
BeanUtils.copyProperties(cmd, userE);
|
||||
userE.encryptionPassword();
|
||||
userGateway.updatePassword(userE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -415,10 +422,6 @@ public class UserUpdateExe {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public Response executeUpdatePassword(UserUpdatePassWordCmd userUpdatePassWordCmd) {
|
||||
UserE userE = new UserE();
|
||||
if (userUpdatePassWordCmd.getPassword().equals(userUpdatePassWordCmd.getNewPassword())) {
|
||||
throw new BizException("新密码不能与旧密码相同");
|
||||
}
|
||||
userE.checkPassword(userUpdatePassWordCmd.getNewPassword(), userUpdatePassWordCmd.getConfirmPassword());
|
||||
BeanUtils.copyProperties(userUpdatePassWordCmd, userE);
|
||||
userE.encryptionPassword();
|
||||
return userGateway.updatePassword(userE);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,5 @@ public class UserUpdatePassWordCmd extends Command {
|
|||
@ApiModelProperty(value = "新密码", name = "newPassword")
|
||||
@NotEmpty(message = "新密码不能为空")
|
||||
private String newPassword;
|
||||
@ApiModelProperty(value = "确认密码", name = "confirmPassword")
|
||||
@NotEmpty(message = "确认密码不能为空")
|
||||
private String confirmPassword;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Getter
|
||||
public enum CorpTypeEnum {
|
||||
// TODO 若修改默认密码通知前端同步修改
|
||||
OrdinaryEnterprises(0,"普通企业",UserTypeEnum.QY.getCode(), "Bb@12345678"),
|
||||
groupUnits(1, "集团单位",UserTypeEnum.QY.getCode(), "Bb@12345678"),
|
||||
share(2,"股份单位",UserTypeEnum.JG.getCode(), "Aa@12345678"),
|
||||
|
|
|
|||
|
|
@ -454,11 +454,15 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
|
||||
@Override
|
||||
public void changePassword(Long id, String password) {
|
||||
//修改这个手机号下所有密码
|
||||
UserDO userDO = getById(id);
|
||||
if (userDO == null) {
|
||||
return;
|
||||
}
|
||||
for (UserDO userDO1 : listUsersForPasswordUpdate(userDO)) {
|
||||
String phone = userDO.getPhone();
|
||||
|
||||
List<UserDO> userDOList = getListByPhone(phone, null);
|
||||
for (UserDO userDO1 : userDOList) {
|
||||
userChangePassword(userDO1.getId(), password);
|
||||
}
|
||||
}
|
||||
|
|
@ -539,9 +543,8 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
@Override
|
||||
public Response updatePassword(UserDO userDO) {
|
||||
UserDO oldUserDO = getById(userDO.getId());
|
||||
if (userDO.getPassword() == null || userDO.getPassword().isEmpty()) {
|
||||
throw new BizException("原密码不能为空");
|
||||
}
|
||||
// TODO 验证老密码是否正确
|
||||
if (userDO.getPassword() != null && !userDO.getPassword().equals("")) {
|
||||
SingleResponse<UserDetailCO> detail = null;
|
||||
try {
|
||||
log.info("updateXgf,GBS获取用户信息{}", userDO.getId());
|
||||
|
|
@ -569,28 +572,21 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
throw new BizException("密码错误");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info("updateXgf,密码为空,不进行密码验证");
|
||||
}
|
||||
|
||||
// 有手机号则同步修改同手机号账号,无手机号则只改当前账号
|
||||
for (UserDO userDO1 : listUsersForPasswordUpdate(oldUserDO)) {
|
||||
//修改多个密码
|
||||
String phone = oldUserDO.getPhone();
|
||||
|
||||
List<UserDO> userDOList = getListByPhone(phone, null);
|
||||
for (UserDO userDO1 : userDOList) {
|
||||
userChangePassword(userDO1.getId(), userDO.getNewPassword());
|
||||
}
|
||||
return Response.buildSuccess();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需要同步更新密码的用户列表。主账号等无手机号场景仅更新当前用户。
|
||||
*/
|
||||
private List<UserDO> listUsersForPasswordUpdate(UserDO userDO) {
|
||||
if (StringUtils.hasText(userDO.getPhone())) {
|
||||
List<UserDO> userDOList = getListByPhone(userDO.getPhone(), null);
|
||||
if (CollUtil.isNotEmpty(userDOList)) {
|
||||
return userDOList;
|
||||
}
|
||||
}
|
||||
return Collections.singletonList(userDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateFaceUrl(UserDO userDO) {
|
||||
return updateById(userDO);
|
||||
|
|
|
|||
Loading…
Reference in New Issue