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 ProcessInstanceEnum {
    请假("PROC-2E5C0DFF-3615-4409-A614-A2011FED5D38", "请假"),
    外出("PROC-56D3ADEE-45A4-47BC-931A-2A0DC067DE32", "外出"),
    出差("PROC-578CBDDF-B768-496D-9918-44A3F1D9CAE7", "出差"),


/*
    邛崃大厅人员请假("PROC-E1A4A56A-0EA7-43FE-A073-52E2B9C53E58", "邛崃大厅人员请假"),
    邛崃大厅人员因公外出("PROC-034CE8B1-ED6D-492F-AC2C-61BAC5C0B4B9", "邛崃大厅人员因公外出"),
    邛崃大厅人员补卡申请("PROC-16D29417-3049-4EB8-9710-9D39F9EDD1BD", "邛崃大厅人员补卡申请"),
*/

/*
    邛崃机关人员补卡申请("PROC-DDBEBB18-4FFC-486A-8E97-BAD7911BB9F2", "邛崃机关人员补卡申请"),
    邛崃机关人员请假("PROC-7C84DFC5-579E-4500-9159-F38642E7238C", "邛崃机关人员请假"),
    邛崃机关人员因公外出("PROC-6B46D143-4A05-4E9B-9C99-E0BD75A29003", "机关人员因公外出"),*/

    ;

    private String value;
    private String desc;

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

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

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

    public static ProcessInstanceEnum getByValue(String value) {
        for (ProcessInstanceEnum componentEnum : ProcessInstanceEnum.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 (ProcessInstanceEnum item : ProcessInstanceEnum.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;
    }
}