ソースを参照

档案-并卷-案卷提名
1、新增根据勾选的文件组装案卷提名

LHB 5 日 前
コミット
90eb90e755

+ 15 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -1317,4 +1317,19 @@ public class ArchivesAutoController extends BladeController {
 		return R.status(true);
 	}
 
+
+	/**
+	 *	案卷并卷后推荐名称
+	 *	项目名称+合同段编号+多个文件名称(去掉项目名称+合同段编号+案卷后缀)去重以、号拼接+案卷后缀
+	 */
+	@PostMapping("/jointNomination")
+	@ApiOperationSupport(order = 44)
+	@ApiModelProperty(value = "案卷并卷后推荐名称")
+	@ApiImplicitParams(value = {
+			@ApiImplicitParam(name = "authId", value = "案卷Id", required = true)
+	})
+	public R jointNomination(String authId){
+		return R.data(archivesAutoService.jointNomination(Arrays.asList(authId.split(","))));
+	}
+
 }

+ 3 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/service/IArchivesAutoService.java

@@ -192,4 +192,7 @@ public interface IArchivesAutoService extends BaseService<ArchivesAuto> {
 
 	void reCreateArchiveAuto2(List<ArchivesAuto> archivesAutoList, String ids, String name);
 	void checkFileInfo(List<String> ids);
+
+
+    String jointNomination(List<String> authId);
 }

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

@@ -5618,6 +5618,54 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			}
 		}
 	}
+
+	@Override
+	public String jointNomination(List<String> authId) {
+		StringBuilder sb = new StringBuilder();
+		//案卷信息  案卷名称
+		List<ArchivesAuto> archivesAutos = this.listByIds(authId);
+		if(CollectionUtils.isNotEmpty(archivesAutos)){
+			//案卷后缀
+			String suffix = "";
+
+			ArchivesAuto archivesAuto = archivesAutos.get(0);
+			//获取项目信息和合同段信息
+			ProjectInfo byId = projectClient.getById(archivesAuto.getProjectId().toString());
+			sb.append(byId.getProjectName());
+			ContractInfo contractById = contractClient.getContractById(archivesAuto.getContractId());
+			sb.append(contractById.getContractNumber());
+			//获取节点信息  文件后缀
+			List<Long> collect1 = archivesAutos.stream().map(ArchivesAuto::getNodeId).collect(Collectors.toList());
+			List<ArchiveTreeContract> archiveTreeContractListByList = archiveTreeContractClient.getArchiveTreeContractListByList(collect1);
+			//获取第一个文件后缀
+			archiveTreeContractListByList = archiveTreeContractListByList.stream().filter(f -> StringUtils.isNotEmpty(f.getArchiveNameSuffix())).collect(Collectors.toList());
+			//id 与 文件后缀的映射关系
+			Map<Long, String> map = archiveTreeContractListByList.stream().collect(Collectors.toMap(ArchiveTreeContract::getId, ArchiveTreeContract::getArchiveNameSuffix));
+			if(CollectionUtils.isNotEmpty(archiveTreeContractListByList)){
+				ArchiveTreeContract archiveTreeContract = archiveTreeContractListByList.get(0);
+				suffix = archiveTreeContract.getArchiveNameSuffix();
+			}
+			List<String> strings = new ArrayList<>();
+			archivesAutos.forEach(f->{
+				//当前案卷所属节点的文件后缀
+				String s = map.get(f.getNodeId());
+				//案卷名称
+				String name = f.getName();
+
+				String newName = name.replace(sb, "");
+				if(s != null){
+					newName = newName.replace(s,"");
+				}
+				strings.add(newName);
+			});
+			//名称去重
+			List<String> distinctList = strings.stream()
+					.distinct()
+					.collect(Collectors.toList());
+			sb.append(StringUtils.join(distinctList,"、")).append(suffix);
+		}
+		return sb.toString();
+	}
 }