package io.renren.modules.aspen.controller;

import io.renren.modules.aspen.entity.TElecdashboardDayEntity;
import io.renren.modules.aspen.entity.base.TElecdashboard;
import io.renren.modules.aspen.service.TElecdashboardDayService;
import io.renren.modules.aspen.utils.DashboardDataPullUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 电厂大屏每日数据
 *
 * @author: Wang Zi Wen
 * @email: wangggziwen@163.com
 * @datetime: 2022/9/14 9:56
 */
@Component
@Configuration
@EnableScheduling
public class TElecdashboardDayController {

    @Resource
    private TElecdashboardDayService tElecdashboardDayService;

    /**
     * 每天8:00抓取数据，存入数据库
     */
//    @Scheduled(cron = "0 0 8 * * ?")
    public void getExcelDataEveryDay(){
        DashboardDataPullUtils dashboardDataPullUtils = new DashboardDataPullUtils();
        TElecdashboard tElecdashboard = dashboardDataPullUtils.getExcelData(new TElecdashboardDayEntity());
        TElecdashboardDayEntity tElecdashboardDayEntity = (TElecdashboardDayEntity) tElecdashboard;
        tElecdashboardDayService.insertTElecdashboardDay(tElecdashboardDayEntity);
    }

}