package com.nantian.cloud.dbcapp.vo;

import com.nantian.cloud.dbcapp.unit.ObjectFieldUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class EnterpriseTce {
    private String regionCode;
    private String regionName;
    private String trade;
    private String count; //计数
    private String cmpName;
    private String epc;
    private String year;
    private Float month1;
    private Float month2;
    private Float month3;
    private Float month4;
    private Float month5;
    private Float month6;
    private Float month7;
    private Float month8;
    private Float month9;
    private Float month10;
    private Float month11;
    private Float month12;
    private Float sumTce; //综合能耗合计值
    private Integer tce0Count; //综合能耗为0出现次数
    private List<Float> month;

    public EnterpriseTce monthGroupConcat(EnterpriseTce tce){
        List<Float> monthList = new ArrayList<>();
        String[] calssNameStr = {"month1","month2","month3","month4","month5","month6","month7","month8","month9","month10","month11","month12"};
        for (String className : calssNameStr) {
            Float value = ObjectFieldUtil.getFieldFloatValueByFieldName(className,tce);
            monthList.add(value==null ? 0f : value);
        }
        tce.setMonth(monthList);
        return tce;
    }

}