This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
web-sketch-webskt-query-agent/src/main/java/com/mesasoft/cn/sketch/enums/ResultStatus.java

77 lines
2.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.mesasoft.cn.sketch.enums;
/**
* @Description: 返回码定义
* 规定:
* #1表示成功
* #10011999 区间表示参数错误
* #20012999 区间表示用户错误
* #30013999 区间表示接口异常
* @Date Create in 2019/7/22 19:28
*/
public enum ResultStatus {
/* 成功 */
SUCCESS(200, "success"),
/* 默认失败 */
COMMON_FAIL(400, "fail"),
FAIL(500, "request fail"),
/* 参数错误10001999 */
PARAM_NOT_VALID(1001, "参数无效"),
PARAM_IS_BLANK(1002, "参数为空"),
PARAM_TYPE_ERROR(1003, "参数类型错误"),
PARAM_NOT_COMPLETE(1004, "参数缺失"),
/* 用户错误 */
USER_NOT_LOGIN(2001, "用户未登录"),
USER_ACCOUNT_EXPIRED(2002, "账号已过期"),
USER_CREDENTIALS_ERROR(2003, "密码错误"),
USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
USER_ACCOUNT_DISABLE(2005, "账号不可用"),
USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
USER_ACCOUNT_USE_BY_OTHERS(2009, "账号下线"),
/* 业务错误 */
NO_PERMISSION(3001, "没有权限");
private Integer status;
private String message;
ResultStatus(Integer status, String message) {
this.status = status;
this.message = message;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
/**
* 根据status获取message
*
* @param status
* @return
*/
public static String getMessageBystatus(Integer status) {
for (ResultStatus ele : values()) {
if (ele.getStatus().equals(status)) {
return ele.getMessage();
}
}
return null;
}
}