package com.mortals.xhx.common.code;

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

/**
 * @author: finegirl
 * @date: 2021/7/16 11:50
 * @description: 组件枚举类
 **/
public enum PerformTypeEnum {
    全部("all", "全部"),
    考勤绩效("attend", "考勤绩效"),
    评价差评绩效("review", "评价好差评绩效"),
    评价投诉绩效("complain", "评价投诉绩效"),
    办件绩效("gowork", "办件绩效"),
    效能绩效("effect", "效能绩效"),
    其它绩效("other", "其它绩效");

    private String value;
    private String desc;

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

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

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

    public static PerformTypeEnum getByValue(String value) {
        for (PerformTypeEnum componentEnum : PerformTypeEnum.values()) {
            if (componentEnum.getValue() == value) {
                return componentEnum;
            }
        }
        return null;
    }

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