pert: 调整预览的数据和警告信息

haikang
huangfeng 1 year ago
parent 0737b18678
commit 45a02a9993

@ -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<ColumnModel> columnList;
@ApiModelProperty("绑定关系")
List<Rptparamindex> rptList;
List<IcdConfigTypeAtt> attList;
}

@ -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<Rptparamindex> result = new ArrayList<>();
String param = type.getIedName() + type.getLdeviceInst() + "/" + type.getLnClass()
+ inst.getInst();
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
List<String> msgList = new ArrayList<>();
for (IcdConfigTypeAtt att : attList) {
if (StringUtils.isBlank(att.getColName())) {
msgList.add(att.getDoName() + "该属性还未配置绑定字段");
}
String paramindex = param + "$" + att.getLastName();
Optional<Rptparamindex> 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<Rptparamindex> rptList = new ArrayList<>();
List<IcdConfigTypeAtt> attList = attRepository.findByIcdConfigTypeId(type.getId());
for (IcdConfigTypeAtt att : attList) {
String paramindex = param + "$" + att.getLastName();
Rptparamindex rpt = new Rptparamindex();
Optional<Rptparamindex> 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);
}
}
}

Loading…
Cancel
Save