feat: SCD文件上传覆盖功能

dev
huangfeng 1 year ago
parent c2d74595b2
commit 4a9d4df27c

@ -40,7 +40,11 @@ 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());
}
attRepository.deleteByIcdConfigTypeId(config.getId());
if (config.getAttMap() != null) { if (config.getAttMap() != null) {
Collection<IcdConfigTypeAtt> attList = config.getAttMap().values(); Collection<IcdConfigTypeAtt> attList = config.getAttMap().values();
for (IcdConfigTypeAtt item : attList) { for (IcdConfigTypeAtt item : attList) {
@ -49,6 +53,7 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
attRepository.saveAll(attList); attRepository.saveAll(attList);
} }
instRepository.deleteByIcdConfigTypeId(config.getId());
if (config.getInstMap() != null) { if (config.getInstMap() != null) {
Collection<IcdConfigTypeInst> instList = config.getInstMap().values(); Collection<IcdConfigTypeInst> instList = config.getInstMap().values();
for (IcdConfigTypeInst item : instList) { for (IcdConfigTypeInst item : instList) {
@ -58,7 +63,6 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
} }
} }
} }
}
@Override @Override
public List<String> iedList() { public List<String> iedList() {

@ -154,19 +154,21 @@ 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());
if (nodeDAType != null) {
List<JsonNode> bdaList = findNodes(nodeDAType, "BDA"); List<JsonNode> bdaList = findNodes(nodeDAType, "BDA");
if (!CollectionUtils.isEmpty(bdaList)) { if (!CollectionUtils.isEmpty(bdaList)) {
String name = bdaList.get(0).get("name").asText(); String name = bdaList.get(0).get("name").asText();
result = result + "$" + name; result = result + "$" + name;
} }
} }
}
break; break;
} }
} }

Loading…
Cancel
Save