mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-09-18 17:48:08 +08:00
优化:修改历史遗留容易造成误解的方法名
This commit is contained in:
@@ -27,7 +27,7 @@ public class PictureFilePreviewImpl implements FilePreview {
|
|||||||
List imgUrls = Lists.newArrayList(url);
|
List imgUrls = Lists.newArrayList(url);
|
||||||
try{
|
try{
|
||||||
imgUrls.clear();
|
imgUrls.clear();
|
||||||
imgUrls.addAll(fileUtils.getRedisImgUrls(fileKey));
|
imgUrls.addAll(fileUtils.getImgCache(fileKey));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
imgUrls = Lists.newArrayList(url);
|
imgUrls = Lists.newArrayList(url);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public class FileUtils {
|
|||||||
Logger log= LoggerFactory.getLogger(getClass());
|
Logger log= LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CacheService cacheService;
|
private CacheService cacheService;
|
||||||
|
|
||||||
String fileDir = ConfigConstants.getFileDir();
|
String fileDir = ConfigConstants.getFileDir();
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ public class FileUtils {
|
|||||||
* @param fileKey
|
* @param fileKey
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List getRedisImgUrls(String fileKey){
|
public List getImgCache(String fileKey){
|
||||||
return cacheService.getImgCache(fileKey);
|
return cacheService.getImgCache(fileKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ public class FileUtils {
|
|||||||
* @param fileKey
|
* @param fileKey
|
||||||
* @param imgs
|
* @param imgs
|
||||||
*/
|
*/
|
||||||
public void setRedisImgUrls(String fileKey,List imgs){
|
public void putImgCache(String fileKey,List imgs){
|
||||||
cacheService.putImgCache(fileKey, imgs);
|
cacheService.putImgCache(fileKey, imgs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@@ -94,7 +94,7 @@ public class ZipReader {
|
|||||||
}
|
}
|
||||||
// 开启新的线程处理文件解压
|
// 开启新的线程处理文件解压
|
||||||
executors.submit(new ZipExtractorWorker(entriesToBeExtracted, zipFile, filePath));
|
executors.submit(new ZipExtractorWorker(entriesToBeExtracted, zipFile, filePath));
|
||||||
fileUtils.setRedisImgUrls(fileKey,imgUrls);
|
fileUtils.putImgCache(fileKey,imgUrls);
|
||||||
return new ObjectMapper().writeValueAsString(appender.get(""));
|
return new ObjectMapper().writeValueAsString(appender.get(""));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -152,7 +152,7 @@ public class ZipReader {
|
|||||||
appender.put(childName, node);
|
appender.put(childName, node);
|
||||||
}
|
}
|
||||||
executors.submit(new RarExtractorWorker(headersToBeExtracted, archive, filePath));
|
executors.submit(new RarExtractorWorker(headersToBeExtracted, archive, filePath));
|
||||||
fileUtils.setRedisImgUrls(fileKey,imgUrls);
|
fileUtils.putImgCache(fileKey,imgUrls);
|
||||||
return new ObjectMapper().writeValueAsString(appender.get(""));
|
return new ObjectMapper().writeValueAsString(appender.get(""));
|
||||||
} catch (RarException e) {
|
} catch (RarException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -204,7 +204,7 @@ public class ZipReader {
|
|||||||
}
|
}
|
||||||
// 开启新的线程处理文件解压
|
// 开启新的线程处理文件解压
|
||||||
executors.submit(new SevenZExtractorWorker(entriesToBeExtracted, filePath));
|
executors.submit(new SevenZExtractorWorker(entriesToBeExtracted, filePath));
|
||||||
fileUtils.setRedisImgUrls(fileKey,imgUrls);
|
fileUtils.putImgCache(fileKey,imgUrls);
|
||||||
return new ObjectMapper().writeValueAsString(appender.get(""));
|
return new ObjectMapper().writeValueAsString(appender.get(""));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Reference in New Issue
Block a user