From b12c93dbaeaf316e7845178e040d345d91469e2d Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 02 九月 2025 17:55:08 +0800
Subject: [PATCH] yys  将文件迁移改为复制+删除

---
 src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java
index d34a291..72ce890 100644
--- a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java
@@ -71,6 +71,9 @@
     @Override
     public IPage<MeasuringInstrumentLedger> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) {
         IPage<MeasuringInstrumentLedger> measuringInstrumentLedgerIPage = measuringInstrumentLedgerMapper.listPage(page, measuringInstrumentLedger);
+        List<Integer>  types = new ArrayList<>();
+        types.add(FileNameType.MEASURING.getValue());
+        types.add(FileNameType.MEASURINGRecord.getValue());
         measuringInstrumentLedgerIPage.getRecords().forEach(item -> {
             LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
             measuringInstrumentLedgerRecordLambdaQueryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId, item.getId());
@@ -81,7 +84,8 @@
             }
             collect.add(item.getId());
             LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>();
-            salesLedgerFileWrapper.in(CommonFile::getCommonId, collect);
+            salesLedgerFileWrapper.in(CommonFile::getCommonId, collect)
+                    .in(CommonFile::getType,types);
             List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper);
             item.setCommonFiles(commonFiles);
 
@@ -185,12 +189,15 @@
 
             try {
                 // 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級
-                Files.move(
-                        Paths.get(tempFile.getTempPath()),
-                        formalFilePath,
-                        StandardCopyOption.REPLACE_EXISTING,
-                        StandardCopyOption.ATOMIC_MOVE
-                );
+//                Files.move(
+//                        Paths.get(tempFile.getTempPath()),
+//                        formalFilePath,
+//                        StandardCopyOption.REPLACE_EXISTING,
+//                        StandardCopyOption.ATOMIC_MOVE
+//                );
+                // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎
+                Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
+                Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
                 log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
 
                 // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�

--
Gitblit v1.9.3