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

import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
import com.zfire.jiasm.syncdata.service.OrderDownloadGDService;
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 RepairDownloadGD {
    @Value("${repairdownc}")
    private String repairdownc = "";
    @Value("${repairflag}")
    private String repairflag = "";
    @Autowired
    OrderDownloadGDService orderDownloadGDService;


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

        orderDownloadGDService.processRepairDownload();
    }



}
