package com.gyee.wisdom.dataadapter.write;

import com.gyee.wisdom.common.data.timeseries.BasicTsPoint;
import com.gyee.wisdom.common.data.timeseries.TsPoint;
import com.gyee.wisdom.dao.things.IThingsPointDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class WriteRedis extends Thread {
   /* public IThingsPointDao getThingsPointDao() {
        return thingsPointDao;
    }

    public void setThingsPointDao(IThingsPointDao thingsPointDao) {
        this.thingsPointDao = thingsPointDao;
    }

    public RedisLatestDao getRedisLatestDao() {
        return redisLatestDao;
    }

    public void setRedisLatestDao(RedisLatestDao redisLatestDao) {
        this.redisLatestDao = redisLatestDao;
    }

    private IThingsPointDao thingsPointDao;
    private RedisLatestDao redisLatestDao;
    public void run() {
        try {
            while (true) {
                Thread.sleep(1000);
                //获取所有key
                List<TsPoint> tsPoints = new ArrayList<>();
                List<TsPoint> lst = thingsPointDao.getAllTsPoint();
                for (TsPoint tsPoint:lst){
                    if (tsPoint.getTag().equals("3")){
                        tsPoints.add(tsPoint);
                    }
                }
                redisLatestDao.setTsDataLatest(tsPoints);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }*/

}
