parent
1e68b8d405
commit
4a534c6583
|
@ -177,7 +177,7 @@ public class ApiService {
|
||||||
new QFilter("shkd_targetsystem", QCP.equals, systemName)).toArray());
|
new QFilter("shkd_targetsystem", QCP.equals, systemName)).toArray());
|
||||||
|
|
||||||
// 组装请求体数据
|
// 组装请求体数据
|
||||||
String requestBody = assembleRequestBody(objects[0]);
|
String requestBody = assembleRequestBody(dynamic, objects[0]);
|
||||||
logger.info("请求URL:{}\n组装请求body:{}", objects[0].getString("shkd_url"), requestBody);
|
logger.info("请求URL:{}\n组装请求body:{}", objects[0].getString("shkd_url"), requestBody);
|
||||||
|
|
||||||
// 调用接口,获取响应数据
|
// 调用接口,获取响应数据
|
||||||
|
@ -186,12 +186,13 @@ public class ApiService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组装请求体数据
|
* 组装请求体数据
|
||||||
* @param dynamic API映射单据数据对象
|
* @param dynamic 推送数据对象
|
||||||
|
* @param mapping API映射对象数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String assembleRequestBody(DynamicObject dynamic) {
|
public static String assembleRequestBody(DynamicObject dynamic, DynamicObject mapping) {
|
||||||
// 获取数据表信息
|
// 获取数据表信息
|
||||||
DynamicObjectCollection dynamicObjectCollection = dynamic.getDynamicObjectCollection("entryentity");
|
DynamicObjectCollection dynamicObjectCollection = mapping.getDynamicObjectCollection("entryentity");
|
||||||
|
|
||||||
// 提取所有层级并存储在 Set 中
|
// 提取所有层级并存储在 Set 中
|
||||||
Set<Integer> tiers = new HashSet<>();
|
Set<Integer> tiers = new HashSet<>();
|
||||||
|
@ -214,7 +215,7 @@ public class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取组装body类型
|
// 获取组装body类型
|
||||||
String shkd_bodytype = dynamic.getString("shkd_bodytype");
|
String shkd_bodytype = mapping.getString("shkd_bodytype");
|
||||||
if ("数组".equals(shkd_bodytype)) {
|
if ("数组".equals(shkd_bodytype)) {
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap");
|
CodeEdit codeEdit = this.getView().getControl("shkd_codeeditap");
|
||||||
|
|
||||||
if ("shkd_generatejson".equals(itemKey)) {
|
if ("shkd_generatejson".equals(itemKey)) {
|
||||||
String requestBody = ApiService.assembleRequestBody(dataEntity);
|
String requestBody = ApiService.assembleRequestBody(billObject, dataEntity);
|
||||||
codeEdit.setText(format(requestBody));
|
codeEdit.setText(format(requestBody));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue