package com.zfire.jiasm.syncdata.download.order;

import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
import com.zfire.jiasm.syncdata.service.RepairDownloadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 格力品牌维修工单下载
 */
@Slf4j
@Component
public class RepairDownload {
    @Value("${repairdownc}")
    private String repairdownc = "";
    @Value("${repairflag}")
    private String repairflag = "";

    @Autowired
    RepairDownloadService repairDownloadService;


    // 下载维修工单数据
    @Scheduled(fixedDelayString = "${repairdown}")
    public void download() throws Exception {
        if (repairdownc.equals(TaskConfigEnum.FALSE.getCode())){
            return;
        }
        if (repairflag.equals(TaskConfigEnum.TRUE.getCode())){
            return;
        }

        repairDownloadService.processRepairDownload();
    }



}
