소스 검색

修改软件著录的获取方式

huangtf 8 달 전
부모
커밋
0beac9464e

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ArchiveTreeContractClient.java

@@ -54,4 +54,7 @@ public interface ArchiveTreeContractClient {
     @PostMapping(API_PREFIX + "/getMeasurementPeriodNode")
     public ArchiveTreeContract getMeasurementPeriodNode(@RequestParam String projectName,@RequestParam String contractName,
                                                         @RequestParam String periodName);
+
+    @PostMapping(API_PREFIX + "/getMatchNode")
+    public ArchiveTreeContract getMatchNode(@RequestParam Long nodeId);
 }

+ 23 - 4
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -996,12 +996,31 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		archivesAuto.setUnit(unit);//立卷单位
 		//archivesAuto.setQuantity();//数量/单位
 
-		archivesAuto.setSpecification(node.getSpecification());//案卷规格 从节点规格获取
+
 		//archivesAuto.setStartDate(LocalDateTime.parse(startDate));//文件开始时间
 		//archivesAuto.setEndDate(LocalDateTime.parse(endDate));//文件结束时间
+		String storageTime = node.getStorageTime();
+		String specification = node.getSpecification();
+		String rollor = node.getRollor();
+		String reviewer = node.getReviewer();
+
+		//如果没有找到立卷人,则向上找到配置立卷人的节点,取配置
+		if (StringUtils.isEmpty(node.getRollor())) {
+			ArchiveTreeContract matchNode = archiveTreeContractClient.getMatchNode(node.getId());
+
+			if (matchNode!= null  ) {
+				 storageTime = matchNode.getStorageTime();
+				 specification = matchNode.getSpecification();
+				 rollor = matchNode.getRollor();
+				 reviewer = matchNode.getReviewer();
+			}
+		}
+
+
+		archivesAuto.setSpecification(specification);//案卷规格 从节点规格获取
 
 		//TODO 保管期限
-		String storageTime = node.getStorageTime();
+		//String storageTime = node.getStorageTime();
 		if (StringUtils.isEmpty(storageTime)) {
 			//节点没有值,就从合同段获取,没有合同段id的 用业主的合同段
 			Long nodeContractId = archivesAuto.getContractId();
@@ -1065,7 +1084,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		archivesAuto.setSecretLevel(secretLevel);
 
 		//立卷人 从节点规格获取
-		String rollor = node.getRollor();
+		//String rollor = node.getRollor();
 		if (StringUtils.isEmpty(rollor)) {
 			//节点没有值,就从合同段获取,没有合同段id的 用业主的合同段
 			Long nodeContractId = archivesAuto.getContractId();
@@ -1089,7 +1108,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		archivesAuto.setRollor(rollor);
 
 		//审核人 从节点规格获取
-		String reviewer = node.getReviewer();
+		//String reviewer = node.getReviewer();
 		if (StringUtils.isEmpty(reviewer)) {
 			//节点没有值,就从合同段获取,没有合同段id的 用业主的合同段
 			Long nodeContractId = archivesAuto.getContractId();

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ArchiveTreeContractImpl.java

@@ -134,4 +134,8 @@ public class ArchiveTreeContractImpl implements ArchiveTreeContractClient {
     }
 
 
+    @Override
+    public ArchiveTreeContract getMatchNode(@RequestParam Long nodeId) {
+        return archiveTreeContractService.getMatchNode(nodeId);
+    }
 }

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IArchiveTreeContractService.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.manager.service;
 
+import com.mixsmart.utils.StringUtils;
 import feign.Param;
 
 import org.springblade.manager.dto.ArchiveTreeContractAutoRuleMapDTO;
@@ -132,4 +133,6 @@ public interface IArchiveTreeContractService extends BaseService<ArchiveTreeCont
     List<MyInspectTreeVO> lazyTree(Long parentId, Long projectId);
 
     Boolean startInspect(Long projectId,Integer type);
+
+    ArchiveTreeContract getMatchNode(Long nodeId);
 }

+ 23 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java

@@ -1035,6 +1035,7 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 	}
 
 
+
 	/**
 	 *
 	 * @param keyId
@@ -1546,4 +1547,26 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 	}
 
 
+	public ArchiveTreeContract getMatchNode(Long nodeId) {
+		ArchiveTreeContract originalNode = this.getById(nodeId); // 保存最初的节点
+		ArchiveTreeContract currentNode = originalNode; // 从最初的节点开始
+
+		// 检查 currentNode 是否为 null,并且 currentNode 的 getRollor() 是否为空
+		while (currentNode != null && StringUtils.isEmpty(currentNode.getRollor())) {
+			Long parentId = currentNode.getParentId();
+
+			// 如果 parentId 为 null 或者 0,跳出循环,返回最初的节点
+			if (parentId == null || parentId == 0) {
+				break;
+			}
+
+			currentNode = this.getById(parentId); // 获取父节点
+		}
+
+		// 如果 currentNode 的 getRollor() 为非空,返回 currentNode,否则返回最初的节点
+		return (currentNode != null && StringUtils.isNotEmpty(currentNode.getRollor())) ? currentNode : originalNode;
+	}
+
+
+
 }