|
|
@ -1,9 +1,10 @@
|
|
|
|
package com.xydl.cac.iec;
|
|
|
|
package com.xydl.cac.iec;
|
|
|
|
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.IcdFile;
|
|
|
|
import com.xydl.cac.entity.*;
|
|
|
|
import com.xydl.cac.entity.constants.Constants;
|
|
|
|
import com.xydl.cac.entity.constants.Constants;
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
import com.xydl.cac.repository.IcdFileRepository;
|
|
|
|
import com.xydl.cac.repository.IcdFileRepository;
|
|
|
|
|
|
|
|
import com.xydl.cac.util.IcdXmlUtil;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@ -11,9 +12,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
import javax.annotation.PreDestroy;
|
|
|
|
import javax.annotation.PreDestroy;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
@ -84,4 +83,32 @@ public class IecServerService {
|
|
|
|
map.put("fileId", iecServer.fileId);
|
|
|
|
map.put("fileId", iecServer.fileId);
|
|
|
|
return map;
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<IcdConfigTypeInst> listParamindex(Integer fileId) throws Exception {
|
|
|
|
|
|
|
|
Optional<IcdFile> optional = fileRepository.findById(fileId);
|
|
|
|
|
|
|
|
if (!optional.isPresent()) {
|
|
|
|
|
|
|
|
throw new BusinessException("未找到该文件");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<IcdConfigTypeInst> result = new ArrayList<>();
|
|
|
|
|
|
|
|
IcdFile icdFile = IcdXmlUtil.loadIcdType(optional.get().getXml());
|
|
|
|
|
|
|
|
for (IcdConfigType config : icdFile.getConfigList()) {
|
|
|
|
|
|
|
|
if (config.getAttMap() != null && config.getInstMap() != null) {
|
|
|
|
|
|
|
|
Collection<IcdConfigTypeInst> instList = config.getInstMap().values();
|
|
|
|
|
|
|
|
Collection<IcdConfigTypeAtt> attList = config.getAttMap().values();
|
|
|
|
|
|
|
|
for (IcdConfigTypeInst inst : instList) {
|
|
|
|
|
|
|
|
String param = config.getIedName() + config.getLdeviceInst() + "/" + config.getLnClass()
|
|
|
|
|
|
|
|
+ inst.getInst();
|
|
|
|
|
|
|
|
inst.setParamIndex(param);
|
|
|
|
|
|
|
|
for (IcdConfigTypeAtt att : attList) {
|
|
|
|
|
|
|
|
if (att.containInst(inst.getInst())) {
|
|
|
|
|
|
|
|
String paramindex = param + "$" + att.getDoName();
|
|
|
|
|
|
|
|
inst.addAtt(paramindex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
result.addAll(instList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|