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

/**
 * 自定义请求状态码
 */
public enum ResultStatus {
    SUCCESS(100, "成功/Success"),
    SIGN_ERROR(-100, "签名错误或者客户端时间有误"),

    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_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 this report"),

    DB_ERROR(-11160,"服务器错误,无法写入数据库");



    /**
     * 返回码
     */
    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;
    }
}