增加日志
This commit is contained in:
parent
60ee0247fa
commit
c0ab0af5ec
|
|
@ -125,7 +125,7 @@ pdf.bookmark.disable = ${KK_PDF_BOOKMARK_DISABLE:true}
|
|||
pdf.disable.editing = ${KK_PDF_DISABLE_EDITING:false}
|
||||
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
||||
#image or pdf
|
||||
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:image}
|
||||
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:pdf}
|
||||
#是否关闭office预览切换开关,默认为false,可配置为true关闭
|
||||
office.preview.switch.disabled = ${KK_OFFICE_PREVIEW_SWITCH_DISABLED:false}
|
||||
|
||||
|
|
@ -193,15 +193,11 @@ token.enable=${KK_TOKEN_ENABLE:true}
|
|||
#Unit, unit is minute
|
||||
token.expire.time=${KK_TOKEN_EXPIRE_TIME:10}
|
||||
|
||||
#????
|
||||
#aes key
|
||||
aes.key.algorithm=${KK_AESKEY_ALGORITHM:AES}
|
||||
#???????????
|
||||
aes.cipher.algorithm=${KK_AESKEY_CIPHER_ALGORITHM:AES/CBC/PKCS7Padding}
|
||||
#?????
|
||||
aes.encryption.provider = ${KK_AESKEY_ENCRYPTION_PROVIDER:BC}
|
||||
#??
|
||||
aes.key=${KK_AESKEY_KEY:zhgd@bonus@zhgd@bonus@1234567890}
|
||||
#???
|
||||
aes.iv=${KK_AESKEY_IV:1234567812345678}
|
||||
|
||||
password.error.msg = ${PASSWORD_ERROR_MSG:password}
|
||||
|
|
@ -10,10 +10,13 @@ import cn.keking.utils.DownloadUtils;
|
|||
import cn.keking.utils.KkFileUtils;
|
||||
import cn.keking.utils.OfficeUtils;
|
||||
import cn.keking.utils.WebUtils;
|
||||
import cn.keking.web.controller.OnlinePreviewController;
|
||||
import cn.keking.web.filter.BaseUrlFilter;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.jodconverter.core.office.OfficeException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
@ -32,6 +35,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
|||
public static final String OFFICE_PREVIEW_TYPE_ALL_IMAGES = "allImages";
|
||||
private static final String OFFICE_PASSWORD_MSG = ConfigConstants.getPasswordErrorMsg();
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(OfficeFilePreviewImpl.class);
|
||||
private final FileHandlerService fileHandlerService;
|
||||
private final OfficeToPdfService officeToPdfService;
|
||||
private final OtherFilePreviewImpl otherFilePreview;
|
||||
|
|
@ -87,7 +91,9 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
|||
} else {
|
||||
if (StringUtils.hasText(outFilePath)) {
|
||||
try {
|
||||
logger.info("start to officeToPdfService.openOfficeToPDF");
|
||||
officeToPdfService.openOfficeToPDF(filePath, outFilePath, fileAttribute);
|
||||
logger.info("end to officeToPdfService.openOfficeToPDF");
|
||||
} catch (OfficeException e) {
|
||||
if (isPwdProtectedOffice && !OfficeUtils.isCompatible(filePath, filePassword)) {
|
||||
// 加密文件密码错误,提示重新输入
|
||||
|
|
@ -137,7 +143,9 @@ public class OfficeFilePreviewImpl implements FilePreview {
|
|||
List<String> imageUrls = null;
|
||||
// long startime = System.currentTimeMillis();
|
||||
try {
|
||||
System.out.println("start to fileHandlerService.pdf2jpg");
|
||||
imageUrls = fileHandlerService.pdf2jpg(outFilePath,outFilePath, pdfName, fileAttribute);
|
||||
System.out.println("end to fileHandlerService.pdf2jpg");
|
||||
//System.out.println("fileHandlerService.pdf2jpg 结果:" +imageUrls + ",outFilePath:" + outFilePath + ",pdfName:" + pdfName );
|
||||
} catch (Exception e) {
|
||||
Throwable[] throwableArray = ExceptionUtils.getThrowables(e);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import cn.keking.utils.DownloadUtils;
|
|||
import cn.keking.utils.WebUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
|
|
@ -25,6 +27,7 @@ public class PdfFilePreviewImpl implements FilePreview {
|
|||
private final FileHandlerService fileHandlerService;
|
||||
private final OtherFilePreviewImpl otherFilePreview;
|
||||
private final String pdfPwdErrorMsg = ConfigConstants.getPasswordErrorMsg();
|
||||
private final Logger logger = LoggerFactory.getLogger(PdfFilePreviewImpl.class);
|
||||
public PdfFilePreviewImpl(FileHandlerService fileHandlerService, OtherFilePreviewImpl otherFilePreview) {
|
||||
this.fileHandlerService = fileHandlerService;
|
||||
this.otherFilePreview = otherFilePreview;
|
||||
|
|
@ -51,7 +54,9 @@ public class PdfFilePreviewImpl implements FilePreview {
|
|||
}
|
||||
List<String> imageUrls;
|
||||
try {
|
||||
logger.info("start to fileHandlerService.pdf2jpg");
|
||||
imageUrls = fileHandlerService.pdf2jpg(originFilePath,outFilePath, pdfName, fileAttribute);
|
||||
logger.info("end to fileHandlerService.pdf2jpg");
|
||||
} catch (Exception e) {
|
||||
Throwable[] throwableArray = ExceptionUtils.getThrowables(e);
|
||||
for (Throwable throwable : throwableArray) {
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ public class OnlinePreviewController {
|
|||
}
|
||||
|
||||
@GetMapping( "/onlinePreview")
|
||||
public String onlinePreview(String url, Model model, HttpServletRequest req, @RequestHeader("Token") String headerValue) {
|
||||
public String onlinePreview(String url, Model model, HttpServletRequest req, String token) {
|
||||
|
||||
String fileUrl;
|
||||
try {
|
||||
if (!WebUtils.checkToken(headerValue)) {
|
||||
if (!WebUtils.checkToken(token)) {
|
||||
return otherFilePreview.notSupportedFile(model, "token 错误");
|
||||
}
|
||||
fileUrl = WebUtils.decodeUrl(url);
|
||||
|
|
@ -90,11 +90,11 @@ public class OnlinePreviewController {
|
|||
|
||||
@GetMapping( "/onConvert")
|
||||
@ResponseBody
|
||||
public String onConvert(String url, Model model, HttpServletRequest req, @RequestHeader("Token") String headerValue) {
|
||||
public String onConvert(String url, Model model, HttpServletRequest req, String token) {
|
||||
|
||||
String fileUrl;
|
||||
try {
|
||||
if (!WebUtils.checkToken(headerValue)) {
|
||||
if (!WebUtils.checkToken(token)) {
|
||||
return otherFilePreview.notSupportedFile(model, "token 错误");
|
||||
}
|
||||
fileUrl = WebUtils.decodeUrl(url);
|
||||
|
|
|
|||
Loading…
Reference in New Issue