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 AppointSite {
    @Value("${jdzpgpwdc}")
    private String jdzpgpwdc = "";

    @Autowired
    private AddJdueUtil addJdueUtil;

    private String[] cols = new String[] { "orderNo", "siteNode", "siteName", "createBy", "createDate",
            "contactMan", "siteMobile", "province", "city", "county", "town", "address" };

    @Scheduled(fixedDelayString = "${jdzpgpwd}")
    private void appointSiteProcess() {
        if (jdzpgpwdc.equals(TaskConfigEnum.FALSE.getCode())){
            return;
        }

        addJdueUtil.process("addJdueAppointSite", "api/jdueFeedback/addJdueAppointSite",
                "itf_addjdueappointsite_req", cols);
    }

}
