fix(后台管理): 新增租户ID=null的情况下跳过租户过滤,删除无用的定时任务逻辑

This commit is contained in:
2025-07-30 01:57:19 +08:00
parent 9eb250d0f0
commit bdc1ffdfd3
2 changed files with 8 additions and 23 deletions
@@ -21,11 +21,11 @@ public class OrderScheduler {
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查订单超时情况
@Scheduled(fixedRate = 60 * 1000)
public void checkOrderTimeout() {
log.info("开始执行订单超时检查任务");
log.debug("开始执行订单超时检查任务");
try {
TenantContextHolder.setTenant("webApp");
orderService.checkAndHandleOrderTimeout();
log.info("订单超时检查任务执行完成");
log.debug("订单超时检查任务执行完成");
} catch (Exception e) {
log.error("订单超时检查任务执行失败", e);
} finally {
@@ -33,25 +33,4 @@ public class OrderScheduler {
}
}
// 每隔一定时间(这里设置为每分钟检查一次,可根据实际情况调整)检查是否存在未服务完成的订单
// @Scheduled(fixedRate = 60 * 1000)
public void processOrdersInQueue() {
log.info("开始执行订单队列处理任务");
try {
orderService.processOrdersInQueue();
log.info("订单队列处理任务执行完成");
} catch (Exception e) {
log.error("订单队列处理任务执行失败", e);
}
}
// @Scheduled(fixedRate = 2 * 60 * 1000)
public void processOrdersCompleted() {
log.info("开始执行订单完成处理任务");
try {
// TODO: 实现订单完成处理逻辑
log.info("订单完成处理任务执行完成");
} catch (Exception e) {
log.error("订单完成处理任务执行失败", e);
}
}
}
@@ -48,6 +48,12 @@ public class CustomTenantInterceptor extends TenantLineInnerInterceptor {
return;
}
// 租户为null时跳过租户过滤
if (null == tenant) {
log.debug("租户为null,SQL {} 跳过租户过滤", msId);
return;
}
// 如果在忽略列表中,直接返回,不执行租户过滤
if (isIgnoreMappedStatement(msId)) {
log.debug("SQL {} 在忽略列表中,跳过租户过滤", msId);