项目导出超长拓扑进行截断

This commit is contained in:
wanxiaoli 2026-06-04 17:58:12 +08:00
parent 4d46de071d
commit a5debf6cd2

View File

@ -95,7 +95,7 @@ public class ProjectServiceImpl
row.createCell(1).setCellValue(p.getCode() == null ? "" : p.getCode());
row.createCell(2).setCellValue(p.getName() == null ? "" : p.getName());
row.createCell(3).setCellValue(p.getDescription() == null ? "" : p.getDescription());
row.createCell(4).setCellValue(p.getTopology() == null ? "" : p.getTopology());
row.createCell(4).setCellValue(clampExcelCellText(p.getTopology()));
row.createCell(5).setCellValue(p.getCreatedAt() == null ? "" : fmt.format(p.getCreatedAt()));
row.createCell(6).setCellValue(p.getUpdatedAt() == null ? "" : fmt.format(p.getUpdatedAt()));
row.createCell(7).setCellValue(p.getModifier() == null ? "" : p.getModifier());
@ -109,6 +109,14 @@ public class ProjectServiceImpl
}
}
private static String clampExcelCellText(String s) {
if (s == null) return "";
int max = 32767;
if (s.length() <= max) return s;
if (max <= 3) return s.substring(0, max);
return s.substring(0, max - 3) + "...";
}
@Override
/**
* 解析指定项目的拓扑结构生成节点边与线性计算计划
@ -1256,7 +1264,7 @@ public class ProjectServiceImpl
row.createCell(1).setCellValue(p.getCode()==null?"":p.getCode());
row.createCell(2).setCellValue(p.getName()==null?"":p.getName());
row.createCell(3).setCellValue(p.getDescription()==null?"":p.getDescription());
row.createCell(4).setCellValue(p.getTopology()==null?"":p.getTopology());
row.createCell(4).setCellValue(clampExcelCellText(p.getTopology()));
row.createCell(5).setCellValue(p.getVisibility()==null?"":p.getVisibility());
row.createCell(6).setCellValue(p.getCreator()==null?"":p.getCreator());
row.createCell(7).setCellValue(p.getCreatedAt()==null?"":fmt.format(p.getCreatedAt()));
@ -1800,4 +1808,3 @@ public class ProjectServiceImpl
// }
}