package com.njcn.influx.bo.po;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.njcn.influx.utils.InstantDateSerializer;
import com.njcn.oracle.bo.po.DataHarmpowerS;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;
import org.influxdb.annotation.TimeColumn;

import java.time.Instant;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2022/5/12 9:13
 */
@Data
@Measurement(name = "data_harmpower_s")
public class InfluxDBDataHarmpowerS {

    @TimeColumn
    @Column(name = "time",tag = true)
    @JsonSerialize(using = InstantDateSerializer.class)
    private Instant time;

    @Column(name = "line_id",tag = true)
    private String lineId;

    @Column(name = "phasic_type",tag = true)
    private String phaseType;

    @Column(name = "quality_flag",tag = true)
    private String qualityFlag;

    @Column(name = "value_type",tag = true)
    private String valueType;

    @Column(name = "s")
    private Float s;

    @Column(name = "s_1")
    private Float s1;

    @Column(name = "s_2")
    private Float s2;

    @Column(name = "s_3")
    private Float s3;

    @Column(name = "s_4")
    private Float s4;

    @Column(name = "s_5")
    private Float s5;

    @Column(name = "s_6")
    private Float s6;

    @Column(name = "s_7")
    private Float s7;

    @Column(name = "s_8")
    private Float s8;

    @Column(name = "s_9")
    private Float s9;

    @Column(name = "s_10")
    private Float s10;

    @Column(name = "s_11")
    private Float s11;

    @Column(name = "s_12")
    private Float s12;

    @Column(name = "s_13")
    private Float s13;

    @Column(name = "s_14")
    private Float s14;

    @Column(name = "s_15")
    private Float s15;

    @Column(name = "s_16")
    private Float s16;

    @Column(name = "s_17")
    private Float s17;

    @Column(name = "s_18")
    private Float s18;

    @Column(name = "s_19")
    private Float s19;

    @Column(name = "s_20")
    private Float s20;

    @Column(name = "s_21")
    private Float s21;

    @Column(name = "s_22")
    private Float s22;

    @Column(name = "s_23")
    private Float s23;

    @Column(name = "s_24")
    private Float s24;

    @Column(name = "s_25")
    private Float s25;

    @Column(name = "s_26")
    private Float s26;

    @Column(name = "s_27")
    private Float s27;

    @Column(name = "s_28")
    private Float s28;

    @Column(name = "s_29")
    private Float s29;

    @Column(name = "s_30")
    private Float s30;

    @Column(name = "s_31")
    private Float s31;

    @Column(name = "s_32")
    private Float s32;

    @Column(name = "s_33")
    private Float s33;

    @Column(name = "s_34")
    private Float s34;

    @Column(name = "s_35")
    private Float s35;

    @Column(name = "s_36")
    private Float s36;

    @Column(name = "s_37")
    private Float s37;

    @Column(name = "s_38")
    private Float s38;

    @Column(name = "s_39")
    private Float s39;

    @Column(name = "s_40")
    private Float s40;

    @Column(name = "s_41")
    private Float s41;

    @Column(name = "s_42")
    private Float s42;

    @Column(name = "s_43")
    private Float s43;

    @Column(name = "s_44")
    private Float s44;

    @Column(name = "s_45")
    private Float s45;

    @Column(name = "s_46")
    private Float s46;

    @Column(name = "s_47")
    private Float s47;

    @Column(name = "s_48")
    private Float s48;

    @Column(name = "s_49")
    private Float s49;

    @Column(name = "s_50")
    private Float s50;

    public static List<InfluxDBDataHarmpowerS> oralceToInfluxDB(DataHarmpowerS dataHarmpowerS) {
        if (dataHarmpowerS == null) {
            return null;
        }
        List<InfluxDBDataHarmpowerS> influxDBDataHarmPhasicVList = new ArrayList<>();
        List<String> valueTypeList = Stream.of("AVG", "MAX", "MIN", "CP95").collect(Collectors.toList());
        for (String valueType : valueTypeList) {
            InfluxDBDataHarmpowerS influxDBDataHarmPhasicV = new InfluxDBDataHarmpowerS();
            Instant instant = dataHarmpowerS.getTimeid().atZone(ZoneId.systemDefault()).toInstant();

            influxDBDataHarmPhasicV.setTime(instant);
            influxDBDataHarmPhasicV.setLineId(dataHarmpowerS.getLineid());
            influxDBDataHarmPhasicV.setPhaseType(dataHarmpowerS.getPhasicType());
            influxDBDataHarmPhasicV.setQualityFlag(dataHarmpowerS.getQualityflag()+"");
            influxDBDataHarmPhasicV.setValueType(valueType);
            if (valueType.equals("AVG")) {
                influxDBDataHarmPhasicV.setS(dataHarmpowerS.getS());

                influxDBDataHarmPhasicV.setS1(dataHarmpowerS.getS1());
                influxDBDataHarmPhasicV.setS2(dataHarmpowerS.getS2());
                influxDBDataHarmPhasicV.setS3(dataHarmpowerS.getS3());
                influxDBDataHarmPhasicV.setS4(dataHarmpowerS.getS4());
                influxDBDataHarmPhasicV.setS5(dataHarmpowerS.getS5());
                influxDBDataHarmPhasicV.setS6(dataHarmpowerS.getS6());
                influxDBDataHarmPhasicV.setS7(dataHarmpowerS.getS7());
                influxDBDataHarmPhasicV.setS8(dataHarmpowerS.getS8());
                influxDBDataHarmPhasicV.setS9(dataHarmpowerS.getS9());
                influxDBDataHarmPhasicV.setS10(dataHarmpowerS.getS10());
                influxDBDataHarmPhasicV.setS11(dataHarmpowerS.getS11());
                influxDBDataHarmPhasicV.setS12(dataHarmpowerS.getS12());
                influxDBDataHarmPhasicV.setS13(dataHarmpowerS.getS13());
                influxDBDataHarmPhasicV.setS14(dataHarmpowerS.getS14());
                influxDBDataHarmPhasicV.setS15(dataHarmpowerS.getS15());
                influxDBDataHarmPhasicV.setS16(dataHarmpowerS.getS16());
                influxDBDataHarmPhasicV.setS17(dataHarmpowerS.getS17());
                influxDBDataHarmPhasicV.setS18(dataHarmpowerS.getS18());
                influxDBDataHarmPhasicV.setS19(dataHarmpowerS.getS19());
                influxDBDataHarmPhasicV.setS20(dataHarmpowerS.getS20());
                influxDBDataHarmPhasicV.setS21(dataHarmpowerS.getS21());
                influxDBDataHarmPhasicV.setS22(dataHarmpowerS.getS22());
                influxDBDataHarmPhasicV.setS23(dataHarmpowerS.getS23());
                influxDBDataHarmPhasicV.setS24(dataHarmpowerS.getS24());
                influxDBDataHarmPhasicV.setS25(dataHarmpowerS.getS25());
                influxDBDataHarmPhasicV.setS26(dataHarmpowerS.getS26());
                influxDBDataHarmPhasicV.setS27(dataHarmpowerS.getS27());
                influxDBDataHarmPhasicV.setS28(dataHarmpowerS.getS28());
                influxDBDataHarmPhasicV.setS29(dataHarmpowerS.getS29());
                influxDBDataHarmPhasicV.setS30(dataHarmpowerS.getS30());
                influxDBDataHarmPhasicV.setS31(dataHarmpowerS.getS31());
                influxDBDataHarmPhasicV.setS32(dataHarmpowerS.getS32());
                influxDBDataHarmPhasicV.setS33(dataHarmpowerS.getS33());
                influxDBDataHarmPhasicV.setS34(dataHarmpowerS.getS34());
                influxDBDataHarmPhasicV.setS35(dataHarmpowerS.getS35());
                influxDBDataHarmPhasicV.setS36(dataHarmpowerS.getS36());
                influxDBDataHarmPhasicV.setS37(dataHarmpowerS.getS37());
                influxDBDataHarmPhasicV.setS38(dataHarmpowerS.getS38());
                influxDBDataHarmPhasicV.setS39(dataHarmpowerS.getS39());
                influxDBDataHarmPhasicV.setS40(dataHarmpowerS.getS40());
                influxDBDataHarmPhasicV.setS41(dataHarmpowerS.getS41());
                influxDBDataHarmPhasicV.setS42(dataHarmpowerS.getS42());
                influxDBDataHarmPhasicV.setS43(dataHarmpowerS.getS43());
                influxDBDataHarmPhasicV.setS44(dataHarmpowerS.getS44());
                influxDBDataHarmPhasicV.setS45(dataHarmpowerS.getS45());
                influxDBDataHarmPhasicV.setS46(dataHarmpowerS.getS46());
                influxDBDataHarmPhasicV.setS47(dataHarmpowerS.getS47());
                influxDBDataHarmPhasicV.setS48(dataHarmpowerS.getS48());
                influxDBDataHarmPhasicV.setS49(dataHarmpowerS.getS49());
                influxDBDataHarmPhasicV.setS50(dataHarmpowerS.getS50());
            }
            else if (valueType.equals("MAX")){
                influxDBDataHarmPhasicV.setS(dataHarmpowerS.getSMax());

                influxDBDataHarmPhasicV.setS1(dataHarmpowerS.getS1Max());
                influxDBDataHarmPhasicV.setS2(dataHarmpowerS.getS2Max());
                influxDBDataHarmPhasicV.setS3(dataHarmpowerS.getS3Max());
                influxDBDataHarmPhasicV.setS4(dataHarmpowerS.getS4Max());
                influxDBDataHarmPhasicV.setS5(dataHarmpowerS.getS5Max());
                influxDBDataHarmPhasicV.setS6(dataHarmpowerS.getS6Max());
                influxDBDataHarmPhasicV.setS7(dataHarmpowerS.getS7Max());
                influxDBDataHarmPhasicV.setS8(dataHarmpowerS.getS8Max());
                influxDBDataHarmPhasicV.setS9(dataHarmpowerS.getS9Max());
                influxDBDataHarmPhasicV.setS10(dataHarmpowerS.getS10Max());
                influxDBDataHarmPhasicV.setS11(dataHarmpowerS.getS11Max());
                influxDBDataHarmPhasicV.setS12(dataHarmpowerS.getS12Max());
                influxDBDataHarmPhasicV.setS13(dataHarmpowerS.getS13Max());
                influxDBDataHarmPhasicV.setS14(dataHarmpowerS.getS14Max());
                influxDBDataHarmPhasicV.setS15(dataHarmpowerS.getS15Max());
                influxDBDataHarmPhasicV.setS16(dataHarmpowerS.getS16Max());
                influxDBDataHarmPhasicV.setS17(dataHarmpowerS.getS17Max());
                influxDBDataHarmPhasicV.setS18(dataHarmpowerS.getS18Max());
                influxDBDataHarmPhasicV.setS19(dataHarmpowerS.getS19Max());
                influxDBDataHarmPhasicV.setS20(dataHarmpowerS.getS20Max());
                influxDBDataHarmPhasicV.setS21(dataHarmpowerS.getS21Max());
                influxDBDataHarmPhasicV.setS22(dataHarmpowerS.getS22Max());
                influxDBDataHarmPhasicV.setS23(dataHarmpowerS.getS23Max());
                influxDBDataHarmPhasicV.setS24(dataHarmpowerS.getS24Max());
                influxDBDataHarmPhasicV.setS25(dataHarmpowerS.getS25Max());
                influxDBDataHarmPhasicV.setS26(dataHarmpowerS.getS26Max());
                influxDBDataHarmPhasicV.setS27(dataHarmpowerS.getS27Max());
                influxDBDataHarmPhasicV.setS28(dataHarmpowerS.getS28Max());
                influxDBDataHarmPhasicV.setS29(dataHarmpowerS.getS29Max());
                influxDBDataHarmPhasicV.setS30(dataHarmpowerS.getS30Max());
                influxDBDataHarmPhasicV.setS31(dataHarmpowerS.getS31Max());
                influxDBDataHarmPhasicV.setS32(dataHarmpowerS.getS32Max());
                influxDBDataHarmPhasicV.setS33(dataHarmpowerS.getS33Max());
                influxDBDataHarmPhasicV.setS34(dataHarmpowerS.getS34Max());
                influxDBDataHarmPhasicV.setS35(dataHarmpowerS.getS35Max());
                influxDBDataHarmPhasicV.setS36(dataHarmpowerS.getS36Max());
                influxDBDataHarmPhasicV.setS37(dataHarmpowerS.getS37Max());
                influxDBDataHarmPhasicV.setS38(dataHarmpowerS.getS38Max());
                influxDBDataHarmPhasicV.setS39(dataHarmpowerS.getS39Max());
                influxDBDataHarmPhasicV.setS40(dataHarmpowerS.getS40Max());
                influxDBDataHarmPhasicV.setS41(dataHarmpowerS.getS41Max());
                influxDBDataHarmPhasicV.setS42(dataHarmpowerS.getS42Max());
                influxDBDataHarmPhasicV.setS43(dataHarmpowerS.getS43Max());
                influxDBDataHarmPhasicV.setS44(dataHarmpowerS.getS44Max());
                influxDBDataHarmPhasicV.setS45(dataHarmpowerS.getS45Max());
                influxDBDataHarmPhasicV.setS46(dataHarmpowerS.getS46Max());
                influxDBDataHarmPhasicV.setS47(dataHarmpowerS.getS47Max());
                influxDBDataHarmPhasicV.setS48(dataHarmpowerS.getS48Max());
                influxDBDataHarmPhasicV.setS49(dataHarmpowerS.getS49Max());
                influxDBDataHarmPhasicV.setS50(dataHarmpowerS.getS50Max());
            }
            else if (valueType.equals("MIN")){
                influxDBDataHarmPhasicV.setS(dataHarmpowerS.getSMin());

                influxDBDataHarmPhasicV.setS1(dataHarmpowerS.getS1Min());
                influxDBDataHarmPhasicV.setS2(dataHarmpowerS.getS2Min());
                influxDBDataHarmPhasicV.setS3(dataHarmpowerS.getS3Min());
                influxDBDataHarmPhasicV.setS4(dataHarmpowerS.getS4Min());
                influxDBDataHarmPhasicV.setS5(dataHarmpowerS.getS5Min());
                influxDBDataHarmPhasicV.setS6(dataHarmpowerS.getS6Min());
                influxDBDataHarmPhasicV.setS7(dataHarmpowerS.getS7Min());
                influxDBDataHarmPhasicV.setS8(dataHarmpowerS.getS8Min());
                influxDBDataHarmPhasicV.setS9(dataHarmpowerS.getS9Min());
                influxDBDataHarmPhasicV.setS10(dataHarmpowerS.getS10Min());
                influxDBDataHarmPhasicV.setS11(dataHarmpowerS.getS11Min());
                influxDBDataHarmPhasicV.setS12(dataHarmpowerS.getS12Min());
                influxDBDataHarmPhasicV.setS13(dataHarmpowerS.getS13Min());
                influxDBDataHarmPhasicV.setS14(dataHarmpowerS.getS14Min());
                influxDBDataHarmPhasicV.setS15(dataHarmpowerS.getS15Min());
                influxDBDataHarmPhasicV.setS16(dataHarmpowerS.getS16Min());
                influxDBDataHarmPhasicV.setS17(dataHarmpowerS.getS17Min());
                influxDBDataHarmPhasicV.setS18(dataHarmpowerS.getS18Min());
                influxDBDataHarmPhasicV.setS19(dataHarmpowerS.getS19Min());
                influxDBDataHarmPhasicV.setS20(dataHarmpowerS.getS20Min());
                influxDBDataHarmPhasicV.setS21(dataHarmpowerS.getS21Min());
                influxDBDataHarmPhasicV.setS22(dataHarmpowerS.getS22Min());
                influxDBDataHarmPhasicV.setS23(dataHarmpowerS.getS23Min());
                influxDBDataHarmPhasicV.setS24(dataHarmpowerS.getS24Min());
                influxDBDataHarmPhasicV.setS25(dataHarmpowerS.getS25Min());
                influxDBDataHarmPhasicV.setS26(dataHarmpowerS.getS26Min());
                influxDBDataHarmPhasicV.setS27(dataHarmpowerS.getS27Min());
                influxDBDataHarmPhasicV.setS28(dataHarmpowerS.getS28Min());
                influxDBDataHarmPhasicV.setS29(dataHarmpowerS.getS29Min());
                influxDBDataHarmPhasicV.setS30(dataHarmpowerS.getS30Min());
                influxDBDataHarmPhasicV.setS31(dataHarmpowerS.getS31Min());
                influxDBDataHarmPhasicV.setS32(dataHarmpowerS.getS32Min());
                influxDBDataHarmPhasicV.setS33(dataHarmpowerS.getS33Min());
                influxDBDataHarmPhasicV.setS34(dataHarmpowerS.getS34Min());
                influxDBDataHarmPhasicV.setS35(dataHarmpowerS.getS35Min());
                influxDBDataHarmPhasicV.setS36(dataHarmpowerS.getS36Min());
                influxDBDataHarmPhasicV.setS37(dataHarmpowerS.getS37Min());
                influxDBDataHarmPhasicV.setS38(dataHarmpowerS.getS38Min());
                influxDBDataHarmPhasicV.setS39(dataHarmpowerS.getS39Min());
                influxDBDataHarmPhasicV.setS40(dataHarmpowerS.getS40Min());
                influxDBDataHarmPhasicV.setS41(dataHarmpowerS.getS41Min());
                influxDBDataHarmPhasicV.setS42(dataHarmpowerS.getS42Min());
                influxDBDataHarmPhasicV.setS43(dataHarmpowerS.getS43Min());
                influxDBDataHarmPhasicV.setS44(dataHarmpowerS.getS44Min());
                influxDBDataHarmPhasicV.setS45(dataHarmpowerS.getS45Min());
                influxDBDataHarmPhasicV.setS46(dataHarmpowerS.getS46Min());
                influxDBDataHarmPhasicV.setS47(dataHarmpowerS.getS47Min());
                influxDBDataHarmPhasicV.setS48(dataHarmpowerS.getS48Min());
                influxDBDataHarmPhasicV.setS49(dataHarmpowerS.getS49Min());
                influxDBDataHarmPhasicV.setS50(dataHarmpowerS.getS50Min());
            }
            else if (valueType.equals("CP95")){
                influxDBDataHarmPhasicV.setS(dataHarmpowerS.getSCp95());

                influxDBDataHarmPhasicV.setS1(dataHarmpowerS.getS1Cp95());
                influxDBDataHarmPhasicV.setS2(dataHarmpowerS.getS2Cp95());
                influxDBDataHarmPhasicV.setS3(dataHarmpowerS.getS3Cp95());
                influxDBDataHarmPhasicV.setS4(dataHarmpowerS.getS4Cp95());
                influxDBDataHarmPhasicV.setS5(dataHarmpowerS.getS5Cp95());
                influxDBDataHarmPhasicV.setS6(dataHarmpowerS.getS6Cp95());
                influxDBDataHarmPhasicV.setS7(dataHarmpowerS.getS7Cp95());
                influxDBDataHarmPhasicV.setS8(dataHarmpowerS.getS8Cp95());
                influxDBDataHarmPhasicV.setS9(dataHarmpowerS.getS9Cp95());
                influxDBDataHarmPhasicV.setS10(dataHarmpowerS.getS10Cp95());
                influxDBDataHarmPhasicV.setS11(dataHarmpowerS.getS11Cp95());
                influxDBDataHarmPhasicV.setS12(dataHarmpowerS.getS12Cp95());
                influxDBDataHarmPhasicV.setS13(dataHarmpowerS.getS13Cp95());
                influxDBDataHarmPhasicV.setS14(dataHarmpowerS.getS14Cp95());
                influxDBDataHarmPhasicV.setS15(dataHarmpowerS.getS15Cp95());
                influxDBDataHarmPhasicV.setS16(dataHarmpowerS.getS16Cp95());
                influxDBDataHarmPhasicV.setS17(dataHarmpowerS.getS17Cp95());
                influxDBDataHarmPhasicV.setS18(dataHarmpowerS.getS18Cp95());
                influxDBDataHarmPhasicV.setS19(dataHarmpowerS.getS19Cp95());
                influxDBDataHarmPhasicV.setS20(dataHarmpowerS.getS20Cp95());
                influxDBDataHarmPhasicV.setS21(dataHarmpowerS.getS21Cp95());
                influxDBDataHarmPhasicV.setS22(dataHarmpowerS.getS22Cp95());
                influxDBDataHarmPhasicV.setS23(dataHarmpowerS.getS23Cp95());
                influxDBDataHarmPhasicV.setS24(dataHarmpowerS.getS24Cp95());
                influxDBDataHarmPhasicV.setS25(dataHarmpowerS.getS25Cp95());
                influxDBDataHarmPhasicV.setS26(dataHarmpowerS.getS26Cp95());
                influxDBDataHarmPhasicV.setS27(dataHarmpowerS.getS27Cp95());
                influxDBDataHarmPhasicV.setS28(dataHarmpowerS.getS28Cp95());
                influxDBDataHarmPhasicV.setS29(dataHarmpowerS.getS29Cp95());
                influxDBDataHarmPhasicV.setS30(dataHarmpowerS.getS30Cp95());
                influxDBDataHarmPhasicV.setS31(dataHarmpowerS.getS31Cp95());
                influxDBDataHarmPhasicV.setS32(dataHarmpowerS.getS32Cp95());
                influxDBDataHarmPhasicV.setS33(dataHarmpowerS.getS33Cp95());
                influxDBDataHarmPhasicV.setS34(dataHarmpowerS.getS34Cp95());
                influxDBDataHarmPhasicV.setS35(dataHarmpowerS.getS35Cp95());
                influxDBDataHarmPhasicV.setS36(dataHarmpowerS.getS36Cp95());
                influxDBDataHarmPhasicV.setS37(dataHarmpowerS.getS37Cp95());
                influxDBDataHarmPhasicV.setS38(dataHarmpowerS.getS38Cp95());
                influxDBDataHarmPhasicV.setS39(dataHarmpowerS.getS39Cp95());
                influxDBDataHarmPhasicV.setS40(dataHarmpowerS.getS40Cp95());
                influxDBDataHarmPhasicV.setS41(dataHarmpowerS.getS41Cp95());
                influxDBDataHarmPhasicV.setS42(dataHarmpowerS.getS42Cp95());
                influxDBDataHarmPhasicV.setS43(dataHarmpowerS.getS43Cp95());
                influxDBDataHarmPhasicV.setS44(dataHarmpowerS.getS44Cp95());
                influxDBDataHarmPhasicV.setS45(dataHarmpowerS.getS45Cp95());
                influxDBDataHarmPhasicV.setS46(dataHarmpowerS.getS46Cp95());
                influxDBDataHarmPhasicV.setS47(dataHarmpowerS.getS47Cp95());
                influxDBDataHarmPhasicV.setS48(dataHarmpowerS.getS48Cp95());
                influxDBDataHarmPhasicV.setS49(dataHarmpowerS.getS49Cp95());
                influxDBDataHarmPhasicV.setS50(dataHarmpowerS.getS50Cp95());
            }

            influxDBDataHarmPhasicVList.add(influxDBDataHarmPhasicV);

        }



        return influxDBDataHarmPhasicVList;
    }

}
