|
@@ -115,7 +115,7 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
Map result;
|
|
|
logger.info("testpreviewWPS..." + path + ", " + ext);
|
|
|
|
|
|
- if (YunHomeService.isNotNeedDeal(ext)) {
|
|
|
+ if (YunHomeService.isNotNeedDeal(ext) && !"pdf".equals(ext) && !"txt".equals(ext)) {
|
|
|
logger.info("testpreviewWPS...10001001");
|
|
|
|
|
|
Map<String, String> headerMap = new HashMap();
|
|
@@ -125,6 +125,8 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
|
|
|
try {
|
|
|
in = this.fileService.download(path, headerMap, new HashMap());
|
|
|
+
|
|
|
+ in = FileSECUtils.processFileWithSEC(path, in);
|
|
|
} catch (Exception var19) {
|
|
|
result = ExceptionUtil.setErrorInfo(var19.getMessage());
|
|
|
previewResult.put(PreviewParams.STATUS.getEnumName(), PreviewParams.ERROR.getEnumName());
|
|
@@ -163,8 +165,6 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
|
|
|
logger.info("testpreviewWPS...10001003解密");
|
|
|
|
|
|
- in = FileSECUtils.processFileWithSEC(path, in);
|
|
|
-
|
|
|
endTime = System.currentTimeMillis();
|
|
|
if (!"xls".equalsIgnoreCase(ext) && !"xlsx".equalsIgnoreCase(ext)) {
|
|
|
previewResult.put(PreviewParams.STATUS.getEnumName(), PreviewParams.PDF_SUCCESS.getEnumName());
|
|
@@ -208,7 +208,7 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
logger.info("testpreviewFromCacheWPS...");
|
|
|
|
|
|
String ext = fileName.substring(fileName.lastIndexOf(46) + 1);
|
|
|
- if (YunHomeService.isNotNeedDeal(ext)) {
|
|
|
+ if (YunHomeService.isNotNeedDeal(ext) && !"pdf".equals(ext) && !"txt".equals(ext)) {
|
|
|
logger.info("testpreviewFromCacheWPS...10001001");
|
|
|
|
|
|
InputStream in = DecodeFileFactory.getDecodeService().getDecodeFileStream(cacheIn);
|
|
@@ -247,7 +247,6 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
|
|
|
|
|
|
logger.info("getYunPanCovertRs...100010012");
|
|
|
- checkInputStream = FileSECUtils.processFileWithSEC(path, checkInputStream);
|
|
|
|
|
|
boolean checkResult = checkFileSize(checkInputStream, fileName, limit == 0L ? limitMax : limit);
|
|
|
if (!checkResult) {
|
|
@@ -269,8 +268,6 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
in = this.yunPanConvert(path, fileName, userAgent, detail, temp);
|
|
|
logger.info("getYunPanCovertRs...100010014");
|
|
|
|
|
|
- in = FileSECUtils.processFileWithSEC(path, in);
|
|
|
-
|
|
|
|
|
|
} catch (Exception var19) {
|
|
|
result = ExceptionUtil.setErrorInfo(var19.getMessage());
|
|
@@ -408,8 +405,6 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
|
|
|
logger.info("yunPanConvert...fileName" + fileName);
|
|
|
|
|
|
- in = FileSECUtils.processFileWithSEC(fileName, in);
|
|
|
-
|
|
|
if (in == null) {
|
|
|
throw new KDException(BosErrorCode.previewFailed, new Object[]{BosRes.get("bos-fileservice-sdk", "DefaultPreviewServiceImpl_3", "从云盘中未获取到pdf流数据,pdf转换失败:", new Object[0])});
|
|
|
} else {
|
|
@@ -420,23 +415,21 @@ public class DefaultPreviewCusServiceImpl implements PreviewService {
|
|
|
|
|
|
logger.info("yunPanConvert...in:" + in);
|
|
|
|
|
|
-// if (statusCode != 200) {
|
|
|
-// try {
|
|
|
-// if (isLog()) {
|
|
|
-// logger.error("yunpan return msg:" + IOUtils.toString(in, "utf-8"));
|
|
|
-// }
|
|
|
-//
|
|
|
-// in.close();
|
|
|
-// } catch (IOException var17) {
|
|
|
-// logger.error("logger error info fail");
|
|
|
-// }
|
|
|
-//
|
|
|
-// throw new KDException(BosErrorCode.previewFailed, new Object[]{this.getErrorMsg(statusCode)});
|
|
|
-// } else {
|
|
|
-// return in;
|
|
|
-// }
|
|
|
+ if (statusCode != 200) {
|
|
|
+ try {
|
|
|
+ if (isLog()) {
|
|
|
+ logger.error("yunpan return msg:" + IOUtils.toString(in, "utf-8"));
|
|
|
+ }
|
|
|
|
|
|
- return in;
|
|
|
+ in.close();
|
|
|
+ } catch (IOException var17) {
|
|
|
+ logger.error("logger error info fail");
|
|
|
+ }
|
|
|
+
|
|
|
+ throw new KDException(BosErrorCode.previewFailed, new Object[]{this.getErrorMsg(statusCode)});
|
|
|
+ } else {
|
|
|
+ return in;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|