| | |
| | | import com.itextpdf.text.pdf.PdfPTable; |
| | | import com.itextpdf.text.pdf.PdfWriter; |
| | | import com.ruoyi.common.config.RuoYiConfig; |
| | | import com.ruoyi.domain.ArchiveRecords; |
| | | import com.ruoyi.domain.vo.DocumentMaterialFileStyle; |
| | | import com.ruoyi.domain.vo.DocumentMaterialsVo; |
| | | import com.ruoyi.domain.vo.DocumentMaterialsVoSmall; |
| | | import com.ruoyi.service.IArchiveRecordsService; |
| | | import com.ruoyi.service.IDocumentMaterialsService; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.*; |
| | |
| | | import java.io.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | private BarcodeService barcodeService; |
| | | @Autowired |
| | | private IDocumentMaterialsService documentMaterialsService; |
| | | |
| | | @Autowired |
| | | private IArchiveRecordsService iArchiveRecordsService; |
| | | //生产二维码 |
| | | public byte[] createQrCodeN(String content, int width, int height) throws IOException { |
| | | QrConfig config = new QrConfig(width, height); |
| | |
| | | |
| | | } |
| | | |
| | | public void generatePdf(String pdfPath) throws IOException, DocumentException { |
| | | public void generatePdf(String pdfPath, Long id) throws IOException, DocumentException { |
| | | |
| | | Document document = new Document(); |
| | | PdfWriter.getInstance(document, new FileOutputStream(pdfPath)); |
| | |
| | | |
| | | String [] tits = {"档 号:","档案馆(室)号:","缩 微 号: ","发 文 号:", |
| | | "案 卷 题 名:","编 制 日 期:","编 制 单 位:","保 管 期 限:","密 级:"}; |
| | | String [] cons = {"D3.4.1-05-2024-0002","","","穗规划资源建证〔2024〕2033号","广州市自来水有限公司白云区江高镇江高镇政府西侧、江府路北侧白云区江高镇江高镇政府西侧、江府路北侧新装供水管工程","2024-04-23","广州市规划和自然资源局白云区分局","永久",""}; |
| | | ArchiveRecords ard = iArchiveRecordsService.selectArchiveRecordsById(id); |
| | | |
| | | |
| | | String formattedDate = ""; |
| | | if(ard.getPreparationDate()!=null) { |
| | | LocalDate date = ard.getPreparationDate().toInstant() |
| | | .atZone(ZoneId.systemDefault()) |
| | | .toLocalDate(); |
| | | ; |
| | | System.out.println("当前日期: " + date); |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | formattedDate = date.format(formatter); |
| | | } |
| | | |
| | | String [] cons = {ard.getRecordId(),ard.getArchiveRoomNumber(),ard.getMicrofilmNumber(),ard.getInquiryNumber(),ard.getCaseTitle(),formattedDate,ard.getPreparationUnit(), |
| | | ard.getRetentionPeriod(),ard.getSecurityClassification()}; |
| | | |
| | | //把图片加入到pdf当中 |
| | | Image img = Image.getInstance(createQrCodeN(cons[0], 80, 80)); |