void startJob(QuartzJob job) { assertNotNull(job, "任务不存在"); JobKey key = createJobKey(job.getId()); JobDetail jobDetail = JobBuilder.newJob(SimpleJob.class) .withIdentity(key) .setJobData(createJobDataMap(job.getParameters())) .usingJobData(SimpleJobFactory.QUARTZ_ID_KEY, job.getId()) .withDescription(job.getName() + (job.getRemark() == null ? "" : job.getRemark())) .build(); MutableTrigger trigger = CronScheduleBuilder.cronSchedule(job.getCron()).build(); trigger.setKey(createTriggerKey(job.getId())); try { scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) { throw new BusinessException("创建定时任务失败!", e, 500); } }