许鹏程
2024-05-28 e6720f333268682d11aedb3b3308fa2f2c3a40df
product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java
@@ -1,6 +1,8 @@
package com.product.data.sync.util;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
@@ -8,6 +10,8 @@
import com.google.common.collect.Sets;
import com.product.admin.service.SystemMenusService;
import com.product.common.lang.StringUtils;
import com.product.core.cache.DataPoolCacheImpl;
import com.product.core.cache.DataPoolRefreshCache;
import com.product.core.config.Global;
import com.product.core.connection.ConnectionManager;
import com.product.core.dao.BaseDao;
@@ -36,6 +40,8 @@
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
 * Copyright LX
@@ -48,8 +54,9 @@
 */
public class BusinessDataSync extends AbstractBaseService implements Runnable {
   private static Logger logger = LoggerFactory.getLogger(SyFeDataService.class);
   @Autowired
   public BaseDao baseDao;
   BatchAddData batchAddData;
   @Override
   public BaseDao getBaseDao() {
@@ -61,7 +68,6 @@
      this.baseDao = baseDao;
   }
   @Autowired
   FileManagerService fileManagerService;
   public FileManagerService getFileManagerService() {
@@ -72,7 +78,6 @@
      this.fileManagerService = fileManagerService;
   }
   @Autowired
   SystemMenusService systemMenusService;
   public SystemMenusService getSystemMenusService() {
@@ -83,7 +88,6 @@
      this.systemMenusService = systemMenusService;
   }
   @Autowired
   private FeDataDSService feDataDSService;
   public FeDataDSService getFeDataDSService() {
@@ -103,6 +107,11 @@
   public void setGdMediaUtil(GdMediaUtil gdMediaUtil) {
      this.gdMediaUtil = gdMediaUtil;
   }
   public void setBatchAddData(BatchAddData batchAddData) {
      this.batchAddData = batchAddData;
   }
   //公司fe id 对应 产品uuid
@@ -144,7 +153,14 @@
//    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 Set<String> clearTable = new HashSet<>();
   private String clientUUID;
   public void setClearTable(Set<String> clearTable) {
      this.clearTable = clearTable;
   }
   public String getClientUUID() {
      return clientUUID;
@@ -159,9 +175,45 @@
   public BusinessDataSync(String tricode_funs) {
      this.tricode_funs = tricode_funs;
      this.functionUuid = this.feFunctionCodeByFunctionUuid.get(tricode_funs.trim().replace("mvc", "").replaceAll(",", ""));
   }
   public String TSPath = Global.getSystemConfig("new.filePackage", "");
   private String functionUuid;
   public Set<String> getClearAttachment() {
      return clearAttachment;
   }
   Map<String, String> feFunctionCodeByFunctionUuid = MapUtil
         .builder("035-411-000", "f7c4dd7d-3e17-4f67-b1cb-b36704f3f896")//会议室申请
         .put("006-009-000", "ed86d09a-23be-4d8c-8cb2-be8622fe50f4")//发布公告
         .put("001-006-000", "df981440-327c-4c9f-9395-f98ad067986e")//收文管理
         .put("001-011-000", "0245268a-8da3-47d5-aab1-4dd85b162904")//自由行文
         .put("019-021-000", "8a7c615a-1c4c-4eca-8d83-f04415128267")//办公用品领用表
         .put("021-012-000", "a3222fac-6203-407b-92c7-3aa2d459c62b")//发文子表单
         .put("021-016-000", "39358718-fe36-44c3-832d-74fae9487922")//工作人员出差(培训)审批单
         .put("019-018-000", "243e5c53-72d7-4419-85cf-acc09db68756")//公务接待审批
         .put("019-017-000", "d7e76a76-5650-4499-a941-23faf64ca3c8")//办公室用品采购单
         .put("001-012-000", "18cbe376-1d7a-4d0c-bd6f-6fd4c5390474")//西宁市房产管理局发文稿纸
         .put("600-008-000", "1d0b60d3-6497-4600-aafb-189ac1c1cdf0")//行政处罚事先告知书
         .put("600-009-000", "9c5b0b79-e801-4a03-a3fa-19974b6c1e67")//行政处罚不予
         .put("600-010-000", "409673e2-bdc3-46f0-adeb-067be4938618")//行政处罚听证告知书
         .put("600-011-000", "19fda013-4950-44e9-b276-2ecbdae1fa55")//行政处罚听证通知书
         .put("600-012-000", "64876b1a-d13d-492c-a488-2f243a837486")//行政处罚不予听证通知书
         .put("600-013-000", "540a3469-5d6f-41b7-807e-0ac44f46303a")//行政处罚决定书
         .put("600-014-000", "5509387d-de73-4a66-a42a-fbeff23fd3f0")//调查终结报告
         .put("600-015-000", "3c9f9d0a-5a5e-465c-9433-b5541cc7a075")//行政案件立案审批表
         .put("600-016-000", "8c7c34c5-5dca-4544-a6e4-0fbb7b80eb1f")//行政处罚催告书
         .put("019-023-000", "8c9d0806-28ba-43b4-b2cf-dcb81a10ce65")//行政执法审批表
         .put("601-001-000", "")//考勤录入
         .put("019-025-000", "30cea2ef-92b1-46c1-8785-5d34755ee803")//办公经费使用审批单
         .put("003-006-000", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8")//协同办公
         .map();
   public Boolean isStr(String str) {
      boolean a = false;
@@ -220,6 +272,36 @@
         throw e;
      }
      String sf28 = Orlfs.getString("sf28");
      //查询本系统中的功能uuid
      String feFunctionName = Orlfs.getString("sf02");
      //SF09
      String functionId = Orlfs.getString("sf00");
      DataTableEntity dataTable = BaseDaoServiceImpl.getDataTable(conn, "select * from WF_MODEL where WM05=(SELECT SF09 FROM SYS_FACE WHERE SF00 IN (\n" +
            "\n" +
            "select SP04 FROM SYS_PAGE where sp01='001-012-000' and sp04 !='0' and sp04!=' ' GROUP BY SP04\n" +
            ") AND SF09 IS NOT NULL AND  LENGTH(SF09)>0 AND SF09!=' ' and ROWNUM=1)", new Object[]{});
//      if (!DataTableEntity.isEmpty(dataTable)) {
//         String feFlowTitle = dataTable.getString(0, "wm01");
//         String feTable = dataTable.getString(0, "wm04").split("\\.")[1];
//
//         //本系统表名
//         String tableName = this.originalTable.getString(feTable);
//         if (StringUtils.isEmpty(tableName)) {
//            //转换为产品表名
//            tableName = feTable.toLowerCase();
//         }
//         FieldSetEntity existFlow = baseDao.getFieldSetEntityByFilter("product_sys_flow_model", "title = ? or table_uuid=?", new Object[]{feFlowTitle, tableName}, false);
//         if (!FieldSetEntity.isEmpty(existFlow)) {
//            //拿流程uuid找mvcpage
//            String flowUuid = existFlow.getString("type_code");
//            FieldSetEntity mvcPage = baseDao.getFieldSetEntityByFilter("product_sys_mvc_page", "flow_uuid = ?", new Object[]{flowUuid}, false);
//            if (!FieldSetEntity.isEmpty(mvcPage)) {
//               functionUuid = mvcPage.getString("function_uuid");
//            }
//         }
//      }
      //功能如果未关联基础表 查询流程表
      if (BaseUtil.strIsNull(sf28) || sf28.indexOf(".") == -1) {
         FieldSetEntity modelFse;
@@ -249,96 +331,10 @@
      } catch (Exception e) {
         e.getStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
         logger.error("synchronizeTablesData", e);
      }
      return sf28;
   }
   /**
    * 同步公告表数据
    *
    * @param conn
    * @param tableName
    * @throws SQLException
    */
   private void syncNotice(Connection conn, String tableName) throws SQLException {
      //判断是否是已经同步过的表
      DataTableEntity dataTable = baseDao.listTable("product_oa_announcement");
      if (!BaseUtil.dataTableIsEmpty(dataTable)) {
         return;
      }
      DataTableEntity noticeDt = null;
      try {
         noticeDt = BaseDaoServiceImpl.getDataTable(conn, tableName, "", new Object[]{});
      } catch (Exception e) {
         DataManipulationUtils.close(null, null, conn);
         throw e;
      }
      for (int i = 0; i < noticeDt.getRows(); i++) {
         FieldSetEntity feFs = noticeDt.getFieldSetEntity(i);
         FieldSetEntity fs = new FieldSetEntity();
         fs.setTableName("product_oa_announcement");
         fs.setValue("title", feFs.getString("title"));
         fs.setValue("content", feFs.getString("content"));
         fs.setValue("type", feFs.getString("notice_category"));
         fs.setValue("annex", feFs.getString("annex"));
         DataTableEntity accessoryData = new DataTableEntity();
         FieldSetEntity accessoryFs = new FieldSetEntity("temp");
         accessoryFs.setValue("si02", "attachment");
         accessoryFs.setValue("si04", "ANNEX");
         accessoryData.addFieldSetEntity(accessoryFs);
         if (!BaseUtil.dataTableIsEmpty(accessoryData)) {
            try {
               Map<String, List<String>> stringListMap = this.synchronizationAttachments(conn, accessoryData, fs, "product_oa_announcement", "annex");
               fs.setValue("annex", CollectionUtil.join(stringListMap.get("annex"), ","));
            } catch (Exception e) {
               e.printStackTrace();
            }
         }
         //Set 转换为字符串逗号分隔
         //写方法判断是多人还是部门,若是部门转换为人
         fs.setValue("extent", this.getUserIds(conn, feFs.getString("receivers")));
         fs.setValue("expiration_date", feFs.getDate("displayed_date"));
         fs.setValue("status", feFs.getString("is_reminded"));
         fs.setValue("publish_status", feFs.getString("status"));
         String publisher = this.userIdJson.getString(feFs.getString("publisher"));
         if (BaseUtil.strIsNull(publisher)) {
            continue;
         }
         fs.setValue("created_by", publisher);
         fs.setValue("created_utc_datetime", feFs.getDate("publish_date"));
         String uuid = baseDao.add(fs);
//            //重新获取jdbc连接
//            Connection connection = null;
//            try {
//                connection = this.getJDBC();
//            } catch (ClassNotFoundException e) {
//                e.printStackTrace();
//            }
         DataTableEntity subFeFs = getSubDt(conn, "FE_APP5.PUB_NOTICE_RECEIVER", "NOTICE_ID", feFs.getString("id"));
         DataTableEntity subData = new DataTableEntity();
         FieldMetaEntity f = new FieldMetaEntity();
         f.setTableName(new String[]{"product_oa_announcement_role"});
         subData.setMeta(f);
         for (int j = 0; j < subFeFs.getRows(); j++) {
            FieldSetEntity fsSubFe = subFeFs.getFieldSetEntity(j);
            FieldSetEntity fsSub = new FieldSetEntity();
            fsSub.setTableName("product_oa_announcement_role");
            String userId = userIdJson.getString(fsSubFe.getString("receiver"));
            if (null == userId) {
               continue;
            }
            //获取所属部门
            fsSub.setValue("user_id", userId);
            fsSub.setValue("status", fsSubFe.getString("readed"));
            fsSub.setValue("announcement_uuid", uuid);
            subData.addFieldSetEntity(fsSub);
         }
         baseDao.add(subData);
//            DataManipulationUtils.close(null, null, connection);
      }
   }
   /**
@@ -403,6 +399,93 @@
         throw new BaseException(e.getMessage(), e.toString());
      }
      return StringUtils.join(extentArr, ",");
   }
   /**
    * 同步公告表数据
    *
    * @param conn
    * @param tableName
    * @throws SQLException
    */
   private void syncNotice(Connection conn, String tableName) throws SQLException {
      //判断是否是已经同步过的表
      DataTableEntity dataTable = baseDao.listTable("product_oa_announcement");
      if (!BaseUtil.dataTableIsEmpty(dataTable)) {
         return;
      }
      DataTableEntity noticeDt = null;
      try {
         noticeDt = BaseDaoServiceImpl.getDataTable(conn, tableName, "", new Object[]{});
      } catch (Exception e) {
         DataManipulationUtils.close(null, null, conn);
         throw e;
      }
      for (int i = 0; i < noticeDt.getRows(); i++) {
         FieldSetEntity feFs = noticeDt.getFieldSetEntity(i);
         FieldSetEntity fs = new FieldSetEntity();
         fs.setTableName("product_oa_announcement");
         fs.setValue("title", feFs.getString("title"));
         fs.setValue("content", feFs.getString("content"));
         fs.setValue("type", feFs.getString("notice_category"));
         fs.setValue("annex", feFs.getString("annex"));
         DataTableEntity accessoryData = new DataTableEntity();
         FieldSetEntity accessoryFs = new FieldSetEntity("temp");
         accessoryFs.setValue("si02", "attachment");
         accessoryFs.setValue("si04", "ANNEX");
         accessoryData.addFieldSetEntity(accessoryFs);
         if (!BaseUtil.dataTableIsEmpty(accessoryData)) {
            try {
               Map<String, List<String>> stringListMap = this.synchronizationAttachments(conn, accessoryData, fs, "product_oa_announcement", "annex");
               fs.setValue("annex", CollectionUtil.join(stringListMap.get("annex"), ","));
            } catch (Exception e) {
               e.printStackTrace();
            }
         }
         //Set 转换为字符串逗号分隔
         //写方法判断是多人还是部门,若是部门转换为人
         fs.setValue("extent", this.getUserIds(conn, feFs.getString("receivers")));
         fs.setValue("expiration_date", feFs.getDate("displayed_date"));
         fs.setValue("status", feFs.getString("is_reminded"));
         fs.setValue("publish_status", feFs.getString("status"));
         String publisher = this.userIdJson.getString(feFs.getString("publisher"));
         if (BaseUtil.strIsNull(publisher)) {
            continue;
         }
         fs.setValue("created_by", publisher);
         fs.setValue("created_utc_datetime", feFs.getDate("publish_date"));
         String uuid = baseDao.add(fs);
//            //重新获取jdbc连接
//            ConnectionInterface connection = null;
//            try {
//                connection = this.getJDBC();
//            } catch (ClassNotFoundException e) {
//                e.printStackTrace();
//            }
         DataTableEntity subFeFs = getSubDt(conn, "FE_APP5.PUB_NOTICE_RECEIVER", "NOTICE_ID", feFs.getString("id"));
         DataTableEntity subData = new DataTableEntity();
         FieldMetaEntity f = new FieldMetaEntity();
         f.setTableName(new String[]{"product_oa_announcement_role"});
         subData.setMeta(f);
         for (int j = 0; j < subFeFs.getRows(); j++) {
            FieldSetEntity fsSubFe = subFeFs.getFieldSetEntity(j);
            FieldSetEntity fsSub = new FieldSetEntity();
            fsSub.setTableName("product_oa_announcement_role");
            String userId = userIdJson.getString(fsSubFe.getString("receiver"));
            if (null == userId) {
               continue;
            }
            //获取所属部门
            fsSub.setValue("user_id", userId);
            fsSub.setValue("status", fsSubFe.getString("readed"));
            fsSub.setValue("announcement_uuid", uuid);
            subData.addFieldSetEntity(fsSub);
         }
         baseDao.add(subData);
//            DataManipulationUtils.close(null, null, connection);
      }
   }
   /**
@@ -726,20 +809,21 @@
    * @return
    * @throws SQLException
    */
   private void syncFunTable(Connection conn, String tableName) throws SQLException {
   private void syncFunTable(Connection conn, String tableName) throws Exception {
      //公告表
      if (tableName.equals("FE_APP5.PUB_NOTICE")) {
         //两个表建立关联
         this.originalTable.put("PUB_NOTICE", "product_oa_announcement");
         syncNotice(conn, tableName);
         //修改已同步附件 添加 module_uuid function_uuid
         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"036ccacd-47da-4f6e-9cf7-972211717e6e", "ed86d09a-23be-4d8c-8cb2-be8622fe50f4", "product_oa_announcement"});
//         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"036ccacd-47da-4f6e-9cf7-972211717e6e", "ed86d09a-23be-4d8c-8cb2-be8622fe50f4", "product_oa_announcement"});
      }
      //考勤表 需同步关联数据如请假表 外出表
      if (tableName.equals("FE_APP5.APP_KQLRB")) {
         this.originalTable.put("APP_KQLRB", "product_oa_punch_record");
         this.originalTable.put("PLEASELEAVE", "product_oa_ask_for_leave");
         this.originalTable.put("FT_1_WCDJB00", "product_oa_business_trip");
         //同步考勤
         this.synchronousClock(conn);
         System.out.println("=================考勤同步成功===============");
@@ -751,11 +835,11 @@
         this.syncCcooperates(conn, tableName);
         //协同模板数据
         this.syncCollaborativeTemplate(conn);
         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"127c3f55-a7b4-4a77-a097-a65ba95b76f0", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8", "product_oa_cooperates"});
         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"127c3f55-a7b4-4a77-a097-a65ba95b76f0", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8", "product_oa_cooperate_flow_node"});
         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"127c3f55-a7b4-4a77-a097-a65ba95b76f0", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8", "product_oa_cooperate_flow_reply"});
//         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"127c3f55-a7b4-4a77-a097-a65ba95b76f0", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8", "product_oa_cooperates"});
//
//         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"127c3f55-a7b4-4a77-a097-a65ba95b76f0", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8", "product_oa_cooperate_flow_node"});
//
//         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{"127c3f55-a7b4-4a77-a097-a65ba95b76f0", "6e587365-8ebd-4ab5-bade-dd3b1bf640f8", "product_oa_cooperate_flow_reply"});
         System.out.println("=================协同办公同步成功===============");
      }
      //会议同步
@@ -799,7 +883,7 @@
    * @param conn
    * @throws SQLException
    */
   private void synchronousClock(Connection conn) throws SQLException {
   private void synchronousClock(Connection conn) throws Exception {
      //同步请假 PLEASELEAVE
      DataTableEntity pleaseleave = null;
      try {
@@ -867,8 +951,15 @@
            fieldSetEntity.setValue("id", leaveFse.getInteger("pl00"));
            //PL11   请休假开始时间            fill_in_time   填单时间
            String pl11 = leaveFse.getString("pl11");
            fieldSetEntity.setValue("fill_in_time", pl11);
            //PL11   请休假开始时间                 start_time   开始时间
            if (!StringUtils.isEmpty(pl11)) {
               //判断是否为日期格式
               fieldSetEntity.setValue("fill_in_time", DateUtil.parse(pl11).toJdkDate());
               fieldSetEntity.setValue("start_time", fieldSetEntity.getObject("fill_in_time"));
            } else {
               fieldSetEntity.setValue("fill_in_time", pl11);
               fieldSetEntity.setValue("start_time", pl11);
            }
            fieldSetEntity.setValue("start_time", pl11);
            //PL15   请休假结束时间                end_time   结束时间
            String pl15 = leaveFse.getString("pl15");
@@ -879,7 +970,12 @@
                  pl15 = pl11;
               }
            }
            fieldSetEntity.setValue("end_time", pl15);
            if (!StringUtils.isEmpty(pl15)) {
               //判断是否为日期格式
               fieldSetEntity.setValue("fill_in_time", DateUtil.parse(pl15).toJdkDate());
            } else {
               fieldSetEntity.setValue("end_time", pl15);
            }
            //PL12   请休假天数 day   请假天数
            fieldSetEntity.setValue("day", leaveFse.getString("pl12"));
            //PL09   请休假原因 cause   请假原因
@@ -1026,12 +1122,25 @@
      FieldSetEntity fieldSetEntity = new FieldSetEntity();
      fieldSetEntity.setTableName("product_oa_ask_for_leave");
      String f1w08 = fse.getString("f1w08");
      //f1w08   请休假开始时间    fill_in_time   填单时间
      fieldSetEntity.setValue("fill_in_time", f1w08);
      //f1w08   请休假开始时间                 start_time   开始时间
      fieldSetEntity.setValue("start_time", f1w08);
      //f1w09   请休假结束时间                end_time   结束时间
      fieldSetEntity.setValue("end_time", fse.getString("f1w09"));
      if (!StringUtils.isEmpty(f1w08)) {
         //判断是否为日期格式
         //f1w08   请休假开始时间    fill_in_time   填单时间
         fieldSetEntity.setValue("fill_in_time", DateUtil.parse(f1w08).toJdkDate());
         //f1w08   请休假开始时间                 start_time   开始时间
         fieldSetEntity.setValue("start_time", fieldSetEntity.getObject("fill_in_time"));
      } else {
         //f1w08   请休假开始时间    fill_in_time   填单时间
         fieldSetEntity.setValue("fill_in_time", f1w08);
         //f1w08   请休假开始时间                 start_time   开始时间
         fieldSetEntity.setValue("start_time", f1w08);
      }
      String f1w09 = fse.getString("f1w09");
      if (!StringUtils.isEmpty(f1w09)) {
         //判断是否为日期格式
         fieldSetEntity.setValue("end_time", DateUtil.parse(f1w09).toJdkDate());
      } else {
         fieldSetEntity.setValue("end_time", fse.getString("f1w09"));
      }
      //day   请休假天数 day   请假天数
      fieldSetEntity.setValue("day", fse.getString("day"));
      //f1w06   请休假原因 cause   请假原因
@@ -1205,7 +1314,7 @@
    *
    * @param clockDt 外出data数据
    */
   private void synchronousClock(DataTableEntity clockDt) throws SQLException {
   private void synchronousClock(DataTableEntity clockDt) throws Exception {
      //同步考勤数据
      if (!BaseUtil.dataTableIsEmpty(clockDt)) {
         DataTableEntity dataTableEntity = new DataTableEntity();
@@ -1263,11 +1372,11 @@
            fieldSetEntity.setValue("time_four_result", fse.getString("xwkqjg"));
//                String xwkqjg = fse.getString("xwkqjg");
            dataTableEntity.addFieldSetEntity(fieldSetEntity);
            if (dataTableEntity.getRows() == 1000) {
               baseDao.add(dataTableEntity);
               dataTableEntity = new DataTableEntity();
               dataTableEntity.setMeta(f);
            }
//            if (dataTableEntity.getRows() == 1000) {
//               baseDao.add(dataTableEntity);
//               dataTableEntity = new DataTableEntity();
//               dataTableEntity.setMeta(f);
//            }
            //请休假放到请假表里面
//                switch (xwkqjg){
//                        //正常
@@ -1303,7 +1412,8 @@
//                }
         }
         if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
            baseDao.add(dataTableEntity);
//            baseDao.add(dataTableEntity);
            batchAddData.add(dataTableEntity);
         }
      }
   }
@@ -2090,7 +2200,7 @@
   /**
    * 同步协同流程消息表
    */
   public void syncCollaborativeNews(DataTableEntity OrlDt, Map<String, String[]> stateMap, String tableName) {
   public void syncCollaborativeNews(DataTableEntity OrlDt, Map<String, String[]> stateMap, String tableName) throws Exception {
      String id = null;
      String message_uuid = null;
      String[] state = null;
@@ -2098,6 +2208,7 @@
      FieldMetaEntity f = new FieldMetaEntity();
      f.setTableName(new String[]{"product_sys_message_user"});
      dataTableEntity.setMeta(f);
      DataTableEntity dt1 = new DataTableEntity();
      for (int i = 0; i < OrlDt.getRows(); i++) {
         FieldSetEntity fs = OrlDt.getFieldSetEntity(i);
         //流程节点id
@@ -2151,7 +2262,9 @@
            //查看详情
            message.setValue("url", state[1]);
            message_uuid = baseDao.add(message);
            dt1.addFieldSetEntity(message);
            message_uuid = UUID.randomUUID().toString();
            message.setValue("uuid", message_uuid);
         }
         FieldSetEntity message_user = new FieldSetEntity();
@@ -2181,8 +2294,17 @@
         }
         message_user.setValue("user_id", user_id);
         dataTableEntity.addFieldSetEntity(message_user);
         if (dt1.getRows() > 50000) {
            batchAddData.add(dt1);
            dt1 = new DataTableEntity();
         }
         if (dataTableEntity.getRows() > 50000) {
            batchAddData.add(dataTableEntity);
            dataTableEntity = new DataTableEntity();
         }
      }
      baseDao.add(dataTableEntity);
      batchAddData.add(dt1);
      batchAddData.add(dataTableEntity);
   }
   /**
@@ -2918,7 +3040,7 @@
//            fs.setValue("script_method", buttonsFs.getString("se14"));
         //路由名称
         fs.setValue("route_name", BaseUtil.getPageCode());
         fs.setValue("terminal_type", 1);
         String uuid = baseDao.add(fs);
         //09为送办按钮
         if ("09".equals(buttonsFs.getString("se12")) && !BaseUtil.strIsNull(buttonsFs.getString("se14"))) {
@@ -3185,7 +3307,7 @@
         e.printStackTrace();
      }
      //修改已同步附件 添加 module_uuid function_uuid
      baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{moduleUUID, funUUID, table});
//      baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{moduleUUID, funUUID, table});
      String sf05 = funFs.getString("sf05");
      //获取jdbc连接
      Connection conn = this.getJDBC();
@@ -3352,6 +3474,8 @@
      }
   }
   private Set<String> clearAttachment = new HashSet<>();
   /**
    * 迁移业务数据表
    *
@@ -3376,8 +3500,8 @@
         SpringMVCContextHolder.getSystemLogger().error(e);
         throw e;
      }
      Map<String, String> map = null;
      Boolean syncAttachments = false;
      Map<String, String> map;
      Boolean syncAttachments;
      DataTableEntity accessoryData;
      //是否是新表
      if (isNew) {
@@ -3393,24 +3517,20 @@
               this.attachmentValue = this.attachmentValue + accessoryData.getString(i, "si04") + ",";
            }
            this.attachmentValue = "," + this.attachmentValue;
         } else {
            syncAttachments = false;
         }
         //同步表结构  及字段信息
         map = this.syncTableField(conn, Orlfs, sf28s, subField);
         //刷新table 表
//                DataPoolCacheImpl.getInstance().cacheDataByTable("product_sys_datamodel_table");;
         //刷新field 表
//                DataPoolCacheImpl.getInstance().cacheDataByTable("product_sys_datamodel_field");
//                try {
//                    Thread.sleep(7000);
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                    SpringMVCContextHolder.getSystemLogger().error(e);
//                }
//            } else {
//                return;
//            }
         //清空表数据
         String clearTableName = Orlfs.getString("st03").toLowerCase();
         if (!clearTable.contains(clearTableName)) {
            baseDao.executeUpdate("truncate table " + clearTableName);
            clearTable.add(clearTableName);
         }
      } else {
         map = null;
         syncAttachments = false;
         //已有表
         this.syncFunTable(conn, sf28s[0] + '.' + sf28s[1]);
         return;
@@ -3425,59 +3545,90 @@
         SpringMVCContextHolder.getSystemLogger().error(e);
         throw e;
      }
      //创建10个固定线程
      DataTableEntity dt = new DataTableEntity();
      //业务表 fe的id  对应UUID
      for (int i = 0; i < dataDt.getRows(); i++) {
         //将循环中的数据放入线程池
         FieldSetEntity dataFs = dataDt.getFieldSetEntity(i);
         FieldSetEntity tableFs = new FieldSetEntity();
         tableFs.setTableName(this.originalTable.getString(taName));
         //key 为本表字段   value 为数据源字段
         for (String key : map.keySet()) {
            //单关联的用户user_id
            if ("USER".equals(fieldTypeJson.getString(key))) {
               tableFs.setValue(key, userIdJson.getString(dataFs.getString(map.get(key))));
               //单关联的组织架构uuid
            } else if ("GROUP".equals(fieldTypeJson.getString(key))) {
               tableFs.setValue(key, groupJson.get(dataFs.getString(map.get(key))));
               //多选组织架构  转换为用户user_ids
            } else if ("USERSGROUPS".equals(fieldTypeJson.getString(map.get(key)))) {
               tableFs.setValue(key, this.getUserIds(conn, dataFs.getString(map.get(key))));
            } else {
               //是否有字段关联主表
               if (subField != null && subField.equals(map.get(key))) {
                  //表名加下标 唯一
                  tableFs.setValue(key, pxMap.getString(masterTableName + dataFs.getString(map.get(key))));
         try {
            FieldSetEntity tableFs = new FieldSetEntity();
            tableFs.setTableName(this.originalTable.getString(taName));
            //key 为本表字段   value 为数据源字段
            for (String key : map.keySet()) {
               //单关联的用户user_id
               if ("USER".equals(fieldTypeJson.getString(key))) {
                  tableFs.setValue(key, userIdJson.getString(dataFs.getString(map.get(key))));
                  //单关联的组织架构uuid
               } else if ("GROUP".equals(fieldTypeJson.getString(key))) {
                  tableFs.setValue(key, groupJson.get(dataFs.getString(map.get(key))));
                  //多选组织架构  转换为用户user_ids
               } else if ("USERSGROUPS".equals(fieldTypeJson.getString(map.get(key)))) {
                  tableFs.setValue(key, this.getUserIds(conn, dataFs.getString(map.get(key))));
               } else {
                  //是否有字段关联主表
                  if (subField != null && subField.equals(map.get(key))) {
                     //表名加下标 唯一
                     tableFs.setValue(key, pxMap.getString(masterTableName + dataFs.getString(map.get(key))));
                  } else {
                     tableFs.setValue(key, dataFs.getString(map.get(key)));
                  }
               }
               if (StringUtils.isEmpty(tableFs.getString(key))) {
                  tableFs.setValue(key, dataFs.getString(map.get(key)));
               }
            }
            if(StringUtils.isEmpty(tableFs.getString(key))){
               tableFs.setValue(key,dataFs.getString(map.get(key)));
            }
         }
         if("bgyplyb".equals(tableFs.getTableName()) && "1208".equals(dataFs.getString("bg00"))){
            System.out.println(1);
         }
         //同步附件
         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, ","));
               if (tableFs.getTableName().equalsIgnoreCase("sfgl")) {
                  tableFs.setValue("is_print", "0");
               }
            }
         }
         String uuid = "";
         try {
            uuid = baseDao.add(tableFs);
         } catch (BaseException e) {
            if ("bgyplyb".equals(tableFs.getTableName()) && "1208".equals(dataFs.getString("bg00"))) {
               System.out.println(1);
            }
            //同步附件
            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, ","));
                  }
               }
            }
            String uuid = UUID.randomUUID().toString();
            try {
               tableFs.setValue("uuid", uuid);
//            uuid = baseDao.add(tableFs);
               if (StringUtils.isEmpty(tableFs.getString("created_by"))) {
                  tableFs.setValue("created_by", 1);
                  tableFs.setValue("created_utc_datetime", new Date());
               }
               if ("fwgz".equalsIgnoreCase(tableFs.getTableName())) {
                  tableFs.setValue("print_sign", tableFs.getString("fw22"));
               }
               dt.addFieldSetEntity(tableFs);
            } catch (BaseException e) {
               e.printStackTrace();
               SpringMVCContextHolder.getSystemLogger().error(e);
               logger.error("syncTable", e);
               throw e;
            } catch (Exception e) {
               e.printStackTrace();
               SpringMVCContextHolder.getSystemLogger().error(e);
               logger.error("syncTable", e);
               throw e;
            }
            synchronized (pxMap) {
               //表唯一id  对应uuid
               pxMap.put(taName + dataFs.getString(this.pk), uuid);
            }
         } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
         }
         //表唯一id  对应uuid
         pxMap.put(taName + dataFs.getString(this.pk), uuid);
      }
      //批量插入数据
      batchAddData.add(dt);
      //同步完一张表数据后清空json数据
      fieldTypeJson.clear();
      DataTableEntity subTble = null;
@@ -3489,13 +3640,19 @@
         SpringMVCContextHolder.getSystemLogger().error(e);
         throw e;
      }
      for (int i = 0; i < subTble.getRows(); i++) {
         FieldSetEntity sf = subTble.getFieldSetEntity(i);
         String a[] = {sf.getString("st02"), sf.getString("st03"), taName};
         if (isStr(sf.getString("st02") + "\\." + sf.getString("st03"))) {
            isNew = false;
      try {
         for (int i = 0; i < subTble.getRows(); i++) {
            FieldSetEntity sf = subTble.getFieldSetEntity(i);
            String a[] = {sf.getString("st02"), sf.getString("st03"), taName};
            if (isStr(sf.getString("st02") + "\\." + sf.getString("st03"))) {
               isNew = false;
            }
            this.syncTable(a, isNew, sf.getString("sf01").toLowerCase(), conn);
         }
         this.syncTable(a, isNew, sf.getString("sf01").toLowerCase(), conn);
      } catch (Exception e) {
         e.printStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
         logger.error("syncTable", e);
      }
   }
@@ -3620,6 +3777,7 @@
                     fieldSetEntity.setMeta(f);
                     fieldSetEntity.setValue(field, name);
                     fieldSetEntity.setValue("~field_name~", field);
                     fieldSetEntity.setValue("function_uuid", this.functionUuid);
                     //放入客户uuid
                     fieldSetEntity.setValue("client_uuid", this.clientUUID);
                     rpe.setFiles(fileMap);
@@ -3630,6 +3788,7 @@
                     } catch (Exception e) {
                        e.getStackTrace();
                        SpringMVCContextHolder.getSystemLogger().error(e);
                        logger.error("synchronizationAttachments", e);
                     }
                  }
               }
@@ -3690,6 +3849,7 @@
               fieldSetEntity.setValue("~field_name~", field);
               //放入客户uuid
               fieldSetEntity.setValue("client_uuid", this.clientUUID);
               fieldSetEntity.setValue("function_uuid", this.functionUuid);
               rpe.setFiles(fileMap);
               rpe.setFormData(fieldSetEntity);
               try {
@@ -3953,6 +4113,7 @@
      } catch (Exception e) {
         DataManipulationUtils.close(null, null, conn);
         SpringMVCContextHolder.getSystemLogger().error(e);
         e.printStackTrace();
         throw e;
      }
      if (Orlfs == null) {
@@ -4000,6 +4161,7 @@
         } catch (Exception e) {
            e.getStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            logger.error("syncModel", e);
         }
      }
@@ -4017,21 +4179,30 @@
      modelFs.setValue("created_by", created_by);
      modelFs.setValue("created_utc_datetime", new Date());
      String modelUuid = null;
      FieldSetEntity existFlow = baseDao.getFieldSetEntityByFilter("product_sys_flow_model", "title = ?", new Object[]{flowTitle}, false);
      if (!FieldSetEntity.isEmpty(existFlow) && !flag) {
         return existFlow.getString("type_code");
      }
      FieldSetEntity existFlow = baseDao.getFieldSetEntityByFilter("product_sys_flow_model", "title = ? or table_uuid=?", new Object[]{flowTitle, this.originalTable.getString(wm04s[1])}, false);
//      if (!FieldSetEntity.isEmpty(existFlow) && !flag) {
//         return existFlow.getString("type_code");
//      }
      try {
         if (!FieldSetEntity.isEmpty(existFlow)) {
            FieldSetEntity mvcPageFse = baseDao.getFieldSetEntityByFilter("product_sys_mvc_page", " flow_uuid = ?", new String[]{wm05}, false);
            typeCode = existFlow.getString("type_code");
            modelFs = existFlow;
            modelUuid = existFlow.getString("uuid");
//            functionUuid = mvcPageFse.getString("function_uuid");
         } else {
            if (modelFs.getString("table_uuid").equalsIgnoreCase("APP_ADMINISTRATIVE_CASES") || modelFs.getString("table_uuid").equalsIgnoreCase("APP_FINAL_SURVEY_REPORT")) {
               modelFs.setValue("module_uuid", "7070362e-6010-4b53-b773-b68b209ad67e");
            }
            modelUuid = baseDao.add(modelFs);
         }
      } catch (Exception e) {
         e.printStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
         logger.error("syncModel", e);
         return typeCode;
      }
      FieldSetEntity mvcPageFse = baseDao.getFieldSetEntityByFilter("product_sys_mvc_page", " flow_uuid = ?", new String[]{wm05}, false);
@@ -4070,10 +4241,12 @@
               this.synchronizingProcessMessages(conn, tricode_funs, stateMap);
            } catch (BaseException e) {
               e.printStackTrace();
               logger.error(e.getMessage(), e);
               SpringMVCContextHolder.getSystemLogger().error(e);
            }
         } catch (Exception e) {
            e.getStackTrace();
            logger.error("syncModel", e);
            SpringMVCContextHolder.getSystemLogger().error(e);
         }
      }
@@ -4370,7 +4543,7 @@
    * @return
    * @throws SQLException
    */
   public Map<String, String> syncDetail(String tricode_funs, Connection conn, JSONObject UUIDMap, String tableName, String modelUUID, Map<String, FieldSetEntity> taskFseMap) throws SQLException {
   public Map<String, String> syncDetail(String tricode_funs, Connection conn, JSONObject UUIDMap, String tableName, String modelUUID, Map<String, FieldSetEntity> taskFseMap) throws Exception {
      tableName = tableName.split("\\.")[1];
      OrgIdUUIDmap = Maps.newHashMap();
      DataTableEntity OrlDt = null;
@@ -4390,6 +4563,8 @@
      FieldMetaEntity f = new FieldMetaEntity();
      f.setTableName(new String[]{"product_sys_flow_detail"});
      DetailData.setMeta(f);
      DataTableEntity dt = new DataTableEntity();
      for (int i = 0; i < OrlDt.getRows(); i++) {
         FieldSetEntity Orlfs = OrlDt.getFieldSetEntity(i);
         FieldSetEntity DetailFs = new FieldSetEntity();
@@ -4495,10 +4670,15 @@
         }
         //关联流程任务表
         DetailFs.setValue("task_uuid", taskFse.getUUID());
         baseDao.add(DetailFs);
         String uuid = UUID.randomUUID().toString();
         DetailFs.setValue("uuid", uuid);
         DetailFs.setValue("~type~", "add");
//         baseDao.add(DetailFs);
         dt.addFieldSetEntity(DetailFs);
         OrgIdUUIDmap.put(wi00, DetailFs);
         stateMap.put(wi00, nodeState);
      }
      batchAddData.add(dt);
      return stateMap;
   }
@@ -4511,7 +4691,7 @@
    * @param stateMap
    * @throws SQLException
    */
   public void synchronizingProcessMessages(Connection conn, String tricode_funs, Map<String, String> stateMap) throws SQLException {
   public void synchronizingProcessMessages(Connection conn, String tricode_funs, Map<String, String> stateMap) throws Exception {
      try {
         StringBuffer sql = new StringBuffer();
         sql.append(" SELECT * FROM FE_BASE5.MESSAGEINFOR WHERE ME14 IN ( ")
@@ -4533,7 +4713,7 @@
   /**
    * 同步流程消息表
    */
   public void synchronizingProcessMessages(DataTableEntity OrlDt, Map<String, String> stateMap, String tableName) {
   public void synchronizingProcessMessages(DataTableEntity OrlDt, Map<String, String> stateMap, String tableName) throws Exception {
      String id = null;
      String message_uuid = null;
      String state = null;
@@ -4541,6 +4721,7 @@
      FieldMetaEntity f = new FieldMetaEntity();
      f.setTableName(new String[]{"product_sys_message"});
      dataTableEntity.setMeta(f);
      DataTableEntity dt1 = new DataTableEntity();
      for (int i = 0; i < OrlDt.getRows(); i++) {
         FieldSetEntity fs = OrlDt.getFieldSetEntity(i);
         //流程节点id
@@ -4602,7 +4783,9 @@
            } else if ("2".equals(state)) {
               message.setValue("url", "1621321824686868oKWL726?uuid=" + source_uuid);
            }
            message_uuid = baseDao.add(message);
            message_uuid = UUID.randomUUID().toString();
            message.setValue("uuid", message_uuid);
            dt1.addFieldSetEntity(message);
         }
         FieldSetEntity message_user = new FieldSetEntity();
@@ -4634,14 +4817,23 @@
         }
         message_user.setValue("user_id", user_id);
         dataTableEntity.addFieldSetEntity(message_user);
         if (dataTableEntity.getRows() == 1000) {
            baseDao.add(dataTableEntity);
//         if (dataTableEntity.getRows() == 1000) {
//            baseDao.add(dataTableEntity);
//            dataTableEntity = new DataTableEntity();
//            dataTableEntity.setMeta(f);
//         }
         if (dt1.getRows() > 50000) {
            batchAddData.add(dt1);
            dt1 = new DataTableEntity();
         }
         if (dataTableEntity.getRows() > 50000) {
            batchAddData.add(dataTableEntity);
            dataTableEntity = new DataTableEntity();
            dataTableEntity.setMeta(f);
         }
      }
      batchAddData.add(dt1);
      if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
         baseDao.add(dataTableEntity);
         batchAddData.add(dataTableEntity);
      }
   }
@@ -4708,7 +4900,7 @@
    * @return
    * @throws SQLException
    */
   public Map<String, FieldSetEntity> syncTask(String tricode_funs, Connection conn, String modelUUID) throws SQLException, BaseException {
   public Map<String, FieldSetEntity> syncTask(String tricode_funs, Connection conn, String modelUUID) throws Exception {
      DataTableEntity OrlDt = null;
      try {
         OrlDt = BaseDaoServiceImpl.getDataTable(conn, "fe_base5.WF_TASK", "WT13=(SELECT se16  FROM fe_base5.SYS_EVENT where se01=? and se08 = 1)", new Object[]{tricode_funs
@@ -4719,7 +4911,7 @@
         throw e;
      }
      Map<String, FieldSetEntity> map = Maps.newHashMap();
      DataTableEntity dt = new DataTableEntity();
      for (int i = 0; i < OrlDt.getRows(); i++) {
         FieldSetEntity Orlfs = OrlDt.getFieldSetEntity(i);
         FieldSetEntity taskFs = new FieldSetEntity();
@@ -4761,9 +4953,15 @@
         taskFs.setValue("record_uuid", record_uuid);
         taskFs.setValue("created_by", id);
         taskFs.setValue("created_utc_datetime", wt09);
         baseDao.add(taskFs);
         taskFs.setValue("uuid", UUID.randomUUID().toString());
//         baseDao.add(taskFs);
         dt.addFieldSetEntity(taskFs);
         map.put(Orlfs.getString("wt00"), taskFs);
      }
      batchAddData.add(dt);
      return map;
   }
@@ -5128,9 +5326,11 @@
         conn = this.getJDBC();
      } catch (SQLException e) {
         e.printStackTrace();
         logger.error("run", e);
         SpringMVCContextHolder.getSystemLogger().error(e);
      } catch (ClassNotFoundException e) {
         e.printStackTrace();
         logger.error("run", e);
         SpringMVCContextHolder.getSystemLogger().error(e);
      }
      String moduleUUID = null;
@@ -5152,9 +5352,7 @@
               //表名查询功能
               FieldSetEntity fse = baseDao.getFieldSetBySQL("SELECT a.* FROM product_sys_functions a LEFT JOIN product_sys_datamodel_table b on a.table_uuid = b.uuid WHERE b.table_name = ?", new String[]{tableName.toLowerCase()}, false);
               moduleUUID = this.getMoudleByFunctionTricode(fse.getString(CmnConst.TRICODE));
               String functionUuid = fse.getUUID();
               //修改已同步附件 添加 module_uuid function_uuid
               baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{moduleUUID, functionUuid, tableName.toLowerCase()});
               //同步流程
               this.syncFlow(conn, moduleUUID, sf28);
            }
@@ -5162,49 +5360,54 @@
         } catch (SQLException e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            logger.error("run", e);
         }
      } else {
         try {
            //同步表和表数据
            sf28 = this.synchronizeTablesData(conn, this.tricode_funs);
         } catch (SQLException e) {
            logger.error("run", e);
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
         }
         String table_name = sf28.split("\\.")[1];
         String myTableName = this.originalTable.getString(table_name);
         if (!isStr(sf28)) {
            //同步mvc
            try {
               moduleUUID = this.synchronizationModuleName(conn, this.tricode_funs, sf28);
            } catch (SQLException e) {
               e.printStackTrace();
               SpringMVCContextHolder.getSystemLogger().error(e);
            }
         } else {
            //已有功能的表就不同步mvc  查询该功能的模块uuid
            StringBuffer sql = new StringBuffer();
            sql.append(" tricode = (\n")
                  .append("SELECT tricode_parent FROM product_sys_functions a LEFT JOIN \n")
                  .append("product_sys_datamodel_table b on a.table_uuid = b.uuid \n")
                  .append("WHERE b.table_name = ? GROUP BY tricode_parent\n")
                  .append(") AND function_type_uuid = 0");
            FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter("product_sys_functions", sql.toString(), new String[]{myTableName}, false);
            moduleUUID = fieldSetEntity.getUUID();
            System.out.println(1);
         }
//            if (!isStr(sf28)) {
//                //同步mvc
//                try {
//                    moduleUUID = this.synchronizationModuleName(conn, this.tricode_funs, sf28);
//                } catch (SQLException e) {
//                    e.printStackTrace();
//                    SpringMVCContextHolder.getSystemLogger().error(e);
//                }
//            } else {
         //已有功能的表就不同步mvc  查询该功能的模块uuid
         StringBuffer sql = new StringBuffer();
         sql.append(" tricode = (\n")
               .append("SELECT tricode_parent FROM product_sys_functions a LEFT JOIN \n")
               .append("product_sys_datamodel_table b on a.table_uuid = b.uuid \n")
               .append("WHERE b.table_name = ? GROUP BY tricode_parent\n")
               .append(") AND function_type_uuid = 0");
         FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter("product_sys_functions", sql.toString(), new String[]{myTableName}, false);
         moduleUUID = fieldSetEntity.getUUID();
//            }
         if (!isStr(sf28)) {
            this.syncFlow(conn, moduleUUID, sf28);
         }
         //表名查询功能
         FieldSetEntity fse = baseDao.getFieldSetBySQL("SELECT a.* FROM product_sys_functions a LEFT JOIN product_sys_datamodel_table b on a.table_uuid = b.uuid WHERE b.table_name = ?", new String[]{myTableName}, false);
         String functionUuid = fse.getUUID();
         //修改已同步附件 添加 module_uuid function_uuid
         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{moduleUUID, functionUuid, myTableName});
//         baseDao.executeUpdate(" UPDATE product_sys_attachments SET module_uuid = ?, function_uuid = ? WHERE attachment_data_table = ? AND function_uuid is null ", new String[]{moduleUUID, functionUuid, myTableName});
      }
      try {
         DataManipulationUtils.close(null, null, conn);
      } catch (SQLException e) {
         logger.error("run", e);
         e.printStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
      }
@@ -5232,6 +5435,7 @@
      } catch (SQLException e) {
         e.printStackTrace();
         SpringMVCContextHolder.getSystemLogger().error(e);
         logger.error("syncFlow", e);
      }
      //初始化菜单缓存
//        systemMenusService.initSystemMenu();