package com.ruoyi;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateRange;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.ucp.entity.*;
import com.ruoyi.ucp.feign.AdapterApi;
import com.ruoyi.ucp.service.*;
import com.ruoyi.ucp.util.CalcCache;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.net.URI;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

@SpringBootTest//classes = RuoYiApp.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
@RunWith(SpringRunner.class)
public class NewTests {

    @Resource
    private JavaFunctionJobHandler task;

    @Test
    public void test() {
        Date date = DateUtil.date().toJdkDate();
//        calcStationZhcydl(date);
//        calcNhglZs(date);
        // 创建日期范围生成器
        DateTime start = DateUtil.parse("2024-06-26");
//        DateTime start = DateUtil.parse("2024-05-01");
        DateTime end = DateUtil.parse("2024-06-26");
        DateRange range = DateUtil.range(start, end, DateField.DAY_OF_YEAR);
        for (DateTime time : range) {
            date=time.toJdkDate();
            System.out.println(DateUtil.date().toString() + "：" + time.toString());
            //安全天数
//            calcAQTS(time.toJdkDate());
//            task.calcLineDjlRfdl(date);
//            //上网购网厂用电量
//            task.calcStationSwGwCyDl(date);
//            //计算综合厂用电量
//            task.calcStationZhcydl(date);
//
//            task.calcTurbineRFDL(date);
//            task.calcStationRfdlFj(date);
//            task.writeReportPool(date);

//            task.writeReportPool(date);
//            task.calcTurbine5s2(date);

        }
        task.calcGlqxnh(start,end);
//        calcTurbineRFDL(date);
        task.calcTurbine5s2(date);
//        writeReportPool(date);

//        task.calcStationSspjfs();
    }
}
