| | |
| | | /** 备注 */ |
| | | @Excel(name = "备注", headerColor = IndexedColors.BLACK, width = 8) |
| | | private String remarks; |
| | | |
| | | /** 备注 */ |
| | | @Excel(name = "备考表备注", headerColor = IndexedColors.BLACK, width = 8) |
| | | private String noteRemark; |
| | | @TableField(exist = false) |
| | | private String orderByColumn; |
| | | @TableField(exist = false) |
| | |
| | | .append("historicalReferenceNumber", getHistoricalReferenceNumber()) |
| | | .toString(); |
| | | } |
| | | |
| | | public String getNoteRemark() { |
| | | return noteRemark; |
| | | } |
| | | |
| | | public void setNoteRemark(String noteRemark) { |
| | | this.noteRemark = noteRemark; |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** 案卷题名 */ |
| | | @Excel(name = "案卷题名", headerColor = IndexedColors.BLACK) |
| | | // @Excel(name = "案卷题名", headerColor = IndexedColors.BLACK) |
| | | private String caseTitle; |
| | | |
| | | /** 公开属性 */ |
| | |
| | | @Excel(name = "密级", readConverterExp = "该页另存=普通", headerColor = IndexedColors.BLACK) |
| | | private String securityClassification; |
| | | |
| | | @Excel(name = "案卷状态", headerColor = IndexedColors.BLACK) |
| | | // @Excel(name = "案卷状态", headerColor = IndexedColors.BLACK) |
| | | private String recordStatus; |
| | | |
| | | /** 案卷页数 */ |
| | |
| | | private String projectNumber; |
| | | |
| | | /** 扫描加工公司 */ |
| | | @Excel(name = "扫描加工公司", headerColor = IndexedColors.BLACK) |
| | | // @Excel(name = "扫描加工公司", headerColor = IndexedColors.BLACK) |
| | | private String scanningCompany; |
| | | |
| | | /** 档案管(室)号 */ |
| | |
| | | |
| | | |
| | | |
| | | @Excel(name = "备考表备注", headerColor = IndexedColors.BLACK) |
| | | private String noteRemark; |
| | | |
| | | /** 历史相关发文号 */ |
| | | @Excel(name = "历史相关发文号", headerColor = IndexedColors.BLACK) |
| | |
| | | private String retentionPeriod; |
| | | |
| | | /** $column.columnComment */ |
| | | @Excel(name = "密级", readConverterExp = "该页另存=普通,普通=普通,内部用图=内部用图,内部用途=内部用途,秘密=秘密", headerColor = IndexedColors.BLACK) |
| | | @Excel(name = "密级", headerColor = IndexedColors.BLACK) |
| | | private String securityLevel; |
| | | |
| | | /** $column.columnComment */ |
| | |
| | | |
| | | |
| | | |
| | | @Excel(name = "备注", headerColor = IndexedColors.BLACK) |
| | | private String remarks; |
| | | |
| | | |
| | | |
| | |
| | | // 其他行:直接使用pageNumber的值 |
| | | item.setPageNumberFormatted(pageNumber != null ? pageNumber.toString() : ""); |
| | | } |
| | | if(item.getSecurityLevel().equals("该页另存")) |
| | | item.setSecurityLevel("普通"); |
| | | } |
| | | return beanRecords; |
| | | } |
| | |
| | | @Override |
| | | public List<DocumentMaterialsVoLarge> selectDocumentMaterialsAllByRecordId(Long id) { |
| | | |
| | | return this.baseMapper.getDocumentMaterialsvoLarge(Math.toIntExact(id)); |
| | | List<DocumentMaterialsVoLarge> lists = this.baseMapper.getDocumentMaterialsvoLarge(Math.toIntExact(id)); |
| | | // 遍历所有条目,设置pageNumberFormatted |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | DocumentMaterialsVoLarge item = lists.get(i); |
| | | Long pageNumber = item.getPageNumber(); |
| | | |
| | | |
| | | if(item.getSecurityLevel().equals("该页另存")) |
| | | item.setSecurityLevel("普通"); |
| | | } |
| | | return lists; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | List<DocumentMaterials> beanRecords = list(lambdaQueryWrapper); |
| | | // 遍历所有条目,设置pageNumberFormatted |
| | | for (int i = 0; i < beanRecords.size(); i++) { |
| | | DocumentMaterials item = beanRecords.get(i); |
| | | Long pageNumber = item.getPageNumber(); |
| | | |
| | | |
| | | if(item.getSecurityLevel().equals("该页另存")) |
| | | item.setSecurityLevel("普通"); |
| | | } |
| | | return beanRecords; |
| | | } |
| | | |
| | |
| | | if (StringUtils.isEmpty(documentMaterials.getIsCanceled())) { |
| | | throw new ErrorcodeExceptionextends(400, "是否注销不能为空"); |
| | | } |
| | | // 手动转换密级字段 |
| | | // if ("秘密".equals(documentMaterials.getSecurityLevel())) { |
| | | // documentMaterials.setSecurityLevel("该页另存"); |
| | | // } |
| | | // if ("内部用图".equals(documentMaterials.getSecurityLevel())) { |
| | | // documentMaterials.setSecurityLevel("该页另存"); |
| | | // } |
| | | // if ("内部用途".equals(documentMaterials.getSecurityLevel())) { |
| | | // documentMaterials.setSecurityLevel("该页另存"); |
| | | // } |
| | | this.insertDocumentMaterials(documentMaterials); |
| | | } |
| | | |
| | |
| | | public void getExportModel(HttpServletResponse response) { |
| | | List<ArchiveRecordModelExp> list = Collections.singletonList(new ArchiveRecordModelExp()); |
| | | ExcelUtil<ArchiveRecordModelExp> util = new ExcelUtil<>(ArchiveRecordModelExp.class); |
| | | util.exportExcel(response, list, "档案信息导入模板"); |
| | | util.exportExcel(response, list, "档案信息"); |
| | | } |
| | | |
| | | |
| | |
| | | public void getExportModelOther(HttpServletResponse response) { |
| | | List<ArchiveRecordModelOther> list = Collections.singletonList(new ArchiveRecordModelOther()); |
| | | ExcelUtil<ArchiveRecordModelOther> util = new ExcelUtil<>(ArchiveRecordModelOther.class); |
| | | util.exportExcel(response, list, "档案信息导入模板"); |
| | | util.exportExcel(response, list, "档案信息"); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:records:list')") |
| | |
| | | list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials); |
| | | |
| | | } |
| | | |
| | | |
| | | ExcelUtil<DocumentMaterials> util = new ExcelUtil<DocumentMaterials>(DocumentMaterials.class); |
| | | util.exportExcel(response, list, "电子文件目录"); |
| | | } |
| | |
| | | String compName = "广州盈家档案管理有限公司"; |
| | | String li_person = "仇翀"; |
| | | String sh_person = "曾瑞莹"; |
| | | |
| | | ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id); |
| | | if(!StringUtils.isEmpty(archiveRecords.getLiPerson())) |
| | | li_person = archiveRecords.getLiPerson(); |
| | | String note_remark = ""; |
| | | if(!StringUtils.isEmpty(archiveRecords.getNoteRemark())) |
| | | note_remark = ","+archiveRecords.getNoteRemark(); |
| | | System.out.println(note_remark+"{{{{"); |
| | | ArchiveProjectName tmp = new ArchiveProjectName(); |
| | | tmp.setName(archiveRecords.getProjectName()); |
| | | List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp); |
| | |
| | | hs.put("company", compName); |
| | | hs.put("liPerson", li_person); |
| | | hs.put("shPerson", sh_person); |
| | | hs.put("noteRemark", note_remark); |
| | | hs.put("time", cdt); |
| | | |
| | | if (!getLicense()) { |
| | |
| | | // 根据页号拿到案卷的详细信息 |
| | | DocumentMaterials doc = documentMaterialsService.selectByPageNumber(nam, Math.toIntExact(recordId)); |
| | | if (doc != null) { |
| | | if (doc.getSecurityLevel() != null && doc.getSecurityLevel().equals("该页另存")) { |
| | | if (doc.getSecurityLevel() != null && (doc.getSecurityLevel().equals("该页另存")|| |
| | | doc.getSecurityLevel().equals("秘密")||doc.getSecurityLevel().equals("内部用途")|| |
| | | doc.getSecurityLevel().equals("内部用图"))) { |
| | | // 替换为了准备好的图像 |
| | | String fp = filePath + "\\glc.jpg"; |
| | | Path path = Paths.get(fp); |
| | |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 140 |
| | | maxActive: 200 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置连接超时时间 |
| | |
| | | user: |
| | | password: |
| | | # 密码最大错误次数 |
| | | maxRetryCount: 5 |
| | | maxRetryCount: 100000 |
| | | # 密码锁定时间(默认10分钟) |
| | | lockTime: 10 |
| | | lockTime: 1 |
| | | |
| | | # Spring配置 |
| | | spring: |
| | |
| | | printSetup.setLandscape(false); // 纵向打印 |
| | | |
| | | // 设置页边距 |
| | | sheet.setMargin(Sheet.LeftMargin, 0.5); |
| | | sheet.setMargin(Sheet.RightMargin, 0.5); |
| | | sheet.setMargin(Sheet.LeftMargin, 0.65); |
| | | sheet.setMargin(Sheet.RightMargin, 0.65); |
| | | sheet.setMargin(Sheet.TopMargin,0.31); |
| | | sheet.setMargin(Sheet.BottomMargin, 0.31); |
| | | // 设置打印区域,从第0行到第1000行,第0列到第20列(根据实际情况调整) |
| | | // sheet.setPrintArea(0, 0, 20, 0, 1000); |
| | | // 如果是index为1的sheet,设置顶端标题行 |
| | |
| | | CellStyle underlineStyle = wb.createCellStyle(); |
| | | Font underlineFont = wb.createFont(); |
| | | underlineFont.setFontName("宋体"); |
| | | underlineFont.setFontHeightInPoints((short) 11); |
| | | underlineFont.setFontHeightInPoints((short) 12); |
| | | underlineFont.setUnderline(Font.U_SINGLE); // 设置下划线 |
| | | underlineStyle.setFont(underlineFont); |
| | | recordIdCell.setCellStyle(underlineStyle); |
| | |
| | | row = sheet.createRow(i + 5 ); |
| | | else |
| | | row = sheet.createRow(i + 1 ); |
| | | |
| | | // 得到导出对象. |
| | | T vo = (T) list.get(i); |
| | | int column = 0; |
| | |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setRightBorderColor(IndexedColors.BLACK.getIndex()); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setTopBorderColor(IndexedColors.BLACK.getIndex()); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); |
| | | // 设置自动换行 |
| | | style.setWrapText(true); |
| | | Font dataFont = wb.createFont(); |
| | | dataFont.setFontName("Arial"); |
| | | dataFont.setFontName("宋体"); |
| | | dataFont.setFontHeightInPoints((short) 12); |
| | | style.setFont(dataFont); |
| | | styles.put("data", style); |
| | |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | Font totalFont = wb.createFont(); |
| | | totalFont.setFontName("Arial"); |
| | | totalFont.setFontName("宋体"); |
| | | totalFont.setFontHeightInPoints((short) 12); |
| | | style.setFont(totalFont); |
| | | // 总计行也设置自动换行 |
| | |
| | | // header.setFontSize((short) 10); |
| | | // 设置页眉内容 |
| | | hssfSheet.setMargin(Sheet.HeaderMargin, 2.1); |
| | | header.setRight("共 &N 页 第 &P页"); |
| | | header.setRight("&\"宋体,Bold\"共 &N 页 第 &P 页"); |
| | | } |
| | | // 如果是index为1的sheet,设置顶端标题行 |
| | | if (index == 1) { |
| | |
| | | |
| | | // 其他打印设置 |
| | | printSetup.setPaperSize(PrintSetup.A4_PAPERSIZE); // A4纸 |
| | | printSetup.setLandscape(false); // 纵向打印 |
| | | printSetup.setLandscape(true); // 纵向打印 |
| | | |
| | | |
| | | // 创建行并设置高度 |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | |
| | | this.init(list, sheetName, Excel.Type.EXPORT); |
| | | exportExcel(response.getOutputStream()); |
| | | } |
| | | private static double calculateScaleForCm(byte[] imageData, double widthCm, double heightCm) throws IOException { |
| | | // 读取图片获取原始尺寸 |
| | | BufferedImage img = ImageIO.read(new ByteArrayInputStream(imageData)); |
| | | double originalWidthPx = img.getWidth(); |
| | | double originalHeightPx = img.getHeight(); |
| | | |
| | | // Excel默认DPI(96) |
| | | double excelDpi = 96.0; |
| | | double pixelsPerCm = excelDpi / 2.54; |
| | | |
| | | // 目标像素尺寸 |
| | | double targetWidthPx = widthCm * pixelsPerCm; |
| | | double targetHeightPx = heightCm * pixelsPerCm; |
| | | |
| | | // 计算比例(取宽高中的较小比例,保持纵横比) |
| | | double scaleWidth = targetWidthPx / originalWidthPx; |
| | | double scaleHeight = targetHeightPx / originalHeightPx; |
| | | System.out.println("-=========67676"); |
| | | System.out.println(originalHeightPx); |
| | | System.out.println(originalWidthPx); |
| | | System.out.println(targetWidthPx); |
| | | System.out.println(targetHeightPx); |
| | | return Math.min(scaleWidth, scaleHeight); |
| | | } |
| | | /** |
| | | * 对list数据源将其里面的数据导入到excel表单 |
| | | * |
| | |
| | | // 创建图片锚点,设置在第2行第2列 |
| | | // 二维码显示在右上角且不填满整个格子 |
| | | // 缩小图片范围:只占用部分单元格空间 |
| | | ClientAnchor anchor = new HSSFClientAnchor(680, 0, 1000, 250, (short) 1, 2, (short) 1, 2); |
| | | |
| | | ClientAnchor anchor = new HSSFClientAnchor(699, 0, 1023, 97, (short) 1, 2, (short) 1, 3); |
| | | // 设置图片位置和大小 |
| | | anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_DONT_RESIZE); |
| | | |
| | | // 添加图片到工作表 |
| | | getDrawingPatriarch(sheet).createPicture(anchor, |
| | | org.apache.poi.ss.usermodel.Picture picture = getDrawingPatriarch(sheet).createPicture(anchor, |
| | | wb.addPicture(data, getImageType(data))); |
| | | |
| | | |
| | | int pictureIdx = wb.addPicture(data, getImageType(data)); |
| | | // Picture picture = drawing.createPicture(anchor, pictureIdx); |
| | | |
| | | // 关键:计算并应用3.15cm的缩放 |
| | | // double targetSizeCm = 3.15; |
| | | // |
| | | //// 方法1:使用精确计算 |
| | | // double scale = calculateScaleForCm(data, targetSizeCm, targetSizeCm); |
| | | // System.out.println(scale); |
| | | // picture.resize(scale); |
| | | |
| | | // 二维码添加完成后,恢复原来的列宽设置 |
| | | sheet.setColumnWidth(1, currentColumnWidth); |
| | | } |
| | |
| | | sheet.setColumnWidth(1, (int) ((51.57 + 0.72) * 256)); // 第二列:宽度51 |
| | | |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.RIGHT); |
| | | style.setAlignment(HorizontalAlignment.LEFT); |
| | | style.setVerticalAlignment(VerticalAlignment.BOTTOM); // 设置垂直下对齐 |
| | | style.setWrapText(true); // 设置自动换行 |
| | | |