BUGFIX:1. 新建的教育管理员无法登录、无法分配积分
2. 填写个人信息时会覆盖其他人的信息 TASK:教育用户不能通过个人版登录入口登录
This commit is contained in:
@@ -145,6 +145,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
|
||||
log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO));
|
||||
Account account = getOneByEmail(accountDTO.getEmail());
|
||||
validateEduOrComLogin(account);
|
||||
//用户有效期校验
|
||||
validateUserValidaExpire(account);
|
||||
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) {
|
||||
@@ -298,6 +299,21 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
}
|
||||
}
|
||||
|
||||
// 判断当前用户应该从哪个入口登录
|
||||
private void validateEduOrComLogin(Account account){
|
||||
// 获取当前用户的身份,判断应该选择的登录入口
|
||||
if (Objects.nonNull(account) && Objects.nonNull(account.getSystemUser())){
|
||||
switch (account.getSystemUser()){
|
||||
case 7:
|
||||
case 8:
|
||||
throw new BusinessException("school.account.login", ResultEnum.PROMPT.getCode());
|
||||
case 5:
|
||||
case 6:
|
||||
throw new BusinessException("company.account.login", ResultEnum.PROMPT.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateExceptionIp(String ip, Account account) {
|
||||
//必须先绑定邮箱才可以发有异常ip邮件提醒
|
||||
if (StringUtils.isNotBlank(account.getUserEmail())) {
|
||||
@@ -532,8 +548,11 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
if (!StringUtil.isNullOrEmpty(emailSendDTO.getCountry()) || !StringUtil.isNullOrEmpty(emailSendDTO.getOccupation())
|
||||
|| StringUtils.isEmpty(emailSendDTO.getSurname()) || StringUtils.isNotEmpty(emailSendDTO.getTitle())
|
||||
|| StringUtils.isNotEmpty(emailSendDTO.getGivenName())){
|
||||
Long accountId = UserContext.getUserHolder().getId();
|
||||
Account account = baseMapper.selectById(accountId);
|
||||
if (StringUtil.isNullOrEmpty(emailSendDTO.getEmail())){
|
||||
throw new BusinessException("email.cannot.be.empty");
|
||||
}
|
||||
// todo 如果之后允许存在相同的邮件,但是所属机构不同的情况,这里需要做修改
|
||||
Account account = getOneByEmail(emailSendDTO.getEmail());
|
||||
account.setCountry(emailSendDTO.getCountry());
|
||||
account.setOccupation(emailSendDTO.getOccupation());
|
||||
account.setTitle(emailSendDTO.getTitle());
|
||||
@@ -2309,12 +2328,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
if (CollectionUtil.isEmpty(accounts)) {
|
||||
throw new BusinessException("UserEmail or school name incorrect.");
|
||||
}
|
||||
qw.lambda().eq(Account::getUserPassword, accountDTO.getPassword());
|
||||
Account account = accounts.get(0);
|
||||
|
||||
/* qw.lambda().eq(Account::getUserPassword, accountDTO.getPassword());
|
||||
accounts = accountMapper.selectList(qw);
|
||||
if (CollectionUtil.isEmpty(accounts)) {
|
||||
throw new BusinessException("password.error");
|
||||
}
|
||||
Account account = accounts.get(0);
|
||||
}*/
|
||||
|
||||
validateUserValidaExpire(account);
|
||||
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) {
|
||||
|
||||
@@ -613,12 +613,14 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
case 5:
|
||||
account.setCreditsUsageLimit(BigDecimal.ZERO);
|
||||
account.setCredits(BigDecimal.ZERO);
|
||||
account.setCreditsUsage(BigDecimal.ZERO);
|
||||
account.setSystemUser(5);
|
||||
account.setSubAccountNum(0);
|
||||
break;
|
||||
case 7:
|
||||
account.setCreditsUsageLimit(BigDecimal.ZERO);
|
||||
account.setCredits(BigDecimal.ZERO);
|
||||
account.setCreditsUsage(BigDecimal.ZERO);
|
||||
account.setSystemUser(7);
|
||||
account.setSubAccountNum(0);
|
||||
break;
|
||||
@@ -627,6 +629,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
|
||||
if (Objects.nonNull(accountAddDTO.getCredits())){
|
||||
account.setCredits(accountAddDTO.getCredits());
|
||||
account.setCreditsUsage(BigDecimal.ZERO);
|
||||
account.setCreditsUsageLimit(accountAddDTO.getCredits());
|
||||
}
|
||||
if (Objects.nonNull(accountAddDTO.getSubAccountNum())){
|
||||
|
||||
Reference in New Issue
Block a user