package cn.cecep.talroad.service.impl;

import cn.cecep.talroad.domain.analysis.SRaRealTimeAnalysisRun;
import cn.cecep.talroad.mapper.analysis.SRaRealTimeAnalysisRunMapper;
import cn.cecep.talroad.util.BeanContext;
import lombok.extern.slf4j.Slf4j;

import java.sql.Timestamp;
import java.util.List;
import java.util.concurrent.Callable;

/**
 * @className: ThreadQueryData
 * @description: TODO 类描述
 * @author: Mr.Yanghongtao
 * @date: 2023/04/24 09:39
 * @Company: Copyright© [2023/04/24 09:39] by [Mr.Yanghongtao]
 **/
@Slf4j
public class ThreadQuerySRaRealTimeAnalysisRunData implements Callable<List<SRaRealTimeAnalysisRun>> {

    private String startTime;
    private String endTime;

    private SRaRealTimeAnalysisRunMapper sRaRealTimeAnalysisRunMapper;


    public ThreadQuerySRaRealTimeAnalysisRunData(String startTime, String endTime) {
        this.startTime = startTime;
        this.endTime = endTime;
    }

    /**
     * When an object implementing interface <code>Runnable</code> is used
     * to create a thread, starting the thread causes the object's
     * <code>run</code> method to be called in that separately executing
     * thread.
     * <p>
     * The general contract of the method <code>run</code> is that it may
     * take any action whatsoever.
     *
     * @see Thread#run()
     */
    @Override
    public List<SRaRealTimeAnalysisRun> call() {
//        log.info("线程池:" + Thread.currentThread().getName() + ";" + "startTime:" + startTime + "," + "endTime:" + endTime + ";");
        this.sRaRealTimeAnalysisRunMapper = BeanContext.getApplicationContext().getBean(SRaRealTimeAnalysisRunMapper.class);
        return sRaRealTimeAnalysisRunMapper.threadSelectListByDate(Timestamp.valueOf(startTime), Timestamp.valueOf(endTime), null);
    }
}
