From 77d9d1e2497f89fc26ceaf97e025434b6c364269 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 25 Sep 2025 12:00:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/user/UserAuthTypeRestController.java | 8 ++++++ .../user/AccountBindUserAuthTypeCmdExe.java | 25 +++++++++++++++++++ .../user/user/UserAuthTypeServiceImpl.java | 5 ++++ .../user/user/UserAuthTypeService.java | 2 ++ 4 files changed, 40 insertions(+) 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);