feat: 增加ST导入,比对61850

haikang
huangfeng 1 year ago
parent 6e928dd5a1
commit 34ae67905a

@ -113,4 +113,11 @@ public class IcdConfigController extends BasicController {
return Response.success("OK");
}
@GetMapping("compare61850")
@ApiOperation("比对61850的不同点")
public Response<List<String>> compare61850() throws Exception {
List<String> result = configService.compare61850();
return Response.success(result);
}
}

@ -22,4 +22,6 @@ public interface IcdFileConfigService {
void deleteAtt(Integer attid);
void clearAll();
List<String> compare61850();
}

@ -14,10 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;
import java.util.*;
@Service
@Slf4j
@ -32,6 +29,8 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
IcdConfigTypeInstRepository instRepository;
@Resource
private JdbcTemplate jdbcTemplate;
@Resource
RptparamindexRepository rptparamindexRepository;
@Override
public void upload(String xml) throws Exception {
@ -149,4 +148,43 @@ public class IcdFileConfigServiceImpl implements IcdFileConfigService {
repository.deleteAll();
}
@Override
public List<String> compare61850() {
List<String> param618List = new ArrayList<>();
List<Rptparamindex> rptList = rptparamindexRepository.findAll();
for (Rptparamindex rpt : rptList) {
param618List.add(rpt.getParamindex());
}
List<String> paramList = new ArrayList<>();
List<IcdConfigType> typeLIst = repository.findAll();
for (IcdConfigType type : typeLIst) {
List<IcdConfigTypeInst> instList = instRepository.findByIcdConfigTypeId(type.getId());
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
for (IcdConfigTypeInst inst : instList) {
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
+ inst.getInst();
for (IcdConfigTypeAtt att : attList) {
if (att.containInst(inst.getInst())) {
String paramindex = param + "$" + att.getParam();
paramList.add(paramindex);
}
}
}
}
List<String> result = new ArrayList<>();
for (String str : param618List) {
if (!paramList.contains(str)) {
result.add("少了" + str);
}
}
for (String str : paramList) {
if (!param618List.contains(str)) {
result.add("多了" + str);
}
}
return result;
}
}

@ -98,18 +98,18 @@ public class IcdXmlUtil {
config.addInst(lnInst);
config.addAtt(doName, doDesc, param, lnInst);
} else if ("ST".equals(fc)) {
// IcdConfigType config = result.get(key);
// if (config == null) {
// config = IcdConfigType.builder()
// .iedName(iedName)
// .ldeviceInst(ldeviceInst)
// .lnClass(lnClass)
// .build();
// result.put(key, config);
// }
// String param = fc + "$" + doName + "$" + lastname;
// config.addInst(lnInst);
// config.addAtt(doName, param);
IcdConfigType config = result.get(key);
if (config == null) {
config = IcdConfigType.builder()
.iedName(iedName)
.ldeviceInst(ldeviceInst)
.lnClass(lnClass)
.build();
result.put(key, config);
}
String param = fc + "$" + doName + "$" + lastname;
config.addInst(lnInst);
config.addAtt(doName, doDesc, param, lnInst);
}
}
}
@ -174,6 +174,7 @@ public class IcdXmlUtil {
for (JsonNode daNode : daList) {
String fc = daNode.get("fc").asText();
String bType = daNode.get("bType").asText();
JsonNode dchgNode = daNode.get("dchg");
if (bType.equals("Struct") && fc.equals(fcname)) {
result = daNode.get("name").asText();
JsonNode typeNode = daNode.get("type");
@ -188,6 +189,19 @@ public class IcdXmlUtil {
}
}
break;
} else if (dchgNode != null && dchgNode.asText().equals("true") && fc.equals(fcname)) {
result = daNode.get("name").asText();
JsonNode typeNode = daNode.get("type");
if (typeNode != null && StringUtils.isNotBlank(typeNode.asText())) {
JsonNode nodeDAType = mapDAType.get(typeNode.asText());
if (nodeDAType != null) {
List<JsonNode> bdaList = findNodes(nodeDAType, "BDA");
if (!CollectionUtils.isEmpty(bdaList)) {
String name = bdaList.get(0).get("name").asText();
result = result + "$" + name;
}
}
}
}
}
return result;

Loading…
Cancel
Save