package cn.cecep.talroad.service.strategy.support.gt;

import cn.cecep.talroad.common.core.utils.DateUtils;
import cn.cecep.talroad.service.IMonElecRealService;
import cn.cecep.talroad.service.strategy.StatusStrategyAdapter;
import cn.cecep.talroad.vo.MonElecRealSiteVo;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Auther: cjh
 * @Date: 2023-05-08 09:10
 * @Class: GtJlZlStatusStrategyAdapter
 * @Deseription:
 * @Version V1.0
 */
@Slf4j
public abstract class GtJlZlStatusStrategyAdapter extends StatusStrategyAdapter {

    @Autowired
    private IMonElecRealService monElecRealService;

    @Override
    protected void doProcessStatus(String industry, String deviceType,Date curr) {
        //查询该行业所有设备

        Date lastHour = DateUtils.addMinutes(curr,-15);

        List<MonElecRealSiteVo> list = monElecRealService.selectLatestMonElecRealByParams(industry,deviceType,lastHour,curr);

        this.doProcessGTStatus(industry,deviceType,list,lastHour, curr);
    }

    /**
     * 处理设备停限产状态、放散状态
     * @param list
     * @return
     */
    protected abstract void doProcessGTStatus(String industry, String deviceType, List<MonElecRealSiteVo> list,Date lastDate ,Date curr);
}
