提交 | 用户 | age
|
b8f5f5
|
1 |
package com.hz.util.http.dto; |
C |
2 |
|
cd1bb5
|
3 |
import com.hx.exception.TipsException; |
C |
4 |
|
b8f5f5
|
5 |
/** |
C |
6 |
* 请求返回统一dto |
|
7 |
*/ |
|
8 |
public class HttpHzResponse { |
|
9 |
|
|
10 |
/**请求状态*/ |
|
11 |
private String code; |
|
12 |
/**错误信息*/ |
|
13 |
private String msg; |
|
14 |
/**返回信息*/ |
|
15 |
private String data; |
|
16 |
|
fa1ffd
|
17 |
/**请求返回状态-成功*/ |
b5bfe5
|
18 |
public static final String CODE_200 = "200"; |
fa1ffd
|
19 |
/**请求返回状态-成功*/ |
C |
20 |
public static final String CODE_201 = "201"; |
b5bfe5
|
21 |
|
cd1bb5
|
22 |
/**封装校验请求码方法,没有进行错误提示*/ |
c5817f
|
23 |
public boolean checkRequesCode(){ |
C |
24 |
if(CODE_200.equals(code) || CODE_201.equals(code)){ |
|
25 |
return true; |
|
26 |
} |
|
27 |
return false; |
|
28 |
} |
|
29 |
|
cd1bb5
|
30 |
/**封装校验请求码方法,进行错误提示*/ |
C |
31 |
public void checkRequesThrow(){ |
|
32 |
if(!CODE_200.equals(code) && !CODE_201.equals(code)){ |
|
33 |
throw new TipsException("请求URL失败:"+this.msg); |
|
34 |
} |
|
35 |
|
|
36 |
} |
|
37 |
|
b8f5f5
|
38 |
public String getCode() { |
C |
39 |
return code; |
|
40 |
} |
|
41 |
|
|
42 |
public void setCode(String code) { |
|
43 |
this.code = code; |
|
44 |
} |
|
45 |
|
|
46 |
public String getMsg() { |
|
47 |
return msg; |
|
48 |
} |
|
49 |
|
|
50 |
public void setMsg(String msg) { |
|
51 |
this.msg = msg; |
|
52 |
} |
|
53 |
|
|
54 |
public String getData() { |
|
55 |
return data; |
|
56 |
} |
|
57 |
|
|
58 |
public void setData(String data) { |
|
59 |
this.data = data; |
|
60 |
} |
|
61 |
} |