package com.njcn.product.carrycapacity.pojo.excel;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.njcn.influx.pojo.po.DataI;
import lombok.Data;
import org.influxdb.annotation.Column;
import org.springframework.beans.BeanUtils;

import java.time.Instant;
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
public class CarryCapcityDataIEexcel {

    @Excel(name = "时间",width = 30)
    private Instant time;

    @Column(name = "line_id")
    @Excel(name = "监测点id",width = 30)
    private String lineId;

    @Excel(name = "数据类型(CP95)",width = 30)
    private String valueType;


    @Column(name = "i_2")
    @Excel(name = "A项2次谐波幅值",width = 15)
    private Double i2_a;

    @Column(name = "i_3")
    @Excel(name = "A项3次谐波幅值",width = 15)
    private Double i3_a;

    @Column(name = "i_4")
    @Excel(name = "A项4次谐波幅值",width = 15)
    private Double i4_a;

    @Column(name = "i_5")
    @Excel(name = "A项5次谐波幅值",width = 15)
    private Double i5_a;

    @Column(name = "i_6")
    @Excel(name = "A项6次谐波幅值",width = 15)
    private Double i6_a;

    @Column(name = "i_7")
    @Excel(name = "A项7次谐波幅值",width = 15)
    private Double i7_a;

    @Column(name = "i_8")
    @Excel(name = "A项8次谐波幅值",width = 15)
    private Double i8_a;

    @Column(name = "i_9")
    @Excel(name = "A项9次谐波幅值",width = 15)
    private Double i9_a;

    @Column(name = "i_10")
    @Excel(name = "A项10次谐波幅值",width = 15)
    private Double i10_a;

    @Column(name = "i_11")
    @Excel(name = "A项11次谐波幅值",width = 15)
    private Double i11_a;

    @Column(name = "i_12")
    @Excel(name = "A项12次谐波幅值",width = 15)
    private Double i12_a;

    @Column(name = "i_13")
    @Excel(name = "A项13次谐波幅值",width = 15)
    private Double i13_a;

    @Column(name = "i_14")
    @Excel(name = "A项14次谐波幅值",width = 15)
    private Double i14_a;

    @Column(name = "i_15")
    @Excel(name = "A项15次谐波幅值",width = 15)
    private Double i15_a;

    @Column(name = "i_16")
    @Excel(name = "A项16次谐波幅值",width = 15)
    private Double i16_a;

    @Column(name = "i_17")
    @Excel(name = "A项17次谐波幅值",width = 15)
    private Double i17_a;

    @Column(name = "i_18")
    @Excel(name = "A项18次谐波幅值",width = 15)
    private Double i18_a;

    @Column(name = "i_19")
    @Excel(name = "A项19次谐波幅值",width = 15)
    private Double i19_a;

    @Column(name = "i_20")
    @Excel(name = "A项20次谐波幅值",width = 15)
    private Double i20_a;

    @Column(name = "i_21")
    @Excel(name = "A项21次谐波幅值",width = 15)
    private Double i21_a;

    @Column(name = "i_22")
    @Excel(name = "A项22次谐波幅值",width = 15)
    private Double i22_a;

    @Column(name = "i_23")
    @Excel(name = "A项23次谐波幅值",width = 15)
    private Double i23_a;

    @Column(name = "i_24")
    @Excel(name = "A项24次谐波幅值",width = 15)
    private Double i24_a;
    @Column(name = "i_25")
    @Excel(name = "A项25次谐波幅值",width = 15)
    private Double i25_a;

    @Column(name = "i_2")
    @Excel(name = "B项2次谐波幅值",width = 15)
    private Double i2_b;

    @Column(name = "i_3")
    @Excel(name = "B项3次谐波幅值",width = 15)
    private Double i3_b;

    @Column(name = "i_4")
    @Excel(name = "B项4次谐波幅值",width = 15)
    private Double i4_b;

    @Column(name = "i_5")
    @Excel(name = "B项5次谐波幅值",width = 15)
    private Double i5_b;

    @Column(name = "i_6")
    @Excel(name = "B项6次谐波幅值",width = 15)
    private Double i6_b;

    @Column(name = "i_7")
    @Excel(name = "B项7次谐波幅值",width = 15)
    private Double i7_b;

    @Column(name = "i_8")
    @Excel(name = "B项8次谐波幅值",width = 15)
    private Double i8_b;

    @Column(name = "i_9")
    @Excel(name = "B项9次谐波幅值",width = 15)
    private Double i9_b;

    @Column(name = "i_10")
    @Excel(name = "B项10次谐波幅值",width = 15)
    private Double i10_b;

    @Column(name = "i_11")
    @Excel(name = "B项11次谐波幅值",width = 15)
    private Double i11_b;

    @Column(name = "i_12")
    @Excel(name = "B项12次谐波幅值",width = 15)
    private Double i12_b;

    @Column(name = "i_13")
    @Excel(name = "B项13次谐波幅值",width = 15)
    private Double i13_b;

    @Column(name = "i_14")
    @Excel(name = "B项14次谐波幅值",width = 15)
    private Double i14_b;

    @Column(name = "i_15")
    @Excel(name = "B项15次谐波幅值",width = 15)
    private Double i15_b;

    @Column(name = "i_16")
    @Excel(name = "B项16次谐波幅值",width = 15)
    private Double i16_b;

    @Column(name = "i_17")
    @Excel(name = "B项17次谐波幅值",width = 15)
    private Double i17_b;

    @Column(name = "i_18")
    @Excel(name = "B项18次谐波幅值",width = 15)
    private Double i18_b;

    @Column(name = "i_19")
    @Excel(name = "B项19次谐波幅值",width = 15)
    private Double i19_b;

    @Column(name = "i_20")
    @Excel(name = "B项20次谐波幅值",width = 15)
    private Double i20_b;

    @Column(name = "i_21")
    @Excel(name = "B项21次谐波幅值",width = 15)
    private Double i21_b;

    @Column(name = "i_22")
    @Excel(name = "B项22次谐波幅值",width = 15)
    private Double i22_b;

    @Column(name = "i_23")
    @Excel(name = "B项23次谐波幅值",width = 15)
    private Double i23_b;

    @Column(name = "i_24")
    @Excel(name = "B项24次谐波幅值",width = 15)
    private Double i24_b;
    @Column(name = "i_25")
    @Excel(name = "B项25次谐波幅值",width = 15)
    private Double i25_b;



    @Column(name = "i_2")
    @Excel(name = "C项2次谐波幅值",width = 15)
    private Double i2_c;

    @Column(name = "i_3")
    @Excel(name = "C项3次谐波幅值",width = 15)
    private Double i3_c;

    @Column(name = "i_4")
    @Excel(name = "C项4次谐波幅值",width = 15)
    private Double i4_c;

    @Column(name = "i_5")
    @Excel(name = "C项5次谐波幅值",width = 15)
    private Double i5_c;

    @Column(name = "i_6")
    @Excel(name = "C项6次谐波幅值",width = 15)
    private Double i6_c;

    @Column(name = "i_7")
    @Excel(name = "C项7次谐波幅值",width = 15)
    private Double i7_c;

    @Column(name = "i_8")
    @Excel(name = "C项8次谐波幅值",width = 15)
    private Double i8_c;

    @Column(name = "i_9")
    @Excel(name = "C项9次谐波幅值",width = 15)
    private Double i9_c;

    @Column(name = "i_10")
    @Excel(name = "C项10次谐波幅值",width = 15)
    private Double i10_c;

    @Column(name = "i_11")
    @Excel(name = "C项11次谐波幅值",width = 15)
    private Double i11_c;

    @Column(name = "i_12")
    @Excel(name = "C项12次谐波幅值",width = 15)
    private Double i12_c;

    @Column(name = "i_13")
    @Excel(name = "C项13次谐波幅值",width = 15)
    private Double i13_c;

    @Column(name = "i_14")
    @Excel(name = "C项14次谐波幅值",width = 15)
    private Double i14_c;

    @Column(name = "i_15")
    @Excel(name = "C项15次谐波幅值",width = 15)
    private Double i15_c;

    @Column(name = "i_16")
    @Excel(name = "C项16次谐波幅值",width = 15)
    private Double i16_c;

    @Column(name = "i_17")
    @Excel(name = "C项17次谐波幅值",width = 15)
    private Double i17_c;

    @Column(name = "i_18")
    @Excel(name = "C项18次谐波幅值",width = 15)
    private Double i18_c;

    @Column(name = "i_19")
    @Excel(name = "C项19次谐波幅值",width = 15)
    private Double i19_c;

    @Column(name = "i_20")
    @Excel(name = "C项20次谐波幅值",width = 15)
    private Double i20_c;

    @Column(name = "i_21")
    @Excel(name = "C项21次谐波幅值",width = 15)
    private Double i21_c;

    @Column(name = "i_22")
    @Excel(name = "C项22次谐波幅值",width = 15)
    private Double i22_c;

    @Column(name = "i_23")
    @Excel(name = "C项23次谐波幅值",width = 15)
    private Double i23_c;

    @Column(name = "i_24")
    @Excel(name = "C项24次谐波幅值",width = 15)
    private Double i24_c;
    @Column(name = "i_25")
    @Excel(name = "C项25次谐波幅值",width = 15)
    private Double i25_c;

    //excel对象转DataI
    public static List<DataI> excelToPO(CarryCapcityDataIEexcel carryCapcityDataIEexcel) {
        List<DataI> data = new ArrayList<>();
        if (carryCapcityDataIEexcel == null) {
            return null;
        }
        List<String> phaseList = Stream.of("A", "B", "C").collect(Collectors.toList());
        for (String phase : phaseList) {
            DataI dataI = new DataI();
            BeanUtils.copyProperties(carryCapcityDataIEexcel,dataI);
            dataI.setPhaseType(phase);
            dataI.setTime(carryCapcityDataIEexcel.getTime());

            if (phase.equals("A")) {

                dataI.setI2( carryCapcityDataIEexcel.getI2_a());
                dataI.setI3( carryCapcityDataIEexcel.getI3_a());
                dataI.setI4( carryCapcityDataIEexcel.getI4_a());
                dataI.setI5( carryCapcityDataIEexcel.getI5_a());
                dataI.setI6( carryCapcityDataIEexcel.getI6_a());
                dataI.setI7( carryCapcityDataIEexcel.getI7_a());
                dataI.setI8( carryCapcityDataIEexcel.getI8_a());
                dataI.setI9( carryCapcityDataIEexcel.getI9_a());
                dataI.setI10( carryCapcityDataIEexcel.getI10_a());
                dataI.setI11( carryCapcityDataIEexcel.getI11_a());
                dataI.setI12( carryCapcityDataIEexcel.getI12_a());
                dataI.setI13( carryCapcityDataIEexcel.getI13_a());
                dataI.setI14( carryCapcityDataIEexcel.getI14_a());
                dataI.setI15( carryCapcityDataIEexcel.getI15_a());
                dataI.setI16( carryCapcityDataIEexcel.getI16_a());
                dataI.setI17( carryCapcityDataIEexcel.getI17_a());
                dataI.setI18( carryCapcityDataIEexcel.getI18_a());
                dataI.setI19( carryCapcityDataIEexcel.getI19_a());
                dataI.setI20( carryCapcityDataIEexcel.getI20_a());
                dataI.setI21( carryCapcityDataIEexcel.getI21_a());
                dataI.setI22( carryCapcityDataIEexcel.getI22_a());
                dataI.setI23( carryCapcityDataIEexcel.getI23_a());
                dataI.setI24( carryCapcityDataIEexcel.getI24_a());
                dataI.setI25( carryCapcityDataIEexcel.getI25_a());


            } else if (phase.equals("B")) {
                dataI.setI2( carryCapcityDataIEexcel.getI2_b());
                dataI.setI3( carryCapcityDataIEexcel.getI3_b());
                dataI.setI4( carryCapcityDataIEexcel.getI4_b());
                dataI.setI5( carryCapcityDataIEexcel.getI5_b());
                dataI.setI6( carryCapcityDataIEexcel.getI6_b());
                dataI.setI7( carryCapcityDataIEexcel.getI7_b());
                dataI.setI8( carryCapcityDataIEexcel.getI8_b());
                dataI.setI9( carryCapcityDataIEexcel.getI9_b());
                dataI.setI10( carryCapcityDataIEexcel.getI10_b());
                dataI.setI11( carryCapcityDataIEexcel.getI11_b());
                dataI.setI12( carryCapcityDataIEexcel.getI12_b());
                dataI.setI13( carryCapcityDataIEexcel.getI13_b());
                dataI.setI14( carryCapcityDataIEexcel.getI14_b());
                dataI.setI15( carryCapcityDataIEexcel.getI15_b());
                dataI.setI16( carryCapcityDataIEexcel.getI16_b());
                dataI.setI17( carryCapcityDataIEexcel.getI17_b());
                dataI.setI18( carryCapcityDataIEexcel.getI18_b());
                dataI.setI19( carryCapcityDataIEexcel.getI19_b());
                dataI.setI20( carryCapcityDataIEexcel.getI20_b());
                dataI.setI21( carryCapcityDataIEexcel.getI21_b());
                dataI.setI22( carryCapcityDataIEexcel.getI22_b());
                dataI.setI23( carryCapcityDataIEexcel.getI23_b());
                dataI.setI24( carryCapcityDataIEexcel.getI24_b());
                dataI.setI25( carryCapcityDataIEexcel.getI25_b());

            }else if (phase.equals("C")){
                dataI.setI2( carryCapcityDataIEexcel.getI2_c());
                dataI.setI3( carryCapcityDataIEexcel.getI3_c());
                dataI.setI4( carryCapcityDataIEexcel.getI4_c());
                dataI.setI5( carryCapcityDataIEexcel.getI5_c());
                dataI.setI6( carryCapcityDataIEexcel.getI6_c());
                dataI.setI7( carryCapcityDataIEexcel.getI7_c());
                dataI.setI8( carryCapcityDataIEexcel.getI8_c());
                dataI.setI9( carryCapcityDataIEexcel.getI9_c());
                dataI.setI10( carryCapcityDataIEexcel.getI10_c());
                dataI.setI11( carryCapcityDataIEexcel.getI11_c());
                dataI.setI12( carryCapcityDataIEexcel.getI12_c());
                dataI.setI13( carryCapcityDataIEexcel.getI13_c());
                dataI.setI14( carryCapcityDataIEexcel.getI14_c());
                dataI.setI15( carryCapcityDataIEexcel.getI15_c());
                dataI.setI16( carryCapcityDataIEexcel.getI16_c());
                dataI.setI17( carryCapcityDataIEexcel.getI17_c());
                dataI.setI18( carryCapcityDataIEexcel.getI18_c());
                dataI.setI19( carryCapcityDataIEexcel.getI19_c());
                dataI.setI20( carryCapcityDataIEexcel.getI20_c());
                dataI.setI21( carryCapcityDataIEexcel.getI21_c());
                dataI.setI22( carryCapcityDataIEexcel.getI22_c());
                dataI.setI23( carryCapcityDataIEexcel.getI23_c());
                dataI.setI24( carryCapcityDataIEexcel.getI24_c());
                dataI.setI25( carryCapcityDataIEexcel.getI25_c());

            }
            data.add(dataI);
        }
        return data;
    }



}
