package cn.com.taiji.track.schedule;

import cn.com.taiji.track.service.IBeidouLocationService;
import cn.com.taiji.track.service.IBeidouTrackService;
import cn.com.taiji.track.service.IShipStatusService;
import cn.com.taiji.track.service.IWarningRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author kok20
 * 适应starrocks保存逻辑，通过定时器降低保存时间间隔
 */
@Component
public class PersistenceSchedule {
    @Autowired
    private IBeidouTrackService beidouTrackService;
    @Autowired
    private IWarningRecordService warningRecordService;
    @Autowired
    private IBeidouLocationService beidouLocationService;
    @Autowired
    private IShipStatusService shipStatusService;

    @Scheduled(cron = "*/10 * * * * ?")
    private void cacheBeidouToMySql() {
        beidouTrackService.cacheBeidouToMySql();
    }
    @Scheduled(cron = "*/10 * * * * ?")
    private void cacheWarningToMySql() {
        warningRecordService.cacheToMySql();
    }
    @Scheduled(cron = "*/10 * * * * ?")
    private void cacheLocationToMySql() {
        beidouLocationService.cacheBeidouToMySql();
    }
    @Scheduled(cron = "*/10 * * * * ?")
    private void cacheStatusToMySql() {
        shipStatusService.onlineCacheToMySql();
    }
    @Scheduled(cron = "*/10 * * * * ?")
    private void anchorCacheToMySql() { shipStatusService.anchorCacheToMySql();}
    @Scheduled(cron = "*/10 * * * * ?")
    private void InportCacheToMySql() {shipStatusService.InportCacheToMySql();}

}

