package com.gyee.generation;

import com.gyee.generation.service.*;
import com.gyee.generation.service.StationPower.StationPowerService;
import com.gyee.generation.service.initalcache.CacheService;
import com.gyee.generation.service.realtimelibrary.*;
import com.xxl.job.core.context.XxlJobHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @ClassName : GenerationTest
 * @Author : xieshengjie
 * @Date: 2022/3/8 9:17
 * @Description :
 */
@SpringBootTest
@RunWith(SpringRunner.class)
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class GenerationTest {
    @Resource
    private CacheService cacheService;
    @Resource
    private ElectricityMeteringService electricityMeteringService;
    @Resource
    private RealtimeService realtimeService;   //实时补风，实时功率
    @Resource
    private CycleCalculationService cycleCalculationService;   //日月年
    @Resource
    private StatusService statusService;
    @Resource
    private RegionCalreService regionCalreService;
    @Resource
    private RegionCalService regionCalService;
    @Resource
    private AccessStatusService accessStatusService;
    @Resource
    private CalculationService calculationService;
    @Resource
    private SafetyDayService safetyDayService;
    @Resource
    private StationPowerService stationPowerService;

    @Resource
    private PVSystemEfficiencyCalculator calculator;

    @Resource
    private AnalysisNewService analysisNewService;

    @Resource
    private PowerCurveFittingByTimeService powerCurveFittingByTimeService;
    @Resource
    private InputOrOutPutService inputOrOutPutService;
    @Resource
    private WindturbineGoodnessService windturbineGoodnessService;
    @Resource
    private EquipmentInfo3Service equipmentInfo3Service;
    @Resource
    private EquipmentInfo2Service equipmentInfo2Service;
    @Resource
    private EquipmentInfo4Service equipmentInfo4Service;

    @Test
    public void test1() throws Exception {
        cacheService.initRedisCache();
        //        electricityMeteringService.saveGenerationDatas();
    }


    @Test
    public void test2() throws Exception {

        //        electricityMeteringService.saveGenerationDatas();
        //        realtimeService.savaRealtimeTarget();
        //        cycleCalculationService.saveCyle();
        //        statusService.powerRationing();
        statusService.startStatusReal();
        //        statusService.calculateStatusNumber();
        //        regionCalService.companyCal();
        //        regionCalService.RegionCal();
        //
        //        regionCalreService.companyCal();
        //        regionCalreService.RegionCal();


    }

    @Test
    public void test3() throws Exception {
        //        //场站接入状态，总预测功率
        //        accessStatusService.accessStatus();
        //        //全场状态
        //        accessStatusService.fullFieldState();


        //        statusService.powerRationing();
        //        statusService.statusReal();
        //        statusService.calculateStatusNumber();

        //          realtimeService.savaRealtimeTarget();
        //        cycleCalculationService.saveCyle();

        //        electricityMeteringService.saveGenerationDatas();

        //        calculationService.calWp();

        //        regionCalService.companyCal();
        //        regionCalService.RegionCal();

        //        regionCalreService.companyCal();
        //        regionCalreService.RegionCal();

        //        safetyDayService.saveSafetyday();

        //        stationPowerService.predictedPower();


//        calculator.planvalue();
//
//        analysisNewService.companys();
//        analysisNewService.saveWindProject();
        Date date=new Date();
//
//        XxlJobHelper.log("切入切出状态切换记录调度程序执行开始!........");
        inputOrOutPutService.inputOrOutputSpeed(new Date());
//        XxlJobHelper.log("切入切出状态切换记录调度任务处理完成!........");

//        XxlJobHelper.log("功率一致性系数和拟合优度统计调度程序执行开始!........");
//        windturbineGoodnessService.calWindturbineGoodness(new Date());
//        XxlJobHelper.log("功率一致性系数和拟合优度统计调度任务处理完成!........");

        XxlJobHelper.log("设备指标2调度程序执行开始!........");
//        equipmentInfo2Service.calEquipmentInfoDay(date);
        XxlJobHelper.log("设备指标2调度程序执行完成!........");

        XxlJobHelper.log("设备指标3调度程序执行开始!........");
//        equipmentInfo3Service.calEquipmentInfoDay(date);
        XxlJobHelper.log("设备指标3调度程序执行完成!........");

        XxlJobHelper.log("设备指标4调度程序执行开始!........");
//        equipmentInfo4Service.calEquipmentInfoDay(date);
        XxlJobHelper.log("设备指标4调度程序执行完成!........");

//        powerCurveFittingByTimeService.cureFittingDay(date, "NX_FGS_HA_FDC_STA");
//        powerCurveFittingByTimeService.cureFittingMonth(date,"0",null);
//        powerCurveFittingByTimeService.cureFittingYear(date, "NX_FGS_HA_FDC_STA");

    }
}
