package com.hz.util.http.dto;
|
|
import com.hx.exception.TipsException;
|
|
/**
|
* 请求返回统一dto
|
*/
|
public class HttpHzResponse {
|
|
/**请求状态*/
|
private String code;
|
/**错误信息*/
|
private String msg;
|
/**返回信息*/
|
private String data;
|
|
/**请求返回状态-成功*/
|
public static final String CODE_200 = "200";
|
/**请求返回状态-成功*/
|
public static final String CODE_201 = "201";
|
|
/**封装校验请求码方法,没有进行错误提示*/
|
public boolean checkRequesCode(){
|
if(CODE_200.equals(code) || CODE_201.equals(code)){
|
return true;
|
}
|
return false;
|
}
|
|
/**封装校验请求码方法,进行错误提示*/
|
public void checkRequesThrow(){
|
if(!CODE_200.equals(code) && !CODE_201.equals(code)){
|
throw new TipsException("请求URL失败:"+this.msg);
|
}
|
|
}
|
|
public String getCode() {
|
return code;
|
}
|
|
public void setCode(String code) {
|
this.code = code;
|
}
|
|
public String getMsg() {
|
return msg;
|
}
|
|
public void setMsg(String msg) {
|
this.msg = msg;
|
}
|
|
public String getData() {
|
return data;
|
}
|
|
public void setData(String data) {
|
this.data = data;
|
}
|
}
|