aa51513
2021-05-15 d06fbb7626ca5c9e4e7a91ac06a6f2ae186c0f27
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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<Business>{
 
    private String bId;
 
    //业务编码
    private String serviceCode;
 
    private String businessTypeCd;
 
    private String serviceName;
 
    private String remark;
 
    private String isInstance;
 
    private JSONObject datas;
 
    //透传
    private String transferData;
 
    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 JSONObject getDatas() {
        return datas;
    }
 
    public void setDatas(JSONObject 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;
    }
 
    public String getIsInstance() {
        return isInstance;
    }
 
    public void setIsInstance(String isInstance) {
        this.isInstance = isInstance;
    }
 
    public String getTransferData() {
        return transferData;
    }
 
    public void setTransferData(String transferData) {
        this.transferData = transferData;
    }
 
    /**
     * 构建成对象
     * @return
     * @throws Exception
     */
    public Business builder(JSONObject businessObj) throws Exception{
 
        try{
            this.setbId(businessObj.getString("bId"));
            this.setBusinessTypeCd(businessObj.getString("businessTypeCd"));
            if(businessObj.containsKey("serviceName")) {
                this.setServiceName(businessObj.getString("serviceName"));
            }
            if(businessObj.containsKey("remark")) {
                this.setRemark(businessObj.getString("remark"));
            }
 
            if(businessObj.containsKey("isInstance")){
                this.setIsInstance(businessObj.getString("isInstance"));
            }
            if(businessObj.containsKey("datas")) {
                this.setDatas(businessObj.getJSONObject("datas"));
            }
 
            if(businessObj.containsKey("attrs")){
                this.setAttrs(businessObj.getJSONArray("attrs"));
            }
 
            if(businessObj.containsKey("transferData")){
                this.setTransferData(businessObj.getString("transferData"));
            }
 
            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(Business otherBusiness) {
        if(this.getSeq() > otherBusiness.getSeq()) {
            return -1;
        }
        return 0;
    }
 
    public String getBusinessTypeCd() {
        return businessTypeCd;
    }
 
    public void setBusinessTypeCd(String businessTypeCd) {
        this.businessTypeCd = businessTypeCd;
    }
}