BeanServiceFlowEnum.java 1.16 KB
package com.dituhui.pea.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * bean 服务状态枚举
 */
public enum BeanServiceFlowEnum {
    //bean 已联系/准备服务/开始服务/结束服务等
    //pea 服务状态:INIT-初始化/PENDING待服务/CONTACTED已排期/STARTED-已开始/FINISHED已完成/UNFINISHED-已上门未完成
    PENDING("已联系", "PENDING"),
    CONTACTED("准备服务", "CONTACTED"),
    STARTED("开始服务", "STARTED"),
    CANCELED("已取消", "CANCELED"),
    FINISHED("结束服务", "FINISHED");

    private String name;
    private String status;

    BeanServiceFlowEnum(String name, String status) {
        this.name = name;
        this.status = status;
    }

    public String getName() {
        return name;
    }

    public String getStatus() {
        return status;
    }

    public static String getStatusByName(String name) {
        if (StringUtils.isBlank(name)) {
            return null;
        }
        for (BeanServiceFlowEnum value : BeanServiceFlowEnum.values()) {
            if (name.equals(value.name)) {
                return value.status;
            }
        }
        return null;
    }
}