明明是设置的下午5点半的定时任务,2点半的时候就执行了。

@EnableScheduling
@Component
public class WorkNumReportSchedule {
    @Autowired
    private WorkTaskReportDetailService workTaskReportDetailService;


    // 工作日的17点半统计报工时间发送报工提醒消息
    @Scheduled(cron = "0 30 17 * * ?")
    public void scheduleWorkingHoursStatistics() throws Exception {
        workTaskReportDetailService.encapsulationMessageEntity(DateUtil.formatDate(new Date(), "yyyy-MM-dd"));
    }

}

 

明明是设置的下午5点半的定时任务,2点半的时候就执行了。

服务器时区?

这个我有考虑过,本地打印的时间也是2点半,就很神奇

找到问题了吗

没有。就发生了那一次。复现不了。我怀疑是我同事本地启动起的windows上的时间,有问题