浏览代码

档案文件格式问题

cr 1 周之前
父节点
当前提交
749d676327

+ 15 - 15
blade-service-api/blade-archive-api/src/main/java/org/springblade/archive/entity/ArchivesAuto.java

@@ -80,13 +80,13 @@ public class ArchivesAuto extends BaseEntity {
     /**
      * 文件起始时间
      */
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime startDate;
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd")
+    private String startDate;
     /**
      * 文件结束时间
      */
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime endDate;
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd")
+    private String endDate;
     /**
      * 保管期限(单位/年)
      */
@@ -210,17 +210,17 @@ public class ArchivesAuto extends BaseEntity {
         BeanUtils.copyProperties(autoVo, this);
 
         // 2. 手动处理类型不兼容的字段
-        // Date -> LocalDateTime 转换
-        if (autoVo.getStartDate() != null) {
-            this.setStartDate(autoVo.getStartDate().toInstant()
-                    .atZone(ZoneId.systemDefault())
-                    .toLocalDateTime());
-        }
-        if (autoVo.getEndDate() != null) {
-            this.setEndDate(autoVo.getEndDate().toInstant()
-                    .atZone(ZoneId.systemDefault())
-                    .toLocalDateTime());
-        }
+         //Date -> LocalDateTime 转换
+//        if (autoVo.getStartDate() != null) {
+//            this.setStartDate(autoVo.getStartDate().toInstant()
+//                    .atZone(ZoneId.systemDefault())
+//                    .toLocalDateTime());
+//        }
+//        if (autoVo.getEndDate() != null) {
+//            this.setEndDate(autoVo.getEndDate().toInstant()
+//                    .atZone(ZoneId.systemDefault())
+//                    .toLocalDateTime());
+//        }
         if (autoVo.getReviewDate() != null) {
             this.setReviewDate(autoVo.getReviewDate().toInstant()
                     .atZone(ZoneId.systemDefault())

+ 6 - 6
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java

@@ -158,8 +158,8 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         archivesAuto.setKeywords("主题词");
         archivesAuto.setReviewer("审核人");
         archivesAuto.setReviewDate(LocalDateTime.now());
-        archivesAuto.setStartDate(LocalDateTime.now());
-        archivesAuto.setEndDate(LocalDateTime.now());
+        //archivesAuto.setStartDate(LocalDateTime.now());
+        //archivesAuto.setEndDate(LocalDateTime.now());
         archivesAuto.setStorageLocation("存放位置");
         archivesAuto.setIsArchive(0);
         archivesAuto.setRemark("备注");
@@ -883,14 +883,14 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         if (!minDate.isEmpty() && !minDate.equals("null") ) {
             LocalDateTime localDateTime = FormulaUtil.parseStringToLocalDateTime(minDate, "yyyyMMdd");
             if (localDateTime != null) {
-                archive.setStartDate(localDateTime);
+                archive.setStartDate(localDateTime.toString());
             }
 
         }
         if (!maxDate.isEmpty() && !maxDate.equals("null") ) {
             LocalDateTime localDateTime = FormulaUtil.parseStringToLocalDateTime(maxDate, "yyyyMMdd");
             if (localDateTime != null) {
-                archive.setEndDate(localDateTime);
+                archive.setEndDate(localDateTime.toString());
             }
         }
 
@@ -904,11 +904,11 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         }
 
         if (archive.getStartDate() != null) {
-            archivesAutoMap.put("startDate", FormulaUtil.formatLocalDateTime(archive.getStartDate(), "yyyyMMdd"));
+            archivesAutoMap.put("startDate", archive.getStartDate());
         }
 
         if (archive.getEndDate() != null) {
-            archivesAutoMap.put("endDate", FormulaUtil.formatLocalDateTime(archive.getEndDate(), "yyyyMMdd"));
+            archivesAutoMap.put("endDate", archive.getEndDate());
         }
 
         Map<String, Object> variables = new HashMap<>();

+ 2 - 2
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveOfflineVersionInfoServiceImpl.java

@@ -449,8 +449,8 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
                     pstm.setString(12, auto.getAllFilePdf() == null ? "" : auto.getAllFilePdf());
                     pstm.setLong(13, auto.getFileSize() == null ? 0L : auto.getFileSize());
                     pstm.setString(14, auto.getTreeSort() == null ? "" : auto.getTreeSort());
-                    pstm.setString(15, auto.getStartDate() == null ? "" : auto.getStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                    pstm.setString(16, auto.getEndDate() == null ? "" : auto.getEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+                    pstm.setString(15, auto.getStartDate() == null ? "" : auto.getStartDate());
+                    pstm.setString(16, auto.getEndDate() == null ? "" : auto.getEndDate());
                     pstm.setString(17, auto.getSecretLevel());
 
                     //添加批处理

+ 9 - 9
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -5401,17 +5401,17 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 							}else if (result.contains("起止日期")) {
 								String time=result.replace("起止日期","").replace(":","").replace(":","").replaceAll("_","");
 								if(result.contains("~")){
-									LocalDateTime[] localDateTimes = convertDateRange(time, "~");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+									String[] split = time.split("~");
+									auto.setStartDate(split[0]);
+									auto.setEndDate(split[1]);
 								} else if (result.contains("-")) {
-									LocalDateTime[] localDateTimes = convertDateRange(time, "-");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+									String[] split = time.split("-");
+									auto.setStartDate(split[0]);
+									auto.setEndDate(split[1]);
 								} else if (result.contains("~")) {
-									LocalDateTime[] localDateTimes = convertDateRange(time, "~");
-									auto.setStartDate(localDateTimes[0]);
-									auto.setEndDate(localDateTimes[1]);
+									String[] split = time.split("~");
+									auto.setStartDate(split[0]);
+									auto.setEndDate(split[1]);
 								}
 							} else if (result.contains("保管期限")||result.contains("保管限期")) {
 								String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","").replaceAll("_","");