package com.adc.da.scheduled; import com.adc.da.slrs.DataSync.DataSyncController; import com.adc.da.slrs.DataSync.service.IDataSyncService; import com.sun.org.apache.bcel.internal.generic.NEW; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; /** * 定时同步用户和组织机构信息 */ @EnableScheduling @Component @Slf4j public class ScheduledSync { @Autowired private IDataSyncService iDataSyncService; // @Scheduled(cron = "0 */40 * * * ?") //40分钟执行同步一次 // @Scheduled(cron="*/5 * * * * ?") @Async public void syncSchedulingTasks() throws Exception { iDataSyncService.orgDataSync(); //时间短 iDataSyncService.dataSync(); //时间长 } }