diff --git a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java index f916ae31..97a21ab2 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -145,6 +145,7 @@ public class AccountServiceImpl extends ServiceImpl 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 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 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 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())) { diff --git a/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java b/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java index 960d4a72..d77201bd 100644 --- a/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/ConvenientInquiryServiceImpl.java @@ -613,12 +613,14 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl