wuxw7
2018-04-17 7274c78616bc6efec76ed67a668688e807d9b6ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package com.java110.entity.center;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
 
/**
 * 业务数据
 * Created by wuxw on 2018/4/13.
 */
public class Business implements Comparable{
 
    private String bId;
 
    //业务编码
    private String serviceCode;
 
    private String serviceName;
 
    private String remark;
 
    private JSONArray datas;
 
    private JSONArray attrs;
    //返回 编码
    private String code;
 
    private String message;
 
    private int seq;
 
 
    public String getbId() {
        return bId;
    }
 
    public void setbId(String bId) {
        this.bId = bId;
    }
 
    public String getServiceCode() {
        return serviceCode;
    }
 
    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }
 
    public String getServiceName() {
        return serviceName;
    }
 
    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }
 
    public String getRemark() {
        return remark;
    }
 
    public void setRemark(String remark) {
        this.remark = remark;
    }
 
    public JSONArray getDatas() {
        return datas;
    }
 
    public void setDatas(JSONArray datas) {
        this.datas = datas;
    }
 
    public JSONArray getAttrs() {
        return attrs;
    }
 
    public void setAttrs(JSONArray attrs) {
        this.attrs = attrs;
    }
 
    public String getCode() {
        return code;
    }
 
    public void setCode(String code) {
        this.code = code;
    }
 
    public String getMessage() {
        return message;
    }
 
    public void setMessage(String message) {
        this.message = message;
    }
 
    public int getSeq() {
        return seq;
    }
 
    public void setSeq(int seq) {
        this.seq = seq;
    }
 
    /**
     * 构建成对象
     * @return
     * @throws Exception
     */
    public Business builder(JSONObject businessObj) throws Exception{
 
        try{
            this.setbId(businessObj.getString("bId"));
            this.setServiceCode(businessObj.getString("serviceCode"));
            this.setServiceName(businessObj.getString("serviceName"));
            this.setRemark(businessObj.getString("remark"));
            this.setDatas(businessObj.getJSONArray("datas"));
            this.setAttrs(businessObj.getJSONArray("attrs"));
            if(businessObj.containsKey("response")){
                this.setCode(businessObj.getJSONObject("response").getString("code"));
                this.setMessage(businessObj.getJSONObject("response").getString("message"));
            }
        }catch (Exception e){
            throw e;
        }
        return this;
    }
 
    @Override
    public int compareTo(Object o) {
        Business otherBusiness = (Business)o;
        if(this.getSeq() > otherBusiness.getSeq()) {
            return -1;
        }
        return 0;
    }
}