ResultStatus.java 2.48 KB
package com.xkl.config;

/**
 * 自定义请求状态码
 */
public enum ResultStatus {
    SUCCESS(100, "成功/Success"),
    SIGN_ERROR(-100, "签名错误、未授权或者客户端时间有误"),
    SIGN_NO_ACTIVE(-101, "数据共享签名未激活"),

    USER_REGISTER(1000, "用户注册成功"),
    USER_LOGOUT(1001, "退出登录成功"),
    USER_MODPASS_LOGOUT(1002, "修改密码成功,请重新登录"),
    USERNAME_OR_PASSWORD_ERROR(-1001, "用户名或密码错误/Account or Password is wrong"),
    USER_NOT_FOUND(-1002, "用户不存在/User is not exist"),
    USER_NOT_LOGIN(-1004, "用户未登录"),
    USER_IS_EXIT(-1005, "用户已注册"),

    //2开头的都是openId相关
    OPENID_BIND_SUCCESS(2001, "OPENID绑定成功"),
    OPENID_UNBIND_SUCESS(2002, "OPENID解除绑定成功"),
    OPENID_ERROR(-2001, "OPENID错误"),

    // 111开头的都是与amp报告上传软件相关的
    AMP_KEY_ERROR(-11100, "AMP密钥不匹配"),
    REPORT_FORMAT_ERROR(-11140, "报告格式错误/Report json format error"),
    REPORT_EXISTED_ERROR(-11141, "报告重复上传/Report is already exist"),
    REPORT_INVALID_ERROR(-11142, "报告在数据库中不存在/Report is not exist in the DB"),

    INVALID_USER_ERROR(-11150, "报告所属用户未注册/Report user's account is not exist"),
    INVALID_ADMIN_RPDEL_ERROR(-11151, "报告非此操作员创建,无权删除!/Operator can not delete the report which is not create by him"),

    DB_ERROR(-11160, "服务器错误,无法写入数据库/Server error, can not write into database"),

    COMPANY_ERROR(-11170, "用户所属公司信息有误/Company information error"),

    // 112开头的与QR Code有关
    INVALID_QR_CODE(-11201, "无效QR码/Invalid QR code"),

    // 113开头的与操作统计有关
    INVALID_OPERATION_CODE(-11301, "无效操作/Invalid operation"),

    // 114开头与相关报告相关
    REPORT_EXIST(11401, "Has"),// 该用户在系统中有报告
    REPORT_NOT_EXIST(11400, "No");// 无报告


    /**
     * 返回码
     */
    private int code;

    /**
     * 返回结果描述
     */
    private String message;

    ResultStatus(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}