From 9d3675b12829de9ec46c210c5c8c460705206dbc Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期六, 18 十一月 2023 16:46:48 +0800
Subject: [PATCH] 问题项修改
---
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java
index 5443fa9..003509b 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningAllEquipmentShiftStatisticalProcessJob.java
@@ -3,9 +3,17 @@
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalShiftInfoService;
+import org.jeecg.modules.mdc.util.ThrowableUtil;
+import org.jeecg.modules.quartz.entity.QuartzJob;
+import org.jeecg.modules.quartz.entity.SysQuartzLog;
+import org.jeecg.modules.quartz.service.IQuartzJobService;
+import org.jeecg.modules.quartz.service.ISysQuartzLogService;
+import org.jeecg.modules.system.service.ISysAnnouncementService;
import org.quartz.*;
import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
/**
* @Description: 瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟
@@ -29,15 +37,37 @@
@Resource
private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService;
+ @Resource
+ private ISysQuartzLogService sysQuartzLogService;
+
+ @Resource
+ private IQuartzJobService quartzJobService;
+
+ @Resource
+ private ISysAnnouncementService sysAnnouncementService;
+
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+ SysQuartzLog quartzLog = new SysQuartzLog();
+ quartzLog.setCreateTime(new Date());
+ List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName());
+ if (byJobClassName != null && !byJobClassName.isEmpty()) {
+ quartzLog.setJobId(byJobClassName.get(0).getId());
+ }
+ quartzLog.setParams(this.parameter);
log.info(String.format("瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟 param: %s RunningAllEquipmentShiftStatisticalProcessJob start! 鏃堕棿:" + DateUtils.now(), this.parameter));
+ long startTime = System.currentTimeMillis();
try {
mdcEquipmentStatisticalShiftInfoService.runningAllEquipmentShiftStatisticalProcess(this.parameter);
- log.info("瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟 RunningAllEquipmentShiftStatisticalProcessJob 鎵ц鎴愬姛!");
+ quartzLog.setIsSuccess(0);
} catch (Exception e) {
- log.error("瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟 RunningAllEquipmentShiftStatisticalProcessJob 鎵ц澶辫触!");
- log.error(e.getMessage(), e);
+ quartzLog.setIsSuccess(-1);
+ quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e));
+ // 鍙戦�佹秷鎭�氱煡
+ sysAnnouncementService.jobSendMessage("瀹氭椂缁熻鍗曟棩鐝鏁版嵁浠诲姟", quartzLog.getExceptionDetail());
}
+ long endTime = System.currentTimeMillis();
+ quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime)));
+ sysQuartzLogService.save(quartzLog);
}
}
--
Gitblit v1.9.3