From 14ac73b5dda63b4a0bda4eed861edaef9d0035f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BB=BA=E5=9B=BD?= Date: Thu, 20 Feb 2025 14:50:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(control):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E5=8A=9F=E8=83=BD=E8=BF=94=E5=9B=9E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 startScan 方法的第二个参数固定为 false - 修改返回值类型,从 Base64 编码的图片列表改为文件路径列表 - 使用 FileUtil.getAbsolutePath 获取文件绝对路径 --- src/main/java/org/aohe/control/Operational.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/aohe/control/Operational.java b/src/main/java/org/aohe/control/Operational.java index c1f57bf..91c54e3 100644 --- a/src/main/java/org/aohe/control/Operational.java +++ b/src/main/java/org/aohe/control/Operational.java @@ -1,6 +1,7 @@ package org.aohe.control; import cn.hutool.core.codec.Base64; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.lang.Console; import com.alibaba.fastjson2.JSONObject; import lombok.extern.slf4j.Slf4j; @@ -218,7 +219,7 @@ public class Operational { * @throws TwainException default error */ public static R startScan(String name) throws TwainException { - return startScan(name, isSystemUI); + return startScan(name, false); } /** @@ -233,11 +234,13 @@ public class Operational { initSettings(source); source.setName(name); List fileList = source.scan(); - List base64Files = new ArrayList<>(); + List filePath = new ArrayList<>(); for (File file : fileList){ - base64Files.add(Base64.encode(file)); + String absolutePath = FileUtil.getAbsolutePath(file); + filePath.add(absolutePath); } - return R.ok(base64Files); + + return R.ok(filePath); } private static void initSettings(Source source) {