diff --git a/business-css/src/main/java/com/yfd/business/css/service/impl/ProjectServiceImpl.java b/business-css/src/main/java/com/yfd/business/css/service/impl/ProjectServiceImpl.java index dc42a9b..81ef5c6 100644 --- a/business-css/src/main/java/com/yfd/business/css/service/impl/ProjectServiceImpl.java +++ b/business-css/src/main/java/com/yfd/business/css/service/impl/ProjectServiceImpl.java @@ -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 // } } -