diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/user/UserAuthTypeRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/user/UserAuthTypeRestController.java index 6b76d436..68f1dfb7 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/user/UserAuthTypeRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/user/UserAuthTypeRestController.java @@ -74,6 +74,14 @@ public class UserAuthTypeRestController extends BaseController { userAuthTypeService.accountBindUserAuthType(cmd); } + /** + * 修改账号密码. + */ + @PostMapping("/account-update") + public void accountUpdate(@RequestBody @Validated AccountBindUserAuthTypeCmd cmd) { + userAuthTypeService.accountUpdate(cmd); + } + /** * 账号是否已经绑定. * diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/AccountBindUserAuthTypeCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/AccountBindUserAuthTypeCmdExe.java index 5dd170d1..5cefe842 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/AccountBindUserAuthTypeCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/AccountBindUserAuthTypeCmdExe.java @@ -36,6 +36,31 @@ public class AccountBindUserAuthTypeCmdExe { private final PasswordLogService passwordLogService; public void execute(AccountBindUserAuthTypeCmd cmd) { + AuthType authType = authTypeService.getAuthInfo( + AuthTypeEnum.ACCOUNT.name(), + cmd.requiredReqUserIdStr() + ); + + // 4032 已被绑定 + ResponseAssert.isNull(UserErrorCode.ALREADY_USED, authType); + + AccountAuth accountAuth = accountAuthService.getByUserId(cmd.requiredReqUserId()); + + ResponseAssert.isNull(UserErrorCode.ALREADY_USED, accountAuth); + //4061 密码不符合规则 + ResponseAssert.isTrue(UserErrorCode.ACCOUNT_PASSWORD_NOT_COMPLY_WITH_RULES, + validatePassword(cmd.getPwd())); + + accountAuthService.saveAccountAuth(new AccountAuth() + .setUserId(cmd.requiredReqUserId()) + .setPwd(cmd.getPwd()) + .setDel(Boolean.FALSE) + ); + + authTypeService.save(toAuthType(cmd.requiredReqUserId(), cmd)); + } + + public void accountUpdate(AccountBindUserAuthTypeCmd cmd) { //4061 密码不符合规则 ResponseAssert.isTrue(UserErrorCode.ACCOUNT_PASSWORD_NOT_COMPLY_WITH_RULES, validatePassword(cmd.getPwd())); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeServiceImpl.java index c9a0675c..345132c6 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeServiceImpl.java @@ -56,6 +56,11 @@ public class UserAuthTypeServiceImpl implements UserAuthTypeService { accountBindUserAuthTypeCmdExe.execute(cmd); } + @Override + public void accountUpdate(AccountBindUserAuthTypeCmd cmd) { + accountBindUserAuthTypeCmdExe.accountUpdate(cmd); + } + @Override public Boolean accountIsBind(AppExtCommand cmd) { return accountIsBindCmdExe.execute(cmd); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeService.java index 87920da6..470d6222 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeService.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserAuthTypeService.java @@ -21,6 +21,8 @@ public interface UserAuthTypeService { void accountBindUserAuthType(AccountBindUserAuthTypeCmd cmd); + void accountUpdate(AccountBindUserAuthTypeCmd cmd); + Boolean accountIsBind(AppExtCommand cmd); void restoreAuthDelByUserId(Long userId);