7 小时以前 9bad721754fe8bbe2e5f459d0706e0fefac569f3
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. 获取文件字节。这里是磁盘上真实存储的那份 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();
            }
        }
    }