From 1a2258c4eca2e7514b6096004fa1c3e0036b402b Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期四, 28 三月 2024 14:04:24 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop --- 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