|
@@ -625,21 +625,15 @@ public class ArchivesAutoController extends BladeController {
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiOperation(value = "重新生成案卷", notes = "传入ids")
|
|
|
@Transactional
|
|
|
- public R reCreateArchiveAuto(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,@ApiParam(value = "合并后的文件题目", required = true)String name){
|
|
|
- //先查出勾选的案卷
|
|
|
- List<ArchivesAuto> archivesAutoList=archivesAutoService.listByIds(Func.toLongList(ids));
|
|
|
-// if(archivesAutoList.size()<=1){
|
|
|
-// return R.fail("请选择多个案卷进行合并");
|
|
|
-// }
|
|
|
- //查出所有案卷文件
|
|
|
- List<ArchiveFile>archiveFileList=new ArrayList<>();
|
|
|
- List<Long> longList = Func.toLongList(ids);
|
|
|
- for (Long id : longList) {
|
|
|
- archiveFileList.addAll(archiveFileClient.getArchiveFileByArchiveIds(id+""));
|
|
|
- }
|
|
|
- //根据档号后缀排序 拿到第一个
|
|
|
- ArchivesAuto auto = archivesAutoList.get(0);
|
|
|
- if(longList.size()>1){
|
|
|
+ public R reCreateArchiveAuto(@ApiParam(value = "主键集合", required = true) @RequestParam String ids,@ApiParam(value = "合并后的文件题目", required = true)String name,Integer type){
|
|
|
+ if(type==1){
|
|
|
+ //先查出勾选的案卷
|
|
|
+ List<ArchivesAuto> archivesAutoList=archivesAutoService.listByIds(Func.toLongList(ids));
|
|
|
+ if(archivesAutoList.size()<=1){
|
|
|
+ return R.fail("请选择多个案卷进行合并");
|
|
|
+ }
|
|
|
+ //根据档号后缀排序 拿到第一个
|
|
|
+ ArchivesAuto auto = archivesAutoList.get(0);
|
|
|
archivesAutoList.sort(Comparator.comparingInt(a -> {
|
|
|
String fileNumber = a.getFileNumber();
|
|
|
if (fileNumber == null || fileNumber.isEmpty()) {
|
|
@@ -664,6 +658,12 @@ public class ArchivesAutoController extends BladeController {
|
|
|
}));
|
|
|
//将除第一个以外的案卷文件archiveId 设置成第一个的id
|
|
|
List<ArchiveFile>updateArchiveFileList=new ArrayList<>();
|
|
|
+ //查出所有案卷文件
|
|
|
+ List<ArchiveFile>archiveFileList=new ArrayList<>();
|
|
|
+ List<Long> longList = Func.toLongList(ids);
|
|
|
+ for (Long id : longList) {
|
|
|
+ archiveFileList.addAll(archiveFileClient.getArchiveFileByArchiveIds(id+""));
|
|
|
+ }
|
|
|
int i=1;
|
|
|
for (ArchiveFile file : archiveFileList) {
|
|
|
if (!file.getArchiveId().equals(auto.getId())) {
|
|
@@ -677,10 +677,20 @@ public class ArchivesAutoController extends BladeController {
|
|
|
//删除其他案卷
|
|
|
archivesAutoList.remove(auto);
|
|
|
archivesAutoService.deleteLogic(archivesAutoList.stream().map(o->o.getId()).collect(Collectors.toList()));
|
|
|
+ //设置案卷页码和四要素
|
|
|
+ archivesAutoService.reCreateArchiveAuto(auto, archiveFileList);
|
|
|
+ return R.status(true);
|
|
|
+ }else {
|
|
|
+ for (Long id : Func.toLongList(ids)) {
|
|
|
+ //先查出勾选的案卷
|
|
|
+ ArchivesAuto archivesAuto=archivesAutoService.getById(id);
|
|
|
+ //查出所有案卷文件
|
|
|
+ List<ArchiveFile>archiveFileList=archiveFileClient.getArchiveFileByArchiveIds(id+"");
|
|
|
+ //设置案卷页码和四要素
|
|
|
+ archivesAutoService.reCreateArchiveAuto(archivesAuto, archiveFileList);
|
|
|
+ }
|
|
|
+ return R.status(true);
|
|
|
}
|
|
|
- //设置案卷页码和四要素
|
|
|
- archivesAutoService.reCreateArchiveAuto(auto, archiveFileList);
|
|
|
- return R.status(true);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/creatFileNameFormAI")
|