fix some codestyle problem
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package cn.keking.service;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileType;
|
||||
import cn.keking.utils.RarUtils;
|
||||
import cn.keking.web.filter.BaseUrlFilter;
|
||||
@ -68,7 +67,6 @@ public class CompressFileReader {
|
||||
if (result == ExtractOperationResult.OK) {
|
||||
FileType type = FileType.typeFromUrl(str[0]);
|
||||
if (type.equals(FileType.PICTURE)) {
|
||||
// System.out.println( baseUrl +folderName + "_" + str[0]);
|
||||
imgUrls.add(baseUrl +folderName + "_/" + str[0].replace("\\", "/"));
|
||||
}
|
||||
fileHandlerService.putImgCache(fileName, imgUrls);
|
||||
|
||||
@ -250,8 +250,8 @@ public class FileHandlerService {
|
||||
String imageFilePath;
|
||||
for (int pageIndex = 0; pageIndex < pageCount; pageIndex++) {
|
||||
imageFilePath = folder + File.separator + pageIndex + pdf2jpg_image_format;
|
||||
BufferedImage image = pdfRenderer.renderImageWithDPI(pageIndex, ConfigConstants.getpdf2JpgDpi(), ImageType.RGB);
|
||||
ImageIOUtil.writeImage(image, imageFilePath, ConfigConstants.getpdf2JpgDpi());
|
||||
BufferedImage image = pdfRenderer.renderImageWithDPI(pageIndex, ConfigConstants.getPdf2JpgDpi(), ImageType.RGB);
|
||||
ImageIOUtil.writeImage(image, imageFilePath, ConfigConstants.getPdf2JpgDpi());
|
||||
String imageUrl = this.getPdf2jpgUrl(pdfName, pageIndex);
|
||||
imageUrls.add(imageUrl);
|
||||
}
|
||||
@ -269,8 +269,7 @@ public class FileHandlerService {
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
System.out.println("发生错误:"+e);
|
||||
// logger.error("Convert pdf to jpg exception, pdfFilePath:{}", pdfFilePath, e);
|
||||
logger.error("Convert pdf to jpg exception, pdfFilePath:{}", pdfFilePath, e);
|
||||
throw new Exception(e);
|
||||
}finally {
|
||||
if (doc != null) { //关闭
|
||||
@ -356,7 +355,6 @@ public class FileHandlerService {
|
||||
fileName = strs[1] + urlStrr.trim();
|
||||
attribute.setSkipDownLoad(true);
|
||||
}
|
||||
// System.out.println(fileName);
|
||||
url = WebUtils.encodeUrlFileName(url);
|
||||
fileName = KkFileUtils.htmlEscape(fileName); //文件名处理
|
||||
attribute.setType(type);
|
||||
@ -374,7 +372,7 @@ public class FileHandlerService {
|
||||
attribute.setFileKey(fileKey);
|
||||
}
|
||||
if ("true".equalsIgnoreCase(forceUpdatedCache)) {
|
||||
attribute.setforceUpdatedCache(true);
|
||||
attribute.setForceUpdatedCache(true);
|
||||
}
|
||||
|
||||
String tifPreviewType = req.getParameter("tifPreviewType");
|
||||
|
||||
@ -56,7 +56,8 @@ public class CadFilePreviewImpl implements FilePreview {
|
||||
if (!convertResult) {
|
||||
return otherFilePreview.notSupportedFile(model, fileAttribute, "cad文件转换异常,请联系管理员");
|
||||
}
|
||||
if( ConfigConstants.getdeletesourcefile()){ //是否保留CAD源文件
|
||||
//是否保留CAD源文件
|
||||
if( ConfigConstants.getDeleteSourceFile()) {
|
||||
KkFileUtils.deleteFileByPath(filePath);
|
||||
}
|
||||
if (ConfigConstants.isCacheEnabled()) {
|
||||
|
||||
@ -61,7 +61,8 @@ public class CompressFilePreviewImpl implements FilePreview {
|
||||
}
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(fileTree)) {
|
||||
if( ConfigConstants.getdeletesourcefile()){ //是否保留压缩包源文件
|
||||
//是否保留压缩包源文件
|
||||
if (ConfigConstants.getDeleteSourceFile()) {
|
||||
KkFileUtils.deleteFileByPath(filePath);
|
||||
}
|
||||
if (ConfigConstants.isCacheEnabled()) {
|
||||
|
||||
@ -114,7 +114,8 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
||||
// 对转换后的文件进行操作(改变编码方式)
|
||||
fileHandlerService.doActionConvertedFile(outFilePath);
|
||||
}
|
||||
if(ConfigConstants.getdeletesourcefile()){ //是否保留OFFICE源文件
|
||||
//是否保留OFFICE源文件
|
||||
if (ConfigConstants.getDeleteSourceFile()) {
|
||||
KkFileUtils.deleteFileByPath(filePath);
|
||||
}
|
||||
if (isUseCached) {
|
||||
|
||||
@ -60,8 +60,9 @@ public class TiffFilePreviewImpl implements FilePreview {
|
||||
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
|
||||
}
|
||||
String filePath = response.getContent();
|
||||
if(ConvertPicUtil.convertJpg2Pdf(filePath, outFilePath)){
|
||||
if(ConfigConstants.getdeletesourcefile()){ //是否保留TIFF源文件
|
||||
if (ConvertPicUtil.convertJpg2Pdf(filePath, outFilePath)) {
|
||||
//是否保留TIFF源文件
|
||||
if (ConfigConstants.getDeleteSourceFile()) {
|
||||
KkFileUtils.deleteFileByPath(filePath);
|
||||
}
|
||||
if (ConfigConstants.isCacheEnabled()) {
|
||||
@ -70,11 +71,10 @@ public class TiffFilePreviewImpl implements FilePreview {
|
||||
}
|
||||
model.addAttribute("pdfUrl", pdfName);
|
||||
return PDF_FILE_PREVIEW_PAGE;
|
||||
}else {
|
||||
} else {
|
||||
return NOT_SUPPORTED_FILE_PAGE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
model.addAttribute("pdfUrl", pdfName);
|
||||
return PDF_FILE_PREVIEW_PAGE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user