parent
a2507e8a6d
commit
23bfa5a450
|
@ -166,6 +166,15 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理楼层
|
||||
*
|
||||
* @param parentJson 父JSON对象
|
||||
* @param parentKey 父字段标识
|
||||
* @param currentFloor 当前层级对象(List)
|
||||
* @param floors 所有楼层对象(List<List>)
|
||||
* @param dynamic 源单据对象
|
||||
*/
|
||||
private void processFloor(JSONObject parentJson, String parentKey, List<DynamicObject> currentFloor, List<List<DynamicObject>> floors, DynamicObject dynamic) {
|
||||
logger.info("进入processFloor方法");
|
||||
if (currentFloor.isEmpty()) {
|
||||
|
@ -399,6 +408,13 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子对象集合
|
||||
*
|
||||
* @param floors 所有层级的所有对象
|
||||
* @param parentKey 父节点的shkd_tarfield
|
||||
* @return 子对象集合
|
||||
*/
|
||||
private List<DynamicObject> getChildren(List<List<DynamicObject>> floors, String parentKey) {
|
||||
List<DynamicObject> children = new ArrayList<>();
|
||||
for (List<DynamicObject> floor : floors) {
|
||||
|
@ -447,6 +463,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
|||
|
||||
/**
|
||||
* 给value赋值
|
||||
*
|
||||
* @param dynamicObject 映射分录的单行数据
|
||||
* @param billObject 源单数据
|
||||
* @param jsonObject JSON对象
|
||||
|
@ -553,11 +570,9 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
|||
jsonObject.put(key, childJson);
|
||||
} else if ("数组".equals(tartype)) {
|
||||
JSONArray childJsonArray = new JSONArray();
|
||||
for (DynamicObject childDynamicObject : getChildren(floors, dynamicObject.getString("shkd_tarfield"))) {
|
||||
JSONObject childJson = new JSONObject();
|
||||
processFloor(childJson, key, Collections.singletonList(childDynamicObject), floors, billObject);
|
||||
processFloor(childJson, key, getChildren(floors, dynamicObject.getString("shkd_tarfield")), floors, billObject);
|
||||
childJsonArray.add(childJson);
|
||||
}
|
||||
jsonObject.put(key, childJsonArray);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue