Bläddra i källkod

Merge branch 'lk20230322'

luok 2 år sedan
förälder
incheckning
e21dc2cde0

+ 2 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeVO2.java

@@ -181,4 +181,6 @@ public class ArchiveTreeVO2 implements INodeEx<ArchiveTreeVO2> {
      */
     private Long fromId;
 
+    private boolean iswbsNode;  //是否为关联的wbs节点
+
 }

+ 4 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ArchiveTreeController.java

@@ -209,9 +209,9 @@ public class ArchiveTreeController extends BladeController {
     @ApiOperationSupport(order = 8)
     @ApiOperation(value = "保存立卷规则设置", notes = "传入archiveAutoType规则类型,nodeIds逗号拼接选择节点id")
     public R saveArchiveAutoRule(@ApiParam(value = "立卷规则", required = true) @RequestParam Integer archiveAutoType,
-                                 @ApiParam(value = "主键集合", required = true) @RequestParam String nodeIds,
+                                 @ApiParam(value = "主键集合", required = true) @RequestParam String selectNodeIds,
                                  @ApiParam(value = "是否wbs节点", required = true) @RequestParam Boolean iswbsNode) {
-        return R.status(archiveTreeService.saveArchiveAutoRule(archiveAutoType,nodeIds,iswbsNode));
+        return R.status(archiveTreeService.saveArchiveAutoRule(archiveAutoType,selectNodeIds,iswbsNode));
     }
 
 
@@ -236,8 +236,8 @@ public class ArchiveTreeController extends BladeController {
      * 查看立卷规则设置
      */
     @PostMapping("/getArchiveAutoRule")
-    public R getArchiveAutoRule(Long id,boolean iswbsNode) {
-        Map<String, Object> ruleMap=archiveTreeService.getArchiveAutoRule(id,iswbsNode);
+    public R getArchiveAutoRule(Long nodeId,boolean iswbsNode) {
+        Map<String, Object> ruleMap=archiveTreeService.getArchiveAutoRule(nodeId,iswbsNode);
         return R.data(ruleMap);
     }
 

+ 5 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeMapper.java

@@ -25,7 +25,7 @@ public interface ArchiveTreeMapper extends BaseMapper<ArchiveTree> {
 
     /**
      * 自动组卷规则设置节点下所有子节点
-     * @param tree
+     * @param
      * @return
      */
     int updateAllSonNodeIdsForArchiveAutoRule(@Param("archiveAutoType") Integer archiveAutoType,
@@ -35,7 +35,7 @@ public interface ArchiveTreeMapper extends BaseMapper<ArchiveTree> {
 
     /**
      * 删除立卷规则设置
-     * @param tree
+     * @param
      * @return
      */
     int removeAllSonNodeIdsForArchiveAutoRule_1(@Param("archiveAutoType") Integer archiveAutoType,
@@ -51,6 +51,8 @@ public interface ArchiveTreeMapper extends BaseMapper<ArchiveTree> {
      * @param groupId
      * @return
      */
-    List<ArchiveTreeAutoRuleVO> getAllSonNodeforGroupView(@Param("ancestors")String ancestors, @Param("groupId")Long groupId);
+    List<ArchiveTreeAutoRuleVO> getAllSonNodeforGroupView(@Param("ancestors")String ancestors,
+                                                          @Param("groupId")Long groupId,
+                                                          @Param("bigNodeID")Long bigNodeID);
 
 }

+ 6 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeMapper.xml

@@ -293,20 +293,20 @@
 
         update m_archive_tree
         set
-        archive_auto_type= #{archiveAutoType},
+        archive_auto_type= #{archiveAutoType}
         <if test="archiveAutoType ==2 ">
-            archive_auto_group_id=#{archiveAutoGroupId},
+            ,archive_auto_group_id=#{archiveAutoGroupId},
             archive_auto_group_select=0
         </if>
         where
         is_deleted = 0 and ancestors like concat('', #{ancestors}, '%')
         /*最高并卷规则不能覆盖 分类并卷规则,单独组卷规则*/
         <if test="archiveAutoType ==1 ">
-            and archive_auto_type != 2 and archive_auto_type != 3
+            and (archive_auto_type != 2 and archive_auto_type != 3 or archive_auto_type is null)
         </if>
         /*分类并卷规则不能覆盖单独组卷规则*/
         <if test="archiveAutoType ==2 ">
-            and archive_auto_type != 3
+            and (archive_auto_type != 3 or archive_auto_type is null)
         </if>
     </update>
 
@@ -379,10 +379,11 @@
         FROM m_archive_tree
         where is_deleted = 0
           and ancestors like concat('', #{ancestors}, '%')
-          and archive_auto_type !=3
+          and (archive_auto_type !=3 or archive_auto_type is null)
           and id not in (
                 select id from m_archive_tree where archive_auto_type=2 and archive_auto_group_id != #{groupId}
             )
+          or id=#{bigNodeID}
         order by ancestors asc,sort asc
     </select>
 

+ 46 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveAutoRuleWbsServiceImpl.java

@@ -38,4 +38,50 @@ public class ArchiveAutoRuleWbsServiceImpl extends BaseServiceImpl<ArchiveAutoRu
 		return page.setRecords(baseMapper.selectArchiveAutoRuleWbsPage(page, archiveAutoRuleWbs));
 	}
 
+	public void archiveAutoMethod(){
+		//步骤一:把项目下未锁定的案卷拆卷。
+		//步骤二:查询归档树节点。存在未归档文件的节点。
+		//步骤三:遍历归档树节点整理出 默认规则节点,分类并卷节点,单独组卷节点 三个集合。
+		//步骤四:按照单独,分类,默认的顺序执行组卷流程。
+	}
+
+	/**
+	 * 单租组卷流程  节点下的文件只在当前节点下组卷
+	 */
+	private void archiveAutoMethod3(){
+		//步骤1:遍历节点集合
+		//步骤2:获取当前节点的案卷规格
+		//步骤3:查询节点下的未归档文件
+		//步骤4:遍历未归档文件
+		//步骤5:判断文件是否存在分盒设置-》走分盒组卷流程
+		//步骤6:计算和判断待组卷文件集合是否达到组卷要求,达到要求创建案卷,案卷归属当前节点,案卷下文件改为已组卷
+	}
+
+	/**
+	 * 分类并卷组卷  设置分类的节点下只有一个案卷,节点下的所有文件都组成这个案卷。如果设置分类节点(select=1的)多个,案卷归属排序第一个节点。
+	 */
+	private void archiveAutoMethod2(){
+		//步骤1:遍历节点集合
+		//步骤2:查询节点下的未归档文件
+		//步骤4:遍历未归档文件
+		//步骤5:判断文件是否存在分盒设置-》走分盒组卷流程
+		//步骤6:将文件按照<groupId,List<文件>>放入集合
+		//步骤7:将文件按照<groupId,List<文件>>放入集合
+		//步骤8:按集合创建案卷,每个group类的案卷归属顺序排第一个节点
+	}
+
+	/**
+	 * 默认组卷流程 文件可以跨节点组卷,受最高并卷节点限制范围,跨节点文件组卷时,案卷规格按照第一个文件所在的节点规格 组卷。
+	 */
+	private void archiveAutoMethod1(){
+		//步骤1:遍历节点集合
+		//步骤2:保存当前节点的最高并卷节点archiveAutoNodeId到变量A,用来限制向上级跨节点组卷。
+		//步骤3:判断变量A是否与当前节点archiveAutoNodeId相同,不同的话(相当于当前节点已跳出最高并卷节点)直接将内存中文件集合List中的文件组卷(这些是属于上一个最高并卷节点的文件),并清空list文件集合
+		//步骤4:获取当前节点的组卷规格
+		//步骤5:查询节点下的未归档文件
+		//步骤6:遍历未归档文件
+		//步骤7:判断文件是否存在分盒设置-》走分盒组卷流程
+		//步骤8:计算和判断文件集合list里是否达到组卷规格,达到创建案卷 并清空集合list。 跨节点文件组卷,案卷归属于当前list中第一个文件所在节点
+	}
+
 }

+ 24 - 13
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeServiceImpl.java

@@ -413,6 +413,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                 continue;
             }
             ArchiveTreeVO2 archiveTree = new ArchiveTreeVO2();
+            archiveTree.setIswbsNode(true);
             archiveTree.setId(wbsTreeVO2.getId());
             archiveTree.setParentId(wbsTreeVO2.getParentId());
             archiveTree.setTitle(wbsTreeVO2.getTitle());
@@ -458,7 +459,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
             //分类并卷规则的需要生成个随机数,作为同一个分类赋值archiveAutoNodeId
             if(archiveAutoType==2){
                 double v = Math.random() * 10000;
-                int ran = (int)v;
+                long ran = (long)v;
                 archiveAutoGroupId=Long.parseLong(System.currentTimeMillis()+""+ran);
             }
 
@@ -483,7 +484,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                         archiveTree.getArchiveAutoType(),
                         archiveTree.getArchiveAutoNodeId(),
                         archiveTree.getArchiveAutoGroupId(),
-                        archiveTree.getAncestors()
+                        archiveTree.getAncestors()+","+archiveTree.getId()
                 );
             }
 
@@ -506,7 +507,8 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
             Long archiveAutoGroupId=null;
             //分类并卷规则的需要生成个随机数,作为同一个分类赋值archiveAutoNodeId
             if(archiveAutoType==2){
-                double ran=(Math.random()*100000000) + 1;
+                double v = Math.random() * 10000;
+                long ran = (long)v;
                 archiveAutoGroupId=Long.parseLong(System.currentTimeMillis()+""+ran);
             }
 
@@ -555,7 +557,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                 if(archiveAutoType==2){
                     Long groupId = dto.getArchiveAutoGroupId();
                     String selectNodeIds = dto.getSelectNodeIds();
-                    List<String> selectNodeIdlist = Arrays.asList(selectNodeIds);
+                    List<String> selectNodeIdlist = Arrays.asList(selectNodeIds.split(","));
                     //先将同一分组的节点删除配置,。
                     baseMapper.removeNodeForArchiveAutoRule_Group(groupId);
                     //然后再按照选择节点保存新的设置
@@ -572,7 +574,7 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                                 archiveTree.getArchiveAutoType(),
                                 archiveTree.getArchiveAutoNodeId(),
                                 archiveTree.getArchiveAutoGroupId(),
-                                archiveTree.getAncestors()
+                                archiveTree.getAncestors()+","+archiveTree.getId()
                         );
                     }
                 }
@@ -650,9 +652,10 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                             // 因为分类并卷规则影响范围包括下面所有子节点,如果给archive_auto_group_select=0的节点也就是范围内的子节点单独取消规则,会造成案卷归属节点错乱。
                             // (不理那么多,就这样限制先 。如业务非要发神经就要 TODO 验证节点的父节点是否为分类并卷规则,如是则取消。若无其他兄弟节点,继续往上验证。)
                             baseMapper.removeAllSonNodeIdsForArchiveAutoRule_2(node.getArchiveAutoType(),node.getAncestors());
+                        }else{
+                            returnMap.put("code","0");
+                            returnMap.put("msg","只能取消设置的节点,不能取消设置节点范围下节点");
                         }
-                        returnMap.put("code","0");
-                        returnMap.put("msg","只能取消设置的节点,不能取消设置节点范围下节点");
                     }
                     //删除节点及所有子节点 单独并卷规则
                     if(archiveAutoType==3){
@@ -677,9 +680,9 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
     public Map<String,Object> getArchiveAutoRule(Long id,boolean iswbsNode) {
 
         if(iswbsNode){
-            return getArchiveAutoRule_ArchiveTreeNode(id);
-        }else{
             return getArchiveAutoRule_WbsTreeNode(id);
+        }else{
+            return getArchiveAutoRule_ArchiveTreeNode(id);
         }
     }
 
@@ -702,6 +705,9 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                     String ancestors = archiveAutoNode.getAncestors();
                     String[] ancestorssplit = ancestors.split(",");//全路径ID
                     for(String pId:ancestorssplit){
+                        if(pId.equals("0")){
+                            continue;
+                        }
                         long pIdLong = Long.parseLong(pId);
                         ArchiveTree pIdNode = baseMapper.selectById(pIdLong);
                         allName.append(pIdNode.getNodeName()+"/");
@@ -720,9 +726,10 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                     //找出当前节点大类
                     String ancestors = archiveTree.getAncestors();
                     String[] ancestorssplit = ancestors.split(",");//全路径ID
-                    String nodeAncestors = ancestorssplit[0]+","+ancestorssplit[1]; //大类的ancestors
+                    String nodeAncestors = ancestorssplit[0]+","+ancestorssplit[1]+","+ancestorssplit[2]; //大类的ancestors
+                    Long bigNodeID =Long.parseLong(ancestorssplit[2]); //大类节点ID
                     //获取大类下所有节点,过滤单独规则,其他分类并卷规则组节点
-                    List<ArchiveTreeAutoRuleVO> nodetree = ForestNodeMerger.merge(baseMapper.getAllSonNodeforGroupView(nodeAncestors, archiveTree.getArchiveAutoNodeId()));
+                    List<ArchiveTreeAutoRuleVO> nodetree = ForestNodeMerger.merge(baseMapper.getAllSonNodeforGroupView(nodeAncestors, archiveTree.getArchiveAutoNodeId(),bigNodeID));
                     //获取与当前节点设置同一分类分组的节点
                     List<ArchiveTree> listGroup= baseMapper.selectList(Wrappers.<ArchiveTree>lambdaQuery()
                             .eq(ArchiveTree::getArchiveAutoGroupId, archiveTree.getArchiveAutoGroupId())
@@ -733,9 +740,10 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                     for(ArchiveTree node:listGroup){
                         nodeSelect.append(node.getId()+",");
                     }
-                    map.put("type",archiveAutoType);
+                    map.put("archiveAutoType",archiveAutoType);
+                    map.put("archiveAutoGroupId",archiveTree.getArchiveAutoGroupId());
                     map.put("tree",nodetree);
-                    map.put("data",nodeSelect.toString());
+                    map.put("selectNodeIds",nodeSelect.toString());
                     return map;
                 }
                 if(archiveAutoType==3){
@@ -744,6 +752,9 @@ public class ArchiveTreeServiceImpl extends BaseServiceImpl<ArchiveTreeMapper, A
                     String ancestors = archiveTree.getAncestors();
                     String[] ancestorssplit = ancestors.split(",");//全路径ID
                     for(String pId:ancestorssplit){
+                        if(pId.equals("0")){
+                            continue;
+                        }
                         long pIdLong = Long.parseLong(pId);
                         ArchiveTree pIdNode = baseMapper.selectById(pIdLong);
                         allName.append(pIdNode.getNodeName()+"/");