| | |
| | | |
| | | //移交清单 |
| | | List<ArchiveRecordSmall> lrs = iArchiveRecordsService.findByIds(archiveRecords); |
| | | //电子文件的个数 |
| | | System.out.println(lrs); |
| | | System.out.println("99999999990000"); |
| | | ZipEntry entry1 = new ZipEntry(fna + "移交清单" + ".xls"); |
| | |
| | | //把DocumentMaterils转到docs |
| | | List<DocumentMaterialsVoLarge> docs = new ArrayList<>(); |
| | | int nstar = 1; |
| | | |
| | | //统计3中材料的个数 |
| | | int texPages = 0; |
| | | int picPages = 0; |
| | | int patPages = 0; |
| | | for (DocumentMaterials mater : docAllInfo) { |
| | | // physcialService.mySave(physcial); |
| | | DocumentMaterialsVoLarge docum = new DocumentMaterialsVoLarge(); |
| | |
| | | docum.setRecordId(archiveRecords1.getRecordId()); |
| | | docum.setNum(nstar++); |
| | | docs.add(docum); |
| | | if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("文字材料")) |
| | | texPages++; |
| | | if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("图样材料")) |
| | | patPages++; |
| | | if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("照片材料")) |
| | | picPages++; |
| | | } |
| | | |
| | | |
| | |
| | | dc.setHorizontalResolution((long) wdpi); |
| | | dc.setVerticalResolution((long) hdpi); |
| | | dc.setSizeType(sizeType); |
| | | fileMap.put(dc.getPageNumber()+"", fp); |
| | | fileMap.put(dc.getPageNumber()+"", fileName1); |
| | | // dc.set |
| | | // 更新数据库 |
| | | // documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId); |
| | |
| | | System.out.println(dc.getPageNumber()); |
| | | String fip = fileMap.get(dc.getPageNumber().toString()); |
| | | // 创建 File 对象 |
| | | if (fip == null) { |
| | | // 补零到4位(根据你的需求调整位数) |
| | | String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue()); |
| | | fip = fileMap.get(paddedKey); |
| | | } |
| | | File fils = new File(fip); |
| | | |
| | | // 使用 ImageIO 读取图片 |
| | |
| | | |
| | | HashMap<String, Object> hs = new HashMap<String, Object>(); |
| | | int allPages = 0; |
| | | int texPages = 0; |
| | | int picPages = 0; |
| | | int patPages = 0; |
| | | if(!dmfs.isEmpty()) |
| | | { |
| | | for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs) |
| | | { |
| | | if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料")) |
| | | texPages = documentMaterialFileStyle.getCnt(); |
| | | if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料")) |
| | | patPages = documentMaterialFileStyle.getCnt(); |
| | | if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料")) |
| | | picPages = documentMaterialFileStyle.getCnt(); |
| | | } |
| | | } |
| | | // int texPages = 0; |
| | | // int picPages = 0; |
| | | // int patPages = 0; |
| | | // if(!dmfs.isEmpty()) |
| | | // { |
| | | // for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs) |
| | | // { |
| | | // if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料")) |
| | | // texPages = documentMaterialFileStyle.getCnt(); |
| | | // if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料")) |
| | | // patPages = documentMaterialFileStyle.getCnt(); |
| | | // if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料")) |
| | | // picPages = documentMaterialFileStyle.getCnt(); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | String compName = "广州盈家档案管理有限公司"; |
| | |
| | | // 创建PDF保存选项 |
| | | com.aspose.cells.PdfSaveOptions pdfSaveOptions = new com.aspose.cells.PdfSaveOptions(); |
| | | pdfSaveOptions.setCompliance(com.aspose.cells.PdfCompliance.PDF_A_1_B); |
| | | // 确保字体嵌入到PDF中 |
| | | |
| | | |
| | | // 创建临时字节输出流 |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | |
| | |
| | | byte[] buf = new byte[1024]; |
| | | for (DocumentMaterialsVoLarge dc : docs) { |
| | | String filePath = fileMap.get(dc.getPageNumber().toString()); |
| | | if(filePath==null) |
| | | continue; |
| | | |
| | | // filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/"); |
| | | |
| | | System.out.println(filePath); |
| | | if (filePath == null) { |
| | | // 补零到4位(根据你的需求调整位数) |
| | | String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue()); |
| | | filePath = fileMap.get(paddedKey); |
| | | } |
| | | if(filePath==null) |
| | | continue; |
| | | |
| | | if(filePath.contains("profile")) |
| | | filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/"); |
| | | |
| | | File tempFile = new File(filePath); |
| | | |
| | | //在压缩包中添加文件夹 |
| | |
| | | //把DocumentMaterils转到docs |
| | | List<DocumentMaterialsVoLarge> docs = new ArrayList<>(); |
| | | int nstar = 1; |
| | | int texPages = 0; |
| | | int patPages = 0; |
| | | int picPages = 0; |
| | | for (DocumentMaterials mater : docAllInfo) { |
| | | // physcialService.mySave(physcial); |
| | | DocumentMaterialsVoLarge docum = new DocumentMaterialsVoLarge(); |
| | |
| | | docum.setRecordId(aIV.getRecordId()); |
| | | docum.setNum(nstar++); |
| | | docs.add(docum); |
| | | if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("文字材料")) |
| | | texPages++; |
| | | if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("图样材料")) |
| | | patPages++; |
| | | if(mater.getFileStyle()!=null&&mater.getFileStyle().equals("照片材料")) |
| | | picPages++; |
| | | } |
| | | System.out.println(docs.size()+"----009"); |
| | | |
| | |
| | | dc.setHorizontalResolution((long) wdpi); |
| | | dc.setVerticalResolution((long) hdpi); |
| | | dc.setSizeType(sizeType); |
| | | fileMap.put(dc.getPageNumber()+"", fp); |
| | | System.out.println(fileName1); |
| | | System.out.println("gggggggggggggggg999999999999"); |
| | | fileMap.put(dc.getPageNumber()+"", fileName1); |
| | | // dc.set |
| | | // 更新数据库 |
| | | // documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId); |
| | |
| | | //拿到图像属性 |
| | | System.out.println(dc.getPageNumber()); |
| | | String fip = fileMap.get(dc.getPageNumber().toString()); |
| | | // 如果直接匹配失败,尝试补零匹配 |
| | | if (fip == null) { |
| | | // 补零到4位(根据你的需求调整位数) |
| | | String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue()); |
| | | fip = fileMap.get(paddedKey); |
| | | } |
| | | // 创建 File 对象 |
| | | if(fip==null||fip.equals("")) |
| | | { |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | File file = new File(fip); |
| | | |
| | | // 使用 ImageIO 读取图片 |
| | |
| | | //压缩文件 |
| | | List<String> filePathList = paths; |
| | | //把docmentMaterial转为 |
| | | File file = compressedFileToZip(docs, dsvs, aIV, id, fileMap); |
| | | File file = compressedFileToZip(docs, dsvs, aIV, id, fileMap, texPages, patPages, picPages); |
| | | System.out.println(file.getName()); |
| | | |
| | | String fileName =aIV.getRecordId()+".zip"; |
| | |
| | | |
| | | |
| | | // 压缩文件 |
| | | private File compressedFileToZip(List<DocumentMaterialsVoLarge> docs, List<DocumentMaterialsVo> dsvs, ArchiveInfoVo aIV, Long id, Map<String, String> fileMap) throws Exception { |
| | | private File compressedFileToZip(List<DocumentMaterialsVoLarge> docs, List<DocumentMaterialsVo> dsvs, ArchiveInfoVo aIV, Long id, Map<String, String> fileMap, |
| | | int texPages, |
| | | int patPages, |
| | | int picPages) throws Exception { |
| | | //压缩包具体名称(拼接时间戳防止重名) |
| | | String datumName = ""; |
| | | String zipFileName =dsvs.get(0).getDocumentNumber()+aIV.getRecordId()+ ".zip"; |
| | |
| | | String pdf09Path = "09-备考表.pdf"; |
| | | // pdfGenerateService.generateFileStyleInfo(pdf09Path, aIV.getRecordId(), id); |
| | | //拿到相关数据 |
| | | List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id)); |
| | | // List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id)); |
| | | |
| | | LocalDate currentDate = LocalDate.now(); |
| | | |
| | |
| | | |
| | | HashMap<String, Object> hs = new HashMap<String, Object>(); |
| | | int allPages = 0; |
| | | int texPages = 0; |
| | | int picPages = 0; |
| | | int patPages = 0; |
| | | if(!dmfs.isEmpty()) |
| | | { |
| | | for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs) |
| | | { |
| | | if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料")) |
| | | texPages = documentMaterialFileStyle.getCnt(); |
| | | if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料")) |
| | | patPages = documentMaterialFileStyle.getCnt(); |
| | | if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料")) |
| | | picPages = documentMaterialFileStyle.getCnt(); |
| | | } |
| | | } |
| | | // int texPages = 0; |
| | | // int picPages = 0; |
| | | // int patPages = 0; |
| | | // if(!docs.isEmpty()) |
| | | // { |
| | | // for(DocumentMaterialsVoLarge documentMaterialFileStyle:docs) |
| | | // { |
| | | // if(documentMaterialFileStyle!=null&&documentMaterialFileStyle.getFileStyle().equals("文字材料")) |
| | | // texPages = documentMaterialFileStyle.getCnt(); |
| | | // if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("图样材料")) |
| | | // patPages = documentMaterialFileStyle.getCnt(); |
| | | // if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("照片材料")) |
| | | // picPages = documentMaterialFileStyle.getCnt(); |
| | | // } |
| | | // } |
| | | |
| | | String compName = "广州盈家档案管理有限公司"; |
| | | String li_person = "仇翀"; |
| | |
| | | byte[] buf = new byte[1024]; |
| | | for (DocumentMaterialsVoLarge dc : docs) { |
| | | String filePath = fileMap.get(dc.getPageNumber().toString()); |
| | | if(filePath==null) |
| | | continue; |
| | | |
| | | |
| | | // else { |
| | | // // 文件名称 |
| | |
| | | // |
| | | |
| | | |
| | | if (filePath == null) { |
| | | // 补零到4位(根据你的需求调整位数) |
| | | String paddedKey = frontCompWithZore(4, dc.getPageNumber().intValue()); |
| | | filePath = fileMap.get(paddedKey); |
| | | System.out.println(paddedKey); |
| | | |
| | | } |
| | | System.out.println(filePath); |
| | | |
| | | if(filePath==null) |
| | | continue; |
| | | |
| | | if(filePath.contains("profile")) |
| | | filePath = filePath.replace("/profile/", RuoYiConfig.getProfile() + "/"); |
| | | |
| | | File tempFile = new File(filePath); |
| | | System.out.println(filePath); |