fix: 优化生成rptparamindex的报错信息

dev
huangfeng 1 year ago
parent 4a9d4df27c
commit fed269b70a

@ -205,36 +205,39 @@ public class ParamBindServiceImpl implements ParamBindService {
List<Modev> modevList = modevRepository.findByIcdidIsNotNull();
if (!CollectionUtils.isEmpty(modevList)) {
for (Modev item : modevList) {
generateOne(item.getId(), item.getIcdid());
generateOne(item);
}
}
}
private void generateOne(Integer eqmid, Integer icdid) throws Exception {
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(icdid);
private void generateOne(Modev item) throws Exception {
Optional<IcdConfigTypeInst> optionalInst = instRepository.findById(item.getIcdid());
if (!optionalInst.isPresent()) {
throw new Exception("未找到该ICD逻辑设备实例, eqmid=" + eqmid + ", icdid=" + icdid);
throw new Exception("未找到该ICD逻辑设备实例, eqmid=" + item.getId() + ", icdid=" + item.getIcdid());
}
IcdConfigTypeInst inst = optionalInst.get();
Optional<IcdConfigType> optionalType = typeRepository.findById(inst.getIcdConfigTypeId());
if (!optionalType.isPresent()) {
throw new Exception("未找到该实例对应的ICD配置类型, icdid=" + icdid);
throw new Exception("未找到该实例对应的ICD配置类型, icdid=" + item.getIcdid());
}
IcdConfigType type = optionalType.get();
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
+ inst.getInst();
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
for (IcdConfigTypeAtt att : attList) {
if (StringUtils.isNotBlank(att.getColName())) {
String paramindex = param + "$" + att.getLastName();
Optional<Rptparamindex> optionalRpt = rptparamindexRepository.findById(paramindex);
if (!optionalRpt.isPresent()) {
throw new Exception("未找到该Rptparamindex对象参引=" + paramindex);
throw new Exception(item.getName() + "的字段" + att.getColName() + "对应的属性"
+ att.getDoName() + "未找到该Rptparamindex对象参引=" + paramindex);
}
Rptparamindex rpt = optionalRpt.get();
rpt.setTablename(type.getTableName());
rpt.setColname(att.getColName());
rpt.setEqmid(eqmid);
rpt.setEqmid(item.getId());
rptparamindexRepository.save(rpt);
}
}
}
}

Loading…
Cancel
Save