package com.njcn.job;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.njcn.filesync.service.FileSyncService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * Description:
 * Date: 2025/12/08  上午 10:47【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Component
@EnableScheduling
@RequiredArgsConstructor
@Slf4j
public class EventWavePathJob {

    private final FileSyncService fileSyncService;
    // 每10分钟执行
    @Scheduled(cron = "0 0/10 * * * ? ")
    public void UpHarmonicJob(){
        String endTime = LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN);
        String startTime =LocalDateTimeUtil.format(LocalDateTime.now().minusMinutes(30), DatePattern.NORM_DATETIME_PATTERN);
        log.info("begin sync------------------" +
                startTime+"---"+endTime+"eventFile");
        fileSyncService.EventWavePathSYnc(startTime,endTime);
        log.info("end sync------------------" +
                startTime+"---"+endTime+"eventFile");


    }
}
