From fed269b70a44db8b6852221b0e89a9054c931471 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Wed, 10 Jan 2024 16:47:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E7=94=9F=E6=88=90rptp?= =?UTF-8?q?aramindex=E7=9A=84=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ParamBindServiceImpl.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java b/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java index 45dda10..9211d35 100644 --- a/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java +++ b/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java @@ -205,36 +205,39 @@ public class ParamBindServiceImpl implements ParamBindService { List 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 optionalInst = instRepository.findById(icdid); + private void generateOne(Modev item) throws Exception { + Optional 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 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 attList = attRepository.findByIcdConfigTypeId(type.getId()); for (IcdConfigTypeAtt att : attList) { - String paramindex = param + "$" + att.getLastName(); - Optional optionalRpt = rptparamindexRepository.findById(paramindex); - if (!optionalRpt.isPresent()) { - throw new Exception("未找到该Rptparamindex,对象参引=" + paramindex); + if (StringUtils.isNotBlank(att.getColName())) { + String paramindex = param + "$" + att.getLastName(); + Optional optionalRpt = rptparamindexRepository.findById(paramindex); + if (!optionalRpt.isPresent()) { + 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(item.getId()); + rptparamindexRepository.save(rpt); } - Rptparamindex rpt = optionalRpt.get(); - rpt.setTablename(type.getTableName()); - rpt.setColname(att.getColName()); - rpt.setEqmid(eqmid); - rptparamindexRepository.save(rpt); } } }