From e6720f333268682d11aedb3b3308fa2f2c3a40df Mon Sep 17 00:00:00 2001
From: 许鹏程 <1821349743@qq.com>
Date: 星期二, 28 五月 2024 16:09:05 +0800
Subject: [PATCH] commit

---
 product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java |  646 ++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 425 insertions(+), 221 deletions(-)

diff --git a/product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java b/product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java
index f9fde2a..b71aaa0 100644
--- a/product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java
+++ b/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");
+		//鏌ヨ鏈郴缁熶腑鐨勫姛鑳絬uid
+		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)) {
+//				//鎷挎祦绋媢uid鎵緈vcpage
+//				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){
 //                        //姝e父
@@ -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鐨刬d  瀵瑰簲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))));
-					//澶氶�夌粍缁囨灦鏋�  杞崲涓虹敤鎴穟ser_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))));
+						//澶氶�夌粍缁囨灦鏋�  杞崲涓虹敤鎴穟ser_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);
 		//鍚屾瀹屼竴寮犺〃鏁版嵁鍚庢竻绌簀son鏁版嵁
 		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();

--
Gitblit v1.9.2