From e3b0d3bc0a8cf50416f476637b6720d0cef92321 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 10 Sep 2025 22:05:45 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:1.=20=E6=96=B0=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E6=95=99=E8=82=B2=E7=AE=A1=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E3=80=81=E6=97=A0=E6=B3=95=E5=88=86=E9=85=8D?= =?UTF-8?q?=E7=A7=AF=E5=88=86=202.=20=E5=A1=AB=E5=86=99=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6=E4=BC=9A=E8=A6=86=E7=9B=96=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E4=BA=BA=E7=9A=84=E4=BF=A1=E6=81=AF=20TASK:=E6=95=99?= =?UTF-8?q?=E8=82=B2=E7=94=A8=E6=88=B7=E4=B8=8D=E8=83=BD=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E7=89=88=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da/service/impl/AccountServiceImpl.java | 30 +++++++++++++++---- .../impl/ConvenientInquiryServiceImpl.java | 3 ++ src/main/resources/messages_en.properties | 2 ++ src/main/resources/messages_zh.properties | 2 ++ 4 files changed, 32 insertions(+), 5 deletions(-) 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