package com.nantian.cloud.jljc.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.text.DecimalFormat;

/**
 * 能耗双控-指标分解计算
 */
@Data
@ApiModel(value = "能耗双控-指标分解计算")
@TableName("t_dualcontrol_indexresolve")
@EqualsAndHashCode(callSuper = true)
public class TDualcontrolIndexresolve extends Model<TDualcontrolIndexresolve> {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId
    @ApiModelProperty(value = "id")
    private Long id;

    /**
     * 指标分解年度
     */
    @ApiModelProperty(value = "指标分解年度")
    private String year;

    /**
     * 指标分解对象
     */
    @ApiModelProperty(value = "指标分解对象")
    private String object;

    /**
     * 指标分解版本id
     */
    @ApiModelProperty(value = "指标分解版本id")
    private Long versionId;

    /**
     * 指标分解类型(1基准值,2激励值)
     */
    @ApiModelProperty(value = "指标分解类型(1基准值,2激励值)")
    private String indexType;

    /**
     * 指标分解状态(1预测值,2统计值)
     */
    @ApiModelProperty(value = "指标分解状态(1预测值,2统计值)")
    private String indexStatus;

    /**
     * 档位编码
     */
    @ApiModelProperty(value = "档位编码")
    private String gearCode;

    /**
     * 档位综合权重上限
     */
    @TableField(value = "false")
    @ApiModelProperty(value = "档位综合权重上限")
    private Double gearUpperLimit;

    /**
     * 档位综合权重下限
     */
    @TableField(value = "false")
    @ApiModelProperty(value = "档位综合权重下限")
    private Double gearLowerLimit;

    /**
     * 项目编码
     */
    @ApiModelProperty(value = "项目编码")
    private String itemCode;

    /**
     * 项目名称
     */
    @ApiModelProperty(value = "项目名称")
    private String itemName;

    /**
     * 上个五年计划最后一年的GDP总量(亿元)
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "上个五年计划最后一年的GDP总量(亿元)")
    private Double preGdpTotal;

    /**
     * 上个五年计划最后一年的能耗总量(万tce)
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "上个五年计划最后一年的能耗总量(万tce)")
    private Double preEnergyTotal;

    /**
     * 上个五年计划最后一年的单位GDP能耗(tce/万元)
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "上个五年计划最后一年的单位GDP能耗(tce/万元)")
    private Double preEnergyUnitGdp;

    /**
     * GDP总量比重(%)
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "GDP总量比重(%)")
    private Double gdpTotalProportion;

    /**
     * 能耗总量比重(%)
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "能耗总量比重(%)")
    private Double energyTotalProportion;

    /**
     * 综合权重(%)
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "综合权重(%)")
    private Double comprehensiveWeight;

    /**
     * GDP年平均增长率
     */
    @ApiModelProperty(value = "GDP年平均增长率")
    private Double averageGrowthrate;

    /**
     * 第一年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "第一年单位GDP能耗降低率(%)")
    private Double energyUnitGdpReducerate1;

    /**
     * 第一年能耗增长率(%)
     */
    @ApiModelProperty(value = "第一年能耗增长率(%)")
    private Double energyGrowthrate1;

    /**
     * 第一年GDP总量(亿元)
     */
    @ApiModelProperty(value = "第一年GDP总量(亿元)")
    private Double gdpTotal1;

    /**
     * 第一年能耗总量(万tce)
     */
    @ApiModelProperty(value = "第一年能耗总量(万tce)")
    private Double energyTotal1;

    /**
     * 第一年单位GDP能耗(tce/万元)
     */
    @ApiModelProperty(value = "第一年单位GDP能耗(tce/万元)")
    private Double energyUnitGdp1;

    /**
     * 第二年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "第二年单位GDP能耗降低率(%)")
    private Double energyUnitGdpReducerate2;

    /**
     * 第二年能耗增长率(%)
     */
    @ApiModelProperty(value = "第二年能耗增长率(%)")
    private Double energyGrowthrate2;

    /**
     * 第二年GDP总量(亿元)
     */
    @ApiModelProperty(value = "第二年GDP总量(亿元)")
    private Double gdpTotal2;

    /**
     * 第二年能耗总量(万tce)
     */
    @ApiModelProperty(value = "第二年能耗总量(万tce)")
    private Double energyTotal2;

    /**
     * 第二年单位GDP能耗(tce/万元)
     */
    @ApiModelProperty(value = "第二年单位GDP能耗(tce/万元)")
    private Double energyUnitGdp2;

    /**
     * 第三年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "第三年单位GDP能耗降低率(%)")
    private Double energyUnitGdpReducerate3;

    /**
     * 第三年能耗增长率(%)
     */
    @ApiModelProperty(value = "第三年能耗增长率(%)")
    private Double energyGrowthrate3;

    /**
     * 第三年GDP总量(亿元)
     */
    @ApiModelProperty(value = "第三年GDP总量(亿元)")
    private Double gdpTotal3;

    /**
     * 第三年能耗总量(万tce)
     */
    @ApiModelProperty(value = "第三年能耗总量(万tce)")
    private Double energyTotal3;

    /**
     * 第三年单位GDP能耗(tce/万元)
     */
    @ApiModelProperty(value = "第三年单位GDP能耗(tce/万元)")
    private Double energyUnitGdp3;

    /**
     * 第四年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "第四年单位GDP能耗降低率(%)")
    private Double energyUnitGdpReducerate4;

    /**
     * 第四年能耗增长率(%)
     */
    @ApiModelProperty(value = "第四年能耗增长率(%)")
    private Double energyGrowthrate4;

    /**
     * 第四年GDP总量(亿元)
     */
    @ApiModelProperty(value = "第四年GDP总量(亿元)")
    private Double gdpTotal4;

    /**
     * 第四年能耗总量(万tce)
     */
    @ApiModelProperty(value = "第四年能耗总量(万tce)")
    private Double energyTotal4;

    /**
     * 第四年单位GDP能耗(tce/万元)
     */
    @ApiModelProperty(value = "第四年单位GDP能耗(tce/万元)")
    private Double energyUnitGdp4;

    /**
     * 第五年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "第五年单位GDP能耗降低率(%)")
    private Double energyUnitGdpReducerate5;

    /**
     * 第五年能耗增长率(%)
     */
    @ApiModelProperty(value = "第五年能耗增长率(%)")
    private Double energyGrowthrate5;

    /**
     * 第五年GDP总量(亿元)
     */
    @ApiModelProperty(value = "第五年GDP总量(亿元)")
    private Double gdpTotal5;

    /**
     * 第五年能耗总量(万tce)
     */
    @ApiModelProperty(value = "第五年能耗总量(万tce)")
    private Double energyTotal5;

    /**
     * 第五年单位GDP能耗(tce/万元)
     */
    @ApiModelProperty(value = "第五年单位GDP能耗(tce/万元)")
    private Double energyUnitGdp5;

    /**
     * 累计五年GDP总量(亿元)
     */
    @ApiModelProperty(value = "累计五年GDP总量(亿元)")
    private Double amountGdpTotal;

    /**
     * 累计五年能耗总量(万tce)
     */
    @ApiModelProperty(value = "累计五年能耗总量(万tce)")
    private Double amountEnergyTotal;

    /**
     * 累计五年单位GDP能耗(tce/万元)
     */
    @ApiModelProperty(value = "累计五年单位GDP能耗(tce/万元)")
    private Double amountEnergyUnitGdp;

    /**
     * 累计五年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "累计五年单位GDP能耗降低率(%)")
    private Double amountEnergyUnitGdpReducerate;

    /**
     * 预估各档位累计五年单位GDP能耗降低率(%)
     */
    @ApiModelProperty(value = "预估各档位累计五年单位GDP能耗降低率(%)")
    private Double checkCalculation;

    /**
     * 部门id
     */
    @ApiModelProperty(value = "部门id")
    private Integer deptId;

    public void setIndexCalculation(Double energyGrowthrate1, Double gdpTotal1, Double energyTotal1, Double energyUnitGdp1, Double energyGrowthrate2, Double gdpTotal2, Double energyTotal2, Double energyUnitGdp2,
                                    Double energyGrowthrate3, Double gdpTotal3, Double energyTotal3, Double energyUnitGdp3, Double energyGrowthrate4, Double gdpTotal4, Double energyTotal4, Double energyUnitGdp4,
                                    Double energyGrowthrate5, Double gdpTotal5, Double energyTotal5, Double energyUnitGdp5, Double amountGdpTotal, Double amountEnergyTotal, Double amountEnergyUnitGdp,
                                    Double amountEnergyUnitGdpReducerate, Long versionId, String indexType, String year){
        //保留2位小数
        DecimalFormat df = new DecimalFormat(".00"); //保留2位小数
        this.energyGrowthrate1 = Double.parseDouble(df.format(energyGrowthrate1*100));
        this.gdpTotal1 = Double.parseDouble(df.format(gdpTotal1));
        this.energyTotal1 = Double.parseDouble(df.format(energyTotal1));
        this.energyUnitGdp1 = Double.parseDouble(df.format(energyUnitGdp1));
        this.energyGrowthrate2 = Double.parseDouble(df.format(energyGrowthrate2*100));
        this.gdpTotal2 = Double.parseDouble(df.format(gdpTotal2));
        this.energyTotal2 = Double.parseDouble(df.format(energyTotal2));
        this.energyUnitGdp2 = Double.parseDouble(df.format(energyUnitGdp2));
        this.energyGrowthrate3 = Double.parseDouble(df.format(energyGrowthrate3*100));
        this.gdpTotal3 = Double.parseDouble(df.format(gdpTotal3));
        this.energyTotal3 = Double.parseDouble(df.format(energyTotal3));
        this.energyUnitGdp3 = Double.parseDouble(df.format(energyUnitGdp3));
        this.energyGrowthrate4 = Double.parseDouble(df.format(energyGrowthrate4*100));
        this.gdpTotal4 = Double.parseDouble(df.format(gdpTotal4));
        this.energyTotal4 = Double.parseDouble(df.format(energyTotal4));
        this.energyUnitGdp4 = Double.parseDouble(df.format(energyUnitGdp4));
        this.energyGrowthrate5 = Double.parseDouble(df.format(energyGrowthrate5*100));
        this.gdpTotal5 = Double.parseDouble(df.format(gdpTotal5));
        this.energyTotal5 = Double.parseDouble(df.format(energyTotal5));
        this.energyUnitGdp5 = Double.parseDouble(df.format(energyUnitGdp5));
        this.amountGdpTotal = Double.parseDouble(df.format(amountGdpTotal));
        this.amountEnergyTotal = Double.parseDouble(df.format(amountEnergyTotal));
        this.amountEnergyUnitGdp = Double.parseDouble(df.format(amountEnergyUnitGdp));
        this.amountEnergyUnitGdpReducerate = Double.parseDouble(df.format(amountEnergyUnitGdpReducerate*100));
        this.versionId = versionId;
        this.indexType = indexType;
        this.year = year;
    }

    public TDualcontrolIndexresolve() {}

    public TDualcontrolIndexresolve(String gearCode, String itemName, Double preGdpTotal, Double preEnergyTotal, Double preEnergyUnitGdp, Double gdpTotalProportion, Double energyTotalProportion, Double comprehensiveWeight,
                                    Double gdpTotal1, Double energyTotal1, Double energyUnitGdp1, Double gdpTotal2, Double energyTotal2, Double energyUnitGdp2, Double gdpTotal3, Double energyTotal3, Double energyUnitGdp3,
                                    Double gdpTotal4, Double energyTotal4, Double energyUnitGdp4, Double gdpTotal5, Double energyTotal5, Double energyUnitGdp5, Double amountGdpTotal, Double amountEnergyTotal, Double amountEnergyUnitGdp,
                                    Double amountEnergyUnitGdpReducerate, Long versionId, String indexType, String year) {
        //保留2位小数
        DecimalFormat df = new DecimalFormat(".00"); //保留2位小数
        this.gearCode = gearCode;
        this.itemName = itemName;
        this.preGdpTotal = Double.parseDouble(df.format(preGdpTotal));
        this.preEnergyTotal = Double.parseDouble(df.format(preEnergyTotal));
        this.preEnergyUnitGdp = Double.parseDouble(df.format(preEnergyUnitGdp));
        this.gdpTotalProportion = Double.parseDouble(df.format(gdpTotalProportion));
        this.energyTotalProportion = Double.parseDouble(df.format(energyTotalProportion));
        this.comprehensiveWeight = Double.parseDouble(df.format(comprehensiveWeight));
        this.gdpTotal1 = Double.parseDouble(df.format(gdpTotal1));
        this.energyTotal1 = Double.parseDouble(df.format(energyTotal1));
        this.energyUnitGdp1 = Double.parseDouble(df.format(energyUnitGdp1));
        this.gdpTotal2 = Double.parseDouble(df.format(gdpTotal2));
        this.energyTotal2 = Double.parseDouble(df.format(energyTotal2));
        this.energyUnitGdp2 = Double.parseDouble(df.format(energyUnitGdp2));
        this.gdpTotal3 = Double.parseDouble(df.format(gdpTotal3));
        this.energyTotal3 = Double.parseDouble(df.format(energyTotal3));
        this.energyUnitGdp3 = Double.parseDouble(df.format(energyUnitGdp3));
        this.gdpTotal4 = Double.parseDouble(df.format(gdpTotal4));
        this.energyTotal4 = Double.parseDouble(df.format(energyTotal4));
        this.energyUnitGdp4 = Double.parseDouble(df.format(energyUnitGdp4));
        this.gdpTotal5 = Double.parseDouble(df.format(gdpTotal5));
        this.energyTotal5 = Double.parseDouble(df.format(energyTotal5));
        this.energyUnitGdp5 = Double.parseDouble(df.format(energyUnitGdp5));
        this.amountGdpTotal = Double.parseDouble(df.format(amountGdpTotal));
        this.amountEnergyTotal = Double.parseDouble(df.format(amountEnergyTotal));
        this.amountEnergyUnitGdp = Double.parseDouble(df.format(amountEnergyUnitGdp));
        this.amountEnergyUnitGdpReducerate = Double.parseDouble(df.format(amountEnergyUnitGdpReducerate));
        this.versionId = versionId;
        this.indexType = indexType;
        this.year = year;
    }
}
