private Map<String, Object> getExecutionResult(JobExecution job) { String exeId = String.valueOf(job.getId()); Map<String, Object> map = batchSerivce.findExecutionDetail(exeId); map.put("duration", durationFmt.reformat(map)); map.put("START_TIME", new ADDateTimeFormatter().reformat(map.get("START_TIME"))); String jobParams = jobParametersExtractor.fromJobParameters(batchSerivce.findJobParams(exeId)); map.put("jobParams", jobParams); List<Map<String, Object>> steps = batchSerivce.findSteps(exeId); for (Map<String, Object> step : steps) { step.put("duration", durationFmt.reformat(step)); } map.put("stepInfos", steps); return map; }
/* * (non-Javadoc) * * @see org.quartz.JobListener#jobWasExecuted(org.quartz.JobExecutionContext, org.quartz.JobExecutionException) */ @Override public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { String jobName = context.getJobDetail().getKey().getName(); final BatchSchedule sch = batchSerivce.findSchById(jobName); final JobExecution job = (JobExecution) context.get(CapBatchConstants.K_JobExecution); if (sch != null && job != null) { if (sch.isNotify() && !CapString.isEmpty(sch.getNotifyStatus()) && !CapString.isEmpty(sch.getNotifyTo())) { for (String status : sch.getNotifyStatus().split(",")) { if (CapString.trimNull(status).equals(job.getExitStatus().getExitCode())) { // 主旨 String subject = MessageFormat.format( mailSubject, new Object[] { sch.getSchId(), sch.getSchDesc(), job.getExitStatus().getExitCode() }); mailSender.sendEmail(sch.getNotifyTo().split(","), subject, buildText(job)); break; } } } } }