返回R对象处理

发布时间 2024-01-05 14:22:38作者: 全琪俊
String urlString = "http://xxx";

String jsonStr = JSONUtil.toJsonStr(jsonObject);
String postReturn = HttpUtil.post(urlString, jsonStr);

if(StrUtil.isNotBlank(postReturn)&&JSONUtil.isTypeJSON(postReturn)) {
JSONObject returnObj = JSONUtil.parseObj(postReturn);
String code = returnObj.getStr("code");
String msg = returnObj.getStr("msg");
String datas = returnObj.getStr("datas");
if(StrUtil.isNotBlank(code)){
jsonObjectReturn.set("code",code);
if(StrUtil.equals("00",code)){
if(JSONUtil.isTypeJSONArray(datas)){
JSONArray parseArray = JSONUtil.parseArray(datas);
if(CollUtil.isNotEmpty(parseArray)){
for(int i=0;i<parseArray.size();i++){
String objStr = parseArray.getStr(i);
if(JSONUtil.isTypeJSONObject(objStr)){
JSONObject arrayJSONObject = parseArray.getJSONObject(i);

String jtcyjs = arrayJSONObject.getStr("jtcyjs");
String gxlx = arrayJSONObject.getStr("gxlx");
if(StrUtil.isNotBlank(jtcyjs)&&StrUtil.isNotBlank(gxlx)){


String birthDay ="";

JSONObject outObj = new JSONObject();

outObj.set("birthDay",birthDay);
outArray.add(outObj);
}
}

}
}
}

}
}

}