BUGFIX:同一浏览器切换版本登录时,密码被置空
This commit is contained in:
@@ -304,7 +304,9 @@ public class AccountController {
|
|||||||
@PostMapping("deleteSubAccount")
|
@PostMapping("deleteSubAccount")
|
||||||
@ApiOperation(value = "子账号删除")
|
@ApiOperation(value = "子账号删除")
|
||||||
public Response<Boolean> deleteSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
|
public Response<Boolean> deleteSubAccount(@Valid @RequestBody AddSubAccountDTO addSubAccountDTO) {
|
||||||
return Response.success(accountService.deleteSubAccount(addSubAccountDTO));
|
// return Response.success(accountService.deleteSubAccount(addSubAccountDTO));
|
||||||
|
accountService.removeSubAccount(addSubAccountDTO, true);
|
||||||
|
return Response.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("subAccountList")
|
@PostMapping("subAccountList")
|
||||||
|
|||||||
@@ -125,6 +125,9 @@ public class Account implements Serializable {
|
|||||||
|
|
||||||
private BigDecimal creditsUsageLimit;
|
private BigDecimal creditsUsageLimit;
|
||||||
|
|
||||||
|
// 学校分配的积分使用情况
|
||||||
|
private BigDecimal creditsUsage = BigDecimal.ZERO;
|
||||||
|
|
||||||
private Integer subAccountNum;
|
private Integer subAccountNum;
|
||||||
|
|
||||||
private String invitationCode;
|
private String invitationCode;
|
||||||
|
|||||||
@@ -2,11 +2,17 @@ package com.ai.da.model.dto;
|
|||||||
|
|
||||||
import com.ai.da.mapper.primary.entity.Account;
|
import com.ai.da.mapper.primary.entity.Account;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
public class AddSubAccountDTO extends Account {
|
public class AddSubAccountDTO extends Account {
|
||||||
|
|
||||||
private List<Long> deleteIdList;
|
private List<Long> deleteIdList;
|
||||||
|
|
||||||
|
public AddSubAccountDTO(List<Long> deleteIdList) {
|
||||||
|
this.deleteIdList = deleteIdList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,8 @@ public interface AccountService extends IService<Account> {
|
|||||||
|
|
||||||
Boolean deleteSubAccount(AddSubAccountDTO addSubAccountDTO);
|
Boolean deleteSubAccount(AddSubAccountDTO addSubAccountDTO);
|
||||||
|
|
||||||
|
void removeSubAccount(AddSubAccountDTO addSubAccountDTO, boolean returnCredits);
|
||||||
|
|
||||||
PageBaseResponse<Account> subAccountList(SubAccountPageDTO subAccountPageDTO);
|
PageBaseResponse<Account> subAccountList(SubAccountPageDTO subAccountPageDTO);
|
||||||
|
|
||||||
Account accountDetail(Long id);
|
Account accountDetail(Long id);
|
||||||
|
|||||||
@@ -132,10 +132,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
Account account = getOneByEmail(accountDTO.getEmail());
|
Account account = getOneByEmail(accountDTO.getEmail());
|
||||||
//用户有效期校验
|
//用户有效期校验
|
||||||
validateUserValidaExpire(account);
|
validateUserValidaExpire(account);
|
||||||
if ("Third-000000".equals(account.getUserPassword())) {
|
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) {
|
||||||
account.setUserPassword(accountDTO.getPassword());
|
account.setUserPassword(accountDTO.getPassword());
|
||||||
accountMapper.updateById(account);
|
accountMapper.updateById(account);
|
||||||
} else {
|
} else if ("Third-000000".equals(account.getUserPassword())){
|
||||||
|
throw new BusinessException("Password cannot be empty");
|
||||||
|
} else {
|
||||||
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
||||||
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
||||||
}
|
}
|
||||||
@@ -1161,10 +1163,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
@Override
|
@Override
|
||||||
public Boolean designWorksRegister(AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
public Boolean designWorksRegister(AccountDesignWorksRegisterDTO accountDesignWorksRegisterDTO) {
|
||||||
log.info("注册账号。邮箱:{}", accountDesignWorksRegisterDTO.getUserEmail() );
|
log.info("注册账号。邮箱:{}", accountDesignWorksRegisterDTO.getUserEmail() );
|
||||||
QueryWrapper<Account> qw = new QueryWrapper<>();
|
QueryWrapper<Account> qwA = new QueryWrapper<>();
|
||||||
qw.eq("BINARY user_email", accountDesignWorksRegisterDTO.getUserEmail());
|
qwA.eq("BINARY user_email", accountDesignWorksRegisterDTO.getUserEmail());
|
||||||
List<Account> accountList = accountMapper.selectList(qw);
|
List<Account> accountList = accountMapper.selectList(qwA);
|
||||||
if (CollectionUtil.isNotEmpty(accountList)) {
|
|
||||||
|
QueryWrapper<TrialOrder> qwT = new QueryWrapper<>();
|
||||||
|
qwT.eq("BINARY email", accountDesignWorksRegisterDTO.getUserEmail());
|
||||||
|
List<TrialOrder> trialOrders = trialOrderMapper.selectList(qwT);
|
||||||
|
if (CollectionUtil.isNotEmpty(accountList) || CollectionUtil.isNotEmpty(trialOrders)) {
|
||||||
throw new BusinessException("The email has already been registered");
|
throw new BusinessException("The email has already been registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2032,9 +2038,12 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
Account account = accounts.get(0);
|
Account account = accounts.get(0);
|
||||||
|
|
||||||
validateUserValidaExpire(account);
|
validateUserValidaExpire(account);
|
||||||
if ("Third-000000".equals(account.getUserPassword())) {
|
|
||||||
|
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) {
|
||||||
account.setUserPassword(accountDTO.getPassword());
|
account.setUserPassword(accountDTO.getPassword());
|
||||||
accountMapper.updateById(account);
|
accountMapper.updateById(account);
|
||||||
|
} else if ("Third-000000".equals(account.getUserPassword())){
|
||||||
|
throw new BusinessException("Password cannot be empty");
|
||||||
} else {
|
} else {
|
||||||
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
||||||
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
||||||
@@ -2092,14 +2101,16 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
qw.lambda().eq(Account::getUserPassword, accountDTO.getPassword());
|
qw.lambda().eq(Account::getUserPassword, accountDTO.getPassword());
|
||||||
accounts = accountMapper.selectList(qw);
|
accounts = accountMapper.selectList(qw);
|
||||||
if (CollectionUtil.isEmpty(accounts)) {
|
if (CollectionUtil.isEmpty(accounts)) {
|
||||||
throw new BusinessException("Password error.");
|
throw new BusinessException("password.error");
|
||||||
}
|
}
|
||||||
Account account = accounts.get(0);
|
Account account = accounts.get(0);
|
||||||
|
|
||||||
validateUserValidaExpire(account);
|
validateUserValidaExpire(account);
|
||||||
if ("Third-000000".equals(account.getUserPassword())) {
|
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) {
|
||||||
account.setUserPassword(accountDTO.getPassword());
|
account.setUserPassword(accountDTO.getPassword());
|
||||||
accountMapper.updateById(account);
|
accountMapper.updateById(account);
|
||||||
|
} else if ("Third-000000".equals(account.getUserPassword())){
|
||||||
|
throw new BusinessException("Password cannot be empty");
|
||||||
} else {
|
} else {
|
||||||
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
if (!account.getUserPassword().equals(accountDTO.getPassword())) {
|
||||||
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
throw new BusinessException("password.error", ResultEnum.PROMPT.getCode());
|
||||||
@@ -2192,6 +2203,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
|||||||
if (isUsernameExists(account.getOrganizationName(), addSubAccountDTO.getUserName())) {
|
if (isUsernameExists(account.getOrganizationName(), addSubAccountDTO.getUserName())) {
|
||||||
throw new BusinessException("This organization already has an account with the same username.");
|
throw new BusinessException("This organization already has an account with the same username.");
|
||||||
}
|
}
|
||||||
|
// 之后是否需要检验密码不能设置为空
|
||||||
|
|
||||||
// 校验当前账号邮箱是否有个人账号
|
// 校验当前账号邮箱是否有个人账号
|
||||||
Account subAccount = accountMapper.selectOne(new QueryWrapper<Account>().eq("user_email", addSubAccountDTO.getUserEmail()));
|
Account subAccount = accountMapper.selectOne(new QueryWrapper<Account>().eq("user_email", addSubAccountDTO.getUserEmail()));
|
||||||
|
|||||||
Reference in New Issue
Block a user