| | |
| | | import com.itextpdf.text.pdf.PdfWriter; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.common.utils.file.FileUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelExp; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.utils.poi.ExcelUtilManySheet; |
| | | import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond; |
| | | import com.ruoyi.domain.DocumentMaterials; |
| | | import com.ruoyi.domain.vo.ArchiveInfoVo; |
| | | import com.ruoyi.domain.vo.DocumentMaterialsVo; |
| | | import com.ruoyi.domain.vo.DocumentMaterialsVoSmall; |
| | | import com.ruoyi.framework.web.domain.server.Sys; |
| | | import com.ruoyi.service.IArchiveRecordsService; |
| | | import com.ruoyi.service.IDocumentMaterialsService; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipFile; |
| | | import java.util.zip.ZipInputStream; |
| | |
| | | |
| | | @Autowired |
| | | private IArchiveRecordsService iArchiveRecordsService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) throws IOException |
| | | { |
| | | //导出卷面封面代码 |
| | | |
| | | ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(55L); |
| | | List<ArchiveInfoVo> arsi = new ArrayList<>(); |
| | | arsi.add(aIV); |
| | | ExcelExp e1 = new ExcelExp("案卷封面数据",arsi, ArchiveInfoVo.class); |
| | | ExcelExp e2 = new ExcelExp("提取方法…", arsi, ArchiveInfoVo.class); |
| | | List<ExcelExp> mysheet = new ArrayList<ExcelExp>(); |
| | | mysheet.add(e1); |
| | | mysheet.add(e2); |
| | | ByteOutputStream bos1 = new ByteOutputStream(); |
| | | ExcelUtilManySheetSecond<List<ExcelExp>> util2 = new ExcelUtilManySheetSecond<List<ExcelExp>>(mysheet); |
| | | |
| | | util2.exportExcelManySheet(response, mysheet); |
| | | |
| | | |
| | | |
| | | //导出卷面目录代码 |
| | | // DocumentMaterials documentMaterials = new DocumentMaterials(); |
| | | // documentMaterials.setRecordId(55L); |
| | | // // List<DocumentMaterials> docs = documentMaterialsService.selectDocumentMaterialsList(documentMaterials); |
| | | // List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo("55"); |
| | | // // dsvs.get(0).setUrl("/profile/upload/2025/08/14/30_20250814212128A031.jpg"); |
| | | // |
| | | // |
| | | // // dsvs.stream().map() |
| | | // List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res -> new DocumentMaterialsVoSmall(res.getNum(), res.getDocumentNumber(),res.getCreator(), |
| | | // res.getTitle(), res.getDate(), res.getPageNumber(), res.getRemarks())).collect(Collectors.toList()); |
| | | // |
| | | // String recordId = dsvs.get(0).getRecordId(); |
| | | // byte[] imgr = barcodeService.generateBarcodeImage(recordId); |
| | | // ExcelExp e1 = new ExcelExp("卷内目录数据",dsvs, DocumentMaterialsVo.class); |
| | | // ExcelExp e2 = new ExcelExp("卷内数据", list2, recordId, imgr, DocumentMaterialsVoSmall.class); |
| | | // List<ExcelExp> mysheet = new ArrayList<ExcelExp>(); |
| | | // mysheet.add(e1); |
| | | // mysheet.add(e2); |
| | | // ExcelUtilManySheet<List<ExcelExp>> util2 = new ExcelUtilManySheet<List<ExcelExp>>(mysheet); |
| | | // util2.exportExcelManySheet(response, mysheet); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 打包下载 |
| | | * @param response |
| | |
| | | |
| | | zos.putNextEntry(entry); |
| | | ByteOutputStream bos = new ByteOutputStream(); |
| | | util.byteOutputStreamExcel(bos, docs,"Date List", ""); |
| | | util.byteOutputStreamExcel(bos, docs,"电子文件目录", ""); |
| | | bos.writeTo(zos); |
| | | |
| | | //拿到卷内目录的excel |
| | | List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res -> new DocumentMaterialsVoSmall(res.getNum(), res.getDocumentNumber(),res.getCreator(), |
| | | res.getTitle(), res.getDate(), res.getPageNumber(), res.getRemarks())).collect(Collectors.toList()); |
| | | |
| | | String recordId = dsvs.get(0).getRecordId(); |
| | | byte[] imgr = barcodeService.generateBarcodeImage(recordId); |
| | | ExcelExp e1 = new ExcelExp("卷内目录数据",dsvs, DocumentMaterialsVo.class); |
| | | ExcelExp e2 = new ExcelExp("卷内数据", list2, recordId, imgr, DocumentMaterialsVoSmall.class); |
| | | List<ExcelExp> mysheet = new ArrayList<ExcelExp>(); |
| | | mysheet.add(e1); |
| | | mysheet.add(e2); |
| | | ExcelUtilManySheet<List<ExcelExp>> util2 = new ExcelUtilManySheet<List<ExcelExp>>(mysheet); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | ZipEntry entr = new ZipEntry("卷内目录" + ".xls"); |
| | | ExcelUtil<DocumentMaterialsVo> util1 = new ExcelUtil<DocumentMaterialsVo>(DocumentMaterialsVo.class); |
| | | System.out.println(dsvs); |
| | | zos.putNextEntry(entr); |
| | | ByteOutputStream bos1 = new ByteOutputStream(); |
| | | util1.byteOutputStreamExcel(bos1, dsvs,"Date List", ""); |
| | | |
| | | util2.exportExcelManySheet(bos1, mysheet); |
| | | |
| | | // util1.byteOutputStreamExcel(bos1, dsvs,"Date List", ""); |
| | | bos1.writeTo(zos); |
| | | //把excel转为pdf |
| | | |