Browse Source

同步-项目同步
1、同步表单时,同时同步电签

LHB 1 month ago
parent
commit
b3a67c4f5c

+ 18 - 127
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsSynchronousServiceImpl.java

@@ -522,6 +522,8 @@ public class WbsSynchronousServiceImpl {
                             editData.addAll(addPrivateNodes);
                             editData.addAll(editPrivateNodes);
                             wbsSynchronousEViSaService.saveFormula(wbsTreeSynchronousRecord, editData);
+                            //现在电签使用的是模糊匹配 如果电签匹配方式改为精确匹配 则需要使用该功能
+                            updateEViSa(collect, wbsTreeSynchronousRecord.getTemplateId(), projectInfo.getId(), templateNodes, editPrivateNodes);
                             //排序
                         case 7:
                             //元素配置
@@ -531,8 +533,6 @@ public class WbsSynchronousServiceImpl {
                         case 4:
                             //默认值  如果有数据 与节点绑定
                         case 6:
-                            //现在电签使用的是模糊匹配 如果电签匹配方式改为精确匹配 则需要使用该功能
-//                            updateEViSa(collect, wbsTreeSynchronousRecord.getTemplateId(), projectInfo.getId(), templateNodes, editPrivateNodes);
                             break;
                         default:
                             break;
@@ -1183,8 +1183,6 @@ public class WbsSynchronousServiceImpl {
 
             //模板的主键ids
             List<Long> tempPKeyIds = new ArrayList<>();
-            List<Long> editPKeyIds = new ArrayList<>();
-
 
             for (WbsTreePrivate tempPrivate : treePrivates) {
                 for (WbsTreePrivate editPrivate : editPrivateNodes) {
@@ -1205,9 +1203,8 @@ public class WbsSynchronousServiceImpl {
                     .eq(TextdictInfo::getProjectId, templateId)
                     .eq(TextdictInfo::getIsDeleted, 0)
                     .in(TextdictInfo::getTabId, tempPKeyIds)
-                    .in(TextdictInfo::getType, 4));
-            //当前值同步默认值
-//                    .in(TextdictInfo::getType, 2, 4, 6));
+                    //当前值同步默认值
+                    .in(TextdictInfo::getType, 2, 4, 6));
             if (CollectionUtil.isEmpty(tempTextDictInfo)) {
                 throw new ServiceException("源数据无电签及默认值配置");
             }
@@ -1216,27 +1213,23 @@ public class WbsSynchronousServiceImpl {
 
             List<TextdictInfo> tempViSa = new ArrayList<>();
             //电签
-            if (collect.contains(3)) {
-                //个人电签
-                List<TextdictInfo> tempMyViSa = tempTextDictInfoMap.get(2);
-                if (CollectionUtil.isNotEmpty(tempMyViSa)) {
-                    tempViSa.addAll(tempMyViSa);
-
-                }
-                //企业电签
-                List<TextdictInfo> tempEnterViSa = tempTextDictInfoMap.get(6);
-                if (CollectionUtil.isNotEmpty(tempEnterViSa)) {
-                    tempViSa.addAll(tempEnterViSa);
-                }
+            List<TextdictInfo> tempMyViSa = tempTextDictInfoMap.get(2);
+            if (CollectionUtil.isNotEmpty(tempMyViSa)) {
+                tempViSa.addAll(tempMyViSa);
 
             }
-            //默认值
-            if (collect.contains(5)) {
-                List<TextdictInfo> tempDefault = tempTextDictInfoMap.get(4);
-                if (CollectionUtil.isNotEmpty(tempDefault)) {
-                    tempViSa.addAll(tempDefault);
-                }
+            //企业电签
+            List<TextdictInfo> tempEnterViSa = tempTextDictInfoMap.get(6);
+            if (CollectionUtil.isNotEmpty(tempEnterViSa)) {
+                tempViSa.addAll(tempEnterViSa);
             }
+            //默认值
+//            if (collect.contains(5)) {
+//                List<TextdictInfo> tempDefault = tempTextDictInfoMap.get(4);
+//                if (CollectionUtil.isNotEmpty(tempDefault)) {
+//                    tempViSa.addAll(tempDefault);
+//                }
+//            }
 
 
             List<TextdictInfo> addData = new ArrayList<>();
@@ -1270,108 +1263,6 @@ public class WbsSynchronousServiceImpl {
     }
 
 
-    /**
-     * 20250414-lhb-新增
-     * 创建祖级路径
-     * <p>
-     * 该方法用于构建给定节点的祖先路径标识符(PId)字符串
-     * 它通过追溯节点的父节点,直到达到根节点或满足特定条件为止
-     *
-     * @param node    WbsTreeContract类型的节点,表示需要构建路径的起始节点
-     * @param nodeMap 一个映射,其键为节点ID,值为WbsTreeContract类型的节点对象,用于快速查找节点
-     * @return 返回一个字符串,表示构建的祖先路径标识符序列,以逗号分隔
-     */
-    private String createAncestorsPId(WbsTreePrivate node, Map<Long, WbsTreePrivate> nodeMap) {
-        // 初始化路径列表,用于存储祖先节点的ID
-        List<Long> path = new ArrayList<>();
-        // 从给定的节点开始
-        WbsTreePrivate current = node;
-        // 初始化访问集合,用于检测循环引用
-        Set<Long> visited = new HashSet<>();
-
-        while (true) {
-            // 检查当前节点是否为根节点或无效节点
-            if (current == null || current.getPId() == null ||
-                    current.getPId() == 0 || current.getPId().equals(current.getPKeyId())) {
-                break;
-            }
-
-            // 检测循环引用
-            if (visited.contains(current.getPId())) {
-                break;
-            }
-            // 将当前节点的ID添加到已访问集合中
-            visited.add(current.getPKeyId());
-
-            // 从映射中获取当前节点的父节点
-            current = nodeMap.get(current.getPId());
-            // 如果父节点存在,则将其ID添加到路径列表的开头
-            if (current != null) {
-                path.add(0, current.getPKeyId());
-            }
-
-            // 安全限制,防止路径过长导致性能问题
-            if (path.size() > 50) {
-                break;
-            }
-        }
-        // 将根节点ID(0)添加到路径的最前面,表示路径的起点
-        path.add(0, 0L);
-        // 将路径列表转换为字符串并返回
-        return String.join(",", path.stream().map(String::valueOf).toArray(String[]::new));
-    }
-
-    /**
-     * 20250414-lhb-新增
-     * 创建祖级路径
-     * <p>
-     * 该方法用于构建给定节点的祖先路径标识符(PId)字符串
-     * 它通过追溯节点的父节点,直到达到根节点或满足特定条件为止
-     *
-     * @param node    WbsTreeContract类型的节点,表示需要构建路径的起始节点
-     * @param nodeMap 一个映射,其键为节点ID,值为WbsTreeContract类型的节点对象,用于快速查找节点
-     * @return 返回一个字符串,表示构建的祖先路径标识符序列,以逗号分隔
-     */
-    private String createAncestorsPId(WbsTreeContract node, Map<Long, WbsTreeContract> nodeMap) {
-        // 初始化路径列表,用于存储祖先节点的ID
-        List<Long> path = new ArrayList<>();
-        // 从给定的节点开始
-        WbsTreeContract current = node;
-        // 初始化访问集合,用于检测循环引用
-        Set<Long> visited = new HashSet<>();
-
-        while (true) {
-            // 检查当前节点是否为根节点或无效节点
-            if (current == null || current.getPId() == null ||
-                    current.getPId() == 0 || current.getPId().equals(current.getPKeyId())) {
-                break;
-            }
-
-            // 检测循环引用
-            if (visited.contains(current.getPId())) {
-                break;
-            }
-            // 将当前节点的ID添加到已访问集合中
-            visited.add(current.getPKeyId());
-
-            // 从映射中获取当前节点的父节点
-            current = nodeMap.get(current.getPId());
-            // 如果父节点存在,则将其ID添加到路径列表的开头
-            if (current != null) {
-                path.add(0, current.getPKeyId());
-            }
-
-            // 安全限制,防止路径过长导致性能问题
-            if (path.size() > 50) {
-                break;
-            }
-        }
-        // 将根节点ID(0)添加到路径的最前面,表示路径的起点
-        path.add(0, 0L);
-        // 将路径列表转换为字符串并返回
-        return String.join(",", path.stream().map(String::valueOf).toArray(String[]::new));
-    }
-
 
     /**
      * 获取指定节点的所有最新节点