Merge branch 'dev/dev_xp' into dev/3.1_release_merge
This commit is contained in:
@@ -22,6 +22,8 @@ import org.apache.poi.ss.usermodel.Row;
|
|||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
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.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.security.core.parameters.P;
|
import org.springframework.security.core.parameters.P;
|
||||||
@@ -157,6 +159,8 @@ public class MyTaskScheduler {
|
|||||||
private PortfolioMapper portfolioMapper;
|
private PortfolioMapper portfolioMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private CollectionSortService collectionSortService;
|
private CollectionSortService collectionSortService;
|
||||||
|
@Autowired
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
// 定时任务,每十五天执行一次
|
// 定时任务,每十五天执行一次
|
||||||
// @Scheduled(cron = "0 0 0 ? * MON")
|
// @Scheduled(cron = "0 0 0 ? * MON")
|
||||||
@@ -188,7 +192,9 @@ public class MyTaskScheduler {
|
|||||||
long thirtyDaysInMillis = 30L * 24 * 60 * 60 * 1000;
|
long thirtyDaysInMillis = 30L * 24 * 60 * 60 * 1000;
|
||||||
boolean within30Days = timeDifference <= thirtyDaysInMillis;
|
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);
|
SendEmailUtil.sendWillBeExpiredEmail(account, null);
|
||||||
}
|
}
|
||||||
@@ -204,7 +210,9 @@ public class MyTaskScheduler {
|
|||||||
qw.lambda().between(TrialOrder::getCreateTime, yesterday.atStartOfDay(), yesterday.atTime(23, 59, 59));
|
qw.lambda().between(TrialOrder::getCreateTime, yesterday.atStartOfDay(), yesterday.atTime(23, 59, 59));
|
||||||
List<TrialOrder> trialOrders = trialOrderMapper.selectList(qw);
|
List<TrialOrder> 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工作簿
|
// 创建Excel工作簿
|
||||||
try (Workbook workbook = new XSSFWorkbook()) {
|
try (Workbook workbook = new XSSFWorkbook()) {
|
||||||
// 创建工作表
|
// 创建工作表
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//先清空当前线程变量,防止上一个线程遗留
|
||||||
|
UserContext.delete();
|
||||||
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
filterChain.doFilter(httpServletRequest, httpServletResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user