许鹏程
2025-01-21 7a4f77f7e13481a93533a7116accc6b590452be7
product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java
@@ -151,7 +151,7 @@
   private String attachmentValue = "";
   //已开发公共功能 公告管理 问卷管理  考勤管理 协同办公 会议管理
//    private List<String> funTable = Lists.newArrayList("FE_APP5.PUB_NOTICE","FE_BASE5.RESEARCH_TOPIC","FE_APP5.APP_KQLRB","FE_BASE5.SYS_COLLABORATIVE","FE_APP5.BS_MEETING_FLOW");
   private List<String> funTable = Lists.newArrayList("FE_APP5.PUB_NOTICE", "FE_BASE5.RESEARCH_TOPIC", "FE_APP5.APP_KQLRB", "FE_BASE5.SYS_COLLABORATIVE", "FE_APP5.BS_MEETING_FLOW");
   private List<String> funTable = Lists.newArrayList("FE_APP5.PUB_NOTICE", "FE_BASE5.RESEARCH_TOPIC", "FE_APP5.APP_KQLRB", "FE_BASE5.SYS_COLLABORATIVE", "FE_APP5.BS_MEETING_FLOW", "FE_APP5.PLEASELEAVE");
   private Set<String> clearTable = new HashSet<>();
@@ -255,6 +255,7 @@
      }
   }
   Set<String> syncData=new HashSet<>();
   /**
    * 同步表及表数据
    *
@@ -327,7 +328,7 @@
      //如果是已开发功能定义 通过自己定义的数据关联 同步数据
      String[] sf28s = sf28.split("\\.");
      try {
         this.syncTable(sf28s, !isStr(sf28), null, conn);
//         this.syncTable(sf28s, !isStr(sf28), null, conn);
      } catch (Exception e) {
         e.getStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
@@ -3488,6 +3489,10 @@
      FieldSetEntity Orlfs;
      //表名
      String taName = sf28s[1];
      if(syncData.contains(taName)){
         return;
      }
      syncData.add(taName);
      //获取主表的表名
      if (sf28s.length == 3) {
         this.masterTableName = sf28s[2];
@@ -3588,13 +3593,13 @@
            }
            //同步附件
            if (syncAttachments) {
               Map<String, List<String>> fileMaps = this.synchronizationAttachments(conn, accessoryData, dataFs, tableFs.getTableName(), null);
               if (fileMaps.size() > 0) {
                  for (String fieldName : fileMaps.keySet()) {
                     List<String> value = fileMaps.get(fieldName);
                     tableFs.setValue(fieldName, StringUtils.join(value, ","));
                  }
               }
//               Map<String, List<String>> fileMaps = this.synchronizationAttachments(conn, accessoryData, dataFs, tableFs.getTableName(), null);
//               if (fileMaps.size() > 0) {
//                  for (String fieldName : fileMaps.keySet()) {
//                     List<String> value = fileMaps.get(fieldName);
//                     tableFs.setValue(fieldName, StringUtils.join(value, ","));
//                  }
//               }
            }
            String uuid = UUID.randomUUID().toString();
            try {
@@ -3731,6 +3736,9 @@
    */
   public Map<String, List<String>> synchronizationAttachments(Connection conn, DataTableEntity accessoryData, FieldSetEntity tableFs, String table, String myField) throws Exception {
      Map<String, List<String>> filesMap = Maps.newHashMap();
      if (true) {
         return filesMap;
      }
      for (int i = 0; i < accessoryData.getRows(); i++) {
         //类型
         String type = accessoryData.getString(i, "si02");
@@ -4224,9 +4232,15 @@
         this.syncLinks(wm00, conn, modelUuid);
      } else {
         DataTableEntity nodeMapping = baseDao.listTable("product_fe_flow_node_mapping", "flow_uuid=? ", new Object[]{existFlow.getUUID()});
         if("BGYPLYB".equals(wm04s[1])){
            DataTableEntity dtt = baseDao.listTable("product_fe_flow_node_mapping", "flow_uuid='2439e326-45e2-4396-b176-857712c31ded' ", new Object[]{});
            BaseUtil.dataTableMerge(nodeMapping, dtt);
         }
         nodesUUID = new JSONObject();
         for (int i = 0; i < nodeMapping.getRows(); i++) {
            nodesUUID.put(nodeMapping.getString(i, "wn53"), nodeMapping.getString(i, "node_uuid"));
            //同步流程节点人员权限配置
            this.syncNodeUser(nodeMapping.getString(i, "node_uuid"), conn, nodeMapping.getString(i, "wn00"));
         }
      }
@@ -4253,6 +4267,40 @@
      return typeCode;
   }
   private void syncNodeUser(String nodeUuid, Connection conn, String wn00) {
      if (StringUtils.isEmpty(wn00) || StringUtils.isEmpty(nodeUuid)) {
         return;
      }
      FieldSetEntity wfNode = BaseDaoServiceImpl.getFieldSet(conn, "fe_base5.wf_nodes", "wn00=?", new Object[]{wn00});
      if (FieldSetEntity.isEmpty(wfNode)) {
         return;
      }
      FieldSetEntity nodeFs = baseDao.getFieldSetEntity("product_sys_flow_node", nodeUuid, false);
      if (FieldSetEntity.isEmpty(nodeFs)) {
         return;
      }
      Map<String, String> map1 = syncNodeInstitutions(conn, wfNode);
      if (map1 != null && map1.size() > 0) {
         String userSet = map1.get("userSet");
         //人员id
         if (!BaseUtil.strIsNull(userSet)) {
            nodeFs.setValue("default_users", userSet);
         }
         String postSet = map1.get("postSet");
         //岗位uuid
         if (!BaseUtil.strIsNull(postSet)) {
            nodeFs.setValue("default_posts", postSet);
         }
         String deptSet = map1.get("deptList");
         //单位部门uuid
         if (!BaseUtil.strIsNull(deptSet)) {
            nodeFs.setValue("default_depts", deptSet);
         }
      }
      BaseUtil.createCreatorAndCreationTime(nodeFs);
      baseDao.saveFieldSetEntity(nodeFs);
   }
   /**
    * 迁移 flow处理器
    *