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

import com.zfire.jiasm.syncdata.constant.TaskConfigEnum;
import com.zfire.jiasm.syncdata.utils.oss.AddJdueUtil;
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;

/**
 * 京东工单数据同步到格力总部
 * 回传指派改派服务人员数据 itf_addJdueAppointSite_req
 */
@Slf4j
@Component
public class ServicePersonnel {
    @Value("${jdzpgpryc}")
    private String jdzpgpryc = "";

    @Autowired
    private AddJdueUtil addJdueUtil;

    private String[] cols = new String[] { "orderNo", "siteNode", "siteName", "createBy", "createDate",
            "engineerCode", "engineerName", "engineerMobile" };

    @Scheduled(fixedDelayString = "${jdzpgpry}")
    private void process() {
        if (jdzpgpryc.equals(TaskConfigEnum.FALSE.getCode())){
            return;
        }

        addJdueUtil.process("addJdueAppointEngineer", "api/jdueFeedback/addJdueAppointEngineer",
                "itf_addjdueappointengineer_req", cols);
    }

}
