之前有个需求,根据规则生成定时任务
public static long getNextTriggerTime(String cron){
if(!CronExpression.isValidExpression(cron)){
return 0;
}
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(“Caclulate Date”).withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
Date time0 = trigger.getStartTime();
Date time1 = trigger.getFireTimeAfter(time0);
return time1.getTime();
}