package cn.pluss.platform.ys;

import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 银盛BusinessCode枚举类
 * @DATE 2021/07/08
 */
@Getter
@AllArgsConstructor
public enum YsBusinessCodeEnum {

    /**
     * 正扫D0
     */
    D0("00510032", "D0"),

    /**
     * D1
     */
    D1("00510030", "D1"),

    /**
     * 反扫D0
     */
    FS_D0("00510080", "FS_D0");

    private String code;

    private String name;


    public static String getCodeValue(String name) {
        if(StringUtil.isEmpty(name)){
            return YsBusinessCodeEnum.D0.getCode();
        }
        YsBusinessCodeEnum[] businessModeEnums = values();
        for (YsBusinessCodeEnum businessModeEnum : businessModeEnums) {
            if (businessModeEnum.name().equals(name)) {
                return businessModeEnum.getCode();
            }
        }
        return YsBusinessCodeEnum.D0.getCode();
    }
}
