diff --git a/src/main/java/com/xydl/cac/iec/IecClient.java b/src/main/java/com/xydl/cac/iec/IecClient.java index 347f282..99f8b21 100644 --- a/src/main/java/com/xydl/cac/iec/IecClient.java +++ b/src/main/java/com/xydl/cac/iec/IecClient.java @@ -30,11 +30,18 @@ public class IecClient implements ClientEventListener { int[] title = new int[]{1, 3, 9999, 33}; if (StringUtils.isNotBlank(apTitle)) { String[] strs = apTitle.replaceAll(" ", ",").split(","); - if (strs.length > 3) { + if (strs.length == 4) { title[0] = Integer.parseInt(strs[0]); title[1] = Integer.parseInt(strs[1]); title[2] = Integer.parseInt(strs[2]); title[3] = Integer.parseInt(strs[3]); + } else if (strs.length == 5) { + title = new int[]{1, 3, 9999, 33, 1}; + title[0] = Integer.parseInt(strs[0]); + title[1] = Integer.parseInt(strs[1]); + title[2] = Integer.parseInt(strs[2]); + title[3] = Integer.parseInt(strs[3]); + title[4] = Integer.parseInt(strs[4]); } } clientSap.setTSelRemote(new byte[]{0, 1}); diff --git a/src/main/java/com/xydl/cac/util/IcdXmlUtil.java b/src/main/java/com/xydl/cac/util/IcdXmlUtil.java index 8a36117..c59961a 100644 --- a/src/main/java/com/xydl/cac/util/IcdXmlUtil.java +++ b/src/main/java/com/xydl/cac/util/IcdXmlUtil.java @@ -46,10 +46,14 @@ public class IcdXmlUtil { icdFile.setConfigList(new ArrayList<>(configMap.values())); List iedList = new ArrayList<>(); + HashMap iedMap = new HashMap<>(); List apList = findNodes(root, "ConnectedAP"); for (JsonNode apNode : apList) { IcdIed ied = processAPNode(apNode); - iedList.add(ied); + if (!iedMap.containsKey(ied.getName())) { + iedMap.put(ied.getName(), "1"); + iedList.add(ied); + } } icdFile.setIedList(iedList); } @@ -65,7 +69,8 @@ public class IcdXmlUtil { if ("IP".equalsIgnoreCase(type)) { ied.setIp(pNode.get("").asText()); } else if ("OSI-AP-Title".equalsIgnoreCase(type)) { - ied.setApTitle(pNode.get("").asText()); + String apTitle = pNode.get("").asText(); + ied.setApTitle(apTitle.replaceAll("\"", "")); } } return ied;