From 284de2dbe3f607c8558d7abdb7f62ffd1d517ed0 Mon Sep 17 00:00:00 2001 From: pengwei Date: Mon, 14 Jul 2025 11:49:43 +0800 Subject: [PATCH] =?UTF-8?q?fit:=E5=AE=A1=E8=AE=A1=E5=8F=B0=E5=B8=90?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../books/NegativeBookController.java | 53 +++++++++---------- .../pojo/vo/NegativeAuditExportVo.java | 6 +-- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java b/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java index 2f57393..8ed9899 100644 --- a/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java +++ b/src/main/java/com/biutag/supervision/controller/books/NegativeBookController.java @@ -3,7 +3,6 @@ package com.biutag.supervision.controller.books; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.IoUtil; -import cn.hutool.core.stream.CollectorUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.metadata.data.ImageData; @@ -20,7 +19,6 @@ import com.biutag.supervision.pojo.vo.*; import com.biutag.supervision.service.*; import com.biutag.supervision.util.DownloadAndZip; import com.biutag.supervision.util.ImgUtils; -import dm.jdbc.util.FileUtil; import dm.jdbc.util.StringUtil; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; @@ -326,10 +324,12 @@ public class NegativeBookController { List negativeBlames = emptyFlag ? new ArrayList<>() : blameService.listByNegativeIds(negativeIds); List problemRelations = emptyFlag ? new ArrayList<>() : negativeProblemRelationService.list(negativeIds); List negativeFiles = emptyFlag ? new ArrayList<>() : negativeFileService.listByNegativeIds(negativeIds); + AtomicInteger index = new AtomicInteger(1); List list = pages.getRecords().stream().map((item) -> { NegativeAuditExportVo vo = new NegativeAuditExportVo(); BeanUtil.copyProperties(item, vo); - + int indexNumber = index.getAndIncrement(); + vo.setIndexNumber(indexNumber); vo.setProblems(problemRelations.stream() .filter(problem -> StrUtil.isNotBlank(problem.getOneLevelContent()) && StrUtil.isNotBlank(problem.getTwoLevelContent()) && StrUtil.isNotBlank(problem.getThreeLevelContentOther())) .map(problem -> String.format("%s / %s / %s", problem.getOneLevelContent(), problem.getTwoLevelContent(), problem.getThreeLevelContentOther())) @@ -338,28 +338,28 @@ public class NegativeBookController { .filter(blame -> StrUtil.isNotBlank(blame.getBlameName()) && StrUtil.isNotBlank(blame.getBlameEmpNo())) .map(blame -> blame.getBlameName() + "-" + blame.getBlameEmpNo()) .collect(Collectors.joining("、"))); - AtomicInteger i = new AtomicInteger(0); - List imageDataList = negativeFiles.stream().filter(file -> item.getId().equals(file.getNegtiveId())) - // 过滤图片 - .filter(file -> ImgUtils.isImg(file.getFileName())).map(file -> { - // 下载文件 - InputStream is = fileService.download(file.getFilePath()); - byte[] bytes = IoUtil.readBytes(is); - ImageData imageData = new ImageData(); - imageData.setImage(bytes); - imageData.setTop(0); - imageData.setBottom(0); - imageData.setLeft(i.get() * 10 + (i.get() == 0 ? 0 : 5)); // 0 15 25 - System.out.println(i.get() * 10 + (i.get() == 0 ? 0 : 5)); - imageData.setRight(i.get() * 15 + 10); // 10 25 35 - System.out.println(i.get() * 15 + 10); - System.out.println("==================="); - i.getAndIncrement(); - return imageData; - }).toList(); - WriteCellData writeCellData = new WriteCellData<>(); - writeCellData.setImageDataList(imageDataList); - vo.setFiles(writeCellData); +// AtomicInteger i = new AtomicInteger(0); +// List imageDataList = negativeFiles.stream().filter(file -> item.getId().equals(file.getNegtiveId())) +// // 过滤图片 +// .filter(file -> ImgUtils.isImg(file.getFileName())).map(file -> { +// // 下载文件 +// InputStream is = fileService.download(file.getFilePath()); +// byte[] bytes = IoUtil.readBytes(is); +// ImageData imageData = new ImageData(); +// imageData.setImage(bytes); +// imageData.setTop(0); +// imageData.setBottom(0); +// imageData.setLeft(i.get() * 10 + (i.get() == 0 ? 0 : 5)); // 0 15 25 +// System.out.println(i.get() * 10 + (i.get() == 0 ? 0 : 5)); +// imageData.setRight(i.get() * 15 + 10); // 10 25 35 +// System.out.println(i.get() * 15 + 10); +// System.out.println("==================="); +// i.getAndIncrement(); +// return imageData; +// }).toList(); +// WriteCellData writeCellData = new WriteCellData<>(); +// writeCellData.setImageDataList(imageDataList); +// vo.setFiles(writeCellData); return vo; }).toList(); String headerValue = "attachment; filename=\"" + URLEncoder.encode("审计监督数据台账.xlsx", "UTF-8") + "\""; @@ -390,7 +390,6 @@ public class NegativeBookController { String serialNumber =String.valueOf(negativeIds.indexOf(s) +1); //问题附件 List fileUrls = maps.get(s); - try { Files.createDirectories(Paths.get(tempDir)); @@ -423,7 +422,7 @@ public class NegativeBookController { log.info("压缩包下载完成---压缩包路径:"+zipFilePath); //删除压缩包 if(Files.exists(zipPath)){ - + Files.delete(zipPath); } } } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/NegativeAuditExportVo.java b/src/main/java/com/biutag/supervision/pojo/vo/NegativeAuditExportVo.java index edfae36..5d0e5d3 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/NegativeAuditExportVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/NegativeAuditExportVo.java @@ -47,9 +47,9 @@ public class NegativeAuditExportVo implements Serializable { @ExcelProperty("整改情况") private String rectifyDesc; - @ExcelProperty("整改佐证材料") - @ColumnWidth(40) - private WriteCellData files; +// @ExcelProperty("整改佐证材料") +// @ColumnWidth(40) +// private WriteCellData files; @ExcelProperty("涉及单位") private String involveDepartName;