From 2f09efc660bf2cc94cbc5291ad25ca06fc9bdadf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 24 一月 2026 22:03:09 +0800
Subject: [PATCH] feat: 增加OCR测试,车辆

---
 ruoyi-system/src/main/java/com/ruoyi/system/file/FileUploadServiceImpl.java |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/file/FileUploadServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/file/FileUploadServiceImpl.java
index 1abb2aa..8b186b4 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/file/FileUploadServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/file/FileUploadServiceImpl.java
@@ -85,7 +85,7 @@
             log.info("寮�濮嬩笂浼犳枃浠跺埌PHP鎺ュ彛: fileName={}, targetPath={}", fileName, targetPath);
             
             // 璋冪敤PHP涓婁紶鎺ュ彛
-            String response = HttpUtils.postFile(legacyConfig.getFileServerUrl(), params, fileName);
+            String response = HttpUtils.postFile(legacyConfig.getFileUploadUrl(), params, fileName);
             
             log.info("PHP鎺ュ彛鍝嶅簲: {}", response);
             
@@ -107,7 +107,7 @@
         try {
             // 浠嶶RL涓嬭浇鏂囦欢
             byte[] fileBytes = downloadFromUrl(fileUrl);
-            if (fileBytes == null || fileBytes.length == 0) {
+            if (fileBytes.length == 0) {
                 return FileUploadResponse.error("浠嶶RL涓嬭浇鏂囦欢澶辫触");
             }
             
@@ -258,7 +258,7 @@
         }
         
         try {
-            log.info("寮�濮嬭В鏋怭HP鍝嶅簲: {}", response);
+//            log.info("寮�濮嬭В鏋怭HP鍝嶅簲: {}", response);
             
             // 鏍规嵁PHP鎺ュ彛鐨勫疄闄呰繑鍥炴牸寮忚繘琛岃В鏋�
             // PHP杩斿洖鏍煎紡: {"success": true, "message": "鏂囦欢涓婁紶鎴愬姛", "data": {...}}
@@ -267,7 +267,7 @@
                 String filePath = extractFilePathFromResponse(response);
                 String thumbnailPath = extractThumbnailPathFromResponse(response);
                 
-                log.info("瑙f瀽缁撴灉 - filePath: {}, thumbnailPath: {}", filePath, thumbnailPath);
+//                log.info("瑙f瀽缁撴灉 - filePath: {}, thumbnailPath: {}", filePath, thumbnailPath);
                 
                 // 鍒涘缓鍝嶅簲瀵硅薄
                 FileUploadResponse uploadResponse = FileUploadResponse.success(filePath, "涓婁紶鎴愬姛");
@@ -305,6 +305,8 @@
                         int end = dataSection.indexOf("\"", start);
                         if (start > 11 && end > start) {
                             String filePath = dataSection.substring(start, end);
+                            // 鍘婚櫎杞箟瀛楃
+                            filePath = filePath.replace("\\", "");
                             log.info("鎻愬彇鍒版枃浠惰矾寰�: {}", filePath);
                             return filePath;
                         }
@@ -346,6 +348,7 @@
                         if (start > 16 && end > start) {
                             String thumbnailPath = dataSection.substring(start, end);
                             log.info("鎻愬彇鍒扮缉鐣ュ浘璺緞: {}", thumbnailPath);
+                            thumbnailPath = thumbnailPath.replace("\\", ""); // 鍘婚櫎杞箟瀛楃
                             return thumbnailPath;
                         }
                     }
@@ -359,6 +362,7 @@
                 if (start > 16 && end > start) {
                     String thumbnailPath = response.substring(start, end);
                     log.info("鎻愬彇鍒扮缉鐣ュ浘璺緞(鏃ф牸寮�): {}", thumbnailPath);
+                    thumbnailPath = thumbnailPath.replace("\\", ""); // 鍘婚櫎杞箟瀛楃
                     return thumbnailPath;
                 }
             }
@@ -471,20 +475,7 @@
                 return uploadResponse;
             }
             
-            // 濡傛灉鏄浘鐗囷紝鐢熸垚缂╃暐鍥�
-            if (isImage && uploadResponse.getFilePath() != null) {
-                String originalPath = uploadResponse.getFilePath();
-                String thumbnailPath = generateThumbnailPath(originalPath);
-                
-                // 鐢熸垚缂╃暐鍥�
-                if (createThumbnail(originalPath, thumbnailPath, 100, 0)) {
-                    uploadResponse.setThumbnailPath(thumbnailPath);
-                    log.info("缂╃暐鍥剧敓鎴愭垚鍔燂細{}", thumbnailPath);
-                } else {
-                    log.warn("缂╃暐鍥剧敓鎴愬け璐ワ細{}", originalPath);
-                }
-            }
-            
+//            log.info("涓婁紶鏂囦欢鎴愬姛 鏂囦欢:{} 缂╃暐:{}",uploadResponse.getFilePath(),uploadResponse.getThumbnailPath());
             return uploadResponse;
             
         } catch (Exception e) {

--
Gitblit v1.9.1