package com.jiayue.ipfcst.fileupload.service;

import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
import com.jiayue.ipfcst.console.service.ForecastPowerUltraShortTermService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
/**
 * 超短期数据生成服务类
 *
 * @author whc
 * @version 3.0
 * @since 2021/5/18 14:34
 */
@Service
@Slf4j
public class GenerateUltraShortDataService {
  @Autowired
  ForecastPowerUltraShortTermService forecastPowerUltraShortTermService;

  public void generateData(){
    try{
      Date systemDate = new Date();
      // 开始时间
      Long startTime = DateMomentUtil.getMomentTime(systemDate.getTime() + 15 * 60 * 1000, 1, 15 * 60 * 1000L);
      // 结束时间
      Long endTime = startTime + 16 * 15 * 60 * 1000 - 1000;
      this.forecastPowerUltraShortTermService.getForecastPowerUltraShortTerm(startTime, endTime);
    }catch (Exception e){
      log.info("执行超短期数据生成定时任务发生错误: "+e);
    }

  }
}
