package com.nantian.cloud.dbcapp.pojo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.metadata.BaseRowModel;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.text.DecimalFormat;

@Data
@ApiModel(value = "企业系统结算综合能耗、企业自送综合能耗比对表")
public class EnterpriseTcePOJO extends BaseRowModel {

    @ColumnWidth(5)
    @ExcelProperty(value = "序号")
    private String id;

    @ColumnWidth(5)
    @ExcelProperty(value = "地区")
    private String region;

    @ColumnWidth(10)
    @ExcelProperty(value = "通俗行业")
    private String industry;

    @ColumnWidth(10)
    @ExcelProperty(value = "国民经济行业")
    private String jnjcTrade;

    @ColumnWidth(15)
    @ExcelProperty(value = "企业名称")
    private String cmpName;

    @ColumnWidth(10)
    @ExcelProperty(value = "企业信用代码")
    private String enterpriseCode;

    @ColumnWidth(15)
    @ExcelProperty(value = "企业耗能级别")
    private String energyConsumeLevel;

    @ColumnWidth(15)
    @ExcelProperty(value = "每月耗能最小值(tce)")
    private String lowerLevel;

    @ColumnWidth(15)
    @ExcelProperty(value = "每月耗能最大值(tce)")
    private String hightLevel;

    @ColumnWidth(15)
    @ExcelProperty(value = "企业接入在线采集系统时间")
    private String applyDate;

    @ExcelProperty(value = {"一月","系统结算综合能耗(tce)"})
    private Float month1;

    @ExcelProperty(value = {"一月","系统结算超出能耗级别"}) //1是，0
    private String month1OverstepLevel;

    @ExcelProperty(value = {"一月","企业送的综合能耗(tce)"})
    private Float month1Zs;

    @ExcelProperty(value = {"一月","企业送的超出能耗级别"}) //1是，0
    private String month1ZsOverstepLevel;

    @ExcelProperty(value = {"二月","系统结算综合能耗(tce)"})
    private Float month2;

    @ExcelProperty(value = {"二月","系统结算超出能耗级别"}) //1是，0
    private String month2OverstepLevel;

    @ExcelProperty(value = {"二月","企业送的综合能耗(tce)"})
    private Float month2Zs;

    @ExcelProperty(value = {"二月","企业送的超出能耗级别"}) //1是，0
    private String month2ZsOverstepLevel;

    @ExcelProperty(value = {"三月","系统结算综合能耗(tce)"})
    private Float month3;

    @ExcelProperty(value = {"三月","系统结算超出能耗级别"}) //1是，0
    private String month3OverstepLevel;

    @ExcelProperty(value = {"三月","企业送的综合能耗(tce)"})
    private Float month3Zs;

    @ExcelProperty(value = {"三月","企业送的超出能耗级别"}) //1是，0
    private String month3ZsOverstepLevel;

    @ExcelProperty(value = {"四月","系统结算综合能耗(tce)"})
    private Float month4;

    @ExcelProperty(value = {"四月","系统结算超出能耗级别"}) //1是，0
    private String month4OverstepLevel;

    @ExcelProperty(value = {"四月","企业送的综合能耗(tce)"})
    private Float month4Zs;

    @ExcelProperty(value = {"四月","企业送的超出能耗级别"}) //1是，0
    private String month4ZsOverstepLevel;

    @ExcelProperty(value = {"五月","系统结算综合能耗(tce)"})
    private Float month5;

    @ExcelProperty(value = {"五月","系统结算超出能耗级别"}) //1是，0
    private String month5OverstepLevel;

    @ExcelProperty(value = {"五月","企业送的综合能耗(tce)"})
    private Float month5Zs;

    @ExcelProperty(value = {"五月","企业送的超出能耗级别"}) //1是，0
    private String month5ZsOverstepLevel;

    @ExcelProperty(value = {"六月","系统结算综合能耗(tce)"})
    private Float month6;

    @ExcelProperty(value = {"六月","系统结算超出能耗级别"}) //1是，0
    private String month6OverstepLevel;

    @ExcelProperty(value = {"六月","企业送的综合能耗(tce)"})
    private Float month6Zs;

    @ExcelProperty(value = {"六月","企业送的超出能耗级别"}) //1是，0
    private String month6ZsOverstepLevel;

    @ExcelProperty(value = {"七月","系统结算综合能耗(tce)"})
    private Float month7;

    @ExcelProperty(value = {"七月","系统结算超出能耗级别"}) //1是，0
    private String month7OverstepLevel;

    @ExcelProperty(value = {"七月","企业送的综合能耗(tce)"})
    private Float month7Zs;

    @ExcelProperty(value = {"七月","企业送的超出能耗级别"}) //1是，0
    private String month7ZsOverstepLevel;

    @ExcelProperty(value = {"八月","系统结算综合能耗(tce)"})
    private Float month8;

    @ExcelProperty(value = {"八月","系统结算超出能耗级别"}) //1是，0
    private String month8OverstepLevel;

    @ExcelProperty(value = {"八月","企业送的综合能耗(tce)"})
    private Float month8Zs;

    @ExcelProperty(value = {"八月","企业送的超出能耗级别"}) //1是，0
    private String month8ZsOverstepLevel;

    @ExcelProperty(value = {"九月","系统结算综合能耗(tce)"})
    private Float month9;

    @ExcelProperty(value = {"九月","系统结算超出能耗级别"}) //1是，0
    private String month9OverstepLevel;

    @ExcelProperty(value = {"九月","企业送的综合能耗(tce)"})
    private Float month9Zs;

    @ExcelProperty(value = {"九月","企业送的超出能耗级别"}) //1是，0
    private String month9ZsOverstepLevel;

    @ExcelProperty(value = {"十月","系统结算综合能耗(tce)"})
    private Float month10;

    @ExcelProperty(value = {"十月","系统结算超出能耗级别"}) //1是，0
    private String month10OverstepLevel;

    @ExcelProperty(value = {"十月","企业送的综合能耗(tce)"})
    private Float month10Zs;

    @ExcelProperty(value = {"十月","企业送的超出能耗级别"}) //1是，0
    private String month10ZsOverstepLevel;

    @ExcelProperty(value = {"十一月","系统结算综合能耗(tce)"})
    private Float month11;

    @ExcelProperty(value = {"十一月","系统结算超出能耗级别"}) //1是，0
    private String month11OverstepLevel;

    @ExcelProperty(value = {"十一月","企业送的综合能耗(tce)"})
    private Float month11Zs;

    @ExcelProperty(value = {"十一月","企业送的超出能耗级别"}) //1是，0
    private String month11ZsOverstepLevel;

    @ExcelProperty(value = {"十二月","系统结算综合能耗(tce)"})
    private Float month12;

    @ExcelProperty(value = {"十二月","系统结算超出能耗级别"}) //1是，0
    private String month12OverstepLevel;

    @ExcelProperty(value = {"十二月","企业送的综合能耗(tce)"})
    private Float month12Zs;

    @ExcelProperty(value = {"十二月","企业送的超出能耗级别"}) //1是，0
    private String month12ZsOverstepLevel;

    @ExcelProperty(value = {"合计","系统结算综合能耗(tce)"})
    private Float sumTce;

    @ExcelProperty(value = {"合计","系统结算超出能耗级别"}) //1是，0
    private String sumOverstepLevel;

    @ExcelProperty(value = {"合计","企业送的综合能耗(tce)"})
    private Float sumTceZs;

    @ExcelProperty(value = {"合计","企业送的超出能耗级别"}) //1是，0
    private String sumZsOverstepLevel;


    public void setZsOverstepLevel() {
        Float tmpLowerLevel = this.lowerLevel!=null && !"".equals(this.lowerLevel) ? Float.parseFloat(this.lowerLevel) : 0;
        Float tmpHightLevel = this.hightLevel!=null && !"".equals(this.hightLevel) ? Float.parseFloat(this.hightLevel) : 0;

        this.month1ZsOverstepLevel = (tmpLowerLevel!=0 && this.month1Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month1Zs>tmpHightLevel/12) ? "是" : "";
        this.month2ZsOverstepLevel = (tmpLowerLevel!=0 && this.month2Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month2Zs>tmpHightLevel/12) ? "是" : "";
        this.month3ZsOverstepLevel = (tmpLowerLevel!=0 && this.month3Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month3Zs>tmpHightLevel/12) ? "是" : "";
        this.month4ZsOverstepLevel = (tmpLowerLevel!=0 && this.month4Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month4Zs>tmpHightLevel/12) ? "是" : "";
        this.month5ZsOverstepLevel = (tmpLowerLevel!=0 && this.month5Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month5Zs>tmpHightLevel/12) ? "是" : "";
        this.month6ZsOverstepLevel = (tmpLowerLevel!=0 && this.month6Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month6Zs>tmpHightLevel/12) ? "是" : "";
        this.month7ZsOverstepLevel = (tmpLowerLevel!=0 && this.month7Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month7Zs>tmpHightLevel/12) ? "是" : "";
        this.month8ZsOverstepLevel = (tmpLowerLevel!=0 && this.month8Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month8Zs>tmpHightLevel/12) ? "是" : "";
        this.month9ZsOverstepLevel = (tmpLowerLevel!=0 && this.month9Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month9Zs>tmpHightLevel/12) ? "是" : "";
        this.month10ZsOverstepLevel = (tmpLowerLevel!=0 && this.month10Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month10Zs>tmpHightLevel/12) ? "是" : "";
        this.month11ZsOverstepLevel = (tmpLowerLevel!=0 && this.month11Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month11Zs>tmpHightLevel/12) ? "是" : "";
        this.month12ZsOverstepLevel = (tmpLowerLevel!=0 && this.month12Zs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.month12Zs>tmpHightLevel/12) ? "是" : "";
        this.sumZsOverstepLevel = (tmpLowerLevel!=0 && this.sumTceZs<tmpLowerLevel/12) || (tmpHightLevel!=0 && this.sumTceZs > tmpHightLevel/12) ? "是" : "";

        DecimalFormat df = new DecimalFormat(".000"); //保留3位小数
        this.lowerLevel = tmpLowerLevel==0 ? null : df.format(tmpLowerLevel/12);
        this.hightLevel = tmpHightLevel==0 ? null : df.format(tmpHightLevel/12);
    }

}
