星空对接接口开发:序列化对象修改
This commit is contained in:
parent
c387616fe5
commit
e1ce92d937
|
@ -78,7 +78,7 @@ public class ApiPostBack {
|
||||||
throw new RuntimeException("JSON序列化失败:" + e.getMessage());
|
throw new RuntimeException("JSON序列化失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJSON = sendPostRequest(url, jsonInputString);
|
String resultJSON = sendPostRequest(url, jsonInputString,"save");
|
||||||
JSONObject jsonObject = JSONObject.parseObject(resultJSON);
|
JSONObject jsonObject = JSONObject.parseObject(resultJSON);
|
||||||
// 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
|
// 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
|
||||||
JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
|
JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
|
||||||
|
@ -131,7 +131,7 @@ public class ApiPostBack {
|
||||||
throw new RuntimeException("JSON序列化失败:" + e.getMessage());
|
throw new RuntimeException("JSON序列化失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
String resultJSON = sendPostRequest(url, jsonInputString);
|
String resultJSON = sendPostRequest(url, jsonInputString,"save");
|
||||||
JSONObject jsonObject = JSONObject.parseObject(resultJSON);
|
JSONObject jsonObject = JSONObject.parseObject(resultJSON);
|
||||||
// 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
|
// 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
|
||||||
JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
|
JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
|
||||||
|
@ -193,10 +193,10 @@ public class ApiPostBack {
|
||||||
throw new RuntimeException("JSON序列化失败:" + e.getMessage());
|
throw new RuntimeException("JSON序列化失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPostRequest(url, jsonInputString);
|
sendPostRequest(url, jsonInputString,"save");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String sendPostRequest(String url, String jsonBody) throws IOException {
|
private String sendPostRequest(String url, String jsonBody,String sendType) throws IOException {
|
||||||
StringBuilder errorLog = new StringBuilder();
|
StringBuilder errorLog = new StringBuilder();
|
||||||
try {
|
try {
|
||||||
URL apiUrl = new URL(url);
|
URL apiUrl = new URL(url);
|
||||||
|
@ -226,6 +226,7 @@ public class ApiPostBack {
|
||||||
while ((responseLine = br.readLine()) != null) {
|
while ((responseLine = br.readLine()) != null) {
|
||||||
response.append(responseLine.trim());
|
response.append(responseLine.trim());
|
||||||
}
|
}
|
||||||
|
if (sendType.equals("save")) {
|
||||||
// 解析响应 JSON
|
// 解析响应 JSON
|
||||||
JSONObject jsonResponse = JSONObject.parseObject(response.toString());
|
JSONObject jsonResponse = JSONObject.parseObject(response.toString());
|
||||||
// 获取 Result 节点
|
// 获取 Result 节点
|
||||||
|
@ -250,6 +251,7 @@ public class ApiPostBack {
|
||||||
throw new RuntimeException("接口返回错误,但未找到具体的错误信息。");
|
throw new RuntimeException("接口返回错误,但未找到具体的错误信息。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return response.toString();
|
return response.toString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -304,7 +306,7 @@ public class ApiPostBack {
|
||||||
|
|
||||||
if (jsonInputString.isEmpty()) return result;
|
if (jsonInputString.isEmpty()) return result;
|
||||||
|
|
||||||
String oaData = sendPostRequest(url, jsonInputString);
|
String oaData = sendPostRequest(url, jsonInputString,"ExecuteBillQuery");
|
||||||
|
|
||||||
//查询的参数为FJoinOutQty/FInStockJoinQty,这两者如果有存在大于0的情况或者存在什么也没查到的情况就返回true
|
//查询的参数为FJoinOutQty/FInStockJoinQty,这两者如果有存在大于0的情况或者存在什么也没查到的情况就返回true
|
||||||
JSONArray dataList = JSONArray.parseArray(oaData);
|
JSONArray dataList = JSONArray.parseArray(oaData);
|
||||||
|
@ -338,7 +340,7 @@ public class ApiPostBack {
|
||||||
" \"IsVerifyProcInst\": \"true\"\n" +
|
" \"IsVerifyProcInst\": \"true\"\n" +
|
||||||
"}\n" +
|
"}\n" +
|
||||||
"}";
|
"}";
|
||||||
String oaData = sendPostRequest(url, jsonInputString);
|
String oaData = sendPostRequest(url, jsonInputString,"save");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,7 +358,7 @@ public class ApiPostBack {
|
||||||
"\t\t\"NetworkCtrl\": \"false\"\n" +
|
"\t\t\"NetworkCtrl\": \"false\"\n" +
|
||||||
"\t}\n" +
|
"\t}\n" +
|
||||||
"}";
|
"}";
|
||||||
sendPostRequest(url, jsonInputString);
|
sendPostRequest(url, jsonInputString,"save");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue