文档库-带文件导出(pdf加水印)
This commit is contained in:
+10
@@ -67,6 +67,7 @@ import com.jero.modules.system.service.ISysDepartService;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import com.jero.modules.system.util.PDFUtils;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import com.jero.modules.tag.entity.OnlCgformArea;
|
||||
import com.jero.modules.tag.service.impl.OnlCgformAreaServiceImpl;
|
||||
@@ -3882,6 +3883,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
*/
|
||||
@Override
|
||||
public void exportExcel(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request) {
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String cut = (String) map.get("cut");
|
||||
//String flag = "file"为带文件导出标识
|
||||
String flag = (String) map.get("flag");
|
||||
@@ -3997,6 +3999,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
boolean b = CosBootUtil.doesObjectExist(url);
|
||||
if(b){
|
||||
InputStream download = CosBootUtil.download(url);
|
||||
if(url.endsWith(".pdf") || url.endsWith(".PDF")){
|
||||
String currentTime = sdf.format(new Date());
|
||||
String waterContent = loginUser.getUsername() + " " + currentTime;
|
||||
File newFile = PDFUtils.PDFWatermark(download,uploadpath,ossFile.getFileName(),waterContent);
|
||||
download = new FileInputStream(newFile.getPath());
|
||||
}
|
||||
copyFile(download, fileNowPath + File.separator + ossFile.getFileName());
|
||||
}
|
||||
}
|
||||
@@ -4026,6 +4034,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
IOUtils.closeQuietly(os);
|
||||
File file = new File(uploadpath + "/tempZip");
|
||||
FileUtil.deleteContents(file);
|
||||
File fileTemp = new File(uploadpath + "/tempZip.zip");
|
||||
FileUtil.deleteContents(fileTemp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user