|
|
@ -1,9 +1,14 @@
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.beanit.iec61850bean.FileInformation;
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.IcdFile;
|
|
|
|
import com.xydl.cac.entity.IcdIed;
|
|
|
|
import com.xydl.cac.entity.IcdIed;
|
|
|
|
import com.xydl.cac.entity.IedDlConfig;
|
|
|
|
import com.xydl.cac.entity.IedDlConfig;
|
|
|
|
import com.xydl.cac.entity.NSensor;
|
|
|
|
import com.xydl.cac.entity.NSensor;
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
|
|
|
|
import com.xydl.cac.iec.IecClient;
|
|
|
|
|
|
|
|
import com.xydl.cac.repository.IcdFileRepository;
|
|
|
|
|
|
|
|
import com.xydl.cac.repository.IcdIedRepository;
|
|
|
|
import com.xydl.cac.repository.IedDlConfigRepository;
|
|
|
|
import com.xydl.cac.repository.IedDlConfigRepository;
|
|
|
|
import com.xydl.cac.repository.NSensorRepository;
|
|
|
|
import com.xydl.cac.repository.NSensorRepository;
|
|
|
|
import com.xydl.cac.service.IcdFileConfigService;
|
|
|
|
import com.xydl.cac.service.IcdFileConfigService;
|
|
|
@ -28,6 +33,10 @@ public class IedDlConfigServiceImpl implements IedDlConfigService {
|
|
|
|
NSensorRepository sensorRepository;
|
|
|
|
NSensorRepository sensorRepository;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
IcdFileConfigService configService;
|
|
|
|
IcdFileConfigService configService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
IcdFileRepository fileRepository;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
IcdIedRepository iedRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<IedDlConfig> listAll() {
|
|
|
|
public List<IedDlConfig> listAll() {
|
|
|
@ -76,4 +85,25 @@ public class IedDlConfigServiceImpl implements IedDlConfigService {
|
|
|
|
public void delete(Integer id) {
|
|
|
|
public void delete(Integer id) {
|
|
|
|
repository.deleteById(id);
|
|
|
|
repository.deleteById(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<FileInformation> listFiles(Integer iedId, String path) throws Exception {
|
|
|
|
|
|
|
|
Optional<IcdIed> optional = iedRepository.findById(iedId);
|
|
|
|
|
|
|
|
if (!optional.isPresent()) {
|
|
|
|
|
|
|
|
throw new BusinessException("未找到该IED");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
IcdIed ied = optional.get();
|
|
|
|
|
|
|
|
Optional<IcdFile> optionalFile = fileRepository.findById(ied.getIcdFileId());
|
|
|
|
|
|
|
|
if (!optionalFile.isPresent()) {
|
|
|
|
|
|
|
|
throw new BusinessException("未找到该icd文件");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
IcdFile icdFile = optionalFile.get();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
IecClient iecClient = new IecClient();
|
|
|
|
|
|
|
|
iecClient.connect(ied.getIp(), 102, ied.getApTitle(), icdFile.getXml());
|
|
|
|
|
|
|
|
return iecClient.listFile(path);
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
throw new BusinessException(ex.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|