包头bug修改

This commit is contained in:
guoshengxiong 2025-04-01 09:41:12 +08:00
parent 81ecbc5d32
commit cf80ea7335

View File

@ -160,7 +160,7 @@ public class CustomController {
checkNameUnique(fromName, process);
checkNameUnique(toName, process);
JSONObject processJo = JSON.parseObject(process);
JSONObject toObj = getToObj(null, fromName, processJo);
JSONObject toObj = getToObj(null, fromName, processJo, 1, null);
setToObj(null, toName, toObj, processJo);
return R.ok(JSON.toJSONString(processJo));
}
@ -187,29 +187,36 @@ public class CustomController {
* @param jo
* @param toName
* @param children
* @param fromType 1是从列表来2是从动children来
* @param parentIterator
* @return
*/
private JSONObject getToObj(JSONObject jo, String toName, JSONObject children) {
private JSONObject getToObj(JSONObject jo, String toName, JSONObject children, int fromType, Iterator<Object> parentIterator) {
if (children == null) {
return null;
}
if (Objects.equals(children.getString("name"), toName)) {
if (jo != null) {
jo.put("name", null);
if (Objects.equals(fromType, 1)) {
parentIterator.remove();
} else {
if (jo != null) {
jo.put("children", null);
}
}
return children;
}
String type = children.getString("type");
if (Objects.equals("CONDITIONS", type)) {
JSONArray array = children.getJSONArray("branchs");
for (int j = 0; j < array.size(); j++) {
JSONObject toObj = getToObj(children, toName, array.getJSONObject(j));
Iterator<Object> iterator = array.iterator();
while (iterator.hasNext()) {
JSONObject toObj = getToObj(children, toName, (JSONObject) iterator.next(), 1, parentIterator);
if (toObj != null) {
return toObj;
}
}
}
return getToObj(children, toName, children.getJSONObject("children"));
return getToObj(children, toName, children.getJSONObject("children"), 2, parentIterator);
}
/**