wuxw7
2018-05-09 1254c7d457b742e16ffc8c7820a445e1985fa55c
java110-bean/src/main/java/com/java110/entity/center/Business.java
@@ -7,7 +7,7 @@
 * 业务数据
 * Created by wuxw on 2018/4/13.
 */
public class Business {
public class Business implements Comparable{
    private String bId;
@@ -18,13 +18,15 @@
    private String remark;
    private JSONArray datas;
    private JSONObject datas;
    private JSONArray attrs;
    //返回 编码
    private String code;
    private String message;
    private int seq;
    public String getbId() {
@@ -59,11 +61,11 @@
        this.remark = remark;
    }
    public JSONArray getDatas() {
    public JSONObject getDatas() {
        return datas;
    }
    public void setDatas(JSONArray datas) {
    public void setDatas(JSONObject datas) {
        this.datas = datas;
    }
@@ -91,6 +93,14 @@
        this.message = message;
    }
    public int getSeq() {
        return seq;
    }
    public void setSeq(int seq) {
        this.seq = seq;
    }
    /**
     * 构建成对象
     * @return
@@ -99,14 +109,28 @@
    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.setDatas(businessObj.getJSONObject("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;
    }
}