From cc587adb7a5a4a4250aa9a4eae11488143b2feb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=9B=84?= Date: Fri, 12 May 2023 01:51:27 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96CAD=20=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=96=B9=E6=B3=95=20=E4=BC=98=E5=8C=96CAD=20?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E8=B5=84=E6=BA=90=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 高雄 --- .../cn/keking/service/impl/CadFilePreviewImpl.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/cn/keking/service/impl/CadFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/CadFilePreviewImpl.java index 7d08d282..2c59b956 100644 --- a/server/src/main/java/cn/keking/service/impl/CadFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/CadFilePreviewImpl.java @@ -12,6 +12,8 @@ import org.springframework.stereotype.Service; import org.springframework.ui.Model; import org.springframework.util.StringUtils; +import java.util.List; + import static cn.keking.service.impl.OfficeFilePreviewImpl.getPreviewType; /** @@ -51,10 +53,15 @@ public class CadFilePreviewImpl implements FilePreview { return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg()); } filePath = response.getContent(); + String imageUrls = null; if (StringUtils.hasText(outFilePath)) { - boolean convertResult = fileHandlerService.cadToPdf(filePath, outFilePath); - if (!convertResult) { - return otherFilePreview.notSupportedFile(model, fileAttribute, "cad文件转换异常,请联系管理员"); + try { + imageUrls = fileHandlerService.cadToPdf(filePath, outFilePath); + } catch (Exception e) { + e.printStackTrace(); + } + if (imageUrls == null ) { + return otherFilePreview.notSupportedFile(model, fileAttribute, "office转图片异常,请联系管理员"); } //是否保留CAD源文件 if( ConfigConstants.getDeleteSourceFile()) {