From 0ce968b919b3307ace0d457b72fb8c2ce0a8acfe Mon Sep 17 00:00:00 2001 From: xupei Date: Thu, 22 Jan 2026 10:37:23 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:=20=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E6=9C=89=E6=95=88=E6=9C=9F=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=8A=9B=E5=87=BA=E5=AF=BC=E8=87=B4=E4=BA=8B?= =?UTF-8?q?=E5=8A=A1=E5=9B=9E=E6=BB=9A=EF=BC=8C=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BF=AE=E6=94=B9=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/service/AccountService.java | 2 ++ .../com/ai/da/service/impl/AccountServiceImpl.java | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ai/da/service/AccountService.java b/src/main/java/com/ai/da/service/AccountService.java index c3c4d24c..f1654e69 100644 --- a/src/main/java/com/ai/da/service/AccountService.java +++ b/src/main/java/com/ai/da/service/AccountService.java @@ -246,4 +246,6 @@ public interface AccountService extends IService { void setEduAdminToExpire(Account adminAccount); String getOrganizationTypeByRole(Integer roleNum); + + void validateUserValidaExpire(Account account); } 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 f8766168..c7543b1c 100644 --- a/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/AccountServiceImpl.java @@ -39,9 +39,10 @@ import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Lazy; +import org.springframework.context.ApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.springframework.util.CollectionUtils; @@ -83,6 +84,9 @@ import java.util.stream.Collectors; @Slf4j @Service public class AccountServiceImpl extends ServiceImpl implements AccountService { + @Resource + private ApplicationContext applicationContext; + @Resource private AccountMapper accountMapper; @@ -279,7 +283,7 @@ public class AccountServiceImpl extends ServiceImpl impl // 定义常量(临时) private static final Integer SYSTEM_USER_TYPE_EDU_ADMIN = 7; - private void validateUserValidaExpire(Account account) { + public void validateUserValidaExpire(Account account) { Long currentTime = new Date().getTime(); if (account.getSystemUser().equals(0)) { return; @@ -297,7 +301,9 @@ public class AccountServiceImpl extends ServiceImpl impl if (isEduAdmin) { setEduAdminToExpire(account); } else { - toVisitor(account); + // 这里调用代理的 toVisitor 方法 + AccountService proxy = applicationContext.getBean(AccountService.class); + proxy.toVisitor(account); // return; throw new BusinessException("account.expired", ResultEnum.PROMPT.getCode()); } @@ -1949,6 +1955,7 @@ public class AccountServiceImpl extends ServiceImpl impl return baseMapper.selectList(queryWrapper); } + @Transactional(propagation = Propagation.REQUIRES_NEW) public void toVisitor(Account account) { accountMapper.toVisitor(account.getId()); }