package com.huatek.busi.task;


import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.busi.service.*;
import com.huatek.busi.task.base.AbstractBusiTaskExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.time.LocalDate;

/**
 * 各个主设备定时器
 *
 * @author mitchell_ma
 * @date 2021/12/16
 */
@Slf4j
@Component("onlineRateTask")
public class OnlineRateNumberTask extends AbstractBusiTaskExecutor {

    @Autowired
    TransformerNumberService transformerNumberService;

    @Autowired
    GisNumberService gisNumberService;

    @Autowired
    CableNumberService cableNumberService;

    @Autowired
    ArresterNumberService arresterNumberService;

    @Autowired
    CubicleNumberService cubicleNumberService;

    @Autowired
    GeneratorNumberService generatorNumberService;

    @Override
    public void execute() throws Exception {
        super.execute();

        /**
         * 查询所有外挂设备并插入cache表中
         */
        transformerNumberService.findAllEquipment();

        /**
         * 查询系统中外挂删除设备，并更新cache表
         */

        transformerNumberService.findEquipmentAndDelete();

        /**
         * 各个设备外挂装置查询并将计算值加入Cache表
         */

        transformerNumberService.findTransformerNumber();

        gisNumberService.findGisNumber();

        cableNumberService.findCableNumber();

        arresterNumberService.findArresterNumber();

        cubicleNumberService.findCubicleNumber();


        // todo-new 发电机
        generatorNumberService.findGeneratorNumber();

    }

    @Override
    public void execute(String params) throws Exception {
        LocalDate day = toLocalDate(params);
        execute(day);

    }

    @Override
    public void execute(LocalDate day) throws Exception {


    }


}