package com.pqs9300.pojo.formdata;

import com.njcn.pojo.data.LimitRate;

import java.util.*;

public class FormData {
    private Integer customDept; //是否自定义部门
    private String deptsIndex; //部门guid
    private String deptsName; //部门名称
    private String supIndex; //技术监督guid
    private String supName; //技术监督名称
    private Map<Integer, Map<Date, resultPojo>> mapresultPojo;
    private Date createTime; //创建时间
    private String createUser;//创建用户
    private Set<Date> setDate; //告警单使用
    private Date eventDate;//预警/告警日期

    public Integer getCustomDept() {
        return customDept;
    }

    public void setCustomDept(Integer customDept) {
        this.customDept = customDept;
    }

    public Set<Date> getSetDate() {
        return setDate;
    }

    public void setSetDate(Set<Date> setDate) {
        this.setDate = setDate;
    }

    public String getDeptsName() {
        return deptsName;
    }

    public void setDeptsName(String deptsName) {
        this.deptsName = deptsName;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getSupName() {
        return supName;
    }

    public void setSupName(String supName) {
        this.supName = supName;
    }

    public Map<Integer, Map<Date, resultPojo>> getMapresultPojo() {
        return mapresultPojo;
    }

    public void setMapresultPojo(Map<Integer, Map<Date, resultPojo>> mapresultPojo) {
        this.mapresultPojo = mapresultPojo;
    }

    public class resultPojo {
        private LimitRate limitRate;
        private StringBuilder description;
        private String lineName;
        private String bdName;
        private String gdName;
        private Integer count = 0;
        private List<String> firstDes;
        private String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public List<String> getFirstDes() {
            return firstDes;
        }

        public void setFirstDes(List<String> firstDes) {
            this.firstDes = firstDes;
        }

        public Integer getCount() {
            return count;
        }

        public void setCount(Integer count) {
            this.count = count;
        }

        public resultPojo() {
            limitRate = new LimitRate();
            description = new StringBuilder();
            firstDes = new ArrayList<>();
        }

        public String getBdName() {
            return bdName;
        }

        public void setBdName(String bdName) {
            this.bdName = bdName;
        }

        public String getGdName() {
            return gdName;
        }

        public void setGdName(String gdName) {
            this.gdName = gdName;
        }

        public String getLineName() {
            return lineName;
        }

        public void setLineName(String lineName) {
            this.lineName = lineName;
        }

        public LimitRate getLimitRate() {
            return limitRate;
        }

        public void setLimitRate(LimitRate limitRate) {
            this.limitRate = limitRate;
        }

        public StringBuilder getDescription() {
            return description;
        }

        public void setDescription(StringBuilder description) {
            this.description = description;
        }

        private void packAge(Integer times, String des) {
            if (times != null && times > 0) {
                this.count += times.intValue();
                this.firstDes.add(des);
                this.description.append(des + "越限" + times + "次,");
            }
        }
    }

    public FormData() {
        mapresultPojo = new HashMap<>();
        setDate = new HashSet<>();
    }

    public String getDeptsIndex() {
        return deptsIndex;
    }

    public void setDeptsIndex(String deptsIndex) {
        this.deptsIndex = deptsIndex;
    }

    public String getSupIndex() {
        return supIndex;
    }

    public void setSupIndex(String supIndex) {
        this.supIndex = supIndex;
    }

    public Date getEventDate() {
        return eventDate;
    }

    public void setEventDate(Date eventDate) {
        this.eventDate = eventDate;
    }

    public void setValue() {
        Iterator<Map.Entry<Integer, Map<Date, resultPojo>>> iterator = mapresultPojo.entrySet().iterator();

        while (iterator.hasNext()) {
            Iterator<Map.Entry<Date, resultPojo>> iterator1 = iterator.next().getValue().entrySet().iterator();

            while (iterator1.hasNext()) {
                resultPojo resultPojo = iterator1.next().getValue();
                resultPojo.packAge(resultPojo.getLimitRate().getFreqDevOverTime(), "频率偏差");
                resultPojo.packAge(resultPojo.getLimitRate().getVoltageDevOvertime(), "电压偏差");
                resultPojo.packAge(resultPojo.getLimitRate().getUBalanceOverTime(), "电压不平衡");
                resultPojo.packAge(resultPojo.getLimitRate().getFlickerOverTime(), "闪变");
                resultPojo.packAge(resultPojo.getLimitRate().getUAberranceOverTime(), "电压谐波畸变率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm2OverTime(), "2次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm3OverTime(), "3次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm4OverTime(), "4次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm5OverTime(), "5次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm6OverTime(), "6次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm7OverTime(), "7次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm8OverTime(), "8次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm9OverTime(), "9次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm10OverTime(), "10次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm11OverTime(), "11次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm12OverTime(), "12次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm13OverTime(), "13次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm14OverTime(), "14次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm15OverTime(), "15次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm16OverTime(), "16次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm17OverTime(), "17次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm18OverTime(), "18次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm19OverTime(), "19次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm20OverTime(), "20次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm21OverTime(), "21次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm22OverTime(), "22次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm23OverTime(), "23次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm24OverTime(), "24次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getUHarm25OverTime(), "25次电压谐波含有率");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm2OverTime(), "2次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm3OverTime(), "3次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm4OverTime(), "4次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm5OverTime(), "5次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm6OverTime(), "6次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm7OverTime(), "7次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm8OverTime(), "8次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm9OverTime(), "9次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm10OverTime(), "10次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm11OverTime(), "11次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm12OverTime(), "12次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm13OverTime(), "13次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm14OverTime(), "14次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm15OverTime(), "15次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm16OverTime(), "16次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm17OverTime(), "17次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm18OverTime(), "18次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm19OverTime(), "19次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm20OverTime(), "20次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm21OverTime(), "21次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm22OverTime(), "22次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm23OverTime(), "23次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm24OverTime(), "24次电流谐波幅值");
                resultPojo.packAge(resultPojo.getLimitRate().getIHarm25OverTime(), "25次电流谐波幅值");
                resultPojo.getDescription().delete(resultPojo.getDescription().lastIndexOf(","), resultPojo.getDescription().length());
            }
        }
    }
}
