package com.qmth.sop.common.enums;

import java.util.Objects;

/**
 * @Description: 任务结果enum
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2021/3/29
 */
public enum TaskResultEnum {

    SUCCESS("成功"),

    ERROR("失败");

    private String title;

    private TaskResultEnum(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    /**
     * 状态转换 toName
     *
     * @param title
     * @return
     */
    public static String convertToName(String title) {
        for (TaskResultEnum e : TaskResultEnum.values()) {
            if (Objects.equals(title, e.getTitle())) {
                return e.name();
            }
        }
        return null;
    }
}
