package com.sptg.iot.biz.quartz;

import com.sptg.iot.api.dto.IotDeviceDto;
import com.sptg.iot.biz.service.IotDeviceServiceInterface;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * @author zwx
 * @create 2020/12/7 18:28
 */
@Slf4j
@Component
@AllArgsConstructor
@Profile({"prod"})
public class IotDeviceSyncQuartzTask {

    private final IotDeviceServiceInterface iotDeviceServiceInterface;

    //每天凌晨0点执行一次
    @Scheduled(cron = "0 0 0 * * *")
    public void run(){
        IotDeviceDto iotDeviceDto = new IotDeviceDto();
        this.iotDeviceServiceInterface.syncIotDeviceList(iotDeviceDto);
    }
}
