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

import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
import com.zfire.jiasm.syncdata.service.RepairProduceDataUploadService;
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：数据准备类型定义表提取数据 select * from out_jiasm_to_gree_upload_task_type;
 * 2：根据类型定义表的任务类型 从数据上传任务表提取对应的任务类型数据 select * from out_jiasm_to_gree_upload_task_list;
 * 生成相应的upload数据插入表中
 * 上传任务表中的 tablename+ordertype处理不同类型的工单
 *    orderer_base+INSTALL为安装工单

 * 修改上传任务表的状态
 */

@Slf4j
@Component
public class RepairProduceDataUpload {
    @Value("${wxuploadyscc}")
    private String wxuploadyscc = "";

    @Autowired
    RepairProduceDataUploadService repairProduceDataUploadService;



    @Scheduled(fixedDelayString = "${wxuploadysc}")
    public void produceList() throws Exception {
        if (wxuploadyscc.equals(TaskConfigEnum.FALSE.getCode())) {
            return;
        }

        repairProduceDataUploadService.processRepairProduceDataUpload();
    }

}
