From a4ef195276a83982ae97076eed5fa8f305f6eabf Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Fri, 12 Jan 2024 15:33:15 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E7=9F=A9=E9=98=B5?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E9=85=8D=E7=BD=AE=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=88=A0=E9=99=A4=E5=86=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8E=EF=BC=8C=E7=BC=96=E8=BE=91=E7=9F=A9?= =?UTF-8?q?=E9=98=B5=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1067338005184512]矩阵引用配置模型,模型删除再新增字段后,编辑矩阵异常 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1067338005184512 --- .../matrix/handler/CiDataSourceHandler.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/neatlogic/module/cmdb/matrix/handler/CiDataSourceHandler.java b/src/main/java/neatlogic/module/cmdb/matrix/handler/CiDataSourceHandler.java index f98e3a5c..b6dfba14 100644 --- a/src/main/java/neatlogic/module/cmdb/matrix/handler/CiDataSourceHandler.java +++ b/src/main/java/neatlogic/module/cmdb/matrix/handler/CiDataSourceHandler.java @@ -167,11 +167,12 @@ public class CiDataSourceHandler extends MatrixDataSourceHandlerBase { } } JSONArray showAttributeArray = new JSONArray(); - List showAttributeLabelList = showAttributeLabelArray.toJavaList(String.class); - if (!showAttributeLabelList.contains("const_id")) { - showAttributeLabelList.add("const_id"); + if (!showAttributeLabelArray.contains("const_id")) { + showAttributeLabelArray.add(0, "const_id"); } - for (String showAttributeLabel : showAttributeLabelList) { + Iterator iterator = showAttributeLabelArray.iterator(); + while (iterator.hasNext()) { + String showAttributeLabel = (String) iterator.next(); JSONObject showAttributeObj = new JSONObject(); String showAttributeUuid = oldShowAttributeUuidMap.get(showAttributeLabel); if (showAttributeUuid == null) { @@ -179,10 +180,12 @@ public class CiDataSourceHandler extends MatrixDataSourceHandlerBase { } showAttributeObj.put("uuid", showAttributeUuid); CiViewVo ciViewVo = ciViewMap.get(showAttributeLabel); - if (ciViewVo != null) { - showAttributeObj.put("name", ciViewVo.getItemLabel()); - showAttributeObj.put("label", showAttributeLabel); + if (ciViewVo == null) { + iterator.remove(); + continue; } + showAttributeObj.put("name", ciViewVo.getItemLabel()); + showAttributeObj.put("label", showAttributeLabel); showAttributeArray.add(showAttributeObj); if (showAttributeLabel.startsWith("const_")) { continue; @@ -411,6 +414,9 @@ public class CiDataSourceHandler extends MatrixDataSourceHandlerBase { default: break; } + if (StringUtils.isBlank(matrixAttributeVo.getLabel())) { + continue; + } if (MapUtils.isNotEmpty(showAttributeUuidMap)) { String uuid = showAttributeUuidMap.get(matrixAttributeVo.getLabel()); if (uuid == null && Objects.equals(matrixAttributeVo.getPrimaryKey(), 0)) { -- Gitee