package com.malk.jinlun.schedule; import com.malk.jinlun.service.JinlunTaskService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; /** * @EnableScheduling 开启定时任务 [配置参考McScheduleTask] */ @Slf4j @Configuration @EnableScheduling @ConditionalOnProperty(name = {"enable.scheduling"}) public class JinlunTask { @Autowired private JinlunTaskService jinlunTaskService; //定时同步物料 @Scheduled(cron = "0 0 0 * * ?") public void syncMaterial(){ jinlunTaskService.syncMaterial(); } //定时同步销售出库单 @Scheduled(cron = "0 0 1 * * ?") public void syncSaleOut(){ jinlunTaskService.syncSaleOut(); } //定时同步收款单 @Scheduled(cron = "0 0 2 * * ?") public void syncReceipt(){ jinlunTaskService.syncReceipt(); } //定时同步应收单 @Scheduled(cron = "0 0 3 * * ?") public void syncReceivable(){ jinlunTaskService.syncReceivable(); } }