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

    @Autowired
    private OLDSystemUtil oldSystemTask;

    @Scheduled(fixedDelayString = "${repairjs}")
    private void process() {
        if (repairjsc.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_tblwxjsjykt", "tblWxjsJykt", new Object[] { "itf_tblwxjsjykt", "tblWxjsJykt",
                        new String[] { "itf_tblwxjsfjjykt", "itf_tblwxjswxxmjykt", "itf_tblwxjsxxyyjykt",
                                "itf_tblwxjspjmxjykt" },
                        new String[] { "tblWxjsFjJykt", "tblWxjsWxxmJykt", "tblWxjsXxyyJykt", "tblWxjsPjmxJykt" }, "", "", "" },
                new Object[] { "itf_tblwxjsjykt", "tblWxjsJykt", new String[] {}, new String[] {}, "", "", "" }, false,
                4, "id");

        log.info("维修结算数据同步结束: \uF0B7{}",sdf.format(new Date()));
    }
}
