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 {
if (orgElement.has(HASH_TREE)) {
JSONArray orgJSONArray = orgElement.optJSONArray(HASH_TREE);
JSONArray targetJSONArray = targetElement.optJSONArray(HASH_TREE);
if (orgJSONArray != null && targetJSONArray != null) {
orgJSONArray.forEach(obj -> {
JSONObject orgJsonObject = (JSONObject) obj;
targetJSONArray.forEach(targetObj -> {
JSONObject targetJsonObject = (JSONObject) targetObj;
if (StringUtils.equals(orgJsonObject.optString(RESOURCE_ID), targetJsonObject.optString(RESOURCE_ID))) {
setRefEnable(targetJsonObject, orgJsonObject);
JSONArray org = orgElement.optJSONArray(HASH_TREE);
JSONArray target = targetElement.optJSONArray(HASH_TREE);
if (org != null && target != null) {
org.forEach(obj -> {
JSONObject childOrg = (JSONObject) obj;
target.forEach(targetObj -> {
JSONObject childTarget = (JSONObject) targetObj;
if (StringUtils.equals(childOrg.optString(ID), childTarget.optString(ID))
&& StringUtils.equals(childOrg.optString(INDEX), childTarget.optString(INDEX))) {
setRefEnable(childTarget, childOrg);
}
});
});