feat: 61850客户端连接端口可调整

haikang
huangfeng 8 months ago
parent 299d781187
commit 61487eb846

@ -45,4 +45,7 @@ public class IcdIed {
@Column(name = "start")
private Integer start;
@ApiModelProperty(name = "端口")
@Column(name = "port")
private Integer port;
}

@ -55,7 +55,7 @@ public class IEDCollectService {
}
public void connect() throws Exception {
iecClient.connect(ied.getIp(), 102, ied.getApTitle(), xml);
iecClient.connect(ied.getIp(), ied.getPort(), ied.getApTitle(), xml);
}
public void disconnect() {

@ -58,16 +58,16 @@ public class RealTimeDataService {
IcdFile icdFile = optionalFile.get();
try {
IecClient iecClient = new IecClient();
iecClient.connect(ied.getIp(), 102, ied.getApTitle(), icdFile.getXml());
iecClient.connect(ied.getIp(), ied.getPort(), ied.getApTitle(), icdFile.getXml());
iecClient.enableReporting();
log.info("61850订阅成功, ied=" + ied.getName() + ", ip=" + ied.getIp());
log.info("61850订阅成功, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
ied.setStart(Constants.TRUE);
iedRepository.save(ied);
clientMap.put(ied.getId(), iecClient);
} catch (Exception ex) {
ied.setStart(Constants.FALSE);
iedRepository.save(ied);
String err = "61850订阅异常, ied=" + ied.getName() + ", ip=" + ied.getIp();
String err = "61850订阅异常, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort();
log.error(err, ex);
throw new BusinessException(err);
} finally {

@ -98,12 +98,14 @@ public class IedDlConfigServiceImpl implements IedDlConfigService {
throw new BusinessException("未找到该icd文件");
}
IcdFile icdFile = optionalFile.get();
try {
IecClient iecClient = new IecClient();
iecClient.connect(ied.getIp(), 102, ied.getApTitle(), icdFile.getXml());
try {
iecClient.connect(ied.getIp(), ied.getPort(), ied.getApTitle(), icdFile.getXml());
return iecClient.listFile(path);
} catch (Exception ex) {
throw new BusinessException(ex.getMessage());
} finally {
iecClient.disconnect();
}
}
}

@ -56,6 +56,7 @@ public class IcdXmlUtil {
private static IcdIed processAPNode(JsonNode apNode) {
IcdIed ied = new IcdIed();
ied.setPort(102);
String iedName = apNode.get("iedName").asText();
ied.setName(iedName);
List<JsonNode> pList = findNodes(apNode, "P");

Loading…
Cancel
Save