From 108cd2008535e1fc703032cbe5bbbd3145e90ddc Mon Sep 17 00:00:00 2001 From: maven <2163098428@qq.com> Date: 星期三, 06 八月 2025 11:42:25 +0800 Subject: [PATCH] yys 修改记录器具bug --- src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java | 13 +++++++------ src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerRecordServiceImpl.java | 7 +++---- 2 files changed, 10 insertions(+), 10 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..bca4629 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 @@ -88,14 +89,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; 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 80cba1e..d34a291 100644 --- a/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java +++ b/src/main/java/com/ruoyi/measuringinstrumentledger/service/impl/MeasuringInstrumentLedgerServiceImpl.java @@ -75,14 +75,15 @@ LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecordLambdaQueryWrapper = new LambdaQueryWrapper<>(); measuringInstrumentLedgerRecordLambdaQueryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId, item.getId()); List<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecords = measuringInstrumentLedgerRecordMapper.selectList(measuringInstrumentLedgerRecordLambdaQueryWrapper); + List<Long> collect = new ArrayList<>(); if(!CollectionUtils.isEmpty(measuringInstrumentLedgerRecords)){ - List<Long> collect = measuringInstrumentLedgerRecords.stream().map(MeasuringInstrumentLedgerRecord::getId).collect(Collectors.toList()); - collect.add(item.getId()); - LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); - salesLedgerFileWrapper.in(CommonFile::getCommonId, collect); - List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper); - item.setCommonFiles(commonFiles); + collect = measuringInstrumentLedgerRecords.stream().map(MeasuringInstrumentLedgerRecord::getId).collect(Collectors.toList()); } + collect.add(item.getId()); + LambdaQueryWrapper<CommonFile> salesLedgerFileWrapper = new LambdaQueryWrapper<>(); + salesLedgerFileWrapper.in(CommonFile::getCommonId, collect); + List<CommonFile> commonFiles = commonFileMapper.selectList(salesLedgerFileWrapper); + item.setCommonFiles(commonFiles); }); return measuringInstrumentLedgerIPage; -- Gitblit v1.9.3