package org.gyk.modules.sssj.util;

import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Calendar;

import static org.gyk.modules.sssj.util.ConfigUtils.getsavetime;


/**
 * @Description: 多线程-实时数据10min存库
 * @Author: jiang
 * @Date: 20231103
 * @Version: V1.0
 */

//@Slf4j
public class saveNgzxData extends Thread {//线程主体类

    private String title;

    public saveNgzxData(String title) {
        this.title = title;
    }

    private static Logger log = LoggerFactory.getLogger(saveNgzxData.class);

    @SneakyThrows
    @Override
    public void run() {//线程的主体方法
        int savetime = getsavetime();
        Thread.sleep(5000);  //延迟5秒启动 待连接工业库成功
        while (true) {
            Calendar cal = Calendar.getInstance();
            int a = cal.get(Calendar.MINUTE);
            if (a % 10 == 0) {
                try{
                    // 发布时要去掉注释
//                    sssjTools.saveNgzxSssj();
                }catch (Exception e){
                    e.printStackTrace();
                }
                Thread.sleep(savetime);
            }
        }

    }
}



