From b9c24386b98a1cbdd011c2f1c0adcd3b82191335 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 16 Sep 2025 17:42:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?BUGFIX:=20=E6=9C=AA=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=BA=86=E4=B8=8A=E4=B8=80=E4=B8=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=BF=99=E4=B8=AA=E7=BA=BF=E7=A8=8B=E7=9A=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/common/security/filter/AuthenticationFilter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java index c3058fa5..d3a053c1 100644 --- a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java +++ b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java @@ -88,6 +88,8 @@ public class AuthenticationFilter extends OncePerRequestFilter { stopWatch.stop(); } } else { + //先清空当前线程变量,防止上一个线程遗留 + UserContext.delete(); filterChain.doFilter(httpServletRequest, httpServletResponse); } } From 3c1d180ed6d4eefb1153c445cea00401a061d572 Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 17 Sep 2025 11:33:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?BUGFIX:=20=E8=AF=95=E7=94=A8=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=EF=BC=8C=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/common/config/MyTaskScheduler.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java index 0fdce29a..312b30da 100644 --- a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java +++ b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java @@ -22,6 +22,8 @@ import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.security.core.parameters.P; @@ -157,6 +159,8 @@ public class MyTaskScheduler { private PortfolioMapper portfolioMapper; @Resource private CollectionSortService collectionSortService; + @Autowired + private Environment environment; // 定时任务,每十五天执行一次 // @Scheduled(cron = "0 0 0 ? * MON") @@ -188,7 +192,9 @@ public class MyTaskScheduler { long thirtyDaysInMillis = 30L * 24 * 60 * 60 * 1000; boolean within30Days = timeDifference <= thirtyDaysInMillis; - if (within30Days) { + String[] activeProfiles = environment.getActiveProfiles(); + boolean env = activeProfiles.length == 1 && Objects.equals(activeProfiles[0], "prod"); + if (within30Days && env) { // 发邮件 SendEmailUtil.sendWillBeExpiredEmail(account, null); } @@ -204,7 +210,9 @@ public class MyTaskScheduler { qw.lambda().between(TrialOrder::getCreateTime, yesterday.atStartOfDay(), yesterday.atTime(23, 59, 59)); List trialOrders = trialOrderMapper.selectList(qw); - if (!trialOrders.isEmpty()) { + String[] activeProfiles = environment.getActiveProfiles(); + boolean env = activeProfiles.length == 1 && Objects.equals(activeProfiles[0], "prod"); + if (!trialOrders.isEmpty() && env) { // 创建Excel工作簿 try (Workbook workbook = new XSSFWorkbook()) { // 创建工作表