|
|
@@ -99,12 +99,12 @@ public class PdfController {
|
|
|
}
|
|
|
byte[] data = (byte[]) result.remove("data");
|
|
|
// 相对路径
|
|
|
- String pdfPath = ReportConstants.GENERATED_FILES_PATH + r + "/"
|
|
|
- + fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier()) + "."
|
|
|
- + ExportType.PDF.getQualifier();
|
|
|
- File file = new File(ReportConstants.GENERATED_FILES_DIR + pdfPath);
|
|
|
+ String pdfPath = r + "/"
|
|
|
+ + fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier())
|
|
|
+ + "." + ExportType.PDF.getQualifier();
|
|
|
+ File file = new File(ReportUtils.getDocumentDir(), pdfPath);
|
|
|
FileUtils.write(file.getPath(), data);
|
|
|
- result.put("path", pdfPath);
|
|
|
+ result.put("path", "pdf/preview?p=" + pdfPath);
|
|
|
result.put("overload", false);
|
|
|
}
|
|
|
return result;
|
|
|
@@ -210,10 +210,10 @@ public class PdfController {
|
|
|
ReportUtils.checkParameters(u, r);
|
|
|
|
|
|
// 相对路径
|
|
|
- String pdfPath = ReportConstants.GENERATED_FILES_PATH + r + "/"
|
|
|
- + fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier()) + "."
|
|
|
- + ExportType.PDF.getQualifier();
|
|
|
- File file = new File(ReportConstants.GENERATED_FILES_DIR + pdfPath);
|
|
|
+ String pdfPath = r + "/"
|
|
|
+ + fileService.generateFileName(u, pr, w, o, ExportType.PDF.getQualifier())
|
|
|
+ + "." + ExportType.PDF.getQualifier();
|
|
|
+ File file = new File(ReportUtils.getDocumentDir(), pdfPath);
|
|
|
String masterOfJrxml = printService.getMasterOfJrxml(u, r);
|
|
|
String jrxmlFilePath = fileService.getJrxmlFilePath(masterOfJrxml, r);
|
|
|
if (!fileService.isFileValid(file.getPath(), jrxmlFilePath)) {
|
|
|
@@ -236,9 +236,9 @@ public class PdfController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/preview")
|
|
|
@ResponseBody
|
|
|
- public void preview(@RequestParam(required = true) String p, HttpServletRequest request, HttpServletResponse response)
|
|
|
+ public void preview(@RequestParam String p, HttpServletRequest request, HttpServletResponse response)
|
|
|
throws JRException, IOException, DocumentException, SQLException, IllegalStateException {
|
|
|
- File file = new File(ReportConstants.GENERATED_FILES_DIR + p);
|
|
|
+ File file = new File(ReportUtils.getDocumentDir(), p);
|
|
|
if(!file.getName().toLowerCase().endsWith(".pdf")){
|
|
|
throw new IOException("并非 pdf 文件:" + p);
|
|
|
}
|