package com.njcn;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.njcn.oracle.bo.param.MigrationParam;
import com.njcn.oracle.bo.po.*;
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
import com.njcn.oracle.service.*;
import lombok.SneakyThrows;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2021年12月14日 12:55
 */
public class DataTest extends BaseJunitTest {


    @Autowired
    private IDataFlickerService dataFlickerService;
    @Autowired
    private IDataFlucService dataFlucService;

    private @Autowired IDataHarmphasicIService dataharmphasiciservice;
    private @Autowired IDataHarmphasicVService dataharmphasicvservice;
    private @Autowired IDataHarmpowerPService dataharmpowerpservice;
    private @Autowired IDataHarmpowerQService dataharmpowerqservice;
    private @Autowired IDataHarmpowerSService dataharmpowersservice;
    private @Autowired IDataHarmrateIService dataharmrateiservice;
    private @Autowired IDataHarmrateVService dataharmratevservice;
    private @Autowired IDataInharmIService datainharmiservice;
    private @Autowired IDataInharmVService datainharmvservice;
    private @Autowired IDataIService dataiservice;
    private @Autowired IDataPltService datapltservice;
    private @Autowired IDataVService datavservice;
    private @Autowired IDayFlickerService dayflickerservice;
    private @Autowired IDayFlucService dayflucservice;
    private @Autowired IDayHarmphasicIService dayharmphasiciservice;
    private @Autowired IDayHarmphasicVService dayharmphasicvservice;
    private @Autowired IDayHarmpowerPService dayharmpowerpservice;
    private @Autowired IDayHarmpowerQService dayharmpowerqservice;
    private @Autowired IDayHarmpowerSService dayharmpowersservice;
    private @Autowired IDayHarmrateIService dayharmrateiservice;
    private @Autowired IDayHarmrateVService dayharmratevservice;
    private @Autowired IDayInharmIService dayinharmiservice;
    private @Autowired IDayInharmVService dayinharmvservice;
    private @Autowired IDayIService dayiservice;
    private @Autowired IDayPltService daypltservice;
    private @Autowired IDayVService dayvservice;
    private @Autowired ILimitRateService limitrateservice;
    private @Autowired ILimitTargetService limittargetservice;


    @SneakyThrows
    @Test
    public void testBean() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);

//        LocalDateTime endTime = LocalDateTimeUtil.parse("1970-01-02 00:00:10", DatePattern.NORM_DATETIME_PATTERN);
//        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -2, ChronoUnit.HOURS);

        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);
        IReplenishMybatisService executor = (IReplenishMybatisService) SpringUtil.getBean(Class.forName("com.njcn.oracle.service.impl.DataFlickerServiceImpl"));
        //查询数据
        List<DataFlicker> temp = executor.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            executor.clearTargetData(migrationParam);
            //插入数据
            executor.insertBatchByDB(temp);
        }
    }


    @SneakyThrows
    @Test
    public void test() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);

//        LocalDateTime endTime = LocalDateTimeUtil.parse("1970-01-02 00:00:10", DatePattern.NORM_DATETIME_PATTERN);
//        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -2, ChronoUnit.HOURS);

        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataFlicker> temp = dataFlickerService.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataFlickerService.clearTargetData(migrationParam);
            //插入数据
            dataFlickerService.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataFluc() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataFluc> temp = dataFlucService.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataFlucService.clearTargetData(migrationParam);
            //插入数据
            dataFlucService.insertBatchByDB(temp);
        }
    }


    @SneakyThrows
    @Test
    public void testDataHarmphasicI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmphasicI> temp = dataharmphasiciservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmphasiciservice.clearTargetData(migrationParam);
            //插入数据
            dataharmphasiciservice.insertBatchByDB(temp);
        }
    }
    @SneakyThrows
    @Test
    public void testDataHarmphasicV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmphasicV> temp = dataharmphasicvservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmphasicvservice.clearTargetData(migrationParam);
            //插入数据
            dataharmphasicvservice.insertBatchByDB(temp);
        }
    }
    @SneakyThrows
    @Test
    public void testDataHarmpowerP() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmpowerP> temp = dataharmpowerpservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmpowerpservice.clearTargetData(migrationParam);
            //插入数据
            dataharmpowerpservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataHarmpowerQ() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmpowerQ> temp = dataharmpowerqservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmpowerqservice.clearTargetData(migrationParam);
            //插入数据
            dataharmpowerqservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataHarmpowerS() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmpowerS> temp = dataharmpowersservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmpowersservice.clearTargetData(migrationParam);
            //插入数据
            dataharmpowersservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataHarmrateI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmrateI> temp = dataharmrateiservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmrateiservice.clearTargetData(migrationParam);
            //插入数据
            dataharmrateiservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataHarmrateV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataHarmrateV> temp = dataharmratevservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataharmratevservice.clearTargetData(migrationParam);
            //插入数据
            dataharmratevservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataInharmI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataInharmI> temp = datainharmiservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            datainharmiservice.clearTargetData(migrationParam);
            //插入数据
            datainharmiservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataInharmV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataInharmV> temp = datainharmvservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            datainharmvservice.clearTargetData(migrationParam);
            //插入数据
            datainharmvservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataI> temp = dataiservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dataiservice.clearTargetData(migrationParam);
            //插入数据
            dataiservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataPlt() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataPlt> temp = datapltservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            datapltservice.clearTargetData(migrationParam);
            //插入数据
            datapltservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDataV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DataV> temp = datavservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            datavservice.clearTargetData(migrationParam);
            //插入数据
            datavservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayFlicker() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayFlicker> temp = dayflickerservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayflickerservice.clearTargetData(migrationParam);
            //插入数据
            dayflickerservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayFluc() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayFluc> temp = dayflucservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayflucservice.clearTargetData(migrationParam);
            //插入数据
            dayflucservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmphasicI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmphasicI> temp = dayharmphasiciservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmphasiciservice.clearTargetData(migrationParam);
            //插入数据
            dayharmphasiciservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmphasicV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmphasicV> temp = dayharmphasicvservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmphasicvservice.clearTargetData(migrationParam);
            //插入数据
            dayharmphasicvservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmpowerP() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmpowerP> temp = dayharmpowerpservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmpowerpservice.clearTargetData(migrationParam);
            //插入数据
            dayharmpowerpservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmpowerQ() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmpowerQ> temp = dayharmpowerqservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmpowerqservice.clearTargetData(migrationParam);
            //插入数据
            dayharmpowerqservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmpowerS() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmpowerS> temp = dayharmpowersservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmpowersservice.clearTargetData(migrationParam);
            //插入数据
            dayharmpowersservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmrateI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmrateI> temp = dayharmrateiservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmrateiservice.clearTargetData(migrationParam);
            //插入数据
            dayharmrateiservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayHarmrateV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayHarmrateV> temp = dayharmratevservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayharmratevservice.clearTargetData(migrationParam);
            //插入数据
            dayharmratevservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayInharmI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayInharmI> temp = dayinharmiservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayinharmiservice.clearTargetData(migrationParam);
            //插入数据
            dayinharmiservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayInharmV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayInharmV> temp = dayinharmvservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayinharmvservice.clearTargetData(migrationParam);
            //插入数据
            dayinharmvservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayI() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayI> temp = dayiservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayiservice.clearTargetData(migrationParam);
            //插入数据
            dayiservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayPlt() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayPlt> temp = daypltservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            daypltservice.clearTargetData(migrationParam);
            //插入数据
            daypltservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testDayV() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<DayV> temp = dayvservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            dayvservice.clearTargetData(migrationParam);
            //插入数据
            dayvservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testLimitRate() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<LimitRate> temp = limitrateservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            limitrateservice.clearTargetData(migrationParam);
            //插入数据
            limitrateservice.insertBatchByDB(temp);
        }
    }

    @SneakyThrows
    @Test
    public void testLimitTarget() {
        LocalDateTime endTime = LocalDateTimeUtil.parse("2023-12-29 15:00:10", DatePattern.NORM_DATETIME_PATTERN);
        LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -24, ChronoUnit.HOURS);


        MigrationParam migrationParam = new MigrationParam();
        migrationParam.setStartTime(startTime);
        migrationParam.setEndTime(endTime);

        //查询数据
        List<LimitTarget> temp = limittargetservice.queryData(migrationParam);
        if(CollectionUtil.isNotEmpty(temp)){
            //清除数据
            limittargetservice.clearTargetData(migrationParam);
            //插入数据
            limittargetservice.insertBatchByDB(temp);
        }
    }

}
