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