public static LocalDateTime getLastExecutionTime(LocalDateTime time, String cron) {
CronParser parser = new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
Cron quartzCron = parser.parse(cron);
ExecutionTime executionTime = ExecutionTime.forCron(quartzCron);
//获取给定时间的,上一次执行时间
Optional<ZonedDateTime> st = executionTime.lastExecution(ZonedDateTime.of(time, ZoneId.systemDefault()));
if (st != null) {
return st.get().toLocalDateTime();
}
return null;
}