From 6d3c8e9c8800becec33e714c2ec42703bb1cef50 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期一, 25 八月 2025 17:42:08 +0800
Subject: [PATCH] 两网交互添加图片

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java
index 586e458..85e3df8 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java
@@ -48,6 +48,9 @@
     @Value("${fileHomePath}")
     private String fileHomePath;
 
+    @Value("${jeecg.path.upload}")
+    private String upLoadPath;
+
     @Autowired
     private MdcEquipmentMapper mdcEquipmentMapper;
 
@@ -201,10 +204,34 @@
                 throw new RuntimeException("鏂囦欢浼犺緭璺緞鑾峰彇澶辫触");
             }
 
-            // 10.鍒犻櫎涓存椂NC鏂囦欢涓巎son鏂囦欢
+            // 璁$畻鍚庝竴涓枃浠跺悕
+            long nextNumber = Long.parseLong(numericPart);
+            nextNumber++;
+
+            //鑾峰彇搴忓垪鍖栫殑绋嬪簭纭琛ㄦ暟鎹�
+            GuideCardBatch guideCardBatch=pkg.getTraceChain().getGuideCardBatch();
+
+            //鑾峰彇鏂囦欢璺緞
+            String pictureUrl=guideCardBatch.getPicture();
+
+            // 淇濇寔鐩稿悓浣嶆暟鏍煎紡
+            String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber);
+            String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1];
+            String nextFilePath = path.getParent().resolve(nextFileName).toString();
+
+            //鎷兼帴鐜版湁璺緞
+            String picturePtah=upLoadPath+"/"+pictureUrl;
+
+            // 9. 澶嶅埗鏂囦欢骞堕噸鍛藉悕
+            logger.info("澶嶅埗鏂囦欢: {} 鈫� {}", nextFilePath,picturePtah);
+            Path PicSource= Paths.get(nextFilePath);
+            Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING);
+
+            // 鍒犻櫎鏂囦欢
             logger.info("鍒犻櫎涓存椂鏂囦欢: {}", ncFilePath);
             Files.delete(source);
             Files.delete(path);
+            Files.delete(PicSource);
 
             return JsonUtils.fromJson(json, TransferPackage.class);
 

--
Gitblit v1.9.3