From e9d7ce9d570c949a700b56ec17f6e6cca821ceee Mon Sep 17 00:00:00 2001 From: liyawei Date: Tue, 14 Jun 2022 22:21:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E5=AF=BC=E5=87=BA-=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=9D=A1=E6=AC=BE=E5=86=85=E5=AE=B9=E8=B6=85=E5=87=BA?= =?UTF-8?q?excel=E5=8D=95=E5=85=83=E6=A0=BC=E5=AD=97=E7=AC=A6=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E9=95=BF=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/FileSplitItemsEOServiceImpl.java | 65 ++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java index 406fbc50d..baf54bd45 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/split/service/impl/FileSplitItemsEOServiceImpl.java @@ -3145,7 +3145,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl valContent){ + FileSplitValExportDto fileSplitValExportDto = valContent.get(valContent.size() - 1); // 始终判断最后一个内容是否超出长度 + int lastIndex = valContent.size() - 1; + if ("TEXT".equals(fileSplitValExportDto.getValType())) { + String dtoValContent = fileSplitValExportDto.getValContent(); + //判断是否超长 + if(dtoValContent.length() > 30000){ // 若超出长度 + // 先移除再添加 + valContent.remove(lastIndex); + + //拆分数据 + List content = new ArrayList<>(); // 存放拆出来的内容 + int lastLength = 0; + while (lastLength < dtoValContent.length()) { + if (lastLength == 0) { + String contentOld = dtoValContent.substring(0, 30000); + String contentNew = contentOld.substring(0,contentOld.lastIndexOf("\n")+1); + content.add(contentNew); + lastLength = 30000; + } else if (lastLength > dtoValContent.length() - 30000) { + String contentOld = dtoValContent.substring(lastLength, dtoValContent.length()); + String contentNew = contentOld.substring(0,contentOld.lastIndexOf("\n")+1); + content.add(contentNew); + lastLength = dtoValContent.length(); + } else{ + String contentOld = dtoValContent.substring(lastLength, lastLength + 30000); + String contentNew = contentOld.substring(0,contentOld.lastIndexOf("\n")+1); + content.add(contentNew); + lastLength = lastLength + 30000; + } + } + + // 添加 + for (String c : content) { + FileSplitValExportDto dto = new FileSplitValExportDto(); + dto.setValType(fileSplitValExportDto.getValType()); + dto.setValContent(c); + valContent.add(dto); + } + + } + } + } + public void downLoadImgList(List allImgList, String fileNowPath) throws IOException { for(FileSplitValImgExportDto imgExportDto : allImgList){ @@ -3428,7 +3489,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl