TASK:AiDA
This commit is contained in:
@@ -11,9 +11,9 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("绑定邮箱")
|
||||
public class AccountBindEmailDTO {
|
||||
|
||||
@NotNull(message = "userId.cannot.be.empty")
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
// @NotNull(message = "userId.cannot.be.empty")
|
||||
// @ApiModelProperty("用户id")
|
||||
// private Long userId;
|
||||
|
||||
@NotBlank(message = "email.cannot.be.empty")
|
||||
@ApiModelProperty("邮箱")
|
||||
|
||||
@@ -281,13 +281,15 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
@Override
|
||||
public Boolean bindEmail(AccountBindEmailDTO accountBindEmailDTO) {
|
||||
Account account = baseMapper.selectById(accountBindEmailDTO.getUserId());
|
||||
// Account account = baseMapper.selectById(accountBindEmailDTO.getUserId());
|
||||
AuthPrincipalVo userHolder = UserContext.getUserHolder();
|
||||
Account account = accountMapper.selectById(userHolder.getId());
|
||||
if (Objects.isNull(account)) {
|
||||
throw new BusinessException("userName.does.not.exist", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
if (StringUtils.isNotBlank(account.getUserEmail())) {
|
||||
throw new BusinessException("user.has.bound.mailbox");
|
||||
}
|
||||
// if (StringUtils.isNotBlank(account.getUserEmail())) {
|
||||
// throw new BusinessException("user.has.bound.mailbox");
|
||||
// }
|
||||
//校验邮箱验证码
|
||||
String verifyCode = LocalCacheUtils.getVerifyCodeCache(AuthenticationOperationTypeEnum.BIND_MAILBOX.name() + "_" + accountBindEmailDTO.getUserEmail());
|
||||
if (StringUtils.isBlank(verifyCode)) {
|
||||
@@ -297,7 +299,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
throw new BusinessException("verification.code.error", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
//绑定
|
||||
updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
|
||||
account.setUserEmail(accountBindEmailDTO.getUserEmail());
|
||||
// updatePwdByUserId(accountBindEmailDTO.getUserEmail(), accountBindEmailDTO.getUserId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user