Merge branch 'dev' of http://47.92.113.182:3000/zcloud_gbs/zcloud_gbs_basic_info_gwj into komen
commit
9bb96f109d
|
|
@ -90,6 +90,13 @@ public class CorpInfoController {
|
|||
}
|
||||
return SingleResponse.of(corpInfoService.info(id));
|
||||
}
|
||||
@ApiOperation("查询当前登录租户自身企业详情")
|
||||
@PostMapping("/info/self")
|
||||
public SingleResponse<CorpInfoCO> getSelfInfo() {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
Long tenantId = ssoUser.getTenantId();
|
||||
return SingleResponse.of(corpInfoService.info(tenantId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除")
|
||||
|
|
|
|||
|
|
@ -659,16 +659,9 @@ public class UserUpdateExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updatePasswordFromApp(AppUserUpdatePassWordCmd cmd) {
|
||||
//新密码和旧密码不能相同
|
||||
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);
|
||||
UserUpdatePassWordCmd userUpdatePassWordCmd = new UserUpdatePassWordCmd();
|
||||
BeanUtils.copyProperties(cmd, userUpdatePassWordCmd);
|
||||
executeUpdatePassword(userUpdatePassWordCmd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -686,6 +679,10 @@ 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,5 +30,8 @@ public class UserUpdatePassWordCmd extends Command {
|
|||
@ApiModelProperty(value = "新密码", name = "newPassword")
|
||||
@NotEmpty(message = "新密码不能为空")
|
||||
private String newPassword;
|
||||
@ApiModelProperty(value = "确认密码", name = "confirmPassword")
|
||||
@NotEmpty(message = "确认密码不能为空")
|
||||
private String confirmPassword;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -578,37 +578,35 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
@Override
|
||||
public Response updatePassword(UserDO userDO) {
|
||||
UserDO oldUserDO = getById(userDO.getId());
|
||||
// TODO 验证老密码是否正确
|
||||
if (userDO.getPassword() != null && !userDO.getPassword().equals("")) {
|
||||
SingleResponse<UserDetailCO> detail = null;
|
||||
try {
|
||||
log.info("updateXgf,GBS获取用户信息{}", userDO.getId());
|
||||
detail = userFacade.getDetail(userDO.getId());
|
||||
log.info("updateXgf,GBS获取用户信息返回: {}", JSONUtil.toJsonStr(detail));
|
||||
} catch (Exception e) {
|
||||
log.error("updateXgf,GBS获取用户信息失败: {}", e.getMessage());
|
||||
}
|
||||
if (detail.getData() != null) {
|
||||
AccountPasswordCheckCmd accountPasswordCheckCmd = new AccountPasswordCheckCmd();
|
||||
accountPasswordCheckCmd.setUserId(userDO.getId());
|
||||
accountPasswordCheckCmd.setPassword(userDO.getPassword());
|
||||
log.info("updateXgf,GBS验证用户密码请求:{}", JSONUtil.toJsonStr(accountPasswordCheckCmd));
|
||||
SingleResponse<Long> response = accountFacade.checkPassword(accountPasswordCheckCmd);
|
||||
log.info("updateXgf,GBS验证用户密码返回:{}", JSONUtil.toJsonStr(response));
|
||||
if (!response.isSuccess()) {
|
||||
throw new BizException("原密码不正确");
|
||||
}
|
||||
} else {
|
||||
//验证本地密码
|
||||
UserE userE = new UserE();
|
||||
Boolean checkUserPassword = userE.checkUserEncryptionPassword(userDO.getPassword(), oldUserDO.getPassword());
|
||||
log.info("updateXgf,验证用户本地密码结果:{}", checkUserPassword);
|
||||
if (!checkUserPassword) {
|
||||
throw new BizException("密码错误");
|
||||
}
|
||||
if (userDO.getPassword() == null || userDO.getPassword().isEmpty()) {
|
||||
throw new BizException("原密码不能为空");
|
||||
}
|
||||
SingleResponse<UserDetailCO> detail = null;
|
||||
try {
|
||||
log.info("updateXgf,GBS获取用户信息{}", userDO.getId());
|
||||
detail = userFacade.getDetail(userDO.getId());
|
||||
log.info("updateXgf,GBS获取用户信息返回: {}", JSONUtil.toJsonStr(detail));
|
||||
} catch (Exception e) {
|
||||
log.error("updateXgf,GBS获取用户信息失败: {}", e.getMessage());
|
||||
}
|
||||
if (detail.getData() != null) {
|
||||
AccountPasswordCheckCmd accountPasswordCheckCmd = new AccountPasswordCheckCmd();
|
||||
accountPasswordCheckCmd.setUserId(userDO.getId());
|
||||
accountPasswordCheckCmd.setPassword(userDO.getPassword());
|
||||
log.info("updateXgf,GBS验证用户密码请求:{}", JSONUtil.toJsonStr(accountPasswordCheckCmd));
|
||||
SingleResponse<Long> response = accountFacade.checkPassword(accountPasswordCheckCmd);
|
||||
log.info("updateXgf,GBS验证用户密码返回:{}", JSONUtil.toJsonStr(response));
|
||||
if (!response.isSuccess()) {
|
||||
throw new BizException("原密码不正确");
|
||||
}
|
||||
} else {
|
||||
log.info("updateXgf,密码为空,不进行密码验证");
|
||||
//验证本地密码
|
||||
UserE userE = new UserE();
|
||||
Boolean checkUserPassword = userE.checkUserEncryptionPassword(userDO.getPassword(), oldUserDO.getPassword());
|
||||
log.info("updateXgf,验证用户本地密码结果:{}", checkUserPassword);
|
||||
if (!checkUserPassword) {
|
||||
throw new BizException("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
//修改多个密码
|
||||
|
|
|
|||
Loading…
Reference in New Issue