From 2228c6fa1bec43a5269eafdd9e74ab06268c51a5 Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期五, 05 九月 2025 10:46:27 +0800 Subject: [PATCH] yys --- src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java index 0dbdc71..88e3bbc 100644 --- a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java +++ b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java @@ -35,6 +35,7 @@ import java.util.Date; import java.util.List; import java.util.UUID; +import java.util.stream.Collectors; /** * @author :yys @@ -64,7 +65,8 @@ IPage<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecordIPage = measuringInstrumentLedgerRecordMapper.listPage(page, measuringInstrumentLedgerRecord); measuringInstrumentLedgerRecordIPage.getRecords().forEach(item -> { LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); - salesLedgerFileWrapper.eq(CommonFile::getCommonId, item.getId()); + salesLedgerFileWrapper.eq(CommonFile::getCommonId, item.getId()) + .eq(CommonFile::getType, FileNameType.MEASURINGRecord.getValue()); List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper); item.setCommonFiles(commonFiles); }); @@ -88,14 +90,12 @@ if(!measuringInstrumentLedgerRecord1.getValid().equals(measuringInstrumentLedgerRecord.getValid())){ MeasuringInstrumentLedger measuringInstrumentLedger = measuringInstrumentLedgerMapper.selectById(measuringInstrumentLedgerRecord1.getMeasuringInstrumentLedgerId()); if(measuringInstrumentLedger != null){ + measuringInstrumentLedger.setValid(measuringInstrumentLedgerRecord.getValid()); measuringInstrumentLedger.setNextDate(new Date(measuringInstrumentLedger.getMostDate().getTime() + measuringInstrumentLedgerRecord.getValid() * 24 * 60 * 60 * 1000L)); } measuringInstrumentLedgerMapper.updateById(measuringInstrumentLedger); } - // 鍒犻櫎闄勪欢 - LambdaQueryWrapper<CommonFile> delWrapper = new LambdaQueryWrapper<>(); - delWrapper.eq(CommonFile::getCommonId, measuringInstrumentLedgerRecord.getId()); - commonFileMapper.delete(delWrapper); + measuringInstrumentLedgerRecordMapper.updateById(measuringInstrumentLedgerRecord); // 璁板綍闄勪欢缁戝畾 migrateTempFilesToFormal(measuringInstrumentLedgerRecord.getId(), measuringInstrumentLedgerRecord.getTempFileIds(), FileNameType.MEASURINGRecord.getValue()); return true; @@ -144,12 +144,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