优化CAD 释放资源方法

优化CAD 释放资源方法

Signed-off-by: 高雄 <admin@cxcp.com>
This commit is contained in:
高雄 2023-05-12 01:51:27 +00:00 committed by Gitee
parent 1581fd277f
commit cc587adb7a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 10 additions and 3 deletions

View File

@ -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()) {