|
@@ -1192,29 +1192,53 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 从案卷删除文件
|
|
|
+ * 从案卷删除文件,兵重新生成封面和打码文件
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean removeFiles(String ids) {
|
|
|
+ public boolean removeFiles(String ids,Long archiveId) {
|
|
|
List<Long> fids = Func.toLongList(ids);
|
|
|
- baseMapper.splitFiles(fids);
|
|
|
|
|
|
- LambdaQueryWrapper<ArchiveFile> wrapper = Wrappers.lambdaQuery();
|
|
|
- wrapper.in(ArchiveFile::getId, fids);
|
|
|
|
|
|
- // 调用 listWrappers() 方法来获取符合条件的 ArchiveFile 对象列表
|
|
|
- List<ArchiveFile> files = archiveFileClient.listWrappers(wrapper);
|
|
|
+ ArchivesAuto archivesAuto = this.getById(archiveId);
|
|
|
+
|
|
|
+ List<String> strIds = new ArrayList<>();
|
|
|
+ strIds.add(archiveId.toString());
|
|
|
+ List<ArchiveFile> files = archiveFileClient.getAllArchiveFileByArchiveIds(strIds);
|
|
|
+ List<ArchiveFile> waitArchiveFiles = new ArrayList<>();
|
|
|
if (files != null && files.size() > 0) {
|
|
|
List<String> removeFiles = new ArrayList<>();
|
|
|
- //删除打码文件
|
|
|
for (ArchiveFile file : files) {
|
|
|
- //打码的也要删除
|
|
|
+
|
|
|
if (StringUtils.isNotBlank(file.getPdfPageUrl())){
|
|
|
removeFiles.add(FileUtils.getAliYunSubUrl(file.getPdfPageUrl()));
|
|
|
}
|
|
|
+
|
|
|
+ if (!fids.contains(file.getId())) {
|
|
|
+ waitArchiveFiles.add(file);
|
|
|
+ }
|
|
|
}
|
|
|
+ //删除文件
|
|
|
iossClient.removeFiles(removeFiles);
|
|
|
+
|
|
|
+ //删除不用的案卷
|
|
|
+ if (fids.size() > 0) {
|
|
|
+ baseMapper.splitFiles(fids);
|
|
|
+ }
|
|
|
+
|
|
|
+ Long archivesAutoId = archivesAuto.getId();
|
|
|
+
|
|
|
+ //封面和生成文件页码
|
|
|
+ archiveAutoPdfService.buildArchiveFrontPdfs(archivesAuto.getProjectId(),archivesAuto,waitArchiveFiles);
|
|
|
+
|
|
|
+ builtFilePageNo(archivesAuto,waitArchiveFiles);//生成文件页码
|
|
|
+
|
|
|
+ for(ArchiveFile file:waitArchiveFiles){
|
|
|
+ file.setArchiveId(archivesAutoId);//设置文件所属案卷
|
|
|
+ file.setIsArchive(1);
|
|
|
+
|
|
|
+ }
|
|
|
+ archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -1303,6 +1327,21 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ public void test(){
|
|
|
+ String ids = "1654406079229165569";
|
|
|
+
|
|
|
+ List<Long> fids = Func.toLongList(ids);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ArchiveFile> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.in(ArchiveFile::getId, fids);
|
|
|
+
|
|
|
+ // 调用 listWrappers() 方法来获取符合条件的 ArchiveFile 对象列表
|
|
|
+ List<ArchiveFile> files = archiveFileClient.listbyIds(fids);
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|