|
|
|
@ -35,6 +35,8 @@ import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.zip.ZipEntry; |
|
|
|
import java.util.zip.ZipOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import org.apache.commons.io.function.IOConsumer; |
|
|
|
@ -712,6 +714,23 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
inspectionReport.getInspectionStartTime() : new Date(); |
|
|
|
String timestamp = DateUtils.format(DateUtils.yyyyMMddHHmmss2, startTime) + "_" + System.currentTimeMillis(); |
|
|
|
String reportName = inspectionReport.getInspectionTaskName() + "_" + timestamp; |
|
|
|
// 上传媒体包 |
|
|
|
uploadFile(basePath, reportName, ".zip", outputStream -> { |
|
|
|
try (ZipOutputStream zipOut = new ZipOutputStream(outputStream)) { |
|
|
|
for (Map.Entry<String, byte[]> entry : streamHashMap.entrySet()) { |
|
|
|
String imagePath = entry.getKey(); |
|
|
|
byte[] imageData = entry.getValue(); |
|
|
|
// 提取文件名并处理路径问题 |
|
|
|
String fileName = new File(imagePath).getName(); |
|
|
|
ZipEntry zipEntry = new ZipEntry(fileName); |
|
|
|
zipOut.putNextEntry(zipEntry); |
|
|
|
zipOut.write(imageData); |
|
|
|
zipOut.closeEntry(); |
|
|
|
} |
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException("生成ZIP文件失败", e); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 上传Excel |
|
|
|
uploadFile(basePath, reportName, ".xls", hssfWorkbook::write); |
|
|
|
// 上传Word |
|
|
|
@ -1092,7 +1111,7 @@ public class PatrolTaskResultMainController extends BaseController { |
|
|
|
cella1.setCellValue(brr.getArea()); |
|
|
|
cella1.setCellStyle(colStyle2); |
|
|
|
cella1 = rowb1.createCell(2); |
|
|
|
cella1.setCellValue(brr.getParts()); |
|
|
|
cella1.setCellValue(brr.getEqName()); |
|
|
|
cella1.setCellStyle(colStyle2); |
|
|
|
cella1 = rowb1.createCell(3); |
|
|
|
cella1.setCellValue(brr.getEqName()); |
|
|
|
|