BUGFIX:1. 新建的教育管理员无法登录、无法分配积分

2. 填写个人信息时会覆盖其他人的信息
TASK:教育用户不能通过个人版登录入口登录
This commit is contained in:
2025-09-10 22:05:45 +08:00
parent 5f5f2c83d7
commit e3b0d3bc0a
4 changed files with 32 additions and 5 deletions

View File

@@ -145,6 +145,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) { public AccountPreLoginVO preLogin(AccountPreLoginDTO accountDTO) {
log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO)); log.info("aida预先登入accountDTO###{}", JSON.toJSONString(accountDTO));
Account account = getOneByEmail(accountDTO.getEmail()); Account account = getOneByEmail(accountDTO.getEmail());
validateEduOrComLogin(account);
//用户有效期校验 //用户有效期校验
validateUserValidaExpire(account); validateUserValidaExpire(account);
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) { 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) { private void calculateExceptionIp(String ip, Account account) {
//必须先绑定邮箱才可以发有异常ip邮件提醒 //必须先绑定邮箱才可以发有异常ip邮件提醒
if (StringUtils.isNotBlank(account.getUserEmail())) { 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()) if (!StringUtil.isNullOrEmpty(emailSendDTO.getCountry()) || !StringUtil.isNullOrEmpty(emailSendDTO.getOccupation())
|| StringUtils.isEmpty(emailSendDTO.getSurname()) || StringUtils.isNotEmpty(emailSendDTO.getTitle()) || StringUtils.isEmpty(emailSendDTO.getSurname()) || StringUtils.isNotEmpty(emailSendDTO.getTitle())
|| StringUtils.isNotEmpty(emailSendDTO.getGivenName())){ || StringUtils.isNotEmpty(emailSendDTO.getGivenName())){
Long accountId = UserContext.getUserHolder().getId(); if (StringUtil.isNullOrEmpty(emailSendDTO.getEmail())){
Account account = baseMapper.selectById(accountId); throw new BusinessException("email.cannot.be.empty");
}
// todo 如果之后允许存在相同的邮件,但是所属机构不同的情况,这里需要做修改
Account account = getOneByEmail(emailSendDTO.getEmail());
account.setCountry(emailSendDTO.getCountry()); account.setCountry(emailSendDTO.getCountry());
account.setOccupation(emailSendDTO.getOccupation()); account.setOccupation(emailSendDTO.getOccupation());
account.setTitle(emailSendDTO.getTitle()); account.setTitle(emailSendDTO.getTitle());
@@ -2309,12 +2328,13 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
if (CollectionUtil.isEmpty(accounts)) { if (CollectionUtil.isEmpty(accounts)) {
throw new BusinessException("UserEmail or school name incorrect."); 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); 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);
validateUserValidaExpire(account); validateUserValidaExpire(account);
if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) { if ("Third-000000".equals(account.getUserPassword()) && !StringUtil.isNullOrEmpty(accountDTO.getPassword())) {

View File

@@ -613,12 +613,14 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
case 5: case 5:
account.setCreditsUsageLimit(BigDecimal.ZERO); account.setCreditsUsageLimit(BigDecimal.ZERO);
account.setCredits(BigDecimal.ZERO); account.setCredits(BigDecimal.ZERO);
account.setCreditsUsage(BigDecimal.ZERO);
account.setSystemUser(5); account.setSystemUser(5);
account.setSubAccountNum(0); account.setSubAccountNum(0);
break; break;
case 7: case 7:
account.setCreditsUsageLimit(BigDecimal.ZERO); account.setCreditsUsageLimit(BigDecimal.ZERO);
account.setCredits(BigDecimal.ZERO); account.setCredits(BigDecimal.ZERO);
account.setCreditsUsage(BigDecimal.ZERO);
account.setSystemUser(7); account.setSystemUser(7);
account.setSubAccountNum(0); account.setSubAccountNum(0);
break; break;
@@ -627,6 +629,7 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
if (Objects.nonNull(accountAddDTO.getCredits())){ if (Objects.nonNull(accountAddDTO.getCredits())){
account.setCredits(accountAddDTO.getCredits()); account.setCredits(accountAddDTO.getCredits());
account.setCreditsUsage(BigDecimal.ZERO);
account.setCreditsUsageLimit(accountAddDTO.getCredits()); account.setCreditsUsageLimit(accountAddDTO.getCredits());
} }
if (Objects.nonNull(accountAddDTO.getSubAccountNum())){ if (Objects.nonNull(accountAddDTO.getSubAccountNum())){

View File

@@ -159,6 +159,8 @@ one.time.limit.per.customer=This code has already been redeemed. Promo codes are
element.already.exists=This element already exists in the public library element.already.exists=This element already exists in the public library
have.no.permission=Sorry, you don't have permission have.no.permission=Sorry, you don't have permission
permit.bulk.creation=The system permits bulk account creation exclusively when no sub-accounts exist. permit.bulk.creation=The system permits bulk account creation exclusively when no sub-accounts exist.
school.account.login=School account detected.Please log in through the Academic portal.
enterprise.account.login=Enterprise account detected.Please log in through the Enterprise portal.
# 可能会报异常 # 可能会报异常
# Informative: # Informative:

View File

@@ -155,6 +155,8 @@ one.time.limit.per.customer=该码已兑换。每个促销码每位用户仅限
element.already.exists=元素已存在于公共库中 element.already.exists=元素已存在于公共库中
have.no.permission=您没有权限 have.no.permission=您没有权限
permit.bulk.creation=系统仅当不存在任何子账号时,才允许批量创建账号。 permit.bulk.creation=系统仅当不存在任何子账号时,才允许批量创建账号。
school.account.login=检测到学校账号。请从教育版入口登录。
enterprise.account.login=检测到企业账号。请从企业版入口登录。
# 可能会报异常 # 可能会报异常
# Informative: # Informative: