Przeglądaj źródła

优化档案在线验收,节点分配

qianxb 1 rok temu
rodzic
commit
1b23c66a52

+ 8 - 19
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.xml

@@ -539,12 +539,8 @@
             (CASE when LENGTH(expert_id) > 0 then 0 else 1 end) as isSelect,
             if((select COUNT(1) from m_archive_tree_contract WHERE is_deleted = 0 and parent_id = atc.id) > 0,true,false) as isChildren,
             (CASE when LENGTH(expert_id) > 0 then concat('该目录已分属', atc.expert_name , '专家') else '' end) as nodeInfo,
-            (concat(atc.node_name,'(', (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-            and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))), '卷)')) as node_name,
-
-            (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-            and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))) as total
-
+            atc.node_name as node_name ,
+            ( select count(1) from u_archives_auto where is_apply = 1 and is_deleted = 0 and node_id = atc.id ) as total
             from m_archive_tree_contract atc
             WHERE is_deleted =0 and project_id = #{projectId}
             and (id = #{ownerUnit} or FIND_IN_SET(#{ownerUnit},ancestors))
@@ -557,10 +553,8 @@
             (CASE when LENGTH(expert_id) > 0 then 0 else 1 end) as isSelect,
             if((select COUNT(1) from m_archive_tree_contract WHERE is_deleted = 0 and parent_id = atc.id) > 0,true,false) as isChildren,
             (CASE when LENGTH(expert_id) > 0 then concat('该目录已分属', atc.expert_name , '专家') else '' end) as nodeInfo,
-            (concat(atc.node_name,'(', (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-            and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))), '卷)')) as node_name,
-            (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-            and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))) as total
+            atc.node_name as node_name ,
+            ( select count(1) from u_archives_auto where is_apply = 1 and is_deleted = 0 and node_id = atc.id ) as total
             from m_archive_tree_contract atc
             WHERE is_deleted =0 and project_id = #{projectId}
             and  (id = #{supervisorUnit} or FIND_IN_SET(#{supervisorUnit},ancestors))
@@ -573,10 +567,8 @@
             (CASE when LENGTH(expert_id) > 0 then 0 else 1 end) as isSelect,
             if((select COUNT(1) from m_archive_tree_contract WHERE is_deleted = 0 and parent_id = atc.id) > 0,true,false) as isChildren,
             (CASE when LENGTH(expert_id) > 0 then concat('该目录已分属', atc.expert_name , '专家') else '' end) as nodeInfo,
-            (concat(atc.node_name,'(', (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-            and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))), '卷)')) as node_name,
-            (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-            and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))) as total
+            atc.node_name as node_name ,
+            ( select count(1) from u_archives_auto where is_apply = 1 and is_deleted = 0 and node_id = atc.id ) as total
             from m_archive_tree_contract atc
             WHERE is_deleted =0 and project_id = #{projectId}
             and  (id = #{buildUnit} or FIND_IN_SET(#{buildUnit},ancestors))
@@ -587,11 +579,8 @@
         select id,parent_id,
                (CASE when LENGTH(expert_id) > 0 then 0 else 1 end) as isSelect,
                if((select COUNT(1) from m_archive_tree_contract WHERE is_deleted = 0 and parent_id = atc.id) > 0,true,false) as isChildren,
---                (CASE when LENGTH(expert_id) > 0 then concat('该目录已分属', atc.expert_name , '专家') else '' end) as nodeInfo,
-               (concat(atc.node_name,'(', (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-                and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))), ')')) as node_name,
-               (select COUNT(1) from u_archives_auto  WHERE  is_apply = 1 and is_deleted=0 and node_id in (select id from m_archive_tree_contract where is_deleted = 0 and project_id = #{projectId}
-                and (id = atc.id or FIND_IN_SET(atc.id,ancestors)))) as total
+               atc.node_name as node_name ,
+               ( select count(1) from u_archives_auto where project_id = #{projectId} and is_apply = 1 and is_deleted = 0) as total
         from m_archive_tree_contract atc
         WHERE atc.parent_id = 0 and atc.is_deleted = 0 and project_id =#{projectId}
     </select>

+ 12 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java

@@ -1364,6 +1364,8 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 		 */
 		//获取首节点
 		InspectTreeVO firstNode = baseMapper.getFirstNode(projectId);
+		String firstName = firstNode.getNodeName()+"("+firstNode.getTotal()+")";
+		firstNode.setTotal(0);
 		//获取三个单位节点
 		List<ArchiveTreeContract> unitFirstNode = baseMapper.getUnitFirstNode(firstNode.getId());
 		Map<String, Long> unitMap = unitFirstNode.stream().collect(Collectors.toMap(l -> l.getTreeCode(), l -> l.getId()));
@@ -1389,6 +1391,7 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 		twoTreeVO.setList(list);
 		List<InspectTreeVO> list2 = new ArrayList<>();
 		gatherSortNode(list,list2);
+		list.get(0).setNodeName(firstName);
 		//查看当前档案是否分配过其他专家
 		if (list.size() > 1){
 			throw new ServiceException("节点信息错误");
@@ -1476,17 +1479,24 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 	}
 
 	//递归方法
-	private void gatherSortNode(List<InspectTreeVO>list, List<InspectTreeVO> list2){
+	private int gatherSortNode(List<InspectTreeVO>list, List<InspectTreeVO> list2){
+		int i = 0;
 		for (InspectTreeVO vo : list) {
 			if (vo.getChildren().size() == 0){
+				vo.setNodeName(vo.getNodeName()+"("+vo.getTotal()+"卷)");
 				if (vo.getTotal() > 0) {
 					list2.add(vo);
+					i += vo.getTotal();
 				}
 				continue;
 			}else {
-				gatherSortNode(vo.getChildren(), list2);
+				int node = gatherSortNode(vo.getChildren(), list2);
+				vo.setTotal(node);
+				i += node;
+				vo.setNodeName(vo.getNodeName()+"("+vo.getTotal()+"卷)");
 			}
 		}
+		return i;
 	}
 
 	/**