perf: 优化数据

haikang
huangfeng 1 year ago
parent 45a02a9993
commit 4a8d3025a7

@ -10,6 +10,7 @@ import java.io.Serializable;
public class Response<T> implements Serializable { public class Response<T> implements Serializable {
private boolean success; private boolean success;
private String errorMsg; private String errorMsg;
private String warnMsg;
private T data; private T data;
public Response(T data) { public Response(T data) {

@ -113,23 +113,24 @@ public class ParamBindServiceImpl implements ParamBindService {
for (IcdConfigTypeAtt att : attList) { for (IcdConfigTypeAtt att : attList) {
if (StringUtils.isBlank(att.getColName())) { if (StringUtils.isBlank(att.getColName())) {
msgList.add(att.getDoName() + "该属性还未配置绑定字段"); msgList.add(att.getDoName() + "该属性还未配置绑定字段");
} } else {
String paramindex = param + "$" + att.getLastName(); String paramindex = param + "$" + att.getLastName();
Optional<Rptparamindex> optionalRpt = rptparamindexRepository.findById(paramindex); Optional<Rptparamindex> optionalRpt = rptparamindexRepository.findById(paramindex);
if (!optionalRpt.isPresent()) { if (!optionalRpt.isPresent()) {
throw new Exception("未找到该Rptparamindex对象参引=" + paramindex); throw new Exception("未找到该Rptparamindex对象参引=" + paramindex);
} }
} }
}
Response resp = Response.success(attList); Response resp = Response.success(attList);
if (StringUtils.isBlank(type.getTableName())) { if (StringUtils.isBlank(type.getTableName())) {
msgList.add("该ICD配置类型还未设置对应的tableName"); msgList.add("该ICD配置类型还未设置对应的tableName");
} else if (!type.getTableName().equals(modevType.getTablename())) { } else if (!type.getTableName().equals(modevType.getTablename())) {
msgList.add("该ICD配置类型的tableName和该监测装置类型的tableName不一致"); msgList.add("该ICD配置类型的tableName(" + type.getTableName() + ")和该监测装置类型的tableName(" + modevType.getTablename() + ")不一致");
} }
if (msgList.size() > 0) { if (msgList.size() > 0) {
String message = msgList.stream().collect(Collectors.joining(",")); String message = msgList.stream().collect(Collectors.joining("\n\r"));
resp.setErrorMsg(message); resp.setWarnMsg(message);
} }
return resp; return resp;
} }

@ -80,18 +80,18 @@ public class IcdXmlUtil {
config.addInst(lnInst); config.addInst(lnInst);
config.addAtt(doName, param); config.addAtt(doName, param);
} else if ("ST".equals(fc)) { } else if ("ST".equals(fc)) {
IcdConfigType config = result.get(key); // IcdConfigType config = result.get(key);
if (config == null) { // if (config == null) {
config = IcdConfigType.builder() // config = IcdConfigType.builder()
.iedName(iedName) // .iedName(iedName)
.ldeviceInst(ldeviceInst) // .ldeviceInst(ldeviceInst)
.lnClass(lnClass) // .lnClass(lnClass)
.build(); // .build();
result.put(key, config); // result.put(key, config);
} // }
String param = fc + "$" + doName + "$" + lastname; // String param = fc + "$" + doName + "$" + lastname;
config.addInst(lnInst); // config.addInst(lnInst);
config.addAtt(doName, param); // config.addAtt(doName, param);
} }
} }
} }

Loading…
Cancel
Save