package com.mortals.xhx.module.api.feign.boss;

import com.mortals.framework.common.IBaseEnum;

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

public enum WorkType implements IBaseEnum{

	INSTALL(1,"安装设备"),
	REMOVE(2,"撤除设备"),
	POLLING(3,"巡检设备"),
	MAINTAIN(4,"维修设备"),
	REPLENISHMENT(5,"补货")
	;

    private int value;
    private String desc;

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

    @Override
    public int getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

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

}
