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

    @Autowired
    private OLDSystemUtil oldSystemTask;

    @Scheduled(fixedDelayString = "${installjy}")
    private void process() {
        if (installjyc.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_tblazwgmxjykt", "tblazwgmxjykt", new String[] { "itf_tblazwgmxjyktfj" },
                        new String[] { "tblAzWgmxJyktFj" }, "\"tblAzWgmxJyktSpecial\":[],\"tblAzWgmxOtherinfo\":[]", "",
                        "" },
                new Object[] { "itf_tblazwgmxjykt", "tblazwgmxjykt", new String[] { "itf_tblazwgmxjyktfj" },
                        new String[] { "tblAzWgmxJyktFj" }, "\"tblAzWgmxJyktSpecial\":[],\"tblAzWgmxOtherinfo\":[]",
                        "", "" },
                true, 1, "id");

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

}
