package com.jiayue.ipfcst.console.job;

import com.jiayue.ipfcst.common.core.exception.BusinessException;
import com.jiayue.ipfcst.common.data.entity.ElectricField;
import com.jiayue.ipfcst.console.service.FileAnalysisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * 文件解析
 *
 * @author bizy
 * @version 3.0
 */
@Slf4j
@Service
@EnableScheduling
public class FileAnalysisJob {

    @Autowired
    private FileAnalysisService fileAnalysisService;

    @Scheduled(cron = "0 0/1 * * * *")
    public void fxglFileAnalysis() {

        log.debug("文件解析定时任务执行开始");

        this.fileAnalysisService.analysisJob();

        log.debug("文件解析定时任务执行完成");

    }


//    @Scheduled(cron = "10 0/1 * * * *")
//    public void zxglFileAnalysis() {
//        log.debug("文件解析定时任务执行开始");
//
//        this.fileAnalysisService.analysisJobZxgl();
//
//        log.debug("文件解析定时任务执行完成");
//
//    }

//    @Scheduled(cron = "30 0/1 * * * *")
//    public void sdpowerplanFileAnalysis() {
//        try {
//            ElectricField electricField = fileAnalysisService.getElectricField();
//            if(electricField.getProvinceEnum().getCode() == 37){
//                log.debug("山东发电计划文件解析定时任务执行开始");
//
//                this.fileAnalysisService.analysisJobSDPowerPlan();
//
//                log.debug("山东发电计划文件解析定时任务执行完成");
//            }
//        } catch (BusinessException e) {
//            log.error("场站信息查询出错",e);
//        }
//    }

}
