暂态文件同步功能开发
This commit is contained in:
47
filesync/src/main/java/com/njcn/job/FileSyncJob.java
Normal file
47
filesync/src/main/java/com/njcn/job/FileSyncJob.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.njcn.job;
|
||||
|
||||
import com.njcn.device.pojo.po.PqDevice;
|
||||
import com.njcn.device.service.PqDeviceService;
|
||||
import com.njcn.filesync.config.*;
|
||||
import com.njcn.filesync.service.FileSyncService;
|
||||
import com.njcn.filesync.sftp.IncrementalFileSync;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-09-19
|
||||
* @Description: 定时任务
|
||||
*/
|
||||
@Component
|
||||
@EnableScheduling
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FileSyncJob {
|
||||
|
||||
private final SourceConfig sourceConfig;
|
||||
private final TargetConfig targetConfig;
|
||||
private final PqDeviceService pqDeviceService;
|
||||
|
||||
private final FileSyncService fileSyncService;
|
||||
// 每10分钟执行
|
||||
@Scheduled(cron = "0 0/10 * * * ? ")
|
||||
public void UpHarmonicJob(){
|
||||
|
||||
fileSyncService.triggerCrossSync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user