feat: SCD文件上传覆盖功能

dev
huangfeng 1 year ago
parent c2d74595b2
commit 4a9d4df27c

@ -40,22 +40,26 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
config.getIedName(), config.getLdeviceInst(), config.getLnClass()); config.getIedName(), config.getLdeviceInst(), config.getLnClass());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
repository.save(config); repository.save(config);
} else {
config.setId(list.get(0).getId());
}
if (config.getAttMap() != null) { attRepository.deleteByIcdConfigTypeId(config.getId());
Collection<IcdConfigTypeAtt> attList = config.getAttMap().values(); if (config.getAttMap() != null) {
for (IcdConfigTypeAtt item : attList) { Collection<IcdConfigTypeAtt> attList = config.getAttMap().values();
item.setIcdConfigTypeId(config.getId()); for (IcdConfigTypeAtt item : attList) {
} item.setIcdConfigTypeId(config.getId());
attRepository.saveAll(attList);
} }
attRepository.saveAll(attList);
}
if (config.getInstMap() != null) { instRepository.deleteByIcdConfigTypeId(config.getId());
Collection<IcdConfigTypeInst> instList = config.getInstMap().values(); if (config.getInstMap() != null) {
for (IcdConfigTypeInst item : instList) { Collection<IcdConfigTypeInst> instList = config.getInstMap().values();
item.setIcdConfigTypeId(config.getId()); for (IcdConfigTypeInst item : instList) {
} item.setIcdConfigTypeId(config.getId());
instRepository.saveAll(instList);
} }
instRepository.saveAll(instList);
} }
} }
} }

@ -154,17 +154,19 @@ public class IcdXmlUtil {
String result = ""; String result = "";
List<JsonNode> daList = findNodes(node, "DA"); List<JsonNode> daList = findNodes(node, "DA");
for (JsonNode daNode : daList) { for (JsonNode daNode : daList) {
JsonNode dchgNode = daNode.get("dchg");
String fc = daNode.get("fc").asText(); String fc = daNode.get("fc").asText();
if (dchgNode != null && dchgNode.asText().equals("true") && fc.equals(fcname)) { String bType = daNode.get("bType").asText();
if (bType.equals("Struct") && fc.equals(fcname)) {
result = daNode.get("name").asText(); result = daNode.get("name").asText();
JsonNode typeNode = daNode.get("type"); JsonNode typeNode = daNode.get("type");
if (typeNode != null && StringUtils.isNotBlank(typeNode.asText())) { if (typeNode != null && StringUtils.isNotBlank(typeNode.asText())) {
JsonNode nodeDAType = mapDAType.get(typeNode.asText()); JsonNode nodeDAType = mapDAType.get(typeNode.asText());
List<JsonNode> bdaList = findNodes(nodeDAType, "BDA"); if (nodeDAType != null) {
if (!CollectionUtils.isEmpty(bdaList)) { List<JsonNode> bdaList = findNodes(nodeDAType, "BDA");
String name = bdaList.get(0).get("name").asText(); if (!CollectionUtils.isEmpty(bdaList)) {
result = result + "$" + name; String name = bdaList.get(0).get("name").asText();
result = result + "$" + name;
}
} }
} }
break; break;

Loading…
Cancel
Save