Search in sources :

Example 1 with EcHolidayDTO

use of com.easy.cloud.core.worker.scheduler.pojo.dto.EcHolidayDTO in project dq-easy-cloud by dq-open-cloud.

the class EcTaskSchedulerManager method buildCalendar.

private Trigger buildCalendar(final EcTaskSchedulerDTO taskSchedulerDTO, final Trigger trigger) throws SchedulerException {
    logger.info("holidayName:" + taskSchedulerDTO.getHolidayName());
    logger.info("holidays:" + taskSchedulerDTO.getHolidayDTOs());
    if (taskSchedulerDTO.getHolidayName() != null && EcCollectionsUtils.isNotEmpty(taskSchedulerDTO.getHolidayDTOs())) {
        AnnualCalendar holidays = new AnnualCalendar();
        for (EcHolidayDTO holidayDTO : taskSchedulerDTO.getHolidayDTOs()) {
            Calendar calendar = new GregorianCalendar(holidayDTO.getYear(), holidayDTO.getMonth() - 1, holidayDTO.getDay());
            holidays.setDayExcluded(calendar, true);
        }
        scheduler.addCalendar(taskSchedulerDTO.getHolidayName(), holidays, true, true);
        return trigger.getTriggerBuilder().modifiedByCalendar(taskSchedulerDTO.getHolidayName()).build();
    } else {
        return trigger.getTriggerBuilder().modifiedByCalendar(null).build();
    }
// return trigger;
}
Also used : EcHolidayDTO(com.easy.cloud.core.worker.scheduler.pojo.dto.EcHolidayDTO) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) AnnualCalendar(org.quartz.impl.calendar.AnnualCalendar) GregorianCalendar(java.util.GregorianCalendar) AnnualCalendar(org.quartz.impl.calendar.AnnualCalendar)

Aggregations

EcHolidayDTO (com.easy.cloud.core.worker.scheduler.pojo.dto.EcHolidayDTO)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 AnnualCalendar (org.quartz.impl.calendar.AnnualCalendar)1