星空对接接口开发:序列化对象修改
This commit is contained in:
parent
0ace834c3c
commit
739a7337f0
|
@ -161,10 +161,18 @@ public class ApiPostBack {
|
||||||
demoPoundMst.setFid(fid);
|
demoPoundMst.setFid(fid);
|
||||||
poundBillService.updateById(demoPoundMst);
|
poundBillService.updateById(demoPoundMst);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除简单生产入库单
|
||||||
|
* return: true 成功删除
|
||||||
|
*/
|
||||||
|
public boolean deleteSPbill(String fid) throws IOException {
|
||||||
|
SPbillUnAudit(fid);
|
||||||
|
SPbillDelete(fid);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//单据下推
|
//单据下推
|
||||||
|
@ -218,6 +226,30 @@ public class ApiPostBack {
|
||||||
while ((responseLine = br.readLine()) != null) {
|
while ((responseLine = br.readLine()) != null) {
|
||||||
response.append(responseLine.trim());
|
response.append(responseLine.trim());
|
||||||
}
|
}
|
||||||
|
// 解析响应 JSON
|
||||||
|
JSONObject jsonResponse = JSONObject.parseObject(response.toString());
|
||||||
|
// 获取 Result 节点
|
||||||
|
JSONObject resultObj = jsonResponse.getJSONObject("Result");
|
||||||
|
if (resultObj == null) {
|
||||||
|
throw new RuntimeException("响应中未找到 'Result' 字段,请检查接口返回格式!");
|
||||||
|
}
|
||||||
|
// 获取 ResponseStatus 节点
|
||||||
|
JSONObject responseStatus = resultObj.getJSONObject("ResponseStatus");
|
||||||
|
if (responseStatus == null) {
|
||||||
|
throw new RuntimeException("响应中未找到 'ResponseStatus' 字段,请检查接口返回格式!");
|
||||||
|
}
|
||||||
|
// 判断 IsSuccess
|
||||||
|
Boolean isSuccess = responseStatus.getBoolean("IsSuccess");
|
||||||
|
if (isSuccess != null && !isSuccess) {
|
||||||
|
// 提取错误信息并抛出异常
|
||||||
|
JSONArray errors = responseStatus.getJSONArray("Errors");
|
||||||
|
if (errors != null && !errors.isEmpty()) {
|
||||||
|
String errorMessage = errors.getJSONObject(0).getString("Message");
|
||||||
|
throw new RuntimeException("接口返回错误: " + errorMessage);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("接口返回错误,但未找到具体的错误信息。");
|
||||||
|
}
|
||||||
|
}
|
||||||
return response.toString();
|
return response.toString();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -289,4 +321,42 @@ public class ApiPostBack {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简单生产入库单反审核接口
|
||||||
|
*/
|
||||||
|
public void SPbillUnAudit(String fid) throws IOException {
|
||||||
|
//查询单据是否存在下游
|
||||||
|
// 目标URL
|
||||||
|
String url = sysConfigService.selectConfigByKey("OA_Url")+"/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.UnAudit.common.kdsvc";
|
||||||
|
String jsonInputString = "{\n" +
|
||||||
|
" “Formid”:”SP_InStock”,\n" +
|
||||||
|
" “data”:\n" +
|
||||||
|
"{\n" +
|
||||||
|
" \"Numbers\": [],\n" +
|
||||||
|
" \"Ids\": "+fid+"\"\",\n" +
|
||||||
|
" \"NetworkCtrl\": \"false\",\n" +
|
||||||
|
" \"IsVerifyProcInst\": \"true\"\n" +
|
||||||
|
"}\n" +
|
||||||
|
"}";
|
||||||
|
String oaData = sendPostRequest(url, jsonInputString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简单生产入库删除接口
|
||||||
|
*/
|
||||||
|
public void SPbillDelete(String fid) throws IOException {
|
||||||
|
//查询单据是否存在下游
|
||||||
|
// 目标URL
|
||||||
|
String url = sysConfigService.selectConfigByKey("OA_Url")+"/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Delete.common.kdsvc";
|
||||||
|
String jsonInputString = "{\n" +
|
||||||
|
"\t\"Formid\": \"SP_InStock\",\n" +
|
||||||
|
"\t\"data\": {\n" +
|
||||||
|
"\t\t\"Numbers\": [],\n" +
|
||||||
|
"\t\t\"Ids\": \""+fid+"\",\n" +
|
||||||
|
"\t\t\"NetworkCtrl\": \"false\"\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"}";
|
||||||
|
sendPostRequest(url, jsonInputString);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue