Commit 514cb623 authored by 王向伟's avatar 王向伟

JsonResult添加success

parent 36c46f58
package cn.quantgroup.cashloanflowboss.spi.model; package cn.quantgroup.cashloanflowboss.spi.model;
import cn.quantgroup.cashloanflowboss.utils.JSONTools; import cn.quantgroup.cashloanflowboss.utils.JSONTools;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -48,6 +49,14 @@ public class JsonResult<T> implements Serializable { ...@@ -48,6 +49,14 @@ public class JsonResult<T> implements Serializable {
this.businessCode = String.format(ZERO_FILL_TEMPLATE, businessCode); this.businessCode = String.format(ZERO_FILL_TEMPLATE, businessCode);
} }
public JsonResult(String msg, Long code, T data, Long businessCode,Boolean success) {
this.msg = msg;
this.code = String.format(ZERO_FILL_TEMPLATE, code);
this.data = data;
this.businessCode = String.format(ZERO_FILL_TEMPLATE, businessCode);
this.success = success;
}
/** /**
* 构造成功的JsonResult * 构造成功的JsonResult
* @param msg String * @param msg String
...@@ -105,4 +114,11 @@ public class JsonResult<T> implements Serializable { ...@@ -105,4 +114,11 @@ public class JsonResult<T> implements Serializable {
public String toString() { public String toString() {
return JSONTools.serialize(this); return JSONTools.serialize(this);
} }
public static void main(String[] args) {
String result = "{\"msg\":\"远程服务错误(403,参数错误申请单已到终态)\",\"code\":\"0800\",\"businessCode\":\"0800\",\"success\":false}";
JsonResult jsonObject = JSONObject.parseObject(result, JsonResult.class);
Boolean success = jsonObject.getSuccess();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment