From a40221c883c632630b4876ad846e08c0da8af388 Mon Sep 17 00:00:00 2001
From: Jay <csj123456>
Date: 星期三, 16 十月 2024 09:20:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/utils/ScheduleJob.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/utils/ScheduleJob.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/utils/ScheduleJob.java
index acdbd82..b4bf553 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/utils/ScheduleJob.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/utils/ScheduleJob.java
@@ -6,6 +6,7 @@
 import com.iailab.framework.tenant.core.context.TenantContextHolder;
 import com.iailab.module.data.job.entity.ScheduleJobEntity;
 import com.iailab.module.data.job.entity.ScheduleJobLogEntity;
+import com.iailab.module.data.job.service.ScheduleJobLogService;
 import org.quartz.DisallowConcurrentExecution;
 import org.quartz.JobExecutionContext;
 import org.slf4j.Logger;
@@ -32,13 +33,16 @@
 
         //设置当前租户
 		TenantContextHolder.setTenantId(scheduleJob.getTenantId());
+		Long tenantId = TenantContextHolder.getRequiredTenantId();
 
         //数据库保存执行记录
         ScheduleJobLogEntity log = new ScheduleJobLogEntity();
+		log.setId(System.currentTimeMillis());
         log.setJobId(scheduleJob.getId());
         log.setBeanName(scheduleJob.getBeanName());
         log.setParams(scheduleJob.getParams());
 		log.setCreateDate(new Date());
+		log.setTenantId(tenantId);
 
         //任务开始时间
         long startTime = System.currentTimeMillis();
@@ -69,8 +73,8 @@
 			log.setError(ExceptionUtils.getErrorStackTrace(e));
 		}finally {
 			//获取spring bean
-			/*ScheduleJobLogService scheduleJobLogService = SpringContextUtils.getBean(ScheduleJobLogService.class);
-			scheduleJobLogService.insert(log);*/
+			ScheduleJobLogService scheduleJobLogService = SpringContextUtils.getBean(ScheduleJobLogService.class);
+			scheduleJobLogService.insert(log);
 		}
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3