|
|
@ -4,6 +4,7 @@ import com.xydl.cac.entity.*;
|
|
|
|
import com.xydl.cac.model.BindDetail;
|
|
|
|
import com.xydl.cac.model.BindDetail;
|
|
|
|
import com.xydl.cac.model.BindingModel;
|
|
|
|
import com.xydl.cac.model.BindingModel;
|
|
|
|
import com.xydl.cac.model.ColumnModel;
|
|
|
|
import com.xydl.cac.model.ColumnModel;
|
|
|
|
|
|
|
|
import com.xydl.cac.model.Response;
|
|
|
|
import com.xydl.cac.repository.*;
|
|
|
|
import com.xydl.cac.repository.*;
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
import com.xydl.cac.service.ParamBindService;
|
|
|
|
import com.xydl.cac.service.ParamBindService;
|
|
|
@ -82,10 +83,20 @@ public class ParamBindServiceImpl implements ParamBindService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<Rptparamindex> preview(BindingModel item) throws Exception {
|
|
|
|
public Response preview(BindingModel item) throws Exception {
|
|
|
|
|
|
|
|
Optional<Modev> optionalModev = modevRepository.findById(item.getEqmid());
|
|
|
|
|
|
|
|
if (!optionalModev.isPresent()) {
|
|
|
|
|
|
|
|
throw new Exception("未找到该监测装置, eqmid=" + item.getEqmid());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Modev modev = optionalModev.get();
|
|
|
|
|
|
|
|
Optional<ModevType> optionalModevType = modevTypeRepository.findById(modev.getModevtid());
|
|
|
|
|
|
|
|
if (!optionalModevType.isPresent()) {
|
|
|
|
|
|
|
|
throw new Exception("该监测装置类型不正确, 请先修正");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ModevType modevType = optionalModevType.get();
|
|
|
|
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
|
|
|
|
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
|
|
|
|
if (!optionalInst.isPresent()) {
|
|
|
|
if (!optionalInst.isPresent()) {
|
|
|
|
throw new Exception("未找到该ICD配置类型实例, eqmid=" + item.getEqmid() + ", icdid=" + item.getIcdid());
|
|
|
|
throw new Exception("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IcdConfigTypeInst inst = optionalInst.get();
|
|
|
|
IcdConfigTypeInst inst = optionalInst.get();
|
|
|
|
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
|
|
|
|
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
|
|
|
@ -110,11 +121,24 @@ public class ParamBindServiceImpl implements ParamBindService {
|
|
|
|
rpt.setEqmid(item.getEqmid());
|
|
|
|
rpt.setEqmid(item.getEqmid());
|
|
|
|
result.add(rpt);
|
|
|
|
result.add(rpt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
Response resp = Response.success(result);
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(type.getTableName())) {
|
|
|
|
|
|
|
|
resp.setErrorMsg("该ICD配置类型还未设置对应的tableName");
|
|
|
|
|
|
|
|
} else if (!type.getTableName().equals(modevType.getTablename())) {
|
|
|
|
|
|
|
|
resp.setErrorMsg("该ICD配置类型的tableName和该监测装置类型的tableName不一致");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void bind(BindingModel item) throws Exception {
|
|
|
|
public void bind(BindingModel item) throws Exception {
|
|
|
|
|
|
|
|
Optional<Modev> optionalModev = modevRepository.findById(item.getEqmid());
|
|
|
|
|
|
|
|
if (!optionalModev.isPresent()) {
|
|
|
|
|
|
|
|
throw new Exception("未找到该监测装置, eqmid=" + item.getEqmid());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Modev modev = optionalModev.get();
|
|
|
|
|
|
|
|
|
|
|
|
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
|
|
|
|
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
|
|
|
|
if (!optionalInst.isPresent()) {
|
|
|
|
if (!optionalInst.isPresent()) {
|
|
|
|
throw new Exception("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
|
|
|
|
throw new Exception("未找到该ICD逻辑设备实例, icdid=" + item.getIcdid());
|
|
|
@ -130,11 +154,7 @@ public class ParamBindServiceImpl implements ParamBindService {
|
|
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
throw new Exception("该逻辑设备实例已被" + list.get(0).getName() + "绑定");
|
|
|
|
throw new Exception("该逻辑设备实例已被" + list.get(0).getName() + "绑定");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Optional<Modev> optionalModev = modevRepository.findById(item.getEqmid());
|
|
|
|
|
|
|
|
if (!optionalModev.isPresent()) {
|
|
|
|
|
|
|
|
throw new Exception("未找到该监测装置");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Modev modev = optionalModev.get();
|
|
|
|
|
|
|
|
modev.setIcdid(item.getIcdid());
|
|
|
|
modev.setIcdid(item.getIcdid());
|
|
|
|
modevRepository.save(modev);
|
|
|
|
modevRepository.save(modev);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -149,7 +169,6 @@ public class ParamBindServiceImpl implements ParamBindService {
|
|
|
|
|
|
|
|
|
|
|
|
BindDetail result = new BindDetail();
|
|
|
|
BindDetail result = new BindDetail();
|
|
|
|
result.setEqmid(eqmid);
|
|
|
|
result.setEqmid(eqmid);
|
|
|
|
result.setIcdid(optionalModev.get().getIcdid());
|
|
|
|
|
|
|
|
Optional<ModevType> optionalModevType = modevTypeRepository.findById(modev.getModevtid());
|
|
|
|
Optional<ModevType> optionalModevType = modevTypeRepository.findById(modev.getModevtid());
|
|
|
|
if (optionalModevType.isPresent()) {
|
|
|
|
if (optionalModevType.isPresent()) {
|
|
|
|
ModevType modevType = optionalModevType.get();
|
|
|
|
ModevType modevType = optionalModevType.get();
|
|
|
@ -159,12 +178,14 @@ public class ParamBindServiceImpl implements ParamBindService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (modev.getIcdid() != null) {
|
|
|
|
if (modev.getIcdid() != null) {
|
|
|
|
|
|
|
|
result.setIcdid(modev.getIcdid());
|
|
|
|
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(modev.getIcdid());
|
|
|
|
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(modev.getIcdid());
|
|
|
|
if (optionalInst.isPresent()) {
|
|
|
|
if (optionalInst.isPresent()) {
|
|
|
|
IcdConfigTypeInst inst = optionalInst.get();
|
|
|
|
IcdConfigTypeInst inst = optionalInst.get();
|
|
|
|
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
|
|
|
|
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
|
|
|
|
if (optionalType.isPresent()) {
|
|
|
|
if (optionalType.isPresent()) {
|
|
|
|
IcdConfigType type = optionalType.get();
|
|
|
|
IcdConfigType type = optionalType.get();
|
|
|
|
|
|
|
|
result.setIedName(type.getIedName());
|
|
|
|
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
|
|
|
|
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
|
|
|
|
+ inst.getInst();
|
|
|
|
+ inst.getInst();
|
|
|
|
List<Rptparamindex> rptList = new ArrayList<>();
|
|
|
|
List<Rptparamindex> rptList = new ArrayList<>();
|
|
|
|