package com.njcn.prepare.harmonic.service.mysql.Impl.line;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjUtil;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.harmonic.pojo.po.day.*;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.*;
import com.njcn.influx.imapper.day.*;
import com.njcn.influx.pojo.po.*;
import com.njcn.influx.pojo.po.day.*;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
import com.njcn.prepare.harmonic.service.mysql.day.*;
import com.njcn.prepare.harmonic.service.mysql.line.DayDataService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2022/10/24  9:46【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */

@Slf4j
@Component
@RequiredArgsConstructor
public class DayDataServiceImpl implements DayDataService {

    //MySQL
    private final IRStatDataFlickerDService statDataFlickerDService;
    private final IRStatDataVDService statDataVDService;
    private final IRStatDataIDService statDataIDService;
    private final IRStatDataFlucDService statDataFlucDService;
    private final IRStatDataHarmphasicIDService statDataHarmphasicIDService;
    private final IRStatDataHarmphasicVDService statDataHarmphasicVDService;
    private final IRStatDataHarmpowerPDService statDataHarmpowerPDService;
    private final IRStatDataHarmpowerQDService statDataHarmpowerQDService;
    private final IRStatDataHarmpowerSDService statDataHarmpowerSDService;
    private final IRStatDataHarmRateIDService statDataHarmRateIDService;
    private final IRStatDataHarmRateVDService statDataHarmRateVDService;
    private final IRStatDataInharmIDService statDataInharmIDService;
    private final IRStatDataInharmVDService statDataInharmVDService;
    private final IRStatDataPltDService statDataPltDService;
    private final DayVMapper dayVMapper;
    private final DayIMapper dayIMapper;
    private final DayFlickerMapper dayFlickerMapper;
    private final DayFlucMapper dayFlucMapper;
    private final DayHarmPhasicIMapper dayHarmPhasicIMapper;
    private final DayHarmRateVMapper dayHarmRateVMapper;
    private final DayHarmRateIMapper dayHarmRateIMapper;
    private final DayHarmPowerPMapper dayHarmPowerPMapper;
    private final DayHarmPhasicVMapper dayHarmPhasicVMapper;
    private final DayHarmPowerQMapper dayHarmPowerQMapper;
    private final DayHarmPowerSMapper dayHarmPowerSMapper;
    private final DayInHarmVRateMapper dayInHarmVRateMapper;
    private final DayInHarmIRateMapper dayInHarmIRateMapper;
    private final DayPltMapper dayPltMapper;
    private final DayInHarmIMapper dayInHarmIMapper;
    private final DayInHarmVMapper dayInHarmVMapper;
    //new
    private final DataVMapper dataVMapper;
    private final DataIMapper dataIMapper;
    private final DataFlickerMapper dataFlickerMapper;
    private final DataFlucMapper dataFlucMapper;
    private final DataHarmPhasicIMapper dataHarmPhasicIMapper;
    private final DataHarmPhasicVMapper dataHarmPhasicVMapper;
    private final DataHarmPowerPMapper dataHarmPowerPMapper;
    private final DataHarmPowerQMapper dataHarmPowerQMapper;
    private final DataHarmPowerSMapper dataHarmPowerSMapper;
    private final DataHarmRateIMapper dataHarmRateIMapper;
    private final DataHarmRateVMapper dataHarmRateVMapper;
    private final DataInHarmIMapper dataInHarmIMapper;
    private final DataInHarmVMapper dataInHarmVMapper;
    private final DataInHarmRateIMapper dataInHarmRateIMapper;
    private final DataInHarmRateVMapper dataInHarmRateVMapper;
    private final DataPltMapper dataPltMapper;

    @Override
    public void dataVHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "dataV表转r_stat_data_v_d开始=====》");
        List<DataV> list1 = new ArrayList<>();
        List<RStatDataVDPO> dataVPOList = new ArrayList<>();
        List<DayV> dayVList = new ArrayList<>();
        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取dataV数据
            List<DataV> vList = getDataV(pendingId, beginDay, endDay);
            list1.addAll(vList);
        }
        //dataV数据入库
        if (!CollectionUtils.isEmpty(list1)) {
            for (DataV item : list1) {
                RStatDataVDPO po1 = new RStatDataVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                //todo 此数据质量标记为influxdb查询得出,数据转换时未做数据异常判断，因前置那边未做判断，系统先做判断拦截，后期前置应该加判断
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                //fixme 因现场数据异常，先处理频率偏差、电压偏差、电压总谐波畸变率、三相电压不平衡度、长时闪变异常数据拦截
                po1.setQualityFlag(DataAnomalyDetectio(po1, null));
                dataVPOList.add(po1);
                DayV dayV = new DayV();
                BeanUtils.copyProperties(item, dayV);
                dayV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayVList.add(dayV);
            }
            statDataVDService.insert(dataVPOList);
            dayVMapper.insertBatch(dayVList);
        }
    }

    @Override
    public void dataIHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "dataI表转r_stat_data_i_d开始=====》");
        List<DataI> list2 = new ArrayList<>();
        List<RStatDataIDPO> dataIPOList = new ArrayList<>();
        List<DayI> dayIList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取dataI数据
            List<DataI> iList = getDataI(pendingId, beginDay, endDay);
            list2.addAll(iList);
        }
        //dataI数据入库
        if (!CollectionUtils.isEmpty(list2)) {
            for (DataI item : list2) {
                RStatDataIDPO po1 = new RStatDataIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataIPOList.add(po1);
                DayI dayI = new DayI();
                BeanUtils.copyProperties(item, dayI);
                dayI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayIList.add(dayI);
            }
            statDataIDService.insert(dataIPOList);
            dayIMapper.insertBatch(dayIList);
        }
    }

    @Override
    public void dataFlickerHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "dataFlicker表转r_stat_data_flicker_d开始=====》");
        List<DataFlicker> list3 = new ArrayList<>();
        List<RStatDataFlickerDPO> dataFlickerPOList = new ArrayList<>();
        List<DayFlicker> dayFlickerList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取dataFlicker数据
            List<DataFlicker> dataFlickerList = getDataFlicker(pendingId, beginDay, endDay);
            list3.addAll(dataFlickerList);
        }
        //dataFlicker数据入库
        if (!CollectionUtils.isEmpty(list3)) {
            for (DataFlicker item : list3) {
                RStatDataFlickerDPO po1 = new RStatDataFlickerDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataFlickerPOList.add(po1);

                DayFlicker dayFlicker = new DayFlicker();
                BeanUtils.copyProperties(item, dayFlicker);
                dayFlicker.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayFlickerList.add(dayFlicker);
            }
            statDataFlickerDService.insert(dataFlickerPOList);
            dayFlickerMapper.insertBatch(dayFlickerList);
        }
    }

    @Override
    public void dataFlucHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "dataFluc表转r_stat_data_fluc_d开始=====》");
        List<DataFluc> list4 = new ArrayList<>();
        List<RStatDataFlucDPO> dataFlucPOList = new ArrayList<>();
        List<DayFluc> dayFlucList = new ArrayList<>();
        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取dataFluc数据
            List<DataFluc> dataFlucList = getDataFluc(pendingId, beginDay, endDay);
            list4.addAll(dataFlucList);
        }
        //dataFluc数据入库
        if (!CollectionUtils.isEmpty(list4)) {
            for (DataFluc item : list4) {
                RStatDataFlucDPO po1 = new RStatDataFlucDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataFlucPOList.add(po1);

                DayFluc dayFluc = new DayFluc();
                BeanUtils.copyProperties(item, dayFluc);
                dayFluc.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayFlucList.add(dayFluc);
            }
            statDataFlucDService.insert(dataFlucPOList);
            dayFlucMapper.insertBatch(dayFlucList);
        }
    }

    @Override
    public void dataHarmPhasicIHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmphasic_i表转r_stat_data_harmphasic_i_d开始=====》");
        List<DataHarmPhasicI> list5 = new ArrayList<>();
        List<RStatDataHarmphasicIDPO> dataHarmPhasicIPOList = new ArrayList<>();
        List<DayHarmPhasicI> dayHarmPhasicIList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取DataHarmPhasicI数据
            List<DataHarmPhasicI> dataHarmPhasicIList = getDataHarmphasicI(pendingId, beginDay, endDay);
            list5.addAll(dataHarmPhasicIList);
        }
        //data_harmphasic_i数据入库
        if (!CollectionUtils.isEmpty(list5)) {
            for (DataHarmPhasicI item : list5) {
                RStatDataHarmphasicIDPO po1 = new RStatDataHarmphasicIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPhasicIPOList.add(po1);

                DayHarmPhasicI dayHarmPhasicI = new DayHarmPhasicI();
                BeanUtils.copyProperties(item, dayHarmPhasicI);
                dayHarmPhasicI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPhasicIList.add(dayHarmPhasicI);
            }
            statDataHarmphasicIDService.insert(dataHarmPhasicIPOList);
            dayHarmPhasicIMapper.insertBatch(dayHarmPhasicIList);
        }
    }


    @Override
    public void dataHarmPhasicVHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmphasic_v表转r_stat_data_harmphasic_v_d开始=====》");
        List<DataHarmPhasicV> list6 = new ArrayList<>();
        List<RStatDataHarmphasicVDPO> dataHarmPhasicVPOList = new ArrayList<>();
        List<DayHarmPhasicV> dayHarmPhasicVList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取DataHarmPhasicV数据
            List<DataHarmPhasicV> dataHarmPhasicVList = getDataHarmphasicV(pendingId, beginDay, endDay);
            list6.addAll(dataHarmPhasicVList);
        }
        //data_harmphasic_v数据入库
        if (!CollectionUtils.isEmpty(list6)) {
            for (DataHarmPhasicV item : list6) {
                RStatDataHarmphasicVDPO po1 = new RStatDataHarmphasicVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPhasicVPOList.add(po1);

                DayHarmPhasicV dayHarmPhasicV = new DayHarmPhasicV();
                BeanUtils.copyProperties(item, dayHarmPhasicV);
                dayHarmPhasicV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPhasicVList.add(dayHarmPhasicV);
            }
            statDataHarmphasicVDService.insert(dataHarmPhasicVPOList);
            dayHarmPhasicVMapper.insertBatch(dayHarmPhasicVList);
        }
    }

    @Override
    public void dataHarmPowerPHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmpower_p转r_stat_data_harmpower_p_d开始=====》");
        List<DataHarmPowerP> list7 = new ArrayList<>();
        List<RStatDataHarmpowerPDPO> dataHarmPowerPPOList = new ArrayList<>();
        List<DayHarmPowerP> dayHarmPowerPList = new ArrayList<>();
        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_harmpower_p数据
            List<DataHarmPowerP> dataHarmPowerPList = getDataHarmPowerP(pendingId, beginDay, endDay);
            list7.addAll(dataHarmPowerPList);
        }
        //data_harmpower_p数据入库
        if (!CollectionUtils.isEmpty(list7)) {
            for (DataHarmPowerP item : list7) {
                RStatDataHarmpowerPDPO po1 = new RStatDataHarmpowerPDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPowerPPOList.add(po1);

                DayHarmPowerP dayHarmPowerP = new DayHarmPowerP();
                BeanUtils.copyProperties(item, dayHarmPowerP);
                dayHarmPowerP.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPowerPList.add(dayHarmPowerP);
            }
            statDataHarmpowerPDService.insert(dataHarmPowerPPOList);
            dayHarmPowerPMapper.insertBatch(dayHarmPowerPList);
        }
    }

    @Override
    public void dataHarmPowerQHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmpower_q转r_stat_data_harmpower_q_d开始=====》");
        List<DataHarmPowerQ> list8 = new ArrayList<>();
        List<RStatDataHarmpowerQDPO> dataHarmPowerQPOList = new ArrayList<>();
        List<DayHarmPowerQ> dayHarmPowerQList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_harmpower_q数据
            List<DataHarmPowerQ> dataHarmPowerQList = getDataHarmPowerQ(pendingId, beginDay, endDay);
            list8.addAll(dataHarmPowerQList);
        }
        //data_harmpower_q数据入库
        if (!CollectionUtils.isEmpty(list8)) {
            for (DataHarmPowerQ item : list8) {
                RStatDataHarmpowerQDPO po1 = new RStatDataHarmpowerQDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPowerQPOList.add(po1);

                DayHarmPowerQ dayHarmPowerQ = new DayHarmPowerQ();
                BeanUtils.copyProperties(item, dayHarmPowerQ);
                dayHarmPowerQ.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPowerQList.add(dayHarmPowerQ);
            }
            statDataHarmpowerQDService.insert(dataHarmPowerQPOList);
            dayHarmPowerQMapper.insertBatch(dayHarmPowerQList);
        }
    }

    @Override
    public void dataHarmPowerSHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmpower_s转r_stat_data_harmpower_s_d开始=====》");
        List<DataHarmPowerS> list9 = new ArrayList<>();
        List<RStatDataHarmpowerSDPO> dataHarmPowerSPOList = new ArrayList<>();
        List<DayHarmPowerS> dayHarmPowerSList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_harmpower_s数据
            List<DataHarmPowerS> dataHarmPowerSList = getDataHarmPowerS(pendingId, beginDay, endDay);
            list9.addAll(dataHarmPowerSList);
        }
        //data_harmpower_s数据入库
        if (!CollectionUtils.isEmpty(list9)) {
            for (DataHarmPowerS item : list9) {
                RStatDataHarmpowerSDPO po1 = new RStatDataHarmpowerSDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPowerSPOList.add(po1);

                DayHarmPowerS dayHarmPowerS = new DayHarmPowerS();
                BeanUtils.copyProperties(item, dayHarmPowerS);
                dayHarmPowerS.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPowerSList.add(dayHarmPowerS);
            }
            statDataHarmpowerSDService.insert(dataHarmPowerSPOList);
            dayHarmPowerSMapper.insertBatch(dayHarmPowerSList);
        }
    }

    @Override
    public void dataHarmRateIHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmrate_i转r_stat_data_harmrate_i_d开始=====》");
        List<DataHarmRateI> list10 = new ArrayList<>();
        List<RStatDataHarmrateIDPO> dataHarmRateIPOList = new ArrayList<>();
        List<DayHarmRateI> dayHarmRateIList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_harmrate_i数据
            List<DataHarmRateI> dataHarmRateIList = getDataHarmRateI(pendingId, beginDay, endDay);
            list10.addAll(dataHarmRateIList);
        }
        //data_harmrate_i数据入库
        if (!CollectionUtils.isEmpty(list10)) {
            for (DataHarmRateI item : list10) {
                RStatDataHarmrateIDPO po1 = new RStatDataHarmrateIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmRateIPOList.add(po1);

                DayHarmRateI dayHarmRateI = new DayHarmRateI();
                BeanUtils.copyProperties(item, dayHarmRateI);
                dayHarmRateI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmRateIList.add(dayHarmRateI);
            }
            statDataHarmRateIDService.insert(dataHarmRateIPOList);
            dayHarmRateIMapper.insertBatch(dayHarmRateIList);
        }
    }

    @Override
    public void dataHarmRateVHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_harmrate_v转r_stat_data_harmrate_v_d开始=====》");
        List<DataHarmRateV> list11 = new ArrayList<>();
        List<RStatDataHarmrateVDPO> dataHarmRateVPOList = new ArrayList<>();
        List<DayHarmRateV> dayHarmRateVList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_harmrate_v数据
            List<DataHarmRateV> dataHarmRateVList = getDataHarmRateV(pendingId, beginDay, endDay);
            list11.addAll(dataHarmRateVList);
        }
        //data_harmrate_v数据入库
        if (!CollectionUtils.isEmpty(list11)) {
            for (DataHarmRateV item : list11) {
                RStatDataHarmrateVDPO po1 = new RStatDataHarmrateVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmRateVPOList.add(po1);

                DayHarmRateV dayHarmRateV = new DayHarmRateV();
                BeanUtils.copyProperties(item, dayHarmRateV);
                dayHarmRateV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmRateVList.add(dayHarmRateV);
            }
            statDataHarmRateVDService.insert(dataHarmRateVPOList);
            dayHarmRateVMapper.insertBatch(dayHarmRateVList);
        }
    }

    @Override
    public void dataInHarmIHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_inharm_i转r_stat_data_inharm_i_d开始=====》");
        List<DataInHarmI> list12 = new ArrayList<>();
        List<RStatDataInharmIDPO> dataInHarmIPOList = new ArrayList<>();
        List<DayInHarmI> dayInHarmIList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_inharm_i数据
            List<DataInHarmI> dataInHarmIList = getDataInHarmI(pendingId, beginDay, endDay);
            list12.addAll(dataInHarmIList);
        }
        //data_inharm_i数据入库
        if (!CollectionUtils.isEmpty(list12)) {
            for (DataInHarmI item : list12) {
                RStatDataInharmIDPO po1 = new RStatDataInharmIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataInHarmIPOList.add(po1);

                DayInHarmI dayInHarmI = new DayInHarmI();
                BeanUtils.copyProperties(item, dayInHarmI);
                dayInHarmI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayInHarmIList.add(dayInHarmI);
            }
            statDataInharmIDService.insert(dataInHarmIPOList);
            dayInHarmIMapper.insertBatch(dayInHarmIList);
        }
    }

    @Override
    public void dataInHarmVHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_inharm_v转r_stat_data_inharm_v_d开始=====》");
        List<DataInHarmV> list13 = new ArrayList<>();
        List<RStatDataInharmVDPO> dataInHarmVPOList = new ArrayList<>();
        List<DayInHarmV> dayInHarmVList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_inharm_v数据
            List<DataInHarmV> dataInHarmVList = getDataInHarmV(pendingId, beginDay, endDay);
            list13.addAll(dataInHarmVList);
        }
        //data_inharm_v数据入库
        if (!CollectionUtils.isEmpty(list13)) {
            for (DataInHarmV item : list13) {
                RStatDataInharmVDPO po1 = new RStatDataInharmVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataInHarmVPOList.add(po1);

                DayInHarmV dayInHarmV = new DayInHarmV();
                BeanUtils.copyProperties(item, dayInHarmV);
                dayInHarmV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayInHarmVList.add(dayInHarmV);
            }
            statDataInharmVDService.insert(dataInHarmVPOList);
            dayInHarmVMapper.insertBatch(dayInHarmVList);
        }
    }

    @Override
    @Transactional(rollbackFor = {Exception.class})
    public void dataPltHardler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data_plt转r_stat_data_plt_d开始=====》");
        List<DataPlt> list16 = new ArrayList<>();
        List<RStatDataPltDPO> dataPltPOList = new ArrayList<>();
        List<DayPlt> dayPltList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，单个监测点执行
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取data_plt数据
            List<DataPlt> dataPltList = getDataPlt(pendingId, beginDay, endDay);
            list16.addAll(dataPltList);
        }
        //data_plt数据入库
        if (!CollectionUtils.isEmpty(list16)) {
            for (DataPlt item : list16) {
                RStatDataPltDPO po1 = new RStatDataPltDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                po1.setQualityFlag(DataAnomalyDetectio(null, po1));
                dataPltPOList.add(po1);

                DayPlt dayPlt = new DayPlt();
                BeanUtils.copyProperties(item, dayPlt);
                dayPlt.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayPltList.add(dayPlt);
            }
            statDataPltDService.insert(dataPltPOList);
            dayPltMapper.insertBatch(dayPltList);
        }
    }


    @Override
    @Transactional(rollbackFor = {Exception.class})
    @Deprecated
    public void dataToDayHandler(CalculatedParam calculatedParam) {
        log.info(LocalDateTime.now() + "data表转day开始=====》");
        //influxdb实体
        List<DataV> list1 = new ArrayList<>();
        List<DataI> list2 = new ArrayList<>();
        List<DataFlicker> list3 = new ArrayList<>();
        List<DataFluc> list4 = new ArrayList<>();
        List<DataHarmPhasicI> list5 = new ArrayList<>();
        List<DataHarmPhasicV> list6 = new ArrayList<>();
        List<DataHarmPowerP> list7 = new ArrayList<>();
        List<DataHarmPowerQ> list8 = new ArrayList<>();
        List<DataHarmPowerS> list9 = new ArrayList<>();
        List<DataHarmRateI> list10 = new ArrayList<>();
        List<DataHarmRateV> list11 = new ArrayList<>();
        List<DataInHarmI> list12 = new ArrayList<>();
        List<DataInHarmV> list13 = new ArrayList<>();
        List<DataInHarmRateI> list14 = new ArrayList<>();
        List<DataInHarmRateV> list15 = new ArrayList<>();
        List<DataPlt> list16 = new ArrayList<>();
        //mysql
        List<RStatDataVDPO> dataVPOList = new ArrayList<>();
        List<RStatDataIDPO> dataIPOList = new ArrayList<>();
        List<RStatDataFlucDPO> dataFlucPOList = new ArrayList<>();
        List<RStatDataHarmphasicIDPO> dataHarmPhasicIPOList = new ArrayList<>();
        List<RStatDataHarmphasicVDPO> dataHarmPhasicVPOList = new ArrayList<>();
        List<RStatDataHarmpowerPDPO> dataHarmPowerPPOList = new ArrayList<>();
        List<RStatDataHarmpowerQDPO> dataHarmPowerQPOList = new ArrayList<>();
        List<RStatDataHarmpowerSDPO> dataHarmPowerSPOList = new ArrayList<>();
        List<RStatDataHarmrateIDPO> dataHarmRateIPOList = new ArrayList<>();
        List<RStatDataHarmrateVDPO> dataHarmRateVPOList = new ArrayList<>();
        List<RStatDataInharmIDPO> dataInHarmIPOList = new ArrayList<>();
        List<RStatDataInharmVDPO> dataInHarmVPOList = new ArrayList<>();
        List<RStatDataPltDPO> dataPltPOList = new ArrayList<>();
        List<RStatDataFlickerDPO> dataFlickerPOList = new ArrayList<>();
        //day表
        List<DayV> dayVList = new ArrayList<>();
        List<DayI> dayIList = new ArrayList<>();
        List<DayFlicker> dayFlickerList = new ArrayList<>();
        List<DayFluc> dayFlucList = new ArrayList<>();
        List<DayHarmPhasicI> dayHarmPhasicIList = new ArrayList<>();
        List<DayHarmPhasicV> dayHarmPhasicVList = new ArrayList<>();
        List<DayHarmPowerP> dayHarmPowerPList = new ArrayList<>();
        List<DayHarmPowerS> dayHarmPowerSList = new ArrayList<>();
        List<DayHarmPowerQ> dayHarmPowerQList = new ArrayList<>();
        List<DayHarmRateV> dayHarmRateVList = new ArrayList<>();
        List<DayHarmRateI> dayHarmRateIList = new ArrayList<>();
        List<DayInHarmI> dayInHarmIList = new ArrayList<>();
        List<DayInHarmV> dayInHarmVList = new ArrayList<>();
        List<DayPlt> dayPltList = new ArrayList<>();

        List<String> lineIds = calculatedParam.getIdList();
        //河北数据量较大，以尺寸20分片
        List<List<String>> pendingIds = ListUtils.partition(lineIds, 20);
        String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN);
        for (List<String> pendingId : pendingIds) {
            //获取dataV数据
            List<DataV> vList = getDataV(pendingId, beginDay, endDay);
            list1.addAll(vList);
            //获取dataI数据
            List<DataI> iList = getDataI(pendingId, beginDay, endDay);
            list2.addAll(iList);
            //获取dataFlicker数据
            List<DataFlicker> dataFlickerList = getDataFlicker(pendingId, beginDay, endDay);
            list3.addAll(dataFlickerList);
            //获取dataFluc数据
            List<DataFluc> dataFlucList = getDataFluc(pendingId, beginDay, endDay);
            list4.addAll(dataFlucList);
            //获取DataHarmPhasicI数据
            List<DataHarmPhasicI> dataHarmPhasicIList = getDataHarmphasicI(pendingId, beginDay, endDay);
            list5.addAll(dataHarmPhasicIList);
            //获取DataHarmPhasicV数据
            List<DataHarmPhasicV> dataHarmPhasicVList = getDataHarmphasicV(pendingId, beginDay, endDay);
            list6.addAll(dataHarmPhasicVList);
            //获取data_harmpower_p数据
            List<DataHarmPowerP> dataHarmPowerPList = getDataHarmPowerP(pendingId, beginDay, endDay);
            list7.addAll(dataHarmPowerPList);
            //获取data_harmpower_q数据
            List<DataHarmPowerQ> dataHarmPowerQList = getDataHarmPowerQ(pendingId, beginDay, endDay);
            list8.addAll(dataHarmPowerQList);
            //获取data_harmpower_s数据
            List<DataHarmPowerS> dataHarmPowerSList = getDataHarmPowerS(pendingId, beginDay, endDay);
            list9.addAll(dataHarmPowerSList);
            //获取data_harmrate_i数据
            List<DataHarmRateI> dataHarmRateIList = getDataHarmRateI(pendingId, beginDay, endDay);
            list10.addAll(dataHarmRateIList);
            //获取data_harmrate_v数据
            List<DataHarmRateV> dataHarmRateVList = getDataHarmRateV(pendingId, beginDay, endDay);
            list11.addAll(dataHarmRateVList);
            //获取data_inharm_i数据
            List<DataInHarmI> dataInHarmIList = getDataInHarmI(pendingId, beginDay, endDay);
            list12.addAll(dataInHarmIList);
            //获取data_inharm_v数据
            List<DataInHarmV> dataInHarmVList = getDataInHarmV(pendingId, beginDay, endDay);
            list13.addAll(dataInHarmVList);
            //获取data_inharmrate_i数据 influxDB暂无此表数据，统计待定
            List<DataInHarmRateI> dataInHarmRateIList = getDataInHarmRateI(pendingId, beginDay, endDay);
            list14.addAll(dataInHarmRateIList);
            //获取data_inharmrate_v数据 influxDB暂无此表数据，统计待定
            List<DataInHarmRateV> dataInHarmRateVList = getDataInHarmRateV(pendingId, beginDay, endDay);
            list15.addAll(dataInHarmRateVList);
            //获取data_plt数据
            List<DataPlt> dataPltList = getDataPlt(pendingId, beginDay, endDay);
            list16.addAll(dataPltList);
        }
        //dataV数据入库
        if (!CollectionUtils.isEmpty(list1)) {
            for (DataV item : list1) {
                RStatDataVDPO po1 = new RStatDataVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataVPOList.add(po1);

                DayV dayV = new DayV();
                BeanUtils.copyProperties(item, dayV);
                dayV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayVList.add(dayV);
            }
            statDataVDService.insert(dataVPOList);
            dayVMapper.insertBatch(dayVList);
        }
        //dataI数据入库
        if (!CollectionUtils.isEmpty(list2)) {
            for (DataI item : list2) {
                RStatDataIDPO po1 = new RStatDataIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataIPOList.add(po1);
                DayI dayI = new DayI();
                BeanUtils.copyProperties(item, dayI);
                dayI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayIList.add(dayI);
            }
            statDataIDService.insert(dataIPOList);
            dayIMapper.insertBatch(dayIList);
        }
        //dataFlicker数据入库
        if (!CollectionUtils.isEmpty(list3)) {
            for (DataFlicker item : list3) {
                RStatDataFlickerDPO po1 = new RStatDataFlickerDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataFlickerPOList.add(po1);

                DayFlicker dayFlicker = new DayFlicker();
                BeanUtils.copyProperties(item, dayFlicker);
                dayFlicker.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayFlickerList.add(dayFlicker);
            }
            statDataFlickerDService.insert(dataFlickerPOList);
            dayFlickerMapper.insertBatch(dayFlickerList);
        }
        //dataFluc数据入库
        if (!CollectionUtils.isEmpty(list4)) {
            for (DataFluc item : list4) {
                RStatDataFlucDPO po1 = new RStatDataFlucDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataFlucPOList.add(po1);

                DayFluc dayFluc = new DayFluc();
                BeanUtils.copyProperties(item, dayFluc);
                dayFluc.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayFlucList.add(dayFluc);
            }
            statDataFlucDService.insert(dataFlucPOList);
            dayFlucMapper.insertBatch(dayFlucList);
        }
        //data_harmphasic_i数据入库
        if (!CollectionUtils.isEmpty(list5)) {
            for (DataHarmPhasicI item : list5) {
                RStatDataHarmphasicIDPO po1 = new RStatDataHarmphasicIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPhasicIPOList.add(po1);

                DayHarmPhasicI dayHarmPhasicI = new DayHarmPhasicI();
                BeanUtils.copyProperties(item, dayHarmPhasicI);
                dayHarmPhasicI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPhasicIList.add(dayHarmPhasicI);
            }
            statDataHarmphasicIDService.insert(dataHarmPhasicIPOList);
            dayHarmPhasicIMapper.insertBatch(dayHarmPhasicIList);
        }
        //data_harmphasic_v数据入库
        if (!CollectionUtils.isEmpty(list6)) {
            for (DataHarmPhasicV item : list6) {
                RStatDataHarmphasicVDPO po1 = new RStatDataHarmphasicVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPhasicVPOList.add(po1);

                DayHarmPhasicV dayHarmPhasicV = new DayHarmPhasicV();
                BeanUtils.copyProperties(item, dayHarmPhasicV);
                dayHarmPhasicV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPhasicVList.add(dayHarmPhasicV);
            }
            statDataHarmphasicVDService.insert(dataHarmPhasicVPOList);
            dayHarmPhasicVMapper.insertBatch(dayHarmPhasicVList);
        }
        //data_harmpower_p数据入库
        if (!CollectionUtils.isEmpty(list7)) {
            for (DataHarmPowerP item : list7) {
                RStatDataHarmpowerPDPO po1 = new RStatDataHarmpowerPDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPowerPPOList.add(po1);

                DayHarmPowerP dayHarmPowerP = new DayHarmPowerP();
                BeanUtils.copyProperties(item, dayHarmPowerP);
                dayHarmPowerP.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPowerPList.add(dayHarmPowerP);
            }
            statDataHarmpowerPDService.insert(dataHarmPowerPPOList);
            dayHarmPowerPMapper.insertBatch(dayHarmPowerPList);
        }
        //data_harmpower_q数据入库
        if (!CollectionUtils.isEmpty(list8)) {
            for (DataHarmPowerQ item : list8) {
                RStatDataHarmpowerQDPO po1 = new RStatDataHarmpowerQDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPowerQPOList.add(po1);

                DayHarmPowerQ dayHarmPowerQ = new DayHarmPowerQ();
                BeanUtils.copyProperties(item, dayHarmPowerQ);
                dayHarmPowerQ.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPowerQList.add(dayHarmPowerQ);
            }
            statDataHarmpowerQDService.insert(dataHarmPowerQPOList);
            dayHarmPowerQMapper.insertBatch(dayHarmPowerQList);
        }
        //data_harmpower_s数据入库
        if (!CollectionUtils.isEmpty(list9)) {
            for (DataHarmPowerS item : list9) {
                RStatDataHarmpowerSDPO po1 = new RStatDataHarmpowerSDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmPowerSPOList.add(po1);

                DayHarmPowerS dayHarmPowerS = new DayHarmPowerS();
                BeanUtils.copyProperties(item, dayHarmPowerS);
                dayHarmPowerS.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmPowerSList.add(dayHarmPowerS);
            }
            statDataHarmpowerSDService.insert(dataHarmPowerSPOList);
            dayHarmPowerSMapper.insertBatch(dayHarmPowerSList);
        }
        //data_harmrate_i数据入库
        if (!CollectionUtils.isEmpty(list10)) {
            for (DataHarmRateI item : list10) {
                RStatDataHarmrateIDPO po1 = new RStatDataHarmrateIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmRateIPOList.add(po1);

                DayHarmRateI dayHarmRateI = new DayHarmRateI();
                BeanUtils.copyProperties(item, dayHarmRateI);
                dayHarmRateI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmRateIList.add(dayHarmRateI);
            }
            statDataHarmRateIDService.insert(dataHarmRateIPOList);
            dayHarmRateIMapper.insertBatch(dayHarmRateIList);
        }
        //data_harmrate_v数据入库
        if (!CollectionUtils.isEmpty(list11)) {
            for (DataHarmRateV item : list11) {
                RStatDataHarmrateVDPO po1 = new RStatDataHarmrateVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataHarmRateVPOList.add(po1);

                DayHarmRateV dayHarmRateV = new DayHarmRateV();
                BeanUtils.copyProperties(item, dayHarmRateV);
                dayHarmRateV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayHarmRateVList.add(dayHarmRateV);
            }
            statDataHarmRateVDService.insert(dataHarmRateVPOList);
            dayHarmRateVMapper.insertBatch(dayHarmRateVList);
        }
        //data_inharm_i数据入库
        if (!CollectionUtils.isEmpty(list12)) {
            for (DataInHarmI item : list12) {
                RStatDataInharmIDPO po1 = new RStatDataInharmIDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataInHarmIPOList.add(po1);

                DayInHarmI dayInHarmI = new DayInHarmI();
                BeanUtils.copyProperties(item, dayInHarmI);
                dayInHarmI.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayInHarmIList.add(dayInHarmI);
            }
            statDataInharmIDService.insert(dataInHarmIPOList);
            dayInHarmIMapper.insertBatch(dayInHarmIList);
        }
        //data_inharm_v数据入库
        if (!CollectionUtils.isEmpty(list13)) {
            for (DataInHarmV item : list13) {
                RStatDataInharmVDPO po1 = new RStatDataInharmVDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataInHarmVPOList.add(po1);

                DayInHarmV dayInHarmV = new DayInHarmV();
                BeanUtils.copyProperties(item, dayInHarmV);
                dayInHarmV.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayInHarmVList.add(dayInHarmV);
            }
            statDataInharmVDService.insert(dataInHarmVPOList);
            dayInHarmVMapper.insertBatch(dayInHarmVList);
        }
        //data_plt数据入库
        if (!CollectionUtils.isEmpty(list16)) {
            for (DataPlt item : list16) {
                RStatDataPltDPO po1 = new RStatDataPltDPO();
                BeanUtils.copyProperties(item, po1);
                po1.setTime(LocalDate.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER));
                po1.setQualityFlag(Integer.parseInt(item.getQualityFlag()));
                dataPltPOList.add(po1);

                DayPlt dayPlt = new DayPlt();
                BeanUtils.copyProperties(item, dayPlt);
                dayPlt.setTime(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_FORMATTER).toInstant());
                dayPltList.add(dayPlt);
            }
            statDataPltDService.insert(dataPltPOList);
            dayPltMapper.insertBatch(dayPltList);
        }
    }






    /**
     * 功能描述:获取dataV数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataV>  getDataV(List<String> lineIndex, String startTime, String endTime) {
        List<DataV> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataV::getLineId, lineIndex)
                .eq(DataV::getValueType, InfluxDbSqlConstant.MIN)
                .min(DataV::getFreq)
                .min(DataV::getFreqDev)
                .min(DataV::getRms)
                .min(DataV::getRmsLvr)
                .min(DataV::getVNeg)
                .min(DataV::getVPos)
                .min(DataV::getVThd)
                .min(DataV::getVUnbalance)
                .min(DataV::getVZero)
                .min(DataV::getVlDev)
                .min(DataV::getVuDev)
                .groupBy(DataV::getLineId, DataV::getPhaseType, DataV::getQualityFlag, DataV::getValueType)
                .between(DataV::getTime, startTime, endTime);
        List<DataV> result1 = dataVMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataV.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataV::getLineId, lineIndex)
                .eq(DataV::getValueType, InfluxDbSqlConstant.MAX)
                .max(DataV::getFreq)
                .max(DataV::getFreqDev)
                .max(DataV::getRms)
                .max(DataV::getRmsLvr)
                .max(DataV::getVNeg)
                .max(DataV::getVPos)
                .max(DataV::getVThd)
                .max(DataV::getVUnbalance)
                .max(DataV::getVZero)
                .max(DataV::getVlDev)
                .max(DataV::getVuDev)
                .groupBy(DataV::getLineId, DataV::getPhaseType, DataV::getQualityFlag, DataV::getValueType)
                .between(DataV::getTime, startTime, endTime);
        List<DataV> result2 = dataVMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataV.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataV::getLineId, lineIndex)
                .eq(DataV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .mean(DataV::getFreq)
                .mean(DataV::getFreqDev)
                .mean(DataV::getRms)
                .mean(DataV::getRmsLvr)
                .mean(DataV::getVNeg)
                .mean(DataV::getVPos)
                .mean(DataV::getVThd)
                .mean(DataV::getVUnbalance)
                .mean(DataV::getVZero)
                .mean(DataV::getVlDev)
                .mean(DataV::getVuDev)
                .groupBy(DataV::getLineId, DataV::getPhaseType, DataV::getQualityFlag, DataV::getValueType)
                .between(DataV::getTime, startTime, endTime);
        List<DataV> result3 = dataVMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataV.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataV::getLineId, lineIndex)
                .eq(DataV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .percentile(DataV::getFreq, 95)
                .percentile(DataV::getFreqDev, 95)
                .percentile(DataV::getRms, 95)
                .percentile(DataV::getRmsLvr, 95)
                .percentile(DataV::getVNeg, 95)
                .percentile(DataV::getVPos, 95)
                .percentile(DataV::getVThd, 95)
                .percentile(DataV::getVUnbalance, 95)
                .percentile(DataV::getVZero, 95)
                .percentile(DataV::getVlDev, 95)
                .percentile(DataV::getVuDev, 95)
                .groupBy(DataV::getLineId, DataV::getPhaseType, DataV::getQualityFlag, DataV::getValueType)
                .between(DataV::getTime, startTime, endTime);
        List<DataV> result4 = dataVMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取dataI数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataI> getDataI(List<String> lineIndex, String startTime, String endTime) {
        List<DataI> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataI::getLineId, lineIndex)
                .eq(DataI::getValueType, InfluxDbSqlConstant.MIN)
                .min(DataI::getINeg)
                .min(DataI::getIPos)
                .min(DataI::getRms)
                .min(DataI::getIThd)
                .min(DataI::getIUnbalance)
                .min(DataI::getIZero)
                .groupBy(DataI::getLineId, DataI::getPhaseType, DataI::getQualityFlag, DataI::getValueType)
                .between(DataI::getTime, startTime, endTime);
        List<DataI> result1 = dataIMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataI.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataI::getLineId, lineIndex)
                .eq(DataI::getValueType, InfluxDbSqlConstant.MAX)
                .max(DataI::getINeg)
                .max(DataI::getIPos)
                .max(DataI::getRms)
                .max(DataI::getIThd)
                .max(DataI::getIUnbalance)
                .max(DataI::getIZero)
                .groupBy(DataI::getLineId, DataI::getPhaseType, DataI::getQualityFlag, DataI::getValueType)
                .between(DataI::getTime, startTime, endTime);
        List<DataI> result2 = dataIMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataI.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataI::getLineId, lineIndex)
                .eq(DataI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .mean(DataI::getINeg)
                .mean(DataI::getIPos)
                .mean(DataI::getRms)
                .mean(DataI::getIThd)
                .mean(DataI::getIUnbalance)
                .mean(DataI::getIZero)
                .groupBy(DataI::getLineId, DataI::getPhaseType, DataI::getQualityFlag, DataI::getValueType)
                .between(DataI::getTime, startTime, endTime);
        List<DataI> result3 = dataIMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataI.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataI::getLineId, lineIndex)
                .eq(DataI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .percentile(DataI::getINeg, 95)
                .percentile(DataI::getIPos, 95)
                .percentile(DataI::getRms, 95)
                .percentile(DataI::getIThd, 95)
                .percentile(DataI::getIUnbalance, 95)
                .percentile(DataI::getIZero, 95)
                .groupBy(DataI::getLineId, DataI::getPhaseType, DataI::getQualityFlag, DataI::getValueType)
                .between(DataI::getTime, startTime, endTime);
        List<DataI> result4 = dataIMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取dataFlicker数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataFlicker> getDataFlicker(List<String> lineIndex, String startTime, String endTime) {
        List<DataFlicker> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
        influxQueryWrapper.regular(DataFlicker::getLineId, lineIndex)
                .min(DataFlicker::getFluc)
                .min(DataFlicker::getPlt)
                .min(DataFlicker::getPst)
                .groupBy(DataFlicker::getLineId, DataFlicker::getPhaseType, DataFlicker::getQualityFlag)
                .between(DataFlicker::getTime, startTime, endTime);
        List<DataFlicker> result1 = dataFlickerMapper.getStatisticsByWraper2(influxQueryWrapper);
        result1.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.MIN);
        });
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataFlicker.class);
        influxQueryWrapper2.regular(DataFlicker::getLineId, lineIndex)
                .max(DataFlicker::getFluc)
                .max(DataFlicker::getPlt)
                .max(DataFlicker::getPst)
                .groupBy(DataFlicker::getLineId, DataFlicker::getPhaseType, DataFlicker::getQualityFlag)
                .between(DataFlicker::getTime, startTime, endTime);
        List<DataFlicker> result2 = dataFlickerMapper.getStatisticsByWraper2(influxQueryWrapper2);
        result2.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.MAX);
        });
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataFlicker.class);
        influxQueryWrapper3.regular(DataFlicker::getLineId, lineIndex)
                .mean(DataFlicker::getFluc)
                .mean(DataFlicker::getPlt)
                .mean(DataFlicker::getPst)
                .groupBy(DataFlicker::getLineId, DataFlicker::getPhaseType, DataFlicker::getQualityFlag)
                .between(DataFlicker::getTime, startTime, endTime);
        List<DataFlicker> result3 = dataFlickerMapper.getStatisticsByWraper2(influxQueryWrapper3);
        result3.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.AVG_WEB);
        });
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataFlicker.class);
        influxQueryWrapper4.regular(DataFlicker::getLineId, lineIndex)
                .percentile(DataFlicker::getFluc, 95)
                .percentile(DataFlicker::getPlt, 95)
                .percentile(DataFlicker::getPst, 95)
                .groupBy(DataFlicker::getLineId, DataFlicker::getPhaseType, DataFlicker::getQualityFlag)
                .between(DataFlicker::getTime, startTime, endTime);
        List<DataFlicker> result4 = dataFlickerMapper.getStatisticsByWraper2(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取dataFluc数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataFluc> getDataFluc(List<String> lineIndex, String startTime, String endTime) {
        List<DataFluc> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFluc.class);
        influxQueryWrapper.regular(DataFluc::getLineId, lineIndex)
                .eq(DataFluc::getValueType, InfluxDbSqlConstant.MIN)
                .min(DataFluc::getFluc)
                .min(DataFluc::getFluccf)
                .groupBy(DataFluc::getLineId, DataFluc::getPhaseType, DataFluc::getQualityFlag, DataFluc::getValueType)
                .between(DataFluc::getTime, startTime, endTime);
        List<DataFluc> result1 = dataFlucMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataFluc.class);
        influxQueryWrapper2.regular(DataFluc::getLineId, lineIndex)
                .eq(DataFluc::getValueType, InfluxDbSqlConstant.MAX)
                .max(DataFluc::getFluc)
                .max(DataFluc::getFluccf)
                .groupBy(DataFluc::getLineId, DataFluc::getPhaseType, DataFluc::getQualityFlag, DataFluc::getValueType)
                .between(DataFluc::getTime, startTime, endTime);
        List<DataFluc> result2 = dataFlucMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataFluc.class);
        influxQueryWrapper3.regular(DataFluc::getLineId, lineIndex)
                .eq(DataFluc::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .mean(DataFluc::getFluc)
                .mean(DataFluc::getFluccf)
                .groupBy(DataFluc::getLineId, DataFluc::getPhaseType, DataFluc::getQualityFlag, DataFluc::getValueType)
                .between(DataFluc::getTime, startTime, endTime);
        List<DataFluc> result3 = dataFlucMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataFluc.class);
        influxQueryWrapper4.regular(DataFluc::getLineId, lineIndex)
                .eq(DataFluc::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .percentile(DataFluc::getFluc, 95)
                .percentile(DataFluc::getFluccf, 95)
                .groupBy(DataFluc::getLineId, DataFluc::getPhaseType, DataFluc::getQualityFlag, DataFluc::getValueType)
                .between(DataFluc::getTime, startTime, endTime);
        List<DataFluc> result4 = dataFlucMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmphasic_i数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmPhasicI> getDataHarmphasicI(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmPhasicI> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPhasicI.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmPhasicI::getLineId, lineIndex)
                .eq(DataHarmPhasicI::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataHarmPhasicI::getLineId, DataHarmPhasicI::getPhaseType, DataHarmPhasicI::getQualityFlag, DataHarmPhasicI::getValueType)
                .between(DataHarmPhasicI::getTime, startTime, endTime);
        List<DataHarmPhasicI> result1 = dataHarmPhasicIMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmPhasicI.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmPhasicI::getLineId, lineIndex)
                .eq(DataHarmPhasicI::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataHarmPhasicI::getLineId, DataHarmPhasicI::getPhaseType, DataHarmPhasicI::getQualityFlag, DataHarmPhasicI::getValueType)
                .between(DataHarmPhasicI::getTime, startTime, endTime);
        List<DataHarmPhasicI> result2 = dataHarmPhasicIMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmPhasicI.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmPhasicI::getLineId, lineIndex)
                .eq(DataHarmPhasicI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmPhasicI::getLineId, DataHarmPhasicI::getPhaseType, DataHarmPhasicI::getQualityFlag, DataHarmPhasicI::getValueType)
                .between(DataHarmPhasicI::getTime, startTime, endTime);
        List<DataHarmPhasicI> result3 = dataHarmPhasicIMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmPhasicI.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmPhasicI::getLineId, lineIndex)
                .eq(DataHarmPhasicI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmPhasicI::getLineId, DataHarmPhasicI::getPhaseType, DataHarmPhasicI::getQualityFlag, DataHarmPhasicI::getValueType)
                .between(DataHarmPhasicI::getTime, startTime, endTime);
        List<DataHarmPhasicI> result4 = dataHarmPhasicIMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmphasic_v数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmPhasicV> getDataHarmphasicV(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmPhasicV> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPhasicV.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmPhasicV::getLineId, lineIndex)
                .eq(DataHarmPhasicV::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataHarmPhasicV::getLineId, DataHarmPhasicV::getPhaseType, DataHarmPhasicV::getQualityFlag, DataHarmPhasicV::getValueType)
                .between(DataHarmPhasicV::getTime, startTime, endTime);
        List<DataHarmPhasicV> result1 = dataHarmPhasicVMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmPhasicV.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmPhasicV::getLineId, lineIndex)
                .eq(DataHarmPhasicV::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataHarmPhasicV::getLineId, DataHarmPhasicV::getPhaseType, DataHarmPhasicV::getQualityFlag, DataHarmPhasicV::getValueType)
                .between(DataHarmPhasicV::getTime, startTime, endTime);
        List<DataHarmPhasicV> result2 = dataHarmPhasicVMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmPhasicV.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmPhasicV::getLineId, lineIndex)
                .eq(DataHarmPhasicV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmPhasicV::getLineId, DataHarmPhasicV::getPhaseType, DataHarmPhasicV::getQualityFlag, DataHarmPhasicV::getValueType)
                .between(DataHarmPhasicV::getTime, startTime, endTime);
        List<DataHarmPhasicV> result3 = dataHarmPhasicVMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmPhasicV.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmPhasicV::getLineId, lineIndex)
                .eq(DataHarmPhasicV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmPhasicV::getLineId, DataHarmPhasicV::getPhaseType, DataHarmPhasicV::getQualityFlag, DataHarmPhasicV::getValueType)
                .between(DataHarmPhasicV::getTime, startTime, endTime);
        List<DataHarmPhasicV> result4 = dataHarmPhasicVMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmpower_p数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmPowerP> getDataHarmPowerP(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmPowerP> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerP.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.P, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmPowerP::getLineId, lineIndex)
                .eq(DataHarmPowerP::getValueType, InfluxDbSqlConstant.MIN)
                .min(DataHarmPowerP::getP)
                .min(DataHarmPowerP::getPf)
                .min(DataHarmPowerP::getDf)
                .groupBy(DataHarmPowerP::getLineId, DataHarmPowerP::getPhaseType, DataHarmPowerP::getQualityFlag, DataHarmPowerP::getValueType)
                .between(DataHarmPowerP::getTime, startTime, endTime);
        List<DataHarmPowerP> result1 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmPowerP.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.P, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmPowerP::getLineId, lineIndex)
                .eq(DataHarmPowerP::getValueType, InfluxDbSqlConstant.MAX)
                .max(DataHarmPowerP::getP)
                .max(DataHarmPowerP::getPf)
                .max(DataHarmPowerP::getDf)
                .groupBy(DataHarmPowerP::getLineId, DataHarmPowerP::getPhaseType, DataHarmPowerP::getQualityFlag, DataHarmPowerP::getValueType)
                .between(DataHarmPowerP::getTime, startTime, endTime);
        List<DataHarmPowerP> result2 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmPowerP.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.P, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmPowerP::getLineId, lineIndex)
                .eq(DataHarmPowerP::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .mean(DataHarmPowerP::getP)
                .mean(DataHarmPowerP::getPf)
                .mean(DataHarmPowerP::getDf)
                .groupBy(DataHarmPowerP::getLineId, DataHarmPowerP::getPhaseType, DataHarmPowerP::getQualityFlag, DataHarmPowerP::getValueType)
                .between(DataHarmPowerP::getTime, startTime, endTime);
        List<DataHarmPowerP> result3 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmPowerP.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.P, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmPowerP::getLineId, lineIndex)
                .eq(DataHarmPowerP::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .percentile(DataHarmPowerP::getP, 95)
                .percentile(DataHarmPowerP::getPf, 95)
                .percentile(DataHarmPowerP::getDf, 95)
                .groupBy(DataHarmPowerP::getLineId, DataHarmPowerP::getPhaseType, DataHarmPowerP::getQualityFlag, DataHarmPowerP::getValueType)
                .between(DataHarmPowerP::getTime, startTime, endTime);
        List<DataHarmPowerP> result4 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmpower_q数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmPowerQ> getDataHarmPowerQ(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmPowerQ> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerQ.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.Q, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmPowerQ::getLineId, lineIndex)
                .eq(DataHarmPowerQ::getValueType, InfluxDbSqlConstant.MIN)
                .min(DataHarmPowerQ::getQ)
                .groupBy(DataHarmPowerQ::getLineId, DataHarmPowerQ::getPhaseType, DataHarmPowerQ::getQualityFlag, DataHarmPowerQ::getValueType)
                .between(DataHarmPowerQ::getTime, startTime, endTime);
        List<DataHarmPowerQ> result1 = dataHarmPowerQMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmPowerQ.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.Q, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmPowerQ::getLineId, lineIndex)
                .eq(DataHarmPowerQ::getValueType, InfluxDbSqlConstant.MAX)
                .max(DataHarmPowerQ::getQ)
                .groupBy(DataHarmPowerQ::getLineId, DataHarmPowerQ::getPhaseType, DataHarmPowerQ::getQualityFlag, DataHarmPowerQ::getValueType)
                .between(DataHarmPowerQ::getTime, startTime, endTime);
        List<DataHarmPowerQ> result2 = dataHarmPowerQMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmPowerQ.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.Q, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmPowerQ::getLineId, lineIndex)
                .eq(DataHarmPowerQ::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .mean(DataHarmPowerQ::getQ)
                .groupBy(DataHarmPowerQ::getLineId, DataHarmPowerQ::getPhaseType, DataHarmPowerQ::getQualityFlag, DataHarmPowerQ::getValueType)
                .between(DataHarmPowerQ::getTime, startTime, endTime);
        List<DataHarmPowerQ> result3 = dataHarmPowerQMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmPowerQ.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.Q, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmPowerQ::getLineId, lineIndex)
                .eq(DataHarmPowerQ::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .percentile(DataHarmPowerQ::getQ, 95)
                .groupBy(DataHarmPowerQ::getLineId, DataHarmPowerQ::getPhaseType, DataHarmPowerQ::getQualityFlag, DataHarmPowerQ::getValueType)
                .between(DataHarmPowerQ::getTime, startTime, endTime);
        List<DataHarmPowerQ> result4 = dataHarmPowerQMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmpower_s数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmPowerS> getDataHarmPowerS(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmPowerS> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerS.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.S, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmPowerS::getLineId, lineIndex)
                .eq(DataHarmPowerS::getValueType, InfluxDbSqlConstant.MIN)
                .min(DataHarmPowerS::getS)
                .groupBy(DataHarmPowerS::getLineId, DataHarmPowerS::getPhaseType, DataHarmPowerS::getQualityFlag, DataHarmPowerS::getValueType)
                .between(DataHarmPowerS::getTime, startTime, endTime);
        List<DataHarmPowerS> result1 = dataHarmPowerSMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmPowerS.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.S, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmPowerS::getLineId, lineIndex)
                .eq(DataHarmPowerS::getValueType, InfluxDbSqlConstant.MAX)
                .max(DataHarmPowerS::getS)
                .groupBy(DataHarmPowerS::getLineId, DataHarmPowerS::getPhaseType, DataHarmPowerS::getQualityFlag, DataHarmPowerS::getValueType)
                .between(DataHarmPowerS::getTime, startTime, endTime);
        List<DataHarmPowerS> result2 = dataHarmPowerSMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmPowerS.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.S, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmPowerS::getLineId, lineIndex)
                .eq(DataHarmPowerS::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .mean(DataHarmPowerS::getS)
                .groupBy(DataHarmPowerS::getLineId, DataHarmPowerS::getPhaseType, DataHarmPowerS::getQualityFlag, DataHarmPowerS::getValueType)
                .between(DataHarmPowerS::getTime, startTime, endTime);
        List<DataHarmPowerS> result3 = dataHarmPowerSMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmPowerS.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.S, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmPowerS::getLineId, lineIndex)
                .eq(DataHarmPowerS::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .percentile(DataHarmPowerS::getS, 95)
                .groupBy(DataHarmPowerS::getLineId, DataHarmPowerS::getPhaseType, DataHarmPowerS::getQualityFlag, DataHarmPowerS::getValueType)
                .between(DataHarmPowerS::getTime, startTime, endTime);
        List<DataHarmPowerS> result4 = dataHarmPowerSMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmrate_i数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmRateI> getDataHarmRateI(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmRateI> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmRateI.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmRateI::getLineId, lineIndex)
                .eq(DataHarmRateI::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataHarmRateI::getLineId, DataHarmRateI::getPhaseType, DataHarmRateI::getQualityFlag, DataHarmRateI::getValueType)
                .between(DataHarmRateI::getTime, startTime, endTime);
        List<DataHarmRateI> result1 = dataHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmRateI.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmRateI::getLineId, lineIndex)
                .eq(DataHarmRateI::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataHarmRateI::getLineId, DataHarmRateI::getPhaseType, DataHarmRateI::getQualityFlag, DataHarmRateI::getValueType)
                .between(DataHarmRateI::getTime, startTime, endTime);
        List<DataHarmRateI> result2 = dataHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmRateI.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmRateI::getLineId, lineIndex)
                .eq(DataHarmRateI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmRateI::getLineId, DataHarmRateI::getPhaseType, DataHarmRateI::getQualityFlag, DataHarmRateI::getValueType)
                .between(DataHarmRateI::getTime, startTime, endTime);
        List<DataHarmRateI> result3 = dataHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmRateI.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmRateI::getLineId, lineIndex)
                .eq(DataHarmRateI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmRateI::getLineId, DataHarmRateI::getPhaseType, DataHarmRateI::getQualityFlag, DataHarmRateI::getValueType)
                .between(DataHarmRateI::getTime, startTime, endTime);
        List<DataHarmRateI> result4 = dataHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_harmrate_v数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataHarmRateV> getDataHarmRateV(List<String> lineIndex, String startTime, String endTime) {
        List<DataHarmRateV> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmRateV.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataHarmRateV::getLineId, lineIndex)
                .eq(DataHarmRateV::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataHarmRateV::getLineId, DataHarmRateV::getPhaseType, DataHarmRateV::getQualityFlag, DataHarmRateV::getValueType)
                .between(DataHarmRateV::getTime, startTime, endTime);
        List<DataHarmRateV> result1 = dataHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataHarmRateV.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataHarmRateV::getLineId, lineIndex)
                .eq(DataHarmRateV::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataHarmRateV::getLineId, DataHarmRateV::getPhaseType, DataHarmRateV::getQualityFlag, DataHarmRateV::getValueType)
                .between(DataHarmRateV::getTime, startTime, endTime);
        List<DataHarmRateV> result2 = dataHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataHarmRateV.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataHarmRateV::getLineId, lineIndex)
                .eq(DataHarmRateV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmRateV::getLineId, DataHarmRateV::getPhaseType, DataHarmRateV::getQualityFlag, DataHarmRateV::getValueType)
                .between(DataHarmRateV::getTime, startTime, endTime);
        List<DataHarmRateV> result3 = dataHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataHarmRateV.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataHarmRateV::getLineId, lineIndex)
                .eq(DataHarmRateV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataHarmRateV::getLineId, DataHarmRateV::getPhaseType, DataHarmRateV::getQualityFlag, DataHarmRateV::getValueType)
                .between(DataHarmRateV::getTime, startTime, endTime);
        List<DataHarmRateV> result4 = dataHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_inharm_i数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataInHarmI> getDataInHarmI(List<String> lineIndex, String startTime, String endTime) {
        List<DataInHarmI> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmI.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataInHarmI::getLineId, lineIndex)
                .eq(DataInHarmI::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataInHarmI::getLineId, DataInHarmI::getPhaseType, DataInHarmI::getQualityFlag, DataInHarmI::getValueType)
                .between(DataInHarmI::getTime, startTime, endTime);
        List<DataInHarmI> result1 = dataInHarmIMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataInHarmI.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataInHarmI::getLineId, lineIndex)
                .eq(DataInHarmI::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataInHarmI::getLineId, DataInHarmI::getPhaseType, DataInHarmI::getQualityFlag, DataInHarmI::getValueType)
                .between(DataInHarmI::getTime, startTime, endTime);
        List<DataInHarmI> result2 = dataInHarmIMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataInHarmI.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataInHarmI::getLineId, lineIndex)
                .eq(DataInHarmI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmI::getLineId, DataInHarmI::getPhaseType, DataInHarmI::getQualityFlag, DataInHarmI::getValueType)
                .between(DataInHarmI::getTime, startTime, endTime);
        List<DataInHarmI> result3 = dataInHarmIMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataInHarmI.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataInHarmI::getLineId, lineIndex)
                .eq(DataInHarmI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmI::getLineId, DataInHarmI::getPhaseType, DataInHarmI::getQualityFlag, DataInHarmI::getValueType)
                .between(DataInHarmI::getTime, startTime, endTime);
        List<DataInHarmI> result4 = dataInHarmIMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_inharm_v数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataInHarmV> getDataInHarmV(List<String> lineIndex, String startTime, String endTime) {
        List<DataInHarmV> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmV.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataInHarmV::getLineId, lineIndex)
                .eq(DataInHarmV::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataInHarmV::getLineId, DataInHarmV::getPhaseType, DataInHarmV::getQualityFlag, DataInHarmV::getValueType)
                .between(DataInHarmV::getTime, startTime, endTime);
        List<DataInHarmV> result1 = dataInHarmVMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataInHarmV.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataInHarmV::getLineId, lineIndex)
                .eq(DataInHarmV::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataInHarmV::getLineId, DataInHarmV::getPhaseType, DataInHarmV::getQualityFlag, DataInHarmV::getValueType)
                .between(DataInHarmV::getTime, startTime, endTime);
        List<DataInHarmV> result2 = dataInHarmVMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataInHarmV.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataInHarmV::getLineId, lineIndex)
                .eq(DataInHarmV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmV::getLineId, DataInHarmV::getPhaseType, DataInHarmV::getQualityFlag, DataInHarmV::getValueType)
                .between(DataInHarmV::getTime, startTime, endTime);
        List<DataInHarmV> result3 = dataInHarmVMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataInHarmV.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataInHarmV::getLineId, lineIndex)
                .eq(DataInHarmV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmV::getLineId, DataInHarmV::getPhaseType, DataInHarmV::getQualityFlag, DataInHarmV::getValueType)
                .between(DataInHarmV::getTime, startTime, endTime);
        List<DataInHarmV> result4 = dataInHarmVMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_inharmrate_i数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataInHarmRateI> getDataInHarmRateI(List<String> lineIndex, String startTime, String endTime) {
        List<DataInHarmRateI> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmRateI.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataInHarmRateI::getLineId, lineIndex)
                .eq(DataInHarmRateI::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataInHarmRateI::getLineId, DataInHarmRateI::getPhaseType, DataInHarmRateI::getQualityFlag, DataInHarmRateI::getValueType)
                .between(DataInHarmRateI::getTime, startTime, endTime);
        List<DataInHarmRateI> result1 = dataInHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataInHarmRateI.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataInHarmRateI::getLineId, lineIndex)
                .eq(DataInHarmRateI::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataInHarmRateI::getLineId, DataInHarmRateI::getPhaseType, DataInHarmRateI::getQualityFlag, DataInHarmRateI::getValueType)
                .between(DataInHarmRateI::getTime, startTime, endTime);
        List<DataInHarmRateI> result2 = dataInHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataInHarmRateI.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataInHarmRateI::getLineId, lineIndex)
                .eq(DataInHarmRateI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmRateI::getLineId, DataInHarmRateI::getPhaseType, DataInHarmRateI::getQualityFlag, DataInHarmRateI::getValueType)
                .between(DataInHarmRateI::getTime, startTime, endTime);
        List<DataInHarmRateI> result3 = dataInHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataInHarmRateI.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataInHarmRateI::getLineId, lineIndex)
                .eq(DataInHarmRateI::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmRateI::getLineId, DataInHarmRateI::getPhaseType, DataInHarmRateI::getQualityFlag, DataInHarmRateI::getValueType)
                .between(DataInHarmRateI::getTime, startTime, endTime);
        List<DataInHarmRateI> result4 = dataInHarmRateIMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_inharmrate_v数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataInHarmRateV> getDataInHarmRateV(List<String> lineIndex, String startTime, String endTime) {
        List<DataInHarmRateV> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInHarmRateV.class);
        influxQueryWrapper.minSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper.regular(DataInHarmRateV::getLineId, lineIndex)
                .eq(DataInHarmRateV::getValueType, InfluxDbSqlConstant.MIN)
                .groupBy(DataInHarmRateV::getLineId, DataInHarmRateV::getPhaseType, DataInHarmRateV::getQualityFlag, DataInHarmRateV::getValueType)
                .between(DataInHarmRateV::getTime, startTime, endTime);
        List<DataInHarmRateV> result1 = dataInHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper);
        result.addAll(result1);
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataInHarmRateV.class);
        influxQueryWrapper2.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper2.regular(DataInHarmRateV::getLineId, lineIndex)
                .eq(DataInHarmRateV::getValueType, InfluxDbSqlConstant.MAX)
                .groupBy(DataInHarmRateV::getLineId, DataInHarmRateV::getPhaseType, DataInHarmRateV::getQualityFlag, DataInHarmRateV::getValueType)
                .between(DataInHarmRateV::getTime, startTime, endTime);
        List<DataInHarmRateV> result2 = dataInHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper2);
        result.addAll(result2);
        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataInHarmRateV.class);
        influxQueryWrapper3.meanSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
        influxQueryWrapper3.regular(DataInHarmRateV::getLineId, lineIndex)
                .eq(DataInHarmRateV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmRateV::getLineId, DataInHarmRateV::getPhaseType, DataInHarmRateV::getQualityFlag, DataInHarmRateV::getValueType)
                .between(DataInHarmRateV::getTime, startTime, endTime);
        List<DataInHarmRateV> result3 = dataInHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper3);
        result.addAll(result3);
        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataInHarmRateV.class);
        influxQueryWrapper4.percentileSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1), 95);
        influxQueryWrapper4.regular(DataInHarmRateV::getLineId, lineIndex)
                .eq(DataInHarmRateV::getValueType, InfluxDbSqlConstant.AVG_WEB)
                .groupBy(DataInHarmRateV::getLineId, DataInHarmRateV::getPhaseType, DataInHarmRateV::getQualityFlag, DataInHarmRateV::getValueType)
                .between(DataInHarmRateV::getTime, startTime, endTime);
        List<DataInHarmRateV> result4 = dataInHarmRateVMapper.getStatisticsByWraper(influxQueryWrapper4);
        result4.forEach(item -> {
            item.setValueType(InfluxDbSqlConstant.CP95);
        });
        result.addAll(result4);
        return result;
    }

    /**
     * 功能描述:获取data_plt数据
     *
     * @param lineIndex 监测点集合
     * @param startTime 起始时间
     * @param endTime   结束时间
     * @return
     */
    public List<DataPlt> getDataPlt(List<String> lineIndex, String startTime, String endTime) {
        List<DataPlt> result = new ArrayList<>();
        //最小值
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
        influxQueryWrapper.regular(DataInHarmRateV::getLineId, lineIndex)
                .min(DataPlt::getPlt)
                .groupBy(DataPlt::getLineId, DataPlt::getPhaseType, DataPlt::getQualityFlag, DataPlt::getValueType)
                .between(DataPlt::getTime, startTime, endTime);
        List<DataPlt> result1 = dataPltMapper.getStatisticsByWraper(influxQueryWrapper);
        if(CollUtil.isNotEmpty(result1)){
            result1.sort(Comparator.comparing(DataPlt::getPlt));
            DataPlt dataPlt = result1.get(0);
            dataPlt.setValueType(InfluxDbSqlConstant.MIN);
            result.add(dataPlt);
        }
        //最大值
        InfluxQueryWrapper influxQueryWrapper2 = new InfluxQueryWrapper(DataPlt.class);
        influxQueryWrapper2.regular(DataPlt::getLineId, lineIndex)
                .max(DataPlt::getPlt)
                .groupBy(DataPlt::getLineId, DataPlt::getPhaseType, DataPlt::getQualityFlag, DataPlt::getValueType)
                .between(DataPlt::getTime, startTime, endTime);
        List<DataPlt> result2 = dataPltMapper.getStatisticsByWraper(influxQueryWrapper2);
        if(CollUtil.isNotEmpty(result2)){
            result2.sort(Comparator.comparing(DataPlt::getPlt).reversed());
            DataPlt dataPlt = result2.get(0);
            dataPlt.setValueType(InfluxDbSqlConstant.MAX);
            result.add(dataPlt);
        }

        //平均值
        InfluxQueryWrapper influxQueryWrapper3 = new InfluxQueryWrapper(DataPlt.class);
        influxQueryWrapper3.regular(DataPlt::getLineId, lineIndex)
                .mean(DataPlt::getPlt)
                .groupBy(DataPlt::getLineId, DataPlt::getPhaseType, DataPlt::getQualityFlag, DataPlt::getValueType)
                .between(DataPlt::getTime, startTime, endTime);
        List<DataPlt> result3 = dataPltMapper.getStatisticsByWraper(influxQueryWrapper3);
        if(CollUtil.isNotEmpty(result3)){
            double asDouble = result3.stream().mapToDouble(DataPlt::getPlt).average().getAsDouble();
            DataPlt dataPlt = result3.get(0);
            dataPlt.setValueType(InfluxDbSqlConstant.AVG_WEB);
            dataPlt.setPlt(asDouble);
            result.add(dataPlt);
        }

        //CP95(取平均值的CP95值)
        InfluxQueryWrapper influxQueryWrapper4 = new InfluxQueryWrapper(DataPlt.class);
        influxQueryWrapper4.regular(DataPlt::getLineId, lineIndex)
                .percentile(DataPlt::getPlt, 95)
                .groupBy(DataPlt::getLineId, DataPlt::getPhaseType, DataPlt::getQualityFlag, DataPlt::getValueType)
                .between(DataPlt::getTime, startTime, endTime);
        List<DataPlt> result4 = dataPltMapper.getStatisticsByWraper(influxQueryWrapper4);
        if(CollUtil.isNotEmpty(result4)){
            result4.sort(Comparator.comparing(DataPlt::getPlt).reversed());
            DataPlt dataPlt = result4.get(0);
            dataPlt.setValueType(InfluxDbSqlConstant.CP95);
            result.add(dataPlt);
        }
        return result;
    }

    public Integer DataAnomalyDetectio(RStatDataVDPO po1, RStatDataPltDPO po2) {
        int result = 0;
        if (ObjUtil.isNotNull(po1)) {
            if (Math.abs(po1.getFreqDev()) > 7.5
                    || Math.abs(po1.getVlDev()) > 20
                    || Math.abs(po1.getVuDev()) > 20
                    || po1.getVThd() > 30
                    || po1.getVUnbalance() > 40) {
                result = 1;
            }
        }
        if (ObjUtil.isNotNull(po2)) {
            if (po2.getPlt() > 20) {
                result = 1;
            }
        }
        return result;
    }




}

