| | |
| | | import com.vincent.rsf.server.system.entity.AiDiagnosisPlan; |
| | | import com.vincent.rsf.server.system.mapper.AiDiagnosisPlanMapper; |
| | | import com.vincent.rsf.server.system.service.AiDiagnosisPlanService; |
| | | import org.springframework.scheduling.support.CronSequenceGenerator; |
| | | import org.springframework.scheduling.support.CronExpression; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.ZoneId; |
| | | import java.time.ZonedDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | if (!validateCron(cronExpr)) { |
| | | return null; |
| | | } |
| | | return new CronSequenceGenerator(cronExpr.trim()).next(after == null ? new Date() : after); |
| | | ZonedDateTime start = ZonedDateTime.ofInstant((after == null ? new Date() : after).toInstant(), ZoneId.systemDefault()); |
| | | ZonedDateTime next = CronExpression.parse(cronExpr.trim()).next(start); |
| | | return next == null ? null : Date.from(next.toInstant()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (cronExpr == null || cronExpr.trim().isEmpty()) { |
| | | return false; |
| | | } |
| | | return CronSequenceGenerator.isValidExpression(cronExpr.trim()); |
| | | return CronExpression.isValidExpression(cronExpr.trim()); |
| | | } |
| | | |
| | | @Override |