refactor(control): 修改扫描功能返回文件路径
- 将 startScan 方法的第二个参数固定为 false - 修改返回值类型,从 Base64 编码的图片列表改为文件路径列表 - 使用 FileUtil.getAbsolutePath 获取文件绝对路径
This commit is contained in:
parent
6c0f398bb2
commit
14ac73b5dd
|
@ -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<File> fileList = source.scan();
|
||||
List<String> base64Files = new ArrayList<>();
|
||||
List<String> 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) {
|
||||
|
|
Loading…
Reference in New Issue