ResultEnum.java 1.38 KB
package cn.com.glsx.common.exception;

import cn.com.glsx.common.enums.DeviceErrorEnum;

/**
 * <p>Description: 业务码
 * <p>Project: chejia-smart
 *
 * @author wbh
 * @date 2021-03-16
 */
public enum ResultEnum {
    NOT_LOGIN_ERROR(1000, "数据不存在", 1101),
    SECRET_INVALID_ERROR(1001, "非法密钥", 1102),
    PERMISSION_DENY_ERROR(1106, "权限受限", 1103),
    FUNCTION_NOT_SUPPORT_ERROR(2003, "不支持的指令", 1104),
    COMMAND_SUPPORT_ERROR(2008, "不支持的指令或值", 1105),
    DEVICE_NOT_EXIST_ERROR(2010, "设备不存在", 1106),
    COMMANDS_ISSUE_ERROR(1103, "指令下发失败", 1107),
    TYPE_IS_ERROR(1104, "类型错误", 1108),
    DEVICE_IS_FFLINE_ERROR(2001, "设备已经离线", 1109);

    private Integer code;
    private String message;
    private Integer errorcode;

    private ResultEnum(Integer code, String message, Integer errorcode) {
        this.code = code;
        this.message = message;
        this.errorcode = errorcode;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public Integer getErrorcode() {
        return errorcode;
    }

    public static ResultEnum searchValue(int key) {
        for (ResultEnum m : ResultEnum.values()) {
            if (m.getCode()==(key)) {
                return m;
            }
        }
        return null;
    }
}