From 45a02a999332a12f20dadd5a02949308e3d1f688 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Wed, 10 Jan 2024 09:20:35 +0800 Subject: [PATCH] =?UTF-8?q?pert:=20=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=92=8C=E8=AD=A6=E5=91=8A=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xydl/cac/model/BindDetail.java | 6 +-- .../service/impl/ParamBindServiceImpl.java | 38 +++++++------------ 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/xydl/cac/model/BindDetail.java b/src/main/java/com/xydl/cac/model/BindDetail.java index c416bde..8d207e1 100644 --- a/src/main/java/com/xydl/cac/model/BindDetail.java +++ b/src/main/java/com/xydl/cac/model/BindDetail.java @@ -1,11 +1,9 @@ package com.xydl.cac.model; -import com.xydl.cac.entity.Rptparamindex; +import com.xydl.cac.entity.IcdConfigTypeAtt; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.validation.constraints.NotNull; -import java.util.ArrayList; import java.util.List; @Data @@ -19,5 +17,5 @@ public class BindDetail { @ApiModelProperty("表字段名") List columnList; @ApiModelProperty("绑定关系") - List rptList; + List attList; } 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 ebec30f..de5a5ad 100644 --- a/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java +++ b/src/main/java/com/xydl/cac/service/impl/ParamBindServiceImpl.java @@ -18,6 +18,7 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; @Service @Slf4j @@ -105,28 +106,30 @@ public class ParamBindServiceImpl implements ParamBindService { } IcdConfigType type = optionalType.get(); - List result = new ArrayList<>(); String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass() + inst.getInst(); List attList = attRepository.findByIcdConfigTypeId(type.getId()); + List msgList = new ArrayList<>(); for (IcdConfigTypeAtt att : attList) { + if (StringUtils.isBlank(att.getColName())) { + msgList.add(att.getDoName() + "该属性还未配置绑定字段"); + } String paramindex = param + "$" + att.getLastName(); Optional optionalRpt = rptparamindexRepository.findById(paramindex); if (!optionalRpt.isPresent()) { throw new Exception("未找到该Rptparamindex,对象参引=" + paramindex); } - Rptparamindex rpt = optionalRpt.get(); - rpt.setTablename(type.getTableName()); - rpt.setColname(att.getColName()); - rpt.setEqmid(item.getEqmid()); - result.add(rpt); } - Response resp = Response.success(result); + Response resp = Response.success(attList); if (StringUtils.isBlank(type.getTableName())) { - resp.setErrorMsg("该ICD配置类型还未设置对应的tableName"); + msgList.add("该ICD配置类型还未设置对应的tableName"); } else if (!type.getTableName().equals(modevType.getTablename())) { - resp.setErrorMsg("该ICD配置类型的tableName和该监测装置类型的tableName不一致"); + msgList.add("该ICD配置类型的tableName和该监测装置类型的tableName不一致"); + } + if (msgList.size() > 0) { + String message = msgList.stream().collect(Collectors.joining(",")); + resp.setErrorMsg(message); } return resp; } @@ -188,23 +191,8 @@ public class ParamBindServiceImpl implements ParamBindService { result.setIedName(type.getIedName()); String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass() + inst.getInst(); - List rptList = new ArrayList<>(); List attList = attRepository.findByIcdConfigTypeId(type.getId()); - for (IcdConfigTypeAtt att : attList) { - String paramindex = param + "$" + att.getLastName(); - Rptparamindex rpt = new Rptparamindex(); - Optional optionalRpt = rptparamindexRepository.findById(paramindex); - if (optionalRpt.isPresent()) { - rpt = optionalRpt.get(); - } else { - rpt.setParamindex(paramindex); - } - rpt.setTablename(type.getTableName()); - rpt.setColname(att.getColName()); - rpt.setEqmid(eqmid); - rptList.add(rpt); - } - result.setRptList(rptList); + result.setAttList(attList); } } }