From afae2409d65e0c044b8119b3fd8f57e438c18a08 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期日, 09 十一月 2025 21:29:24 +0800
Subject: [PATCH] 修改了大量的代码块
---
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java | 129 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 115 insertions(+), 14 deletions(-)
diff --git a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
index 7b2d06f..c98e310 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -5,23 +5,28 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.domain.ArchiveRecords;
-import com.ruoyi.domain.Archiverecordstouser;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.ArchiveCategory;
import com.ruoyi.domain.DocumentMaterials;
+import com.ruoyi.domain.vo.*;
import com.ruoyi.mapper.DocumentMaterialsMapper;
-import com.ruoyi.service.IArchiveCategoryService;
import com.ruoyi.service.IDocumentMaterialsService;
+import com.ruoyi.util.ErrorcodeExceptionextends;
import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDateTime;
import java.time.ZoneId;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
+import java.util.*;
+/**
+ * 銆愭枃浠舵潗鏂欑患鍚堜俊鎭�慡ervice涓氬姟灞傚鐞�
+ *
+ * @author ruoyi
+ * @date 2025-07-26
+ */
@Service
public class DocumentMaterialsServiceImpl extends ServiceImpl<DocumentMaterialsMapper, DocumentMaterials> implements IDocumentMaterialsService {
private LambdaQueryWrapper<DocumentMaterials> buildCondition(DocumentMaterials documentMaterials){
@@ -36,8 +41,10 @@
.like(!StringUtils.isEmpty(documentMaterials.getRetentionPeriod()), DocumentMaterials::getRetentionPeriod, documentMaterials.getRetentionPeriod())
.like(!StringUtils.isEmpty(documentMaterials.getSecurityLevel()), DocumentMaterials::getSecurityLevel, documentMaterials.getSecurityLevel())
.eq(documentMaterials.getDate()!=null, DocumentMaterials::getDate, documentMaterials.getDate())
- .eq(documentMaterials.getRecordId()!=null, DocumentMaterials::getRecordId, documentMaterials.getRecordId());
-// .like(!StringUtils.isEmpty(archiveRecords.getFilingNumber()), ArchiveRecords::getFilingNumber, archiveRecords.getFilingNumber())
+ .eq(documentMaterials.getRecordId()!=null, DocumentMaterials::getRecordId, documentMaterials.getRecordId())
+ .eq(documentMaterials.getPageNumber()!=null, DocumentMaterials::getPageNumber, documentMaterials.getPageNumber());
+
+ // .like(!StringUtils.isEmpty(archiveRecords.getFilingNumber()), ArchiveRecords::getFilingNumber, archiveRecords.getFilingNumber())
// .like(!StringUtils.isEmpty(archiveRecords.getArchiveRoomNumber()), ArchiveRecords::getArchiveRoomNumber, archiveRecords.getArchiveRoomNumber())
// .like(!StringUtils.isEmpty(archiveRecords.getRecordId()), ArchiveRecords::getRecordId, archiveRecords.getRecordId());
// // .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation())
@@ -50,7 +57,8 @@
// .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
// lqw.orderByDesc(ZfProperty::getCreateTime);
// lqw.orderByDesc(ArchiveRecords::isOwnData)
- lqw.orderByDesc(DocumentMaterials::getCreatedAt);
+ lqw.orderByAsc(DocumentMaterials::getPageNumber);
+
System.out.println("ssssssssssssddd0000000000000000");
return lqw;
@@ -65,7 +73,7 @@
List<DocumentMaterials> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
-
+ System.out.println(beanRecords);
// beanRecords.forEach(record -> {
// if (record.getUserId() != null) {
// SysUser user = userMapper.selectUserById(record.getUserId());
@@ -99,8 +107,18 @@
public List<DocumentMaterials> selectDocumentMaterialsList(DocumentMaterials documentMaterials) {
LambdaQueryWrapper<DocumentMaterials> lambdaQueryWrapper = buildCondition(documentMaterials);
List<DocumentMaterials> beanRecords = list(lambdaQueryWrapper);
-
return beanRecords;
+ }
+
+ @Override
+ public List<DocumentMaterialsVoLarge> selectDocumentMaterialsAllByRecordId(Long id) {
+
+ return this.baseMapper.getDocumentMaterialsvoLarge(Math.toIntExact(id));
+ }
+
+ @Override
+ public List<DocumentMaterialsFileList> selectDocumentMaterialsFileList(Long id) {
+ return this.baseMapper.getDocumentMaterialsFileList(Math.toIntExact(id));
}
@Override
@@ -109,7 +127,20 @@
Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
documentMaterials.setCreatedAt(date);
- boolean res = this.save(documentMaterials);
+ System.out.println(documentMaterials.getFileStyle());
+ System.out.println(documentMaterials.getPageNumber());
+// if(documentMaterials.getPageNumber()==null)
+// {
+// documentMaterials.setPageNumber(-1L);
+// }
+ boolean res = false;
+ try {
+ res = this.save(documentMaterials);
+
+ } catch (Exception e) {
+ System.out.println(e);
+ throw new ErrorcodeExceptionextends(500, "鍚屼竴涓鍗峰唴锛屼笉鍏佽椤电爜閲嶅锛�");
+ }
if(res)
return 1;
else
@@ -139,4 +170,74 @@
public int deleteDocumentMaterialsByMaterialId(String materialId) {
return 0;
}
+
+ @Override
+ public Long getFiNum(Long pageNumber, Long recordId) {
+ return this.baseMapper.getFileNumber(pageNumber, recordId);
+ }
+
+ @Override
+ public int updateByPageNumber(Long pageNumber, String sizeType, Long fileNumber, int width, int height, int horizontalResolution, int verticalResolution, double fileSize, String url, String format, Long recordId) {
+ //鏍规嵁pageNumber鎷垮埌title锛岀劧鍚庤绠梡ageOrder
+ LambdaQueryWrapper<DocumentMaterials> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(pageNumber!=null, DocumentMaterials::getPageNumber, pageNumber);
+ List<DocumentMaterials> records = list(lqw);
+
+ Long pageOrder = 1L;
+ if(pageNumber.equals(1))
+ pageOrder = 1L;
+ else {
+ Long maxPOrder = this.baseMapper.getMaxPageOrder(records.get(0).getTitle(), pageNumber, records.get(0).getStage(), recordId);
+ if (maxPOrder != null)
+ pageOrder = maxPOrder + 1;
+ }
+
+ this.baseMapper.updateInfoByPageNumber(pageNumber, sizeType,fileNumber,pageOrder, width, height, horizontalResolution, verticalResolution, fileSize, url,format, recordId);
+
+ return 0;
+ }
+
+ @Override
+ public List<DocumentMaterialsVo> findArchMInfo(String recordId) {
+ return this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
+ }
+
+ @Override
+ public List<DocumentMaterialFileStyle> findFileStyleInfo(int recordId) {
+ return this.baseMapper.getFileStyleInfo(recordId);
+ }
+
+ @Override
+ public AjaxResult importExcel(MultipartFile file, String recordId) {
+ ExcelUtil<DocumentMaterialFileSmallVo> util = new ExcelUtil<>(DocumentMaterialFileSmallVo.class);
+ List<DocumentMaterialFileSmallVo> dataList = null;
+ try {
+ dataList = util.importExcel(file.getInputStream());
+ } catch (Exception e) {
+ throw new RuntimeException("娌℃湁鎸夌収瑙勫垯瀵煎叆鏁版嵁");
+ }
+
+ assert dataList != null;
+
+ for (DocumentMaterialFileSmallVo archiveCategory : dataList) {
+ // physcialService.mySave(physcial);
+ DocumentMaterials documentMaterials = new DocumentMaterials();
+ BeanUtils.copyProperties(archiveCategory, documentMaterials);
+ documentMaterials.setRecordId(Long.parseLong(recordId));
+ this.insertDocumentMaterials(documentMaterials);
+ }
+
+ return AjaxResult.success(); }
+
+ @Override
+ public DocumentMaterials selectByPageNumber(Long pageNumber, Integer recordId) {
+ LambdaQueryWrapper<DocumentMaterials> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(pageNumber!=null, DocumentMaterials::getPageNumber, pageNumber);
+ lqw.eq(recordId!=null, DocumentMaterials::getRecordId, recordId);
+ List<DocumentMaterials> ls = list(lqw);
+ if(!ls.isEmpty())
+ return ls.get(0);
+ else
+ return null;
+ }
}
--
Gitblit v1.9.1