|
@@ -134,7 +134,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
private final IArchiveExpertConclusionService expertConclusionService;
|
|
|
private final ITraceLogService iTraceLogService;
|
|
|
- private final IArchiveNameService archiveNameService;
|
|
|
|
|
|
//表格高度
|
|
|
private static int high = 20;
|
|
@@ -1320,8 +1319,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
//获取案卷题名
|
|
|
String archiveName = builtArchiveName(waitArchiveFiles, node, true);//获取案卷题名
|
|
|
|
|
|
- //test(waitArchiveFiles);
|
|
|
-
|
|
|
//1.创建新案卷
|
|
|
ArchivesAuto archivesAuto = builtArchives(node, pageN, fileN, startDate, endDate, archiveName);
|
|
|
|
|
@@ -4090,71 +4087,76 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void test(List<ArchiveFile> waitArchiveFiles) {
|
|
|
- // 1. 提取并保持节点ID顺序(使用LinkedHashSet保持原始顺序)
|
|
|
- Set<String> uniqueNodeIds = waitArchiveFiles.stream()
|
|
|
- .map(ArchiveFile::getNodeId)
|
|
|
- .filter(nodeId -> nodeId != null && !nodeId.isEmpty())
|
|
|
- .collect(Collectors.toCollection(LinkedHashSet::new));
|
|
|
|
|
|
- if (uniqueNodeIds.isEmpty()) {
|
|
|
- log.info("没有需要处理的节点ID");
|
|
|
- return;
|
|
|
+ private String formatExecutionTime(long millis) {
|
|
|
+ if (millis < 1000) {
|
|
|
+ return millis + "毫秒";
|
|
|
+ } else if (millis < 60000) {
|
|
|
+ return String.format("%.2f秒", millis / 1000.0);
|
|
|
+ } else {
|
|
|
+ long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
|
|
|
+ long seconds = TimeUnit.MILLISECONDS.toSeconds(millis) % 60;
|
|
|
+ return minutes + "分钟" + seconds + "秒";
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- try {
|
|
|
- // 2. 将节点ID从String转换为Long(保持原始顺序)
|
|
|
- List<Long> nodeIds = uniqueNodeIds.stream()
|
|
|
- .map(this::safeParseLong)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .collect(Collectors.toList());
|
|
|
-
|
|
|
- if (nodeIds.isEmpty()) {
|
|
|
- log.warn("无法解析任何有效的节点ID");
|
|
|
- return;
|
|
|
- }
|
|
|
- String nodeIdsStr = nodeIds.stream()
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
- // 3. 批量获取节点信息
|
|
|
- List<ArchiveTreeContract> nodeList = archiveTreeContractClient
|
|
|
- .getArchiveTreeContractListByIds(nodeIdsStr);
|
|
|
-
|
|
|
- if (nodeList.isEmpty()) {
|
|
|
- log.warn("未找到任何节点信息");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 4. 构建节点层级关系
|
|
|
- IArchiveNameService.NodeHierarchy hierarchy =
|
|
|
- archiveNameService.buildNodeHierarchy(nodeList);
|
|
|
-
|
|
|
- // 5. 生成完整层级名称
|
|
|
- String fullName = archiveNameService.generateFullLevelName(nodeIds, hierarchy);
|
|
|
|
|
|
- // 6. 输出或使用结果
|
|
|
- System.out.println("完整层级名称: " + fullName);
|
|
|
- log.info("成功生成长度 {} 的层级名称", fullName.length());
|
|
|
+ @Override
|
|
|
+ public R sendFileToEArchives(ArchiveDataVo dataInfo) {
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("生成层级名称时出错", e);
|
|
|
+ if(dataInfo==null || Func.isNull(dataInfo)){
|
|
|
+ return R.fail("请根据接口文档上传参数");
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- // 安全解析Long的方法(处理格式异常)
|
|
|
- private Long safeParseLong(String value) {
|
|
|
- try {
|
|
|
- return Long.parseLong(value);
|
|
|
- } catch (NumberFormatException e) {
|
|
|
- log.warn("无法转换的节点ID格式: {}", value);
|
|
|
- return null;
|
|
|
+ String nodeId = dataInfo.getNodeId();
|
|
|
+ String contractId = dataInfo.getContractId();
|
|
|
+ String fileUrl = dataInfo.getFileUrl();
|
|
|
+ String fileName = dataInfo.getFileNmae();
|
|
|
+ if(nodeId==null || Func.isNull(nodeId)){
|
|
|
+ return R.fail("请上传nodeId");
|
|
|
+ }
|
|
|
+ if(contractId==null || Func.isNull(contractId)){
|
|
|
+ R.fail("请上传contractId");
|
|
|
+ }
|
|
|
+ if(fileUrl==null || Func.isNull(fileUrl)){
|
|
|
+ R.fail("请上传fileUrl");
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
+ if(fileName==null || Func.isNull(fileName)){
|
|
|
+ R.fail("请上传fileName");
|
|
|
+ }
|
|
|
|
|
|
+ ContractInfo contractInfo = contractClient.getContractById(Func.toLong(contractId));
|
|
|
+ if(contractInfo==null){
|
|
|
+ return R.fail("请传输正确的contractId");
|
|
|
+ }
|
|
|
+ //获取文件的父节点Id
|
|
|
+ String treeContractId = baseMapper.getArchiveFileByParentId(nodeId, contractId);
|
|
|
+ if(treeContractId==null || Func.isNull(treeContractId)){
|
|
|
+ R.fail("请校验传输的nodeId和contractId,没有查到父节点Id");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
+ // 将数据插入到 auto表中
|
|
|
+ ArchivesAuto archivesAuto = new ArchivesAuto();
|
|
|
+ long newPkId = SnowFlakeUtil.getId(); //主键Id
|
|
|
+ archivesAuto.setId(newPkId);
|
|
|
+ archivesAuto.setProjectId(Func.toLong(contractInfo.getPId()));
|
|
|
+ archivesAuto.setContractId(Func.toLong(contractId));
|
|
|
+ archivesAuto.setName(fileName);
|
|
|
+ archivesAuto.setIsDeleted(0);
|
|
|
+ this.save(archivesAuto);
|
|
|
+
|
|
|
+ // 保存文件到archive_file表中
|
|
|
+ long arueId = SnowFlakeUtil.getId(); //主键Id
|
|
|
+ ArchiveFile archiveFile = new ArchiveFile();
|
|
|
+ archiveFile.setId(arueId);
|
|
|
+ archiveFile.setArchiveId(newPkId);
|
|
|
+ archiveFile.setFileName(fileName);
|
|
|
+ archiveFileClient.saveArchiveFileByBIM(archiveFile);
|
|
|
+ return R.success("保存成功");
|
|
|
+ }
|
|
|
|
|
|
}
|