|
@@ -102,7 +102,7 @@ public class PdfController {
|
|
|
String pdfPath = r + "/"
|
|
String pdfPath = r + "/"
|
|
|
+ fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier())
|
|
+ fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier())
|
|
|
+ "." + ExportType.PDF.getQualifier();
|
|
+ "." + ExportType.PDF.getQualifier();
|
|
|
- File file = new File(ReportUtils.getDocumentDir(), pdfPath);
|
|
|
|
|
|
|
+ File file = new File(ReportUtils.getDocumentsDir(), pdfPath);
|
|
|
FileUtils.write(file.getPath(), data);
|
|
FileUtils.write(file.getPath(), data);
|
|
|
result.put("path", "pdf/preview?p=" + pdfPath);
|
|
result.put("path", "pdf/preview?p=" + pdfPath);
|
|
|
result.put("overload", false);
|
|
result.put("overload", false);
|
|
@@ -213,7 +213,7 @@ public class PdfController {
|
|
|
String pdfPath = r + "/"
|
|
String pdfPath = r + "/"
|
|
|
+ fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier())
|
|
+ fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier())
|
|
|
+ "." + ExportType.PDF.getQualifier();
|
|
+ "." + ExportType.PDF.getQualifier();
|
|
|
- File file = new File(ReportUtils.getDocumentDir(), pdfPath);
|
|
|
|
|
|
|
+ File file = new File(ReportUtils.getDocumentsDir(), pdfPath);
|
|
|
String masterOfJrxml = printService.getMasterOfJrxml(u, r);
|
|
String masterOfJrxml = printService.getMasterOfJrxml(u, r);
|
|
|
String jrxmlFilePath = fileService.getJrxmlFilePath(masterOfJrxml, r);
|
|
String jrxmlFilePath = fileService.getJrxmlFilePath(masterOfJrxml, r);
|
|
|
if (!fileService.isFileValid(file.getPath(), jrxmlFilePath)) {
|
|
if (!fileService.isFileValid(file.getPath(), jrxmlFilePath)) {
|
|
@@ -238,7 +238,7 @@ public class PdfController {
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public void preview(@RequestParam String p, HttpServletRequest request, HttpServletResponse response)
|
|
public void preview(@RequestParam String p, HttpServletRequest request, HttpServletResponse response)
|
|
|
throws JRException, IOException, DocumentException, SQLException, IllegalStateException {
|
|
throws JRException, IOException, DocumentException, SQLException, IllegalStateException {
|
|
|
- File file = new File(ReportUtils.getDocumentDir(), p);
|
|
|
|
|
|
|
+ File file = new File(ReportUtils.getDocumentsDir(), p);
|
|
|
if(!file.getName().toLowerCase().endsWith(".pdf")){
|
|
if(!file.getName().toLowerCase().endsWith(".pdf")){
|
|
|
throw new IOException("并非 pdf 文件:" + p);
|
|
throw new IOException("并非 pdf 文件:" + p);
|
|
|
}
|
|
}
|