diff --git a/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java b/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java index 4df99038..cc34cb29 100644 --- a/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java +++ b/adc-da-sys/src/main/java/com/adc/da/att/controller/AttFileEOController.java @@ -288,7 +288,19 @@ public class AttFileEOController { WaterMarkUtil.waterMark(oldFilePath,waterFilePath,waterContent); response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\""); response.setContentType("application/octet-stream"); - File file = new File(waterFilePath); + + String downloadFilePath=""; + String fileName=attFileEO.getFileName(); + String suffix=fileName.substring(fileName.lastIndexOf(".")+1); + //只能在pdf中添加水印, + //非pdf文件直接下载原文件 + if (suffix.equals("pdf")){ + downloadFilePath=waterFilePath; + }else { + downloadFilePath=oldFilePath; + } + + File file = new File(downloadFilePath); is = new FileInputStream(file); os = response.getOutputStream(); IOUtils.copy(is, os);