fix(接口测试): 修复多层嵌套引用场景无法保存子级禁用状态的缺陷

--bug=1025447 --user=王孝刚
github#23645【接口测试】-接口自动化-场景引用-禁用某一步骤后显示保存成功,再次打开发现仍显示启用
https://www.tapd.cn/55049933/s/1363065
This commit is contained in:
wxg0103 2023-04-14 18:43:44 +08:00 committed by fit2-zhao
parent 81483dd438
commit 467d8afcda
1 changed files with 10 additions and 9 deletions

View File

@ -281,15 +281,16 @@ public class MsHashTreeService {
} }
try { try {
if (orgElement.has(HASH_TREE)) { if (orgElement.has(HASH_TREE)) {
JSONArray orgJSONArray = orgElement.optJSONArray(HASH_TREE); JSONArray org = orgElement.optJSONArray(HASH_TREE);
JSONArray targetJSONArray = targetElement.optJSONArray(HASH_TREE); JSONArray target = targetElement.optJSONArray(HASH_TREE);
if (orgJSONArray != null && targetJSONArray != null) { if (org != null && target != null) {
orgJSONArray.forEach(obj -> { org.forEach(obj -> {
JSONObject orgJsonObject = (JSONObject) obj; JSONObject childOrg = (JSONObject) obj;
targetJSONArray.forEach(targetObj -> { target.forEach(targetObj -> {
JSONObject targetJsonObject = (JSONObject) targetObj; JSONObject childTarget = (JSONObject) targetObj;
if (StringUtils.equals(orgJsonObject.optString(RESOURCE_ID), targetJsonObject.optString(RESOURCE_ID))) { if (StringUtils.equals(childOrg.optString(ID), childTarget.optString(ID))
setRefEnable(targetJsonObject, orgJsonObject); && StringUtils.equals(childOrg.optString(INDEX), childTarget.optString(INDEX))) {
setRefEnable(childTarget, childOrg);
} }
}); });
}); });