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

import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
import com.zfire.jiasm.syncdata.service.InstallDownloadService;
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;


/**
 * 格力品牌安装工单下载
 * 批量下载记录表、主表、明细表、反馈明细表、费用清单表、
 * 用户预约改约表、安装辅助人员表、客户评价表、三方平台订单信息表
 * 1：先放本地download表
 * 2：与总部同步下载状态
 * 3：AnzhuangGongDanBusiness 类处理，数据落本地数所表
 */
@Slf4j
@Component
public class InstallDownload {
    @Value("${installdownc}")
    private String installdownc = "";
    @Value("${installflag}")
    private String installflag = "";

    @Autowired
    InstallDownloadService installDownloadService;



    // 1：下载安装工单数据
    @Scheduled(fixedDelayString = "${installdown}")
    public void download() throws Exception {
        if (installdownc.equals(TaskConfigEnum.FALSE.getCode())){
            return;
        }
        if (installflag.equals(TaskConfigEnum.TRUE.getCode())){
            return;
        }

        installDownloadService.processInstallDownload();
    }

}
