From 9f92084490d292fd2f5897438567a627f0c4b580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-S9HJSOEB=5C=E6=98=8A=E5=A4=A9?= Date: Fri, 23 Jan 2026 18:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=97=A0=E6=84=8F=E4=B9=89=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LxPointCloudSaveImage.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java b/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java index bfe3437..f9d7737 100644 --- a/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java +++ b/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java @@ -6,9 +6,12 @@ import com.sun.jna.ptr.PointerByReference; import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; @@ -21,6 +24,30 @@ public class LxPointCloudSaveImage { public static DcLibrary INSTANCER = (DcLibrary) Native.loadLibrary((System.getProperty("user.dir"))+"\\libs\\lx\\LxCameraApi.dll", DcLibrary.class); + static Map instanceMap = new ConcurrentHashMap<>(); + + public static boolean copyFileIfNotExists(String sourcePath, String destinationPath) { + Path destPath = Paths.get(destinationPath); + + // 检查目标文件是否存在 + if (Files.exists(destPath)) { + System.out.println("文件已存在: " + destinationPath); + return false; + } + + try { + // 创建父目录(如果不存在) + Files.createDirectories(destPath.getParent()); + + // 复制文件 + Files.copy(Paths.get(sourcePath), destPath, StandardCopyOption.REPLACE_EXISTING); + System.out.println("文件复制成功: " + sourcePath + " -> " + destinationPath); + return true; + } catch (IOException e) { + System.err.println("文件复制失败: " + e.getMessage()); + return false; + } + } // 设备句柄映射 static Map handleMap = new ConcurrentHashMap<>();