浏览代码

档案分卷

cr 1 天之前
父节点
当前提交
127d861f1f

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

@@ -5732,6 +5732,22 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 				String update = "UPDATE u_archive_file SET archive_id = ?, old_archive_id = ?, is_volume = 1 WHERE id IN (" + saveVolumeDto1.getFileIds() + ")";
 				jdbcTemplate.update(update, archiveId, dto.getArchiveId());
 				archivesAuto.setVolumeIds(archivesAuto.getVolumeIds()+archiveId+",");
+				List<ArchiveFile> files1 = archiveFileClient.getArchiveFileByArchivesId(archiveId + "", "");
+				if(!files1.isEmpty()){
+					List<Integer> sorts = files1.stream()
+							.map(file -> Optional.ofNullable(file.getSort()).orElse(0))
+							.sorted()
+							.collect(Collectors.toList());
+					String[] fileIds = saveVolumeDto1.getFileIds().split(",");
+					if(sorts.size()==fileIds.length){
+						if(fileIds.length>0){
+							for (int i = 0; i < fileIds.length; i++) {
+								String updateSql = "UPDATE u_archive_file SET sort = ? WHERE id = ?";
+								jdbcTemplate.update(updateSql, sorts.get(i), fileIds[i]);
+							}
+						}
+					}
+				}
 			}
 			archivesAuto.setVolumeIds(archivesAuto.getVolumeIds().substring(0,archivesAuto.getVolumeIds().length()-1));
 		}