From 4e2dbadb64676b7913ad8bd6f1394b9983e4365c Mon Sep 17 00:00:00 2001 From: 许鹏程 <1821349743@qq.com> Date: 星期四, 26 九月 2024 10:04:53 +0800 Subject: [PATCH] 底层redis迭代修改不兼容代码 --- src/main/java/com/product/file/util/PdfConcurrenceUtil.java | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/product/file/util/PdfConcurrenceUtil.java b/src/main/java/com/product/file/util/PdfConcurrenceUtil.java index 784fc7c..5d053be 100644 --- a/src/main/java/com/product/file/util/PdfConcurrenceUtil.java +++ b/src/main/java/com/product/file/util/PdfConcurrenceUtil.java @@ -152,6 +152,7 @@ * @param output * @return */ + @Deprecated public static File convertToPdf(String input, String output) throws Exception { File inputFile = null; File outFile = null; @@ -178,4 +179,41 @@ } return outFile; } + /** + * 杞崲pdf + * @param input + * @param output + * @return + */ + public static File convertToPdf(String input, String output,String officeType) throws Exception { + File inputFile = null; + File outFile = null; + OfficeManager officeManager = null; + try { + if(Global.getPropertyToBoolean("open.office.isEnable", "false")) {//鍚敤oepn office杞崲 + officeManager = officeManagerQueue.take(); + inputFile = new File(input); + outFile = new File(output); + SpringMVCContextHolder.getSystemLogger().info("寮�濮嬭浆鎹㈡枃妗o細" + input + "=>" + output); + OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); + converter.convert(inputFile, outFile); // 杞崲鏂囨。 + }else{ + outFile = new File(AsposeUtil.OfficeToPdf(input, output,officeType)); + } + + }catch (Exception e) { + outFile = null; + throw e; + } finally { + SpringMVCContextHolder.getSystemLogger().info("缁撴潫杞崲鏂囨。"); + if (officeManager != null) { + try { + officeManagerQueue.put(officeManager); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + return outFile; + } } -- Gitblit v1.9.2