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_addJdueCancel_req
 */
@Slf4j
@Component
public class CancelOrder {
    @Value("${jdzfqxc}")
    private String jdzfqxc = "";

    @Autowired
    private AddJdueUtil addJdueUtil;
    private String[] cols = new String[] { "orderNo", "createBy", "createDate", "cancelType","cancelReason"};

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

        addJdueUtil.process("addJdueCancel", "api/jdueFeedback/addJdueCancel",
                "itf_addjduecancel_req", cols);
    }
}
