package com.mortals.xhx.common.code;

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

public enum TaskExcuteStrategyEnum{
    /** 按日 */
    DAY(1, "按日"),
    /** 按周 */
    WEEK(2, "按周"),
    /** 按月 */
    MONTH(3, "按月"),
    /** 按间隔时间 */
    INTERVAL(4, "按间隔时间");
    
    private int value;
    private String desc;
    

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

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

    public String getDesc() {
        return desc;
    }

	public static TaskExcuteStrategyEnum getByValue(int value) {
        for (TaskExcuteStrategyEnum taskExcuteStrategy : TaskExcuteStrategyEnum.values()) {
            if (taskExcuteStrategy.getValue() == value) {
                return taskExcuteStrategy;
            }
        }
        return null;
    }
	/**
	 * 获取Map集合
	 * @param eItem 不包含项
	 * @return
	 */
	public static Map<String,String> getEnumMap(int... eItem) {
		Map<String,String> resultMap= new LinkedHashMap<String,String>();
		for (TaskExcuteStrategyEnum item : TaskExcuteStrategyEnum.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;
	}
}
