Kaynağa Gözat

feat(admin): 体脂秤图片数据采集器 — 修复 Java 8 兼容性问题

- 替换 Map.of() → HashMap + static block
- 修复 ArrayNode/ObjectNode 类型不匹配
- 修复 String.isBlank() → trim().isEmpty()
- 修复 var → 显式类型声明
- 编译验证通过
iwt 2 ay önce
ebeveyn
işleme
07aac712f8

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminBodyFatScaleController.java

@@ -28,7 +28,7 @@ public class AdminBodyFatScaleController {
     @PostMapping("/images/analyze")
     @PostMapping("/images/analyze")
     public Result<?> analyzeImage(@RequestBody Map<String, String> params) {
     public Result<?> analyzeImage(@RequestBody Map<String, String> params) {
         String imagePath = params.get("imagePath");
         String imagePath = params.get("imagePath");
-        if (imagePath == null || imagePath.isBlank()) {
+        if (imagePath == null || imagePath.trim().isEmpty()) {
             return Result.error("imagePath 不能为空");
             return Result.error("imagePath 不能为空");
         }
         }
         return Result.success(bodyFatScaleService.analyzeImage(imagePath));
         return Result.success(bodyFatScaleService.analyzeImage(imagePath));

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/service/BodyFatScaleService.java

@@ -142,7 +142,7 @@ public class BodyFatScaleService {
             ArrayNode messages = objectMapper.createArrayNode();
             ArrayNode messages = objectMapper.createArrayNode();
             ObjectNode userMsg = objectMapper.createObjectNode();
             ObjectNode userMsg = objectMapper.createObjectNode();
             userMsg.put("role", "user");
             userMsg.put("role", "user");
-            ObjectNode contentArr = objectMapper.createArrayNode();
+            ArrayNode contentArr = objectMapper.createArrayNode();
             ObjectNode textContent = objectMapper.createObjectNode();
             ObjectNode textContent = objectMapper.createObjectNode();
             textContent.put("type", "text");
             textContent.put("type", "text");
             textContent.put("text", prompt);
             textContent.put("text", prompt);