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 SettlementInstallSH {
    @Value("${installshc}")
    private String installshc = "";
    @Autowired
    private OLDSystemUtil oldSystemTask;

    @Scheduled(fixedDelayString = "${installsh}")
    private void process() {
        if (installshc.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_tblazwgmxqita", "tblAzWgmxQita", new String[] { "itf_tblazwgmxqitafj" },
                        new String[] { "tblAzWgmxQitaFj" }, "", "", "" },
                new Object[] { "itf_tblazwgmxqita", "tblAzWgmxQita", new String[] { "itf_tblazwgmxqitafj" },
                        new String[] { "tblAzWgmxQitaFj" }, "", "", "" },
                true, 3, "id");

        log.info("生活电器数据同步结束: \uF0B7{}",sdf.format(new Date()));
    }
}
