From 9bad721754fe8bbe2e5f459d0706e0fefac569f3 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期日, 20 九月 2026 09:05:41 +0800
Subject: [PATCH] feat(mes): 添加智能质检报告功能与AI导入能力

---
 yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/ai/CrmSaleQuotationAiServiceImpl.java |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/ai/CrmSaleQuotationAiServiceImpl.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/ai/CrmSaleQuotationAiServiceImpl.java
index b82c22d..ea2adde 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/ai/CrmSaleQuotationAiServiceImpl.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/quotation/ai/CrmSaleQuotationAiServiceImpl.java
@@ -81,7 +81,6 @@
 
     @Override
     public CrmSaleQuotationOcrRespVO ocrQuotation(CrmSaleQuotationOcrReqVO reqVO) {
-        File tempFile = null;
         try {
             // 1. 涓嬭浇鏂囦欢
             SystemStorageBlobDO blob = blobService.getStorageBlob(reqVO.getBlobId());
@@ -99,14 +98,14 @@
                 return error;
             }
 
-            // 3. 鑾峰彇鏂囦欢瀛楄妭
-            tempFile = blobService.getPublicFile(blob.getUidFilename(), blob.getResourceKey());
-            if (tempFile == null || !tempFile.exists()) {
+            // 3. 鑾峰彇鏂囦欢瀛楄妭銆傝繖閲屾槸纾佺洏涓婄湡瀹炲瓨鍌ㄧ殑閭d唤 blob锛屼笉鏄复鏃跺壇鏈紝璇诲畬涓嶈兘鍒犮��
+            File blobFile = blobService.getPublicFile(blob.getUidFilename(), blob.getResourceKey());
+            if (blobFile == null || !blobFile.exists()) {
                 CrmSaleQuotationOcrRespVO error = new CrmSaleQuotationOcrRespVO();
                 error.setRawText("鏂囦欢璇诲彇澶辫触");
                 return error;
             }
-            byte[] fileBytes = Files.readAllBytes(tempFile.toPath());
+            byte[] fileBytes = Files.readAllBytes(blobFile.toPath());
 
             // 4. AI 璇嗗埆锛堝浘鐗囪蛋澶氭ā鎬侊紝鏂囨湰璧扮函鏂囨湰锛�
             boolean isImage = IMAGE_EXTENSIONS.contains(ext);
@@ -137,10 +136,6 @@
             CrmSaleQuotationOcrRespVO fallback = new CrmSaleQuotationOcrRespVO();
             fallback.setRawText("AI 璇嗗埆鏆傛椂涓嶅彲鐢紝璇锋墜鍔ㄥ綍鍏�");
             return fallback;
-        } finally {
-            if (tempFile != null && tempFile.exists()) {
-                tempFile.delete();
-            }
         }
     }
 

--
Gitblit v1.9.3