| | |
| | | import org.jeecg.modules.eam.service.IEamMaintenanceStandardDetailService; |
| | | import org.jeecg.modules.eam.service.IEamMaintenanceStandardService; |
| | | import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService; |
| | | 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.quartz.JobExecutionException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | |
| | | * @throws JobExecutionException |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | //任务日志 |
| | | SysQuartzLog quartzLog = new SysQuartzLog(); |
| | |
| | | } |
| | | //当前日期 |
| | | LocalDate now = LocalDate.now(); |
| | | try { |
| | | for (EamMaintenanceStandard standard : standardList) { |
| | | if (standard.getMaintenancePeriod() == null || standard.getMaintenancePeriod() < 1) { |
| | | log.error("周保标准周期设置错误,请先配置标准周期, standard:{}", standard); |
| | |
| | | request.setCreationMethod(OrderCreationMethodEnum.AUTO.name()); |
| | | List<EamWeekMaintenanceOrderDetail> collect = standardDetailList.stream().map(EamWeekMaintenanceOrderDetail::new).collect(Collectors.toList()); |
| | | request.setTableDetailList(collect); |
| | | try { |
| | | eamWeekMaintenanceOrderService.addWeekMaintenance(request); |
| | | } catch (Exception e) { |
| | | log.error("周保生成执行定时任务失败,{}", e.getMessage(), e); |
| | | } |
| | | } |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | log.error("周保过生成执行定时任务失败,{}", e.getMessage(), e); |
| | | quartzLog.setIsSuccess(-1); |
| | | quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); |
| | | } |
| | | long endTime = System.currentTimeMillis(); |
| | | quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); |
| | | sysQuartzLogService.save(quartzLog); |