package io.renren.modules.aspen.controller;

import io.renren.modules.aspen.entity.TElecdashboardHourEntity;
import io.renren.modules.aspen.entity.base.TElecdashboard;
import io.renren.modules.aspen.service.TElecdashboardHourService;
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 10:01
 */
@Component
@Configuration
@EnableScheduling
public class TElecdashboardHourController {

    @Resource
    private TElecdashboardHourService tElecdashboardHourService;

    /**
     * 每小时抓取数据，存入数据库
     */
//    @Scheduled(cron = "0 0 */1 * * ?")
    public void getExcelDataEveryHour(){
        DashboardDataPullUtils dashboardDataPullUtils = new DashboardDataPullUtils();
        TElecdashboard tElecdashboard = dashboardDataPullUtils.getExcelData(new TElecdashboardHourEntity());
        TElecdashboardHourEntity tElecdashboardHourEntity = (TElecdashboardHourEntity) tElecdashboard;
        tElecdashboardHourService.insertTElecdashboardHour(tElecdashboardHourEntity);
    }

}