From 359f1d48b1d859a23cd35a425d2cffb1e9d1c811 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期五, 26 十二月 2025 19:58:59 +0800
Subject: [PATCH] 修改了对应代码
---
archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 56 insertions(+), 3 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 90cc40f..a483197 100644
--- a/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
+++ b/archiveManager/src/main/java/com/ruoyi/service/impl/DocumentMaterialsServiceImpl.java
@@ -129,8 +129,9 @@
@Override
public int insertDocumentMaterials(DocumentMaterials documentMaterials) {
+
+
LocalDateTime time = LocalDateTime.now();
-
Date date = Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
documentMaterials.setCreatedAt(date);
System.out.println(documentMaterials.getFileStyle());
@@ -142,7 +143,6 @@
boolean res = false;
try {
res = this.save(documentMaterials);
-
} catch (Exception e) {
System.out.println(e);
throw new ErrorcodeExceptionextends(500, "鍚屼竴涓鍗峰唴锛屼笉鍏佽椤电爜閲嶅锛�");
@@ -265,7 +265,32 @@
@Override
public List<DocumentMaterialsVo> findArchMInfo(String recordId) {
- return this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
+ // 鑾峰彇鍘熷鏁版嵁鍒楄〃
+ List<DocumentMaterialsVo> dataList = this.baseMapper.getArchiveMatInfo(Integer.parseInt(recordId));
+
+ // 鑾峰彇璇ユ鍗风殑鏈�澶ч〉鍙凤紙鎬婚〉鏁帮級
+ Long totalPages = this.baseMapper.getMaxPageNumber(Integer.parseInt(recordId));
+
+ // 濡傛灉鏁版嵁鍒楄〃涓嶄负绌�
+ if (dataList != null && !dataList.isEmpty() && totalPages != null) {
+ int size = dataList.size();
+
+ // 閬嶅巻鎵�鏈夋潯鐩紝璁剧疆pageNumberFormatted
+ for (int i = 0; i < size; i++) {
+ DocumentMaterialsVo item = dataList.get(i);
+ Long pageNumber = item.getPageNumber();
+
+ if (i == size - 1) {
+ // 鏈�鍚庝竴琛岋細鏍煎紡鍖栭〉鍙蜂负"鏈�鍚庝竴椤甸〉鍙�-鎬婚〉鏁�"鐨勫舰寮�
+ item.setPageNumberFormatted(pageNumber + "-" + totalPages);
+ } else {
+ // 鍏朵粬琛岋細鐩存帴浣跨敤pageNumber鐨勫��
+ item.setPageNumberFormatted(pageNumber != null ? pageNumber.toString() : "");
+ }
+ }
+ }
+
+ return dataList;
}
@Override
@@ -291,6 +316,32 @@
BeanUtils.copyProperties(archiveCategory, documentMaterials);
documentMaterials.setRecordId(Long.parseLong(recordId));
documentMaterials.setVisible(1);
+ // 楠岃瘉蹇呭~瀛楁
+ if (StringUtils.isEmpty(documentMaterials.getTitle())) {
+ throw new ErrorcodeExceptionextends(400, "鏂囦欢棰樺悕涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(documentMaterials.getFileStyle())) {
+ throw new ErrorcodeExceptionextends(400, "鏉愭枡绫诲瀷涓嶈兘涓虹┖");
+ }
+ // 鏉愭枡绫诲瀷涓嶆槸"鍏跺畠鏉愭枡"鏃讹紝椤靛彿蹇呴』杈撳叆
+ if (!"鍏朵粬鏉愭枡".equals(documentMaterials.getFileStyle()) && documentMaterials.getPageNumber() == null) {
+ throw new ErrorcodeExceptionextends(400, "褰撳墠鏉愭枡绫诲瀷闈炲叾瀹冩潗鏂欙紝椤靛彿蹇呴』杈撳叆");
+ }
+ if (StringUtils.isEmpty(documentMaterials.getIsAttachment())) {
+ throw new ErrorcodeExceptionextends(400, "鏄惁涓洪檮浠朵笉鑳戒负绌�");
+ }
+ if (StringUtils.isEmpty(documentMaterials.getStage())) {
+ throw new ErrorcodeExceptionextends(400, "鎵�澶勯樁娈典笉鑳戒负绌�");
+ }
+ if (StringUtils.isEmpty(documentMaterials.getRetentionPeriod())) {
+ throw new ErrorcodeExceptionextends(400, "淇濈鏈熼檺涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(documentMaterials.getIsSensitive())) {
+ throw new ErrorcodeExceptionextends(400, "鏄惁鏁忔劅涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(documentMaterials.getIsCanceled())) {
+ throw new ErrorcodeExceptionextends(400, "鏄惁娉ㄩ攢涓嶈兘涓虹┖");
+ }
this.insertDocumentMaterials(documentMaterials);
}
@@ -431,3 +482,5 @@
}
+
+
--
Gitblit v1.9.1