package com.njcn.csharmonic.pojo.vo.report;

import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author wr
 * @description
 * @date 2023/4/10 15:36
 */
@NoArgsConstructor
public class ReportValue implements Serializable {

    private String phaseType; //A(AB)相，B(BC)相，C(CA)相，T总功
    private Float fmaxValue; //最大值
    private Float minValue; //最小值
    private Float meanValue; //平均值
    private Float cp95Value; //CP95值

    public String getPhaseType() {
        return phaseType;
    }

    public Float getFmaxValue() {
        return fmaxValue;
    }

    public Float getMinValue() {
        return minValue;
    }

    public Float getMeanValue() {
        return meanValue;
    }

    public Float getCp95Value() {
        return cp95Value;
    }

    public void setPhaseType(String phaseType) {
        this.phaseType = phaseType;
    }

    public void setFmaxValue(Float fmaxValue) {
        this.fmaxValue = transData(fmaxValue);
    }

    public void setMinValue(Float minValue) {
        this.minValue = transData(minValue);
    }

    public void setMeanValue(Float meanValue) {
        this.meanValue = transData(meanValue);
    }

    public void setCp95Value(Float cp95Value) {
        this.cp95Value = transData(cp95Value);
    }

    public ReportValue(String phaseType, Float maxValue, Float minValue, Float meanValue, Float cp95Value) {
        this.phaseType = phaseType;
        this.fmaxValue = transData(maxValue);
        this.minValue = transData(minValue);
        this.meanValue = transData(meanValue);
        this.cp95Value = transData(cp95Value);
    }
    private Float transData(Float f) {
        if (f == null) {
            return f;
        }
        float f1 = (float) (Math.round(f.floatValue() * 100)) / 100;
        return new Float(f1);
    }
}
