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 f98e3a5cab65e25972aca1304fbc4aca4fa45654..b6dfba14e0d8346ecdeb84cd152fbadf2d94082a 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)) {