|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.report.controller;
|
|
|
|
|
|
+import com.itextpdf.kernel.pdf.*;
|
|
|
import com.uas.report.DynamicProperties;
|
|
|
import com.uas.report.model.ExportType;
|
|
|
import com.uas.report.model.Platform;
|
|
|
@@ -196,6 +197,7 @@ public class PrintController {
|
|
|
+ fileService.generateFileName(userName, profile, whereCondition, otherParameters, exportFileType)
|
|
|
+ "." + exportType.getQualifier();
|
|
|
File file = new File(ReportUtils.getDocumentsDir(), filePath);
|
|
|
+ System.out.println(file.getAbsolutePath()+'-'+file.getPath());
|
|
|
// 指定flush为true(强制刷新pdf、xls)
|
|
|
// 文件无效(不存在或过期),创建
|
|
|
if ((flush != null && flush)
|
|
|
@@ -204,6 +206,19 @@ public class PrintController {
|
|
|
throw new IllegalStateException("数据量过大,无法提供服务");
|
|
|
}
|
|
|
printService.export(userName, profile, reportName, whereCondition, otherParameters, exportType, file, null, true);
|
|
|
+ if("AccountRegZW_ccsq".equals(reportName)) {
|
|
|
+ PdfReader pdfReader = new PdfReader(file);
|
|
|
+ WriterProperties writerProperties = new WriterProperties();
|
|
|
+ writerProperties.setStandardEncryption(null, "edit_paaword".getBytes(), EncryptionConstants.ALLOW_PRINTING, EncryptionConstants.ENCRYPTION_AES_128);
|
|
|
+ String path = ReportUtils.getDocumentsDir()+"/"+reportName + "/"
|
|
|
+ + fileService.generateFileEncryt(userName, profile, whereCondition, otherParameters, ExportType.PDF.getQualifier())
|
|
|
+ + "." + ExportType.PDF.getQualifier();
|
|
|
+ PdfWriter pdfWriter = new PdfWriter(path, writerProperties);
|
|
|
+ PdfDocument pdfDocument = new PdfDocument(pdfReader, pdfWriter);
|
|
|
+ pdfDocument.close();
|
|
|
+ file = new File(path);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
String exportFileName = (!StringUtils.isEmpty(title) ? title : reportName);
|
|
|
if (split) {
|
|
|
@@ -255,7 +270,21 @@ public class PrintController {
|
|
|
}
|
|
|
printService.export(userName, profile, reportName, whereCondition, otherParameters, ExportType.PDF, file, null, true);
|
|
|
}
|
|
|
- return "pdf/preview?p=" + pdfPath;
|
|
|
+ if("AccountRegZW_ccsq".equals(reportName)) {
|
|
|
+ PdfReader pdfReader = new PdfReader(file);
|
|
|
+ WriterProperties writerProperties = new WriterProperties();
|
|
|
+ writerProperties.setStandardEncryption(null,"edit_paaword".getBytes(), EncryptionConstants.ALLOW_PRINTING,EncryptionConstants.ENCRYPTION_AES_128);
|
|
|
+ String path = ReportUtils.getDocumentsDir()+ "/"+ reportName + "/"
|
|
|
+ + fileService.generateFileEncryt(userName, profile, whereCondition, otherParameters, ExportType.PDF.getQualifier())
|
|
|
+ + "." + ExportType.PDF.getQualifier();
|
|
|
+ PdfWriter pdfWriter = new PdfWriter(path ,writerProperties);
|
|
|
+ PdfDocument pdfDocument = new PdfDocument(pdfReader, pdfWriter);
|
|
|
+ pdfDocument.close();
|
|
|
+ System.out.println("---"+path);
|
|
|
+ return "pdf/preview?p=" + path;
|
|
|
+ }else {
|
|
|
+ return "pdf/preview?p=" + pdfPath;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|