package com.dsideal.gw.Bean; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.Getter; import lombok.Setter; @Setter @Getter public class RetBean { /** * { * "code": 200, * "data": { }, * "msg": "成功" * } */ private int code; private String msg; private Object data; public static final Integer SUCCESS = 200; public static final Integer ERROR = 500; public static final Integer OVERDUE = 401; public static final Integer TIMEOUT = 30000; public RetBean(int code, String msg, JSONObject data) { this.code = code; this.msg = msg; if (data.getJSONArray("data") != null) { this.data = data.getJSONArray("data"); } else { this.data = data; } } public String toJsonString() { return JSONObject.toJSONString(this); } }