Browse Source

PDF预览路径调整

zhouy 2 years ago
parent
commit
591ff75ec0

+ 4 - 6
report/src/main/java/com/uas/report/controller/PrintController.java

@@ -197,7 +197,6 @@ 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)
@@ -210,10 +209,10 @@ public class PrintController {
 				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 + "/"
+				String path = reportName + "/"
 						+ fileService.generateFileEncryt(userName, profile, whereCondition, otherParameters, ExportType.PDF.getQualifier())
 						+ "." + ExportType.PDF.getQualifier();
-				PdfWriter pdfWriter = new PdfWriter(path, writerProperties);
+				PdfWriter pdfWriter = new PdfWriter(ReportUtils.getDocumentsDir()+"/"+path, writerProperties);
 				PdfDocument pdfDocument = new PdfDocument(pdfReader, pdfWriter);
 				pdfDocument.close();
 				file = new File(path);
@@ -274,13 +273,12 @@ public class PrintController {
 			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 + "/"
+			String path = reportName + "/"
 					+ fileService.generateFileEncryt(userName, profile, whereCondition, otherParameters, ExportType.PDF.getQualifier())
 					+ "." + ExportType.PDF.getQualifier();
-			PdfWriter pdfWriter = new PdfWriter(path ,writerProperties);
+			PdfWriter pdfWriter = new PdfWriter(ReportUtils.getDocumentsDir()+ "/"+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;