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

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

import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
@Component
public class SettlementInstallSY {
    @Value("${installsyc}")
    private String installsyc = "";
    @Autowired
    private OLDSystemUtil oldSystemTask;

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

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        log.info("开始商用空调数据同步: \uF0B7{}",sdf.format(new Date()));

        oldSystemTask.process("商用空调", "itf_installitem", "installItem",
                new Object[] { "itf_tblazwgmxsykt", "tblAzWgmxSykt",
                        new String[] { "itf_tblazwgmxsyktfj", "itf_tblazwgmxsykttmmxls" },
                        new String[] { "tblAzWgmxSyktFj", "tblAzWgmxSyktTmmxLs"}, "", "", "" },
                new Object[] { "itf_tblazwgmxsykt", "tblAzWgmxSykt",
                        new String[] { "itf_tblazwgmxsyktfj", "itf_tblazwgmxsykttmmxls" },
                        new String[] { "tblAzWgmxSyktFj", "tblAzWgmxSyktTmmxLs" }, "", "",
                        "" },
                true, 2, "id");

        log.info("商用空调数据同步结束: \uF0B7{}",sdf.format(new Date()));
    }
}
