SchedulerService { public void addSimpleJob(TaskInfo info) { String jobName = info.getJobName(); String jobClassName = info.getJobClassName(); String jobGroupName = info.getJobGroupName(); String jobDescription = info.getJobDescription(); Date createTime = new Date(); JobDataMap dataMap = new JobDataMap(); if (info.getData() != null) { dataMap.putAll(info.getData()); } dataMap.put("createTime", createTime); try { TriggerKey triggerKey = TriggerKey.triggerKey(jobName, jobGroupName); JobKey jobKey = JobKey.jobKey(jobName, jobGroupName); if (checkExists(jobName, jobGroupName)) { throw new OpenAlertException(String.format("任务已经存在, jobName:[%s],jobGroup:[%s]", jobName, jobGroupName)); } SimpleTrigger trigger = TriggerBuilder .newTrigger() .withIdentity(triggerKey) .startAt(info.getStartDate()) .withSchedule( SimpleScheduleBuilder.simpleSchedule() .withIntervalInMilliseconds(info.getRepeatInterval()) .withRepeatCount(info.getRepeatCount())) .endAt(info.getEndDate()).build(); Class<? extends Job> clazz = (Class<? extends Job>) Class .forName(jobClassName); JobDetail jobDetail = JobBuilder.newJob(clazz).withIdentity(jobKey) .withDescription(jobDescription).usingJobData(dataMap).build(); scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException | ClassNotFoundException e) { throw new OpenAlertException("任务添加失败"); } }  List<String> getJobGroupNames(); List<TaskInfo> getJobList(); void addSimpleJob(TaskInfo info); void addCronJob(TaskInfo info); void editSimpleJob(TaskInfo info); void editCronJob(TaskInfo info); void deleteJob(String jobName, String jobGroup); void pauseJob(String jobName, String jobGroup); void resumeJob(String jobName, String jobGroup);  }
@Test public void addSimpleJob() { }