Commit 424fa11c authored by yanzg's avatar yanzg

检测处理结果

parent 1c523cd9
package com.yanzuoguang.util.contants;
/**
* InterValidateContants
*
* @author: Kang
* @time: 2018年04月28日 13:54
*/
public final class LoginConstants {
private LoginConstants() {
super();
}
/**
* 请求加密key
*/
public static final String TOKEN = "token";
/**
* 签名
*/
public static final String SIGN = "sign";
/**
* 签名
*/
public static final String TIME = "time";
}
package com.yanzuoguang.util.contants;
/**
* 系统服务返回code静态常量类
* 要求所有返回code不要相同,便于统一规范服务代码
*/
public final class ResultConstants {
/**
* 成功 success
*/
public static final String SUCCESS = "00";
/**
* 参数不正常
*/
public static final String PARAM_INVALID = "01";
/**
* feign failed
*/
public static final String FEIGN_FAILED = "02";
/**
* 接口鉴权不通过
*/
public static final String SIGN_NO_PASS = "03";
/**
* 返回参数为空
*/
public static final String RESULT_EMPTY = "04";
/**
* 文件上传异常
*/
public static final String FILE_UPLOAD_ERROR = "98";
/**
* 系统异常
*/
public static final String UNKNOW_ERROR = "99";
/**
* 数据业务返回码
*/
public static class DataCode {
/**
* 数据已存在
*/
public static final String DATA_CODE_1001 = "1001";
/**
* 数据不存在
*/
public static final String DATA_CODE_1002 = "1002";
/**
* 数据查询失败
*/
public static final String DATA_CODE_1003 = "1003";
/**
* 数据修改失败
*/
public static final String DATA_CODE_1004 = "1004";
/**
* 数据删除失败
*/
public static final String DATA_CODE_1005 = "1005";
/**
* 数据异常
*/
public static final String DATA_CODE_1006 = "1006";
/**
* 数据已处理
*/
public static final String DATA_CODE_1007 = "1007";
/**
* 金额不足
*/
public static final String DATA_CODE_1009 = "1009";
}
/**
* 第三方资源返回码
*/
public static class ThirdPartyCode {
/**
* 请求超时
*/
public static final String THIRD_PARTY_CODE_2001 = "2001";
/**
* 读取超时
*/
public static final String THIRD_PARTY_CODE_2002 = "2002";
/**
* 返回数据异常
*/
public static final String THIRD_PARTY_CODE_2003 = "2003";
}
}
package com.yanzuoguang.util.contants;
/**
* 系统服务返回code静态常量类
* 要求所有返回code不要相同,便于统一规范服务代码
*/
public final class ResultMessageConstants {
/**
* feign failed message
*/
public static final String FEIGN_FAILED_MSG = "feign client is failed, server name: %s";
/**
* sign no pass
*/
public static final String SIGN_NO_PASS_MSG = "sign no pass!!! %s";
/**
* exception message
*/
public static final String ERROR_MESSAGE = "system problem, please contact administrator!";
/**
* success
*/
public static final String SUCCESS = "success";
/**
* 请求参数格式错误
*/
public static final String PARAMS_FORMAT_MESSAGE = "request params format error!";
/**
* 文件上传错误
*/
public static final String FILE_UPLOAD_ERROR_MESSAGE = "request params format error!";
/**
* 数据业务返回信息
*/
public static class DataMessage{
/**
* 数据已存在
*/
public static final String DATA_MESSAGE_1001 = "{0} is already exists";
/**
* 数据不存在
*/
public static final String DATA_MESSAGE_1002 = "{0} is not exists";
/**
* 数据查询失败
*/
public static final String DATA_MESSAGE_1003 = "query {0} is failed";
/**
* 数据修改失败
*/
public static final String DATA_MESSAGE_1004 = "update {0} is failed";
/**
* 数据删除失败
*/
public static final String DATA_MESSAGE_1005 = "delete {0} is failed";
/**
*数据异常
*/
public static final String DATA_MESSAGE_1006 = "{0} data is exception {1}";
/**
* 数据已经处理
*/
public static final String DATA_MESSAGE_1007 = "{0} data is handler";
/**
* 金额不足
*/
public static final String DATA_MESSAGE_1009 = "{0} balance is not enough";
}
/**
* 第三方资源返回信息
*/
public static class ThirdPartyCode {
/**
* 请求超时
*/
public static final String THIRD_PARTY_MESSAGE_2001 = "request {0} timeout";
/**
* 读取超时
*/
public static final String THIRD_PARTY_MESSAGE_2002 = "read {0} timeout";
/**
* 返回数据异常
*/
public static final String THIRD_PARTY_MESSAGE_2003 = "{0} return data is exception";
}
}
package com.yanzuoguang.util.contants;
/**
* SystemContants
*
* @author: Kang
* @time: 2018年04月29日 3:28
*/
public final class SystemContants {
public static final String ISO88591 = "iso8859-1";
public static final String UTF8 = "UTF-8";
public static final String NULL = null;
public static final String EMPTY = "";
public static final String TRANSVERSE = "-";
public static final String SLASH = "/";
public static final String UNSLASH = "\\";
/**
* 单竖线(拼接字符串可以,不能用于字符串分隔)
*/
public static final String VERTICAL = "|";
/**
* 单竖线分隔符(执行split时必须用该分隔符)
*/
public static final String VERTICAL_ESCAPE = "\\|";
/**
* URL 地址分隔符
*/
public static final String COMMA = ",";
/**
* 鉴权分隔符
*/
public static final String REQUEST_SEPARATE = "{0}";
/**
* 点
*/
public static final String POINT = ".";
}
package com.yanzuoguang.util.contants;
/**
* WebCodeConstants
*
* @author: Kang
* @time: 2018年06月15日 17:29
*/
public final class WebCodeConstants {
/**
* 成功
*/
public static final String SUCCESS = "00";
/**
* 无权限访问
*/
public static final String NOT_AUTH = "02";
/**
* 接口鉴权不通过
*/
public static final String NOT_LOGIN = "03";
/**
* 登录失败
*/
public static final String LOGIN_FAIL = "04";
}
package com.yanzuoguang.util.contants;
/**
* WebMessageConstants
*
* @author: Kang
* @time: 2018年06月15日 17:30
*/
public final class WebMessageConstants {
/**
* 成功
*/
public static final String SUCCESS_MESSAGE = "success";
/**
* 无权限
*/
public static final String NOT_AUTH_MESSAGE = "validate not auth!";
/**
* 未登录
*/
public static final String NOT_LOGIN_MESSAGE = "don't login!";
public static final String LOGIN_FAIL_MESSAGE = "username or password is error!";
}
package com.yanzuoguang.util.vo;
import com.yanzuoguang.util.contants.ResultConstants;
/**
* ResponseResult
*
* @author: Kang
* @time: 2018年04月27日 13:06
*/
public class ResponseResult<T> extends BaseVo {
private static final long serialVersionUID = -508702000019378459L;
/**
* 请求状态码
*/
private String code;
/**
* 服务消息
*/
private String message;
/**
* 返回数据
*/
private T data;
/**
* 获取结果状态码
*
* @return
*/
public String getCode() {
return code;
}
/**
* 设置请求结果状态码
*
* @param code
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取结果消息
*
* @return
*/
public String getMessage() {
return message;
}
/**
* 设置结果消息
*
* @param message
*/
public void setMessage(String message) {
this.message = message;
}
/**
* 获取数据
*
* @return
*/
public T getData() {
return data;
}
/**
* 设置数据
*
* @param data
*/
public void setData(T data) {
this.data = data;
}
/**
* 构造函数
*/
public ResponseResult() {
}
/**
* 构造函数
*
* @param code 结果状态
* @param message 结果消息
*/
public ResponseResult(String code, String message) {
this.code = code;
this.message = message;
}
/**
* 构造函数
*
* @param code 结果状态
* @param message 结果熊希
* @param data 结果
*/
public ResponseResult(String code, String message, T data) {
this.code = code;
this.message = message;
this.data = data;
}
/**
* 构造成功结果
*
* @param data 数据
* @param <T> 数据类型
* @return 一个请求成功的数据集合
*/
public static final <T extends Object> ResponseResult<T> result(T data) {
ResponseResult<T> ret = new ResponseResult<T>();
ret.setCode(ResultConstants.SUCCESS);
ret.setMessage("处理成功");
ret.setData(data);
return ret;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment