package com.mortals.xhx.common.code;

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

/**
* 请假类型(1.旷工率,2.缺卡率,3.迟到率,4.早退率,5.请假率,6.离岗率,7.睡觉率,8.玩手机率,9.办件超期率,10.差评率)枚举类
*
* @author zxfei
*/
public enum AssessmentTypeEnum {
    旷工率(1, "旷工率"),
    缺卡率(2, "缺卡率"),
    迟到率(3, "迟到率"),
    早退率(4, "早退率"),
    请假率(5, "请假率"),
    离岗率(6, "离岗率"),
    睡觉率(7, "睡觉率"),
    玩手机率(8, "玩手机率"),
    办件超期率(9, "办件超期率"),
    差评率(10, "差评率");
    private Integer value;
    private String desc;

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

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

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

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

    /**
    * 获取Map集合
    *
    * @param eItem 不包含项
    * @return
    */
    public static Map<String, String> getEnumMap(Integer... eItem) {
        Map<String, String> resultMap = new LinkedHashMap<>();
        for (AssessmentTypeEnum item : AssessmentTypeEnum.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;
    }
}