package com.steerinfo.meterwork.meterworkmonitor.scheduler;

import com.steerinfo.meterwork.meterworkmonitor.service.MeterWorkMonitorSyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Tarantool METER_WORK_MONITOR → Oracle 定时回写。
 */
@Component
@ConditionalOnProperty(name = "meter.monitor.sync.enabled", havingValue = "true", matchIfMissing = false)
public class MeterWorkMonitorSyncScheduler {

    private static final Logger log = LoggerFactory.getLogger(MeterWorkMonitorSyncScheduler.class);

    @Autowired
    private MeterWorkMonitorSyncService meterWorkMonitorSyncService;

//    @Scheduled(cron = "${meter.monitor.sync.cron:0 */1 * * * ?}")
    public void scheduledSync() {
        log.info("========== 开始执行 METER_WORK_MONITOR Tarantool→Oracle 同步 ==========");
        meterWorkMonitorSyncService.doSync();
    }
}
