Browse Source

新增功能:添加更新缓存方法&forceUpdatedCache=true

新增功能:添加更新缓存方法&forceUpdatedCache=true

Signed-off-by: 高雄 <admin@cxcp.com>
pull/107/head
高雄 2 years ago committed by Gitee
parent
commit
ace5a1898c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
  1. 13
      server/src/main/java/cn/keking/service/FileHandlerService.java

13
server/src/main/java/cn/keking/service/FileHandlerService.java

@ -179,14 +179,11 @@ public class FileHandlerService {
*/
public List<String> pdf2jpg(String pdfFilePath, String pdfName, String baseUrl, FileAttribute fileAttribute) {
List<String> imageUrls = new ArrayList<>();
Integer imageCount ;
Integer imageCount = null; ;
String imageFileSuffix = ".jpg";
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
boolean force_updated_cache=fileAttribute.forceUpdatedCache();
String filePassword = fileAttribute.getFilePassword();
if (force_updated_cache){
imageCount = Integer.valueOf("0");
}else {
boolean forceUpdatedCache=fileAttribute.forceUpdatedCache();
if (!forceUpdatedCache){
imageCount = this.getConvertedPdfImage(pdfFilePath);
}
String urlPrefix;
@ -207,7 +204,7 @@ public class FileHandlerService {
if (!pdfFile.exists()) {
return null;
}
PDDocument doc = PDDocument.load(pdfFile,filePassword);
PDDocument doc = PDDocument.load(pdfFile);
doc.setResourceCache(new NotResourceCache());
int pageCount = doc.getNumberOfPages();
PDFRenderer pdfRenderer = new PDFRenderer(doc);
@ -321,7 +318,7 @@ public class FileHandlerService {
if (StringUtils.hasText(fileKey)) {
attribute.setFileKey(fileKey);
}
if (StringUtil.isNotBlank(forceUpdatedCache) && "true".equalsIgnoreCase(forceUpdatedCache)) {
if ( "true".equalsIgnoreCase(forceUpdatedCache)) {
attribute.setforceUpdatedCache(true);
}

Loading…
Cancel
Save