package com.jiayue.ipfcst.cronJob;

import com.jiayue.ipfcst.service.CustomReportFormService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class ReportForms {

  private final CustomReportFormService customReportFormService;
  @Autowired
  public ReportForms (CustomReportFormService customReportFormService){
    this.customReportFormService = customReportFormService;
  }

  @Scheduled(cron = "10 13 0 * * ?")
  public void generateReportForms(){
    try {
      log.info("自定义报表定时任务启动");
      customReportFormService.generate();
    }catch (Exception e){
      log.error("自定义报表定时任务运行失败");
      e.printStackTrace();
    }finally {
      log.info("自定义报表定时任务执行完成");
    }

  }

}
