From 29b0e06f470cd2ee33fe9dabfa732deab796dab9 Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期五, 26 九月 2025 11:42:46 +0800 Subject: [PATCH] 搜索 --- archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 111 insertions(+), 6 deletions(-) diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java index 4036f57..7fc704d 100644 --- a/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java +++ b/archiveManager/src/main/java/com/ruoyi/service/impl/ArchiveRecordsServiceImpl.java @@ -11,13 +11,18 @@ import com.ruoyi.common.utils.MapUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ArchiveRecords; import com.ruoyi.domain.Archiverecordstouser; +import com.ruoyi.domain.vo.AnalysisResult; +import com.ruoyi.domain.vo.ArchiveInfoVo; +import com.ruoyi.domain.vo.ArchiveRecordSmall; import com.ruoyi.mapper.ArchiveRecordsMapper; import com.ruoyi.mapper.ArchiverecordstouserMapper; import com.ruoyi.service.IArchiveRecordsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; /** * 妗f璁板綍Service涓氬姟灞傚鐞� @@ -40,10 +45,35 @@ private LambdaQueryWrapper<ArchiveRecords> buildCondition(ArchiveRecords archiveRecords, Long userId){ LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>(); - lqw.like(!StringUtils.isEmpty(archiveRecords.getProjectName()), ArchiveRecords::getProjectName, archiveRecords.getProjectName()) + System.out.println(archiveRecords.getIds()); + + lqw.like(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId, archiveRecords.getRecordId()) + .like(!StringUtils.isEmpty(archiveRecords.getInquiryNumber()), ArchiveRecords::getInquiryNumber, archiveRecords.getInquiryNumber()) + .like(!StringUtils.isEmpty(archiveRecords.getCaseTitle()), ArchiveRecords::getCaseTitle, archiveRecords.getCaseTitle()) + .like(!StringUtils.isEmpty(archiveRecords.getPublicAttribute()), ArchiveRecords::getPublicAttribute, archiveRecords.getPublicAttribute()) + .like(!StringUtils.isEmpty(archiveRecords.getPreparationUnit()), ArchiveRecords::getPreparationUnit, archiveRecords.getPreparationUnit()) + .like(!StringUtils.isEmpty(archiveRecords.getRetentionPeriod()), ArchiveRecords::getRetentionPeriod, archiveRecords.getRetentionPeriod()) + .like(!StringUtils.isEmpty(archiveRecords.getSecurityClassification()), ArchiveRecords::getSecurityClassification, archiveRecords.getSecurityClassification()) .like(!StringUtils.isEmpty(archiveRecords.getFilingNumber()), ArchiveRecords::getFilingNumber, archiveRecords.getFilingNumber()) + .like(!StringUtils.isEmpty(archiveRecords.getConstructionUnit()), ArchiveRecords::getConstructionUnit, archiveRecords.getConstructionUnit()) + .like(!StringUtils.isEmpty(archiveRecords.getConstructionAddress()), ArchiveRecords::getConstructionAddress, archiveRecords.getConstructionAddress()) + .like(!StringUtils.isEmpty(archiveRecords.getProjectName()), ArchiveRecords::getProjectName, archiveRecords.getProjectName()) + .like(!StringUtils.isEmpty(archiveRecords.getProjectNumber()), ArchiveRecords::getProjectNumber, archiveRecords.getProjectNumber()) + .like(!StringUtils.isEmpty(archiveRecords.getScanningCompany()), ArchiveRecords::getScanningCompany, archiveRecords.getScanningCompany()) .like(!StringUtils.isEmpty(archiveRecords.getArchiveRoomNumber()), ArchiveRecords::getArchiveRoomNumber, archiveRecords.getArchiveRoomNumber()) - .like(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId, archiveRecords.getRecordId()); + .like(!StringUtils.isEmpty(archiveRecords.getMicrofilmNumber()), ArchiveRecords::getMicrofilmNumber, archiveRecords.getMicrofilmNumber()) + .like(!StringUtils.isEmpty(archiveRecords.getHistoricalReferenceNumber()), ArchiveRecords::getHistoricalReferenceNumber, archiveRecords.getHistoricalReferenceNumber()) + .eq(!StringUtils.isEmpty(archiveRecords.getRecordStatus()), ArchiveRecords::getRecordStatus, archiveRecords.getRecordStatus()) + .like(!StringUtils.isEmpty(archiveRecords.getEveryProjectName()), ArchiveRecords::getEveryProjectName, archiveRecords.getEveryProjectName()) + .like(!StringUtils.isEmpty(archiveRecords.getRemarks()), ArchiveRecords::getRemarks, archiveRecords.getRemarks()); + + + + if(archiveRecords.getIds()!=null) + lqw.in(ArchiveRecords::getId,new ArrayList<>(Arrays.asList(archiveRecords.getIds()))); + + + // .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation()) // .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder()) // .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress()) @@ -166,6 +196,10 @@ Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); archiveRecords.setCreateTime(date); + + + archiveRecords.setRecordStatus("鏈綍鍏�"); + // archiveRecords boolean res = this.save(archiveRecords); if(res) return 1; @@ -198,11 +232,13 @@ @Override public int deleteArchiveRecordsByIds(Long[] ids) { - if (this.removeByIds(Arrays.asList(ids))) { - return 1; + Long res = 0L; + for(Long id: ids) + { + this.baseMapper.updateAllInfoById(id); + } - else - return 0; + return 1; } /** @@ -216,4 +252,73 @@ { return 0; } + + @Override + public ArchiveInfoVo selectByRecordId(Long id) { + return this.baseMapper.findByRecordId(id); + } + + @Override + public AjaxResult importExcel(MultipartFile file) { + ExcelUtil<ArchiveRecords> util = new ExcelUtil<>(ArchiveRecords.class); + List<ArchiveRecords> dataList = null; + try { + dataList = util.importExcel(file.getInputStream()); + } catch (Exception e) { + throw new RuntimeException("娌℃湁鎸夌収瑙勫垯瀵煎叆鏁版嵁"); + } + + assert dataList != null; + + for (ArchiveRecords archiveRecords : dataList) { + // physcialService.mySave(physcial); + this.mySave(archiveRecords); + } + + return AjaxResult.success(); + } + + @Override + public List<AnalysisResult> statisticAya() { + return this.baseMapper.statisticAyasis(); + } + + @Override + public int updateArchiveById(Long id) { + this.baseMapper.updateStatusById(id); + return 0; + } + + @Override + public List<ArchiveRecordSmall> findByIds(ArchiveRecords archiveRecords) { + + LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>(); + if(archiveRecords.getIds()!=null) + lqw.in(ArchiveRecords::getId,new ArrayList<>(Arrays.asList(archiveRecords.getIds()))); + return this.baseMapper.selectByIds(lqw); + } + + + public AjaxResult mySave(ArchiveRecords archiveRecords) { + + + //妫�鏌ユ槸鍚︽湁閲嶅鏁版嵁鎻掑叆 + LambdaQueryWrapper<ArchiveRecords> lqw = new LambdaQueryWrapper<>(); + lqw.eq(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId,archiveRecords.getRecordId()); + List<ArchiveRecords> list = list(lqw); + if (list.size() > 0) { + // throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁"); + //濡傛灉鏈夐噸澶嶆暟鎹紝鍒欐牴鎹畆ecordId杩涜鏁版嵁淇敼 + this.baseMapper.update(archiveRecords, lqw); + return AjaxResult.success(); + } + else { + if (save(archiveRecords)) { + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } + + } } -- Gitblit v1.9.1