package com.mortals.xhx.common.code;

import java.util.LinkedHashMap;
import java.util.Map;

/***
 * 核查类型枚举(1.考勤绩效,2.评价绩效,3.办件绩效,4.效能绩效,5.其它绩效,6.投诉绩效)
 */
public enum CheckTypeEnum {
    考勤绩效(1, "考勤绩效"),
    评价绩效(2, "评价绩效"),
    办件绩效(3, "办件绩效"),
    效能绩效(4, "效能绩效"),
    其它绩效(5, "其它绩效"),
    投诉绩效(6, "投诉绩效"),
    ;
    private Integer value;
    private String desc;

    CheckTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }

    public static CheckTypeEnum getByValue(Integer value) {
        for (CheckTypeEnum checkTypeEnum : CheckTypeEnum.values()) {
            if (checkTypeEnum.getValue() == value) {
                return checkTypeEnum;
            }
        }
        return null;
    }

    /**
     * 获取Map集合
     *
     * @param eItem 不包含项
     * @return
     */
    public static Map<String, String> getEnumMap(Integer... eItem) {
        Map<String, String> resultMap = new LinkedHashMap<>();
        for (CheckTypeEnum item : CheckTypeEnum.values()) {
            try {
                boolean hasE = false;
                for (Integer e : eItem) {
                    if (item.getValue() == e) {
                        hasE = true;
                        break;
                    }
                }
                if (!hasE) {
                    resultMap.put(item.getValue() + "", item.getDesc());
                }
            } catch (Exception ex) {

            }
        }
        return resultMap;
    }
}
