|
|
|
|
@ -3,14 +3,14 @@ package com.biutag.lan.service;
|
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
@Component |
|
|
|
|
public class DataSyncScheduler { |
|
|
|
|
private final ReportService dataSourceService; |
|
|
|
|
public DataSyncScheduler(ReportService dataSourceService) { |
|
|
|
|
this.dataSourceService = dataSourceService; |
|
|
|
|
} |
|
|
|
|
@Scheduled(fixedRate = 60 * 60 * 1000) // 每5分钟执行一次
|
|
|
|
|
public void syncDataSourcesPeriodically() { |
|
|
|
|
dataSourceService.syncData(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//@Component
|
|
|
|
|
//public class DataSyncScheduler {
|
|
|
|
|
// private final ReportService dataSourceService;
|
|
|
|
|
// public DataSyncScheduler(ReportService dataSourceService) {
|
|
|
|
|
// this.dataSourceService = dataSourceService;
|
|
|
|
|
// }
|
|
|
|
|
// @Scheduled(fixedRate = 60 * 60 * 1000) // 每5分钟执行一次
|
|
|
|
|
// public void syncDataSourcesPeriodically() {
|
|
|
|
|
// dataSourceService.syncData();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|