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/service/FeDataDSService.java | 1793 +++++++++++++++++++++--------------------
product-server-data-sync/src/main/java/com/product/data/sync/util/BusinessDataSync.java | 646 +++++++++-----
product-server-data-sync/src/main/java/com/product/data/sync/service/SyFeDataService.java | 63 +
product-server-data-sync/src/main/java/com/product/data/sync/controller/SyFeDataController.java | 2
product-server-data-sync/src/main/java/com/product/data/sync/util/BatchAddData.java | 75 +
5 files changed, 1,475 insertions(+), 1,104 deletions(-)
diff --git a/product-server-data-sync/src/main/java/com/product/data/sync/controller/SyFeDataController.java b/product-server-data-sync/src/main/java/com/product/data/sync/controller/SyFeDataController.java
index 2b59210..2c198b3 100644
--- a/product-server-data-sync/src/main/java/com/product/data/sync/controller/SyFeDataController.java
+++ b/product-server-data-sync/src/main/java/com/product/data/sync/controller/SyFeDataController.java
@@ -50,8 +50,10 @@
return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
}
String uuid = syFeDataService.saveSyncFedata(fse);
+
return OK();
} catch (BaseException e) {
+ e.printStackTrace();
SpringMVCContextHolder.getSystemLogger().error(e);
return this.error(e);
} catch (Exception e) {
diff --git a/product-server-data-sync/src/main/java/com/product/data/sync/service/FeDataDSService.java b/product-server-data-sync/src/main/java/com/product/data/sync/service/FeDataDSService.java
index 2470002..5afad7a 100644
--- a/product-server-data-sync/src/main/java/com/product/data/sync/service/FeDataDSService.java
+++ b/product-server-data-sync/src/main/java/com/product/data/sync/service/FeDataDSService.java
@@ -45,245 +45,256 @@
@Component
public class FeDataDSService extends AbstractBaseService {
- @Autowired
- public BaseDao baseDao;
- @Autowired
- private UserService userService;
- @Autowired
- private CodeService codeService;
- @Autowired
- private SystemOrgLevelsService systemOrgLevelsService;
+ @Autowired
+ public BaseDao baseDao;
+ @Autowired
+ private UserService userService;
+ @Autowired
+ private CodeService codeService;
+ @Autowired
+ private SystemOrgLevelsService systemOrgLevelsService;
- @Autowired
- public FunctionSynchrService functionSynchrService;
- @Autowired
- FileManagerService fileManagerService;
+ @Autowired
+ public FunctionSynchrService functionSynchrService;
+ @Autowired
+ FileManagerService fileManagerService;
- //涓存椂鏂囦欢璺緞
- private static String TSPath = Global.getSystemConfig("new.filePackage","");
- private static String testString = "^(\\d{0,4}`)|(\\d{0,3}\\^\\d{0,4}`)";
- private static String startWith = "FE#ENC#";
- private int[] intPosition = new int[64];
- //鎴戜滑浜у搧鐨勫姛鑳芥潈闄�
- private String[] functionCode = {"001-004-000-000","001-004-000-001","001-004-000-002","001-004-000-003","001-004-000-004",
- "001-006-006-000","001-006-002-000","001-006-000-000","001-006-001-000",
- "001-006-001-001","001-006-000-001", "001-006-002-001" ,"001-006-002-002","001-006-004-000",
- "001-006-003-000","001-006-002-003","001-006-003-001","001-006-003-002","001-006-003-003",
- "001-006-004-001","001-006-003-004","001-006-003-005","001-006-003-006","001-006-006-001",
- "001-006-008-000","001-006-008-001","001-006-008-002", "001-006-008-003","001-006-008-004",
- "001-006-008-005","001-006-008-006", "001-006-000-003", "001-006-011-000","001-006-011-001",
- "001-008-001-001","001-008-001-000","001-008-001-003"};
+ //涓存椂鏂囦欢璺緞
+ private static String TSPath = Global.getSystemConfig("new.filePackage", "");
+ private static String testString = "^(\\d{0,4}`)|(\\d{0,3}\\^\\d{0,4}`)";
+ private static String startWith = "FE#ENC#";
+ private int[] intPosition = new int[64];
+ //鎴戜滑浜у搧鐨勫姛鑳芥潈闄�
+ private String[] functionCode = {"001-004-000-000", "001-004-000-001", "001-004-000-002", "001-004-000-003", "001-004-000-004",
+ "001-006-006-000", "001-006-002-000", "001-006-000-000", "001-006-001-000",
+ "001-006-001-001", "001-006-000-001", "001-006-002-001", "001-006-002-002", "001-006-004-000",
+ "001-006-003-000", "001-006-002-003", "001-006-003-001", "001-006-003-002", "001-006-003-003",
+ "001-006-004-001", "001-006-003-004", "001-006-003-005", "001-006-003-006", "001-006-006-001",
+ "001-006-008-000", "001-006-008-001", "001-006-008-002", "001-006-008-003", "001-006-008-004",
+ "001-006-008-005", "001-006-008-006", "001-006-000-003", "001-006-011-000", "001-006-011-001",
+ "001-008-001-001", "001-008-001-000", "001-008-001-003"};
- private Integer sort = 0;
- //鍏徃鍜岄儴闂╩ap key 涓哄叕鍙告垨閮ㄩ棬鍏ㄧО
- Map<String, FieldSetEntity> institutionMap = Maps.newHashMap();
- public Connection getJDBC() throws SQLException, ClassNotFoundException {
- //鑾峰彇jdbc杩炴帴
+ private Integer sort = 0;
+ //鍏徃鍜岄儴闂╩ap key 涓哄叕鍙告垨閮ㄩ棬鍏ㄧО
+ Map<String, FieldSetEntity> institutionMap = Maps.newHashMap();
+
+ public Connection getJDBC() throws SQLException, ClassNotFoundException {
+ //鑾峰彇jdbc杩炴帴
// String diver = "oracle.jdbc.driver.OracleDriver";
// String url = "jdbc:oracle:thin:@10.0.0.21:1521:orcl";
// return DataManipulationUtils.getConnection(diver, url, "FE_BASE5", "fe123");
- //鑾峰彇jdbc杩炴帴
- String diver = Global.getSystemConfig("data.synchronism.function.jdbc.diver", "");
- String url = Global.getSystemConfig("data.synchronism.function.jdbc.url", "");
- String name = Global.getSystemConfig("data.synchronism.function.jdbc.name", "");
- String password = Global.getSystemConfig("data.synchronism.function.jdbc.password", "");
- return DataManipulationUtils.getConnection(diver, url, name, password);
- }
+ //鑾峰彇jdbc杩炴帴
+ String diver = Global.getSystemConfig("data.synchronism.function.jdbc.diver", "");
+ String url = Global.getSystemConfig("data.synchronism.function.jdbc.url", "");
+ String name = Global.getSystemConfig("data.synchronism.function.jdbc.name", "");
+ String password = Global.getSystemConfig("data.synchronism.function.jdbc.password", "");
+ return DataManipulationUtils.getConnection(diver, url, name, password);
+ }
- public String FEDataMigration(){
- String clientUUID = "";
- try {
- //admin鍒濆鍖栧鎴峰強瑙掕壊
- clientUUID = this.initializeClients();
- //鍚屾鍏徃閮ㄩ棬
- this.syncDepartmentCompany();
- //灏佽鍏徃閮ㄩ棬map
- this.packInstitutionMap();
- //鍚屾宀椾綅绛夌骇鍜屽矖浣�
- this.synchronousPost();
- //鍚屾瑙掕壊
- this.synchronousRole();
- //鍚屾绠$悊鍛�
- this.syncManager(clientUUID);
- //鍚屾浜哄憳
- this.addEmployees(clientUUID);
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return clientUUID;
- }
+ public String FEDataMigration() {
+ String clientUUID = "";
+ try {
+ //admin鍒濆鍖栧鎴峰強瑙掕壊
+ clientUUID = this.initializeClients();
+ //鍚屾鍏徃閮ㄩ棬
+ this.syncDepartmentCompany();
+ //灏佽鍏徃閮ㄩ棬map
+ this.packInstitutionMap();
+ //鍚屾宀椾綅绛夌骇鍜屽矖浣�
+ this.synchronousPost();
+// //鍚屾瑙掕壊
+// this.synchronousRole();
+ //鍚屾绠$悊鍛�
+// this.syncManager(clientUUID);
+ //鍚屾浜哄憳
+ this.addEmployees(clientUUID);
+ } catch (SQLException e) {
+ logger.error("FEDataMigration", e);
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ logger.error("FEDataMigration", e);
+ e.printStackTrace();
+ }
+ return clientUUID;
+ }
- /**
- * 鍒濆鍖栧鎴峰強瀹㈡埛瑙掕壊(淇敼瀹㈡埛涓篎E鐨勫鎴峰悕绉�)
- * @return
- * @throws SQLException
- * @throws ClassNotFoundException
- */
- public String initializeClients() throws SQLException, ClassNotFoundException {
- FieldSetEntity grouoFs = null;
- Connection conn = this.getJDBC();
- try {
- grouoFs = BaseDaoServiceImpl.getFieldSet(conn, "fe_base5.SYS_GROUP", "SG10=1", new Object[]{});
- } catch (Exception e) {
- DataManipulationUtils.close(null, null, conn);
- throw e;
- }
- //鏌ヨ鍘熷鎴� 鏀逛负瑗垮畞
- FieldSetEntity tableFs = baseDao.getFieldSetEntityByFilter("product_sys_clients", " client_code = ? ", new String[]{"001"},false);
- if (tableFs==null) {
+ /**
+ * 鍒濆鍖栧鎴峰強瀹㈡埛瑙掕壊(淇敼瀹㈡埛涓篎E鐨勫鎴峰悕绉�)
+ *
+ * @return
+ * @throws SQLException
+ * @throws ClassNotFoundException
+ */
+ public String initializeClients() throws SQLException, ClassNotFoundException {
+ FieldSetEntity grouoFs = null;
+ Connection conn = this.getJDBC();
+ try {
+ grouoFs = BaseDaoServiceImpl.getFieldSet(conn, "fe_base5.SYS_GROUP", "SG10=1", new Object[]{});
+ } catch (Exception e) {
+ DataManipulationUtils.close(null, null, conn);
+ throw e;
+ }
+ //鏌ヨ鍘熷鎴� 鏀逛负瑗垮畞
+ FieldSetEntity tableFs = baseDao.getFieldSetEntityByFilter("product_sys_clients", " client_code = ? ", new String[]{"001"}, false);
+ if (tableFs == null) {
throw new BaseException("500", "瀹㈡埛琛ㄦ病鏈�001鐨勬暟鎹�");
}
- //鍘熷鎴峰悕绉�
- String clientName = tableFs.getString("client_name");
- tableFs.setValue("client_name", grouoFs.getString("sg01"));
- String clientUUID = tableFs.getUUID();
- //鏌ヨ鍘熷鎴风殑瑙掕壊 鏀逛负瑗垮畞
- FieldSetEntity roleFs = baseDao.getFieldSetEntityByFilter("product_sys_role", " role_name = ? ", new String[]{clientName}, false);
- roleFs.setValue("role_name", grouoFs.getString("sg01"));
- //淇敼瑙掕壊
- baseDao.update(roleFs);
- //淇敼瀹㈡埛
+ //鍘熷鎴峰悕绉�
+ String clientName = tableFs.getString("client_name");
+ tableFs.setValue("client_name", grouoFs.getString("sg01"));
+ String clientUUID = tableFs.getUUID();
+ //鏌ヨ鍘熷鎴风殑瑙掕壊 鏀逛负瑗垮畞
+ FieldSetEntity roleFs = baseDao.getFieldSetEntityByFilter("product_sys_role", " role_name = ? ", new String[]{clientName}, false);
+ roleFs.setValue("role_name", grouoFs.getString("sg01"));
+ //淇敼瑙掕壊
+ baseDao.update(roleFs);
+ //淇敼瀹㈡埛
// tableFs.setCodeFieldUpdateFlat("client_code", true);
- baseDao.update(tableFs);
- return clientUUID;
- }
+ baseDao.update(tableFs);
+ return clientUUID;
+ }
- /**
- * 鍚屾鍗曚綅绠$悊鍛�
- */
- public void syncManager(String clientUUID) throws SQLException, ClassNotFoundException {
- Connection conn = this.getJDBC();
- DataTableEntity managerData;
- try {
- //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
- StringBuffer sql = new StringBuffer();
- sql.append(" SELECT A.*,REPLACE(REPLACE(REPLACE(A.SU03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
- .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASU03 FROM ")
- .append(" FE_BASE5.SYS_USERS A WHERE A.SU31 = 2 ");
- //浜哄憳鏁版嵁
- managerData = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
- this.syncManager(managerData, clientUUID);
- } catch (Exception e) {
- throw e;
- }
- }
+ /**
+ * 鍚屾鍗曚綅绠$悊鍛�
+ */
+ public void syncManager(String clientUUID) throws SQLException, ClassNotFoundException {
+ Connection conn = this.getJDBC();
+ DataTableEntity managerData;
+ try {
+ //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
+ StringBuffer sql = new StringBuffer();
+ sql.append(" SELECT A.*,REPLACE(REPLACE(REPLACE(A.SU03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
+ .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASU03 FROM ")
+ .append(" FE_BASE5.SYS_USERS A WHERE A.SU31 = 2 ");
+ //浜哄憳鏁版嵁
+ managerData = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
+ this.syncManager(managerData, clientUUID);
+ } catch (Exception e) {
+ throw e;
+ }
+ }
- /**
- * 鍚屾绠$悊鍛�
- * @param managerData 绠$悊鍛樼敤鎴锋暟鎹�
- */
- public void syncManager(DataTableEntity managerData,String clientUUID){
- if(!BaseUtil.dataTableIsEmpty(managerData)) {
- for (int i = 0; i < managerData.getRows(); i++) {
- FieldSetEntity userFs = new FieldSetEntity();
- FieldSetEntity fse = managerData.getFieldSetEntity(i);
- userFs.setTableName("product_sys_users");
- String su01 = fse.getString("su01");
- userFs.setValue("user_name", su01);
- userFs.setValue("user_account",su01);
- userFs.setValue("gender", 1);
- userFs.setValue("user_pwd", userService.createPassWord(su01, "123"));
- userFs.setValue("is_manager", 1);
- userFs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
- userFs.setValue("created_utc_datetime", new Date());
- userFs.setValue("status", 1);
+ /**
+ * 鍚屾绠$悊鍛�
+ *
+ * @param managerData 绠$悊鍛樼敤鎴锋暟鎹�
+ */
+ public void syncManager(DataTableEntity managerData, String clientUUID) {
+ if (!BaseUtil.dataTableIsEmpty(managerData)) {
+ for (int i = 0; i < managerData.getRows(); i++) {
+ FieldSetEntity userFs = new FieldSetEntity();
+ FieldSetEntity fse = managerData.getFieldSetEntity(i);
+ userFs.setTableName("product_sys_users");
+ String su01 = fse.getString("su01");
+ userFs.setValue("user_name", su01);
+ userFs.setValue("user_account", su01);
+ userFs.setValue("gender", 1);
+ userFs.setValue("user_pwd", userService.createPassWord(su01, "123"));
+ userFs.setValue("is_manager", 1);
+ userFs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
+ userFs.setValue("created_utc_datetime", new Date());
+ userFs.setValue("status", 1);
- //鏂板绠$悊鍛�
- String usersUUID = baseDao.add(userFs);
- FieldSetEntity users = baseDao.getFieldSetEntity("product_sys_users", usersUUID, false);
- FieldSetEntity managerFs = new FieldSetEntity();
- managerFs.setTableName("product_sys_org_manager");
- managerFs.setValue("user_id", users.getString("user_id"));
- //浼佷笟绠$悊鍛�
- managerFs.setValue("manager_type", "2");
- managerFs.setValue("role_uuids", "eabb00f3-2118-4165-967b-a7d88f472f67-notchange");
- managerFs.setValue("is_used", 1);
- managerFs.setValue("clients_uuid", clientUUID);
- managerFs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
- managerFs.setValue("created_utc_datetime", new Date());
- //閲嶆柊缁勮鍚庣殑缁勭粐鍏ㄧО
- String uuid = this.getSuperiorCompanyUuid(fse.getString("asu03"));
- managerFs.setValue("org_level_uuid", uuid);
- baseDao.add(managerFs);
- }
+ //鏂板绠$悊鍛�
+ String usersUUID = baseDao.add(userFs);
+ FieldSetEntity users = baseDao.getFieldSetEntity("product_sys_users", usersUUID, false);
+ FieldSetEntity managerFs = new FieldSetEntity();
+ managerFs.setTableName("product_sys_org_manager");
+ managerFs.setValue("user_id", users.getString("user_id"));
+ //浼佷笟绠$悊鍛�
+ managerFs.setValue("manager_type", "2");
+ managerFs.setValue("role_uuids", "eabb00f3-2118-4165-967b-a7d88f472f67-notchange");
+ managerFs.setValue("is_used", 1);
+ managerFs.setValue("clients_uuid", clientUUID);
+ managerFs.setValue("created_by", SpringMVCContextHolder.getCurrentUser().getUser_id());
+ managerFs.setValue("created_utc_datetime", new Date());
+ //閲嶆柊缁勮鍚庣殑缁勭粐鍏ㄧО
+ String uuid = this.getSuperiorCompanyUuid(fse.getString("asu03"));
+ managerFs.setValue("org_level_uuid", uuid);
+ baseDao.add(managerFs);
+ }
- }
- }
+ }
+ }
- /**
- * 鍚屾鍏徃閮ㄩ棬
- */
- public void syncDepartmentCompany() throws SQLException, ClassNotFoundException {
+ /**
+ * 鍚屾鍏徃閮ㄩ棬
+ */
+ public void syncDepartmentCompany() throws SQLException, ClassNotFoundException {
- //鍚屾缁勭粐鏈烘瀯鏁版嵁瀛樻斁闆嗗悎
- DataTableEntity groupLeadersFs;
- Connection conn = this.getJDBC();
- try {
- StringBuffer sql = new StringBuffer();
- sql.append("SELECT A.*,REPLACE(REPLACE(A.SG03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/') ASG03 FROM ( ")
- .append( "SELECT * FROM FE_BASE5.SYS_GROUP WHERE length(SG10) > 3 or SG10 = '001' ORDER BY SG10) A ORDER BY SG10");
- //鑾峰彇闇�瑕佸悓姝ョ殑缁勭粐鏈烘瀯
- groupLeadersFs = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
- } catch (Exception e) {
- throw e;
- }
- DataManipulationUtils.close(null, null, conn);
-
- //鍒涘缓椤剁骇鍏徃
- //鑾峰彇FE椤剁骇鍏徃
- FieldSetEntity topCompanies = groupLeadersFs.getFieldSetEntity(0);
- //鑾峰彇浜у搧001椤剁骇鍏徃
- FieldSetEntity field = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", " org_level_code = 001 ", null,false);
- //鏇存柊鍏徃鍚嶇О锛屽叕鍙哥煭缂栫爜锛屽叕鍙告帓搴�
- field.setValue("org_level_name", topCompanies.getString("sg01"));
- field.setValue("org_level_shortcode", topCompanies.getString("sg10"));
- field.setValue("sequence", topCompanies.getString("sg00"));
+ //鍚屾缁勭粐鏈烘瀯鏁版嵁瀛樻斁闆嗗悎
+ DataTableEntity groupLeadersFs;
+ Connection conn = this.getJDBC();
+ try {
+ StringBuffer sql = new StringBuffer();
+ sql.append("SELECT A.*,REPLACE(REPLACE(A.SG03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/') ASG03 FROM ( ")
+ .append("SELECT * FROM FE_BASE5.SYS_GROUP WHERE length(SG10) > 3 or SG10 = '001' ORDER BY SG10) A ORDER BY SG10");
+ //鑾峰彇闇�瑕佸悓姝ョ殑缁勭粐鏈烘瀯
+ groupLeadersFs = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
+ } catch (Exception e) {
+ throw e;
+ }
+ DataManipulationUtils.close(null, null, conn);
+
+ //鍒涘缓椤剁骇鍏徃
+ //鑾峰彇FE椤剁骇鍏徃
+ FieldSetEntity topCompanies = groupLeadersFs.getFieldSetEntity(0);
+ //鑾峰彇浜у搧001椤剁骇鍏徃
+ FieldSetEntity field = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", " org_level_code = 001 ", null, false);
+ //鏇存柊鍏徃鍚嶇О锛屽叕鍙哥煭缂栫爜锛屽叕鍙告帓搴�
+ field.setValue("org_level_name", topCompanies.getString("sg01"));
+ field.setValue("org_level_shortcode", topCompanies.getString("sg10"));
+ field.setValue("sequence", topCompanies.getString("sg00"));
// field.setCodeFieldUpdateFlat("org_level_code", true);
-
- //浜嬬墿璋冪敤锛屼繚瀛樺叕鍙镐俊鎭�
- ISystemOrgLevelsService service=(ISystemOrgLevelsService) getProxyInstance(systemOrgLevelsService);
- service.updateCompany(field);
-
+
+ //浜嬬墿璋冪敤锛屼繚瀛樺叕鍙镐俊鎭�
+ ISystemOrgLevelsService service = (ISystemOrgLevelsService) getProxyInstance(systemOrgLevelsService);
+ service.updateCompany(field);
+
// FieldSetEntity topField = this.addCompany(topCompanies,null, null);
- institutionMap.put(field.getString("org_level_all"),field);
-
- //閬嶅巻fe鏋舵瀯鏁版嵁 瀛樺叆缁勭粐鏋舵瀯淇℃伅琛�
- for (int i = 1; i < groupLeadersFs.getRows(); i++) {
-
- FieldSetEntity levelFs = groupLeadersFs.getFieldSetEntity(i);
- //鑾峰彇FE琛ㄧ粍缁囨満鏋勫叏绉�
- String asg03 = levelFs.getString("asg03");
- //鎴彇涓轰笂绾у叕鍙哥浉鍚岀殑鍏ㄧО
- String level_all = asg03.substring(0,asg03.lastIndexOf("/"));
- //鏇挎崲涓轰竴鏍风殑绗﹀彿鏂逛究瀵规瘮
- level_all = level_all.replace("/", ">");
- //鑾峰彇涓婄骇鍏徃鎴栭儴闂�
- FieldSetEntity fieldSet = institutionMap.get(level_all);
- //涓婄骇鍏徃uuid
- String org_level_uuid = this.getSuperiorCompanyUuid(level_all);
- if(fieldSet == null){
- throw new BaseException("涓婄骇涓虹┖","鏃犳硶鑾峰彇涓婄骇code");
- }
- if(org_level_uuid == null){
- throw new BaseException("涓婄骇鍏徃涓虹┖","涓婄骇鍏徃uuid");
- }
- //涓婄骇鍏徃code
- String org_level_code = fieldSet.getString("org_level_code");
- FieldSetEntity fse;
+ institutionMap.put(field.getString("org_level_all"), field);
+
+ //閬嶅巻fe鏋舵瀯鏁版嵁 瀛樺叆缁勭粐鏋舵瀯淇℃伅琛�
+ for (int i = 1; i < groupLeadersFs.getRows(); i++) {
+
+ FieldSetEntity levelFs = groupLeadersFs.getFieldSetEntity(i);
+ //鑾峰彇FE琛ㄧ粍缁囨満鏋勫叏绉�
+ String asg03 = levelFs.getString("asg03");
+ String levelAll = asg03.replaceAll("/", ">");
+ levelFs = baseDao.getFieldSetByFilter("product_sys_org_levels", "org_level_all=?", new Object[]{levelAll}, false);
+ if (levelFs != null && !StringUtils.isEmpty(levelFs.getUUID())) {
+ institutionMap.put(levelFs.getString("org_level_all"), levelFs);
+ continue;
+ }
+ //鎴彇涓轰笂绾у叕鍙哥浉鍚岀殑鍏ㄧО
+ String level_all = asg03.substring(0, asg03.lastIndexOf("/"));
+ //鏇挎崲涓轰竴鏍风殑绗﹀彿鏂逛究瀵规瘮
+ level_all = level_all.replace("/", ">");
+ //鑾峰彇涓婄骇鍏徃鎴栭儴闂�
+ FieldSetEntity fieldSet = institutionMap.get(level_all);
+ //涓婄骇鍏徃uuid
+ String org_level_uuid = this.getSuperiorCompanyUuid(level_all);
+ if (fieldSet == null) {
+ throw new BaseException("涓婄骇涓虹┖", "鏃犳硶鑾峰彇涓婄骇code");
+ }
+ if (org_level_uuid == null) {
+ throw new BaseException("涓婄骇鍏徃涓虹┖", "涓婄骇鍏徃uuid");
+ }
+ //涓婄骇鍏徃code
+ String org_level_code = fieldSet.getString("org_level_code");
+ FieldSetEntity fse;
// levelFs.setCodeFieldUpdateFlat("org_level_code", true);
- //杩涘叆鏂板鍏徃鏂规硶
- if(levelFs.getInteger("sg14") == 1){
- fse = this.addCompany(levelFs,org_level_code,org_level_uuid);
- //杩涘叆鏂板閮ㄩ棬鏂规硶
- }else {
- fse = this.addDepartment(levelFs, org_level_code, org_level_uuid);
- }
- institutionMap.put(fse.getString("org_level_all"), fse);
- }
+ //杩涘叆鏂板鍏徃鏂规硶
+ if (levelFs.getInteger("sg14") == 1) {
+ fse = this.addCompany(levelFs, org_level_code, org_level_uuid);
+ //杩涘叆鏂板閮ㄩ棬鏂规硶
+ } else {
+ fse = this.addDepartment(levelFs, org_level_code, org_level_uuid);
+ }
+ institutionMap.put(fse.getString("org_level_all"), fse);
+ }
// //鍒涘缓瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�涓嬮儴闂紙鍔炲叕瀹わ級
// FieldSetEntity fse = new FieldSetEntity();
@@ -295,374 +306,395 @@
// FieldSetEntity fieldSet = institutionMap.get("瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�");
// FieldSetEntity fs = this.addDepartment(fse,fieldSet.getString("org_level_code"), fieldSet.getUUID());
// institutionMap.put(fs.getString("org_level_all"), fs);
- }
+ }
- /**
- * 鍚屾宀椾綅鍜屽矖浣嶇瓑绾�
- */
- public void synchronousPost() throws SQLException, ClassNotFoundException {
+ /**
+ * 鍚屾宀椾綅鍜屽矖浣嶇瓑绾�
+ */
+ public void synchronousPost() throws SQLException, ClassNotFoundException {
- Connection conn = this.getJDBC();
- DataTableEntity groupLeadersFs;
- try {
- //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
- StringBuffer sql = new StringBuffer();
- sql.append(" SELECT SR00,SR01,SR02,SR10, SR15, ")
- .append(" REPLACE(REPLACE(REPLACE(SR03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
- .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASR03 FROM fe_base5.SYS_ROLE ");
- //1涓哄叕鍙�
- groupLeadersFs = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
- } catch (Exception e) {
+ Connection conn = this.getJDBC();
+ DataTableEntity groupLeadersFs;
+ try {
+ //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
+ StringBuffer sql = new StringBuffer();
+ sql.append(" SELECT SR00,SR01,SR02,SR10, SR15, ")
+ .append(" REPLACE(REPLACE(REPLACE(SR03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
+ .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASR03 FROM fe_base5.SYS_ROLE ");
+ //1涓哄叕鍙�
+ groupLeadersFs = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
+ } catch (Exception e) {
- throw e;
- }
- DataManipulationUtils.close(null, null, conn);
- //鍚屾宀椾綅绛夌骇
- this.postGrades(groupLeadersFs);
- this.addPost(groupLeadersFs);
- }
+ throw e;
+ }
+ DataManipulationUtils.close(null, null, conn);
+ //鍚屾宀椾綅绛夌骇
+ this.postGrades(groupLeadersFs);
+ this.addPost(groupLeadersFs);
+ }
- /**
- * 鍚屾瑙掕壊
- */
- public void synchronousRole()throws SQLException, ClassNotFoundException{
- Connection conn = this.getJDBC();
- DataTableEntity roleData;
- try {
- //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
- StringBuffer sql = new StringBuffer();
- sql.append(" select * from fe_base5.SYS_POPEDOM_TEMPLET a left join fe_base5.SYS_POPEDOM_TEMP_SUB b on a.SPT00=b.STS01 ");
- //浜哄憳鏁版嵁
- roleData = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
+ /**
+ * 鍚屾瑙掕壊
+ */
+ public void synchronousRole() throws SQLException, ClassNotFoundException {
+ Connection conn = this.getJDBC();
+ DataTableEntity roleData;
+ try {
+ //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
+ StringBuffer sql = new StringBuffer();
+ sql.append(" select * from fe_base5.SYS_POPEDOM_TEMPLET a left join fe_base5.SYS_POPEDOM_TEMP_SUB b on a.SPT00=b.STS01 ");
+ //浜哄憳鏁版嵁
+ roleData = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
- } catch (Exception e) {
- throw e;
- }
- DataManipulationUtils.close(null, null, conn);
- this.synchronousRole(roleData);
+ } catch (Exception e) {
+ throw e;
+ }
+ DataManipulationUtils.close(null, null, conn);
+ this.synchronousRole(roleData);
- }
+ }
- /**
- * 鍒濆鍖栧熀鏈潈闄�
- */
- public void packageButton(String role_uuid){
- StringBuffer sql = new StringBuffer();
- String tricodeIn = BaseUtil.buildQuestionMarkFilter("tricode", this.functionCode, true);
- sql.append(" SELECT function_uuid,group_concat(uuid SEPARATOR ',') button_uuid FROM product_sys_function_buttons WHERE function_uuid IN ( ")
- .append(" SELECT uuid FROM product_sys_functions WHERE ")
- .append(tricodeIn).append(" ) GROUP BY function_uuid ");
- DataTableEntity dataTableEntity = baseDao.listTable(sql.toString(),new String[]{});
- for (int i = 0; i < dataTableEntity.getRows(); i++) {
- FieldSetEntity fieldSetEntity = new FieldSetEntity();
- fieldSetEntity.setTableName("product_sys_function_permission");
- fieldSetEntity.setValue("function_uuid", dataTableEntity.getString(i,"function_uuid"));
- fieldSetEntity.setValue("button_uuid", dataTableEntity.getString(i,"button_uuid"));
- fieldSetEntity.setValue("role_uuid", role_uuid);
- baseDao.add(fieldSetEntity);
- }
- }
+ /**
+ * 鍒濆鍖栧熀鏈潈闄�
+ */
+ public void packageButton(String role_uuid) {
+ StringBuffer sql = new StringBuffer();
+ String tricodeIn = BaseUtil.buildQuestionMarkFilter("tricode", this.functionCode, true);
+ sql.append(" SELECT function_uuid,group_concat(uuid SEPARATOR ',') button_uuid FROM product_sys_function_buttons WHERE function_uuid IN ( ")
+ .append(" SELECT uuid FROM product_sys_functions WHERE ")
+ .append(tricodeIn).append(" ) GROUP BY function_uuid ");
+ DataTableEntity dataTableEntity = baseDao.listTable(sql.toString(), new String[]{});
+ for (int i = 0; i < dataTableEntity.getRows(); i++) {
+ FieldSetEntity fieldSetEntity = new FieldSetEntity();
+ fieldSetEntity.setTableName("product_sys_function_permission");
+ fieldSetEntity.setValue("function_uuid", dataTableEntity.getString(i, "function_uuid"));
+ fieldSetEntity.setValue("button_uuid", dataTableEntity.getString(i, "button_uuid"));
+ fieldSetEntity.setValue("role_uuid", role_uuid);
+ baseDao.add(fieldSetEntity);
+ }
+ }
- /**
- * 鍚屾浜哄憳
- */
- public void addEmployees(String clientUUID) throws SQLException, ClassNotFoundException {
+ /**
+ * 鍚屾浜哄憳
+ */
+ public void addEmployees(String clientUUID) throws SQLException, ClassNotFoundException {
- Connection conn = this.getJDBC();
- DataTableEntity personnelData;
- try {
- //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
- StringBuffer sql = new StringBuffer();
+ Connection conn = this.getJDBC();
+ DataTableEntity personnelData;
+ try {
+ //鑾峰彇宀椾綅 淇敼/ 涓�> 鏂逛究閫傞厤鎴戜滑鏁版嵁琛�
+ StringBuffer sql = new StringBuffer();
// sql.append(" SELECT A.*,REPLACE(REPLACE(REPLACE(A.SU03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
// .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASU03 FROM ")
// .append(" FE_BASE5.SYS_USERS A WHERE A.SU39 is not null and A.SU35 is not null AND A.SU03 IS NOT NULL ");
- sql.append(" SELECT A.*,REPLACE(REPLACE(REPLACE(A.SU03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
- .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASU03 FROM ")
- .append(" FE_BASE5.SYS_USERS A WHERE SU39 IS NOT NULL");
- //浜哄憳鏁版嵁
- personnelData = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
- } catch (Exception e) {
- throw e;
- }
- DataManipulationUtils.close(null, null, conn);
- this.addEmployees(personnelData,clientUUID);
- }
+ sql.append(" SELECT A.*,REPLACE(REPLACE(REPLACE(A.SU03, '/瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�', ''), ")
+ .append(" '瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/灞�灞炲悇鍗曚綅/','瑗垮畞甯備綇鎴夸繚闅滃拰鎴夸骇绠$悊灞�/'),'/','>') ASU03 FROM ")
+ .append(" FE_BASE5.SYS_USERS A WHERE SU39 IS NOT NULL");
+ //浜哄憳鏁版嵁
+ personnelData = BaseDaoServiceImpl.getDataTable(conn, sql.toString(), new Object[]{});
+ } catch (Exception e) {
+ throw e;
+ }
+ DataManipulationUtils.close(null, null, conn);
+ this.addEmployees(personnelData, clientUUID);
+ }
- /**
- * 閫掑綊鑾峰彇涓婄骇鍏徃uuid
- * @param level_all 涓婄骇鍏徃鍏ㄧО
- * @return 淇濆瓨鍚庤繑鍥炰繚瀛樺悗鐨� fse
- */
- public String getSuperiorCompanyUuid(String level_all){
- FieldSetEntity fieldSet = institutionMap.get(level_all);
- if(fieldSet == null){
- return null;
- }
- //涓婄骇涓哄叕鍙�
- if("0".equals(fieldSet.getString("org_level_type"))){
- return fieldSet.getUUID();
- }else {
- Integer index = level_all.lastIndexOf(">");
- if(index == -1){
- return null;
- }
- level_all = level_all.substring(0,index);
- return this.getSuperiorCompanyUuid(level_all);
- }
- }
+ /**
+ * 閫掑綊鑾峰彇涓婄骇鍏徃uuid
+ *
+ * @param level_all 涓婄骇鍏徃鍏ㄧО
+ * @return 淇濆瓨鍚庤繑鍥炰繚瀛樺悗鐨� fse
+ */
+ public String getSuperiorCompanyUuid(String level_all) {
+ FieldSetEntity fieldSet = institutionMap.get(level_all);
+ if (fieldSet == null) {
+ return null;
+ }
+ //涓婄骇涓哄叕鍙�
+ if ("0".equals(fieldSet.getString("org_level_type"))) {
+ return fieldSet.getUUID();
+ } else {
+ Integer index = level_all.lastIndexOf(">");
+ if (index == -1) {
+ return null;
+ }
+ level_all = level_all.substring(0, index);
+ return this.getSuperiorCompanyUuid(level_all);
+ }
+ }
- /**
- * 淇濆瓨鍏徃
- * @param fse 鍏徃fes
- * @param code_parent 鍏徃涓婄骇code
- * @return 淇濆瓨鍚庤繑鍥炰繚瀛樺悗鐨� fse
- */
- public FieldSetEntity addCompany(FieldSetEntity fse, String code_parent, String org_level_uuid){
- FieldSetEntity levelsFs = new FieldSetEntity();
- levelsFs.setTableName("product_sys_org_levels");
- //閮ㄩ棬鍚嶇О,,
- levelsFs.setValue("org_level_name", fse.getString("sg01"));
+ /**
+ * 淇濆瓨鍏徃
+ *
+ * @param fse 鍏徃fes
+ * @param code_parent 鍏徃涓婄骇code
+ * @return 淇濆瓨鍚庤繑鍥炰繚瀛樺悗鐨� fse
+ */
+ public FieldSetEntity addCompany(FieldSetEntity fse, String code_parent, String org_level_uuid) {
+ FieldSetEntity levelsFs = new FieldSetEntity();
+ levelsFs.setTableName("product_sys_org_levels");
+ //閮ㄩ棬鍚嶇О,,
+ levelsFs.setValue("org_level_name", fse.getString("sg01"));
- //鍏徃娈电紪鐮�
- levelsFs.setValue("org_level_shortcode", fse.getString("sg10"));
- //鍏徃鎺掑簭
- levelsFs.setValue("sequence", ++sort);
- //鏀惧叆涓婄骇code 鐢熸垚code
- levelsFs.setValue("org_level_code_parent", code_parent);
- //涓婄骇鍏徃uuid
- levelsFs.setValue("org_level_uuid", org_level_uuid);
- ISystemOrgLevelsService service=(ISystemOrgLevelsService) getProxyInstance(systemOrgLevelsService);
+ //鍏徃娈电紪鐮�
+ levelsFs.setValue("org_level_shortcode", fse.getString("sg10"));
+ //鍏徃鎺掑簭
+ levelsFs.setValue("sequence", ++sort);
+ //鏀惧叆涓婄骇code 鐢熸垚code
+ levelsFs.setValue("org_level_code_parent", code_parent);
+ //涓婄骇鍏徃uuid
+ levelsFs.setValue("org_level_uuid", org_level_uuid);
+ ISystemOrgLevelsService service = (ISystemOrgLevelsService) getProxyInstance(systemOrgLevelsService);
// levelsFs.setCodeFieldUpdateFlat("org_level_code", true);
- service.addCompany(levelsFs);
- return levelsFs;
- }
+ service.addCompany(levelsFs);
+ return levelsFs;
+ }
- /**
- * 淇濆瓨閮ㄩ棬
- * @param fse 鍏徃fes
- * @param code_parent 鍏徃涓婄骇code
- * @return 淇濆瓨鍚庤繑鍥炰繚瀛樺悗鐨� fse
- */
- public FieldSetEntity addDepartment(FieldSetEntity fse, String code_parent, String org_level_uuid){
- FieldSetEntity levelsFs = new FieldSetEntity();
- levelsFs.setTableName("product_sys_org_levels");
- //閮ㄩ棬鍚嶇О,,
- levelsFs.setValue("org_level_name", fse.getString("sg01"));
- //閮ㄩ棬缂栫爜
- levelsFs.setValue("org_level_shortcode", fse.getString("sg10"));
- //鍏徃鎺掑簭
- levelsFs.setValue("sequence", fse.getString("sg00"));
- //鏀惧叆涓婄骇code 鐢熸垚code
- levelsFs.setValue("org_level_code_parent", code_parent);
- //涓婄骇鍏徃uuid
- levelsFs.setValue("org_level_uuid", org_level_uuid);
- ISystemOrgLevelsService service=(ISystemOrgLevelsService) getProxyInstance(systemOrgLevelsService);
+ /**
+ * 淇濆瓨閮ㄩ棬
+ *
+ * @param fse 鍏徃fes
+ * @param code_parent 鍏徃涓婄骇code
+ * @return 淇濆瓨鍚庤繑鍥炰繚瀛樺悗鐨� fse
+ */
+ public FieldSetEntity addDepartment(FieldSetEntity fse, String code_parent, String org_level_uuid) {
+ FieldSetEntity levelsFs = new FieldSetEntity();
+ levelsFs.setTableName("product_sys_org_levels");
+ //閮ㄩ棬鍚嶇О,,
+ levelsFs.setValue("org_level_name", fse.getString("sg01"));
+ //閮ㄩ棬缂栫爜
+ levelsFs.setValue("org_level_shortcode", fse.getString("sg10"));
+ //鍏徃鎺掑簭
+ levelsFs.setValue("sequence", fse.getString("sg00"));
+ //鏀惧叆涓婄骇code 鐢熸垚code
+ levelsFs.setValue("org_level_code_parent", code_parent);
+ //涓婄骇鍏徃uuid
+ levelsFs.setValue("org_level_uuid", org_level_uuid);
+ ISystemOrgLevelsService service = (ISystemOrgLevelsService) getProxyInstance(systemOrgLevelsService);
// levelsFs.setCodeFieldUpdateFlat("org_level_code", true);
- service.addDepartment(levelsFs);
- return levelsFs;
- }
- /**
- * 灏佽鍏徃閮ㄩ棬鍏ㄧО Map
- */
- public void packInstitutionMap()throws BaseException {
- DataTableEntity dataTableEntity = baseDao.listTable("SELECT * FROM product_sys_org_levels WHERE org_level_code like ? ", new String[]{"%001%"});
- if(!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
- for (int i = 0; i < dataTableEntity.getRows(); i++) {
- FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i);
- String org_level_all = fieldSetEntity.getString("org_level_all");
- institutionMap.put(org_level_all, fieldSetEntity);
- }
- }else {
- throw new BaseException("鏈煡璇㈠埌鍗曚綅閮ㄩ棬鏁版嵁", "鏈煡璇㈠埌鍗曚綅閮ㄩ棬鏁版嵁");
- }
- }
+ service.addDepartment(levelsFs);
+ return levelsFs;
+ }
- /**
- * 鍚屾瑙掕壊
- */
- public void synchronousRole(DataTableEntity data){
- for (int i = 0; i < data.getRows(); i++) {
- FieldSetEntity rolesFs = data.getFieldSetEntity(i);
- String sts02s = rolesFs.getString("sts02");
- FieldSetEntity levelsField = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", " org_level_shortcode = ? ", new String[]{sts02s}, false);
- //鏈変簺瑙掕壊鍏宠仈鐨勫崟浣嶆垨閮ㄩ棬宸茬粡琚垹闄ゆ帀,浣嗘槸瑙掕壊杩樹繚鐣欎粬鐨勭紪鐮� 鐩存帴璺宠繃
- if(levelsField == null){
- continue;
- }
- FieldSetEntity lxRoleFs = new FieldSetEntity();
- lxRoleFs.setTableName("product_sys_role");
- lxRoleFs.setValue("org_level_uuid",levelsField.getUUID());
- lxRoleFs.setValue("role_name", rolesFs.getString("spt01"));
- lxRoleFs.setValue("role_description", rolesFs.getString("spt02"));
- lxRoleFs.setValue("is_used", 1);
- lxRoleFs.setValue("sequence", rolesFs.getInteger("spt00"));
- this.userAndTime(lxRoleFs);
- String role_uuid = baseDao.add(lxRoleFs);
+ /**
+ * 灏佽鍏徃閮ㄩ棬鍏ㄧО Map
+ */
+ public void packInstitutionMap() throws BaseException {
+ DataTableEntity dataTableEntity = baseDao.listTable("SELECT * FROM product_sys_org_levels WHERE org_level_code like ? ", new String[]{"%001%"});
+ if (!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
+ for (int i = 0; i < dataTableEntity.getRows(); i++) {
+ FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i);
+ String org_level_all = fieldSetEntity.getString("org_level_all");
+ institutionMap.put(org_level_all, fieldSetEntity);
+ }
+ } else {
+ throw new BaseException("鏈煡璇㈠埌鍗曚綅閮ㄩ棬鏁版嵁", "鏈煡璇㈠埌鍗曚綅閮ㄩ棬鏁版嵁");
+ }
+ }
- //璇ヨ鑹插垵濮嬪寲鏉冮檺
- this.packageButton(role_uuid);
- }
- }
-
- /**
- * 娣诲姞鐢ㄦ埛鍜屽憳宸�
- */
- public void addEmployees(DataTableEntity data,String clientUUID){
- //fe 浜哄憳id 瀵瑰簲 userid
- JSONObject idUserMap = new JSONObject();
- //鑾峰彇瀹㈡埛uuid
- FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", " org_level_code = ? ", new String[]{"001"}, false);
- String client_uuid = fieldSetEntity.getString("client_uuid");
-
- Map<String, FieldSetEntity> staffsMap = Maps.newHashMap();
- for (int i = 0; i < data.getRows(); i++) {
- FieldSetEntity userFs = data.getFieldSetEntity(i);
- FieldSetEntity usersFs = new FieldSetEntity();
- //鍒涘缓 user 鏁版嵁
- usersFs.setTableName("product_sys_users");
- //鐢ㄦ埛鍚�
- usersFs.setValue("user_name", userFs.getString("su02"));
- //鎻忚堪
- usersFs.setValue("user_account", userFs.getString("su01"));
- //閭
- usersFs.setValue("user_primary_email", userFs.getString("su11"));
- //鎬у埆杞崲
- String su16 = userFs.getString("su16");
- String sex = null;
- if (su16 != null) {
- sex = su16.equals("鐢�") ? "0" : "1";
- }
- usersFs.setValue("gender", sex);
- //鐢ㄦ埛鐢佃瘽
- usersFs.setValue("user_mobile_number", userFs.getString("su10"));
- //鍐呯嚎鐢佃瘽
- usersFs.setValue("inside_phone", userFs.getString("su13"));
- //鍦板潃
- usersFs.setValue("contact_address", userFs.getString("su18"));
- //鍒濆鍖栫敤鎴峰瘑鐮�
- usersFs.setValue("user_pwd", userService.createPassWord(userFs.getString("su01"), "123"));
- //鏄惁鏄鐞嗗憳 0:鍚� 1:鏄�
- usersFs.setValue("is_manager", 0);
- //鍔炲叕鐢佃瘽
- usersFs.setValue("office_phone", userFs.getString("su09"));
- this.userAndTime(usersFs);
- //鐘舵�� 0锛氱鐢� 1锛氭甯�
- usersFs.setValue("status", userFs.getString("su08"));
- //绛惧悕
- String su23 = userFs.getString("su23");
- if (!BaseUtil.strIsNull(su23)) {
- usersFs.setValue("user_signature", this.signatureAndThumbnail(su23, clientUUID,"user_signature"));
- }
- //澶村儚
- String su28 = userFs.getString("su28");
- if (!BaseUtil.strIsNull(su28)) {
- usersFs.setValue("thumbnail_img", this.signatureAndThumbnail(su28, clientUUID,"thumbnail_img"));
- }
-
- String usersUUID = baseDao.add(usersFs);
- FieldSetEntity users = baseDao.getFieldSetEntity("product_sys_users", usersUUID, false);
- //fe鐢ㄦ埛id 鍏宠仈绯荤粺琛�"product_sys_users锛塽ser_id
- idUserMap.put(userFs.getString("su00"), users.getString("user_id"));
-
- if (BaseUtil.strIsNull(userFs.getString("su03")) || BaseUtil.strIsNull(userFs.getString("su35")) || BaseUtil.strIsNull(userFs.getString("su39"))) {
+ /**
+ * 鍚屾瑙掕壊
+ */
+ public void synchronousRole(DataTableEntity data) {
+ for (int i = 0; i < data.getRows(); i++) {
+ FieldSetEntity rolesFs = data.getFieldSetEntity(i);
+ String sts02s = rolesFs.getString("sts02");
+ FieldSetEntity levelsField = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", " org_level_shortcode = ? ", new String[]{sts02s}, false);
+ //鏈変簺瑙掕壊鍏宠仈鐨勫崟浣嶆垨閮ㄩ棬宸茬粡琚垹闄ゆ帀,浣嗘槸瑙掕壊杩樹繚鐣欎粬鐨勭紪鐮� 鐩存帴璺宠繃
+ if (levelsField == null) {
continue;
}
-
- FieldSetEntity staffsFs = new FieldSetEntity();
- //鍛樺伐琛�
- staffsFs.setTableName("product_sys_staffs");
- //鐢ㄦ埛琛╥d
- staffsFs.setValue("user_id", users.getString("user_id"));
- //鏄剧ず鍚嶇О
- staffsFs.setValue("show_name", userFs.getString("su02"));
- //鍛樺伐鍚�
- staffsFs.setValue("given_name", userFs.getString("su02"));
- //鍛樺伐濮�
- staffsFs.setValue("family_name", userFs.getString("su02"));
- //閭
- staffsFs.setValue("email_address", userFs.getString("su11"));
- //绉诲姩鐢佃瘽
- staffsFs.setValue("mobile_phone", userFs.getString("su10"));
- //鍔炲叕鐢佃瘽
- staffsFs.setValue("office_telephone", userFs.getString("su09"));
+ FieldSetEntity lxRoleFs = new FieldSetEntity();
+ lxRoleFs.setTableName("product_sys_role");
+ lxRoleFs.setValue("org_level_uuid", levelsField.getUUID());
+ lxRoleFs.setValue("role_name", rolesFs.getString("spt01"));
+ lxRoleFs.setValue("role_description", rolesFs.getString("spt02"));
+ lxRoleFs.setValue("is_used", 1);
+ lxRoleFs.setValue("sequence", rolesFs.getInteger("spt00"));
+ this.userAndTime(lxRoleFs);
+ String role_uuid = baseDao.add(lxRoleFs);
- //鍛樺伐鎬у埆
- staffsFs.setValue("sex", sex);
- //鍛樺伐閭
- String su11 = userFs.getString("su11");
- //閭涓虹┖鍏堣1
- if(BaseUtil.strIsNull(su11)){
- su11 = "1";
- }
- staffsFs.setValue("staff_email", su11);
- //鐘舵�侊細0鍑嗗鍏ヨ亴 1璇曠敤 2鍑嗗杞 3鍦ㄨ亴 4鍋滆亴 5鍑嗗绂昏亴 6绂昏亴 7閫�浼�
- staffsFs.setValue("staff_status", 3);
+ //璇ヨ鑹插垵濮嬪寲鏉冮檺
+ this.packageButton(role_uuid);
+ }
+ }
- staffsFs.setValue("client_uuid", client_uuid);
- //閲嶆柊缁勮鍚庣殑缁勭粐鍏ㄧО
- FieldSetEntity fieldSet = institutionMap.get(userFs.getString("asu03"));
- String uuid = this.getSuperiorCompanyUuid(userFs.getString("asu03"));
- //鍏徃uuid
- staffsFs.setValue("org_level_uuid", uuid);
- //閮ㄩ棬uuid
- staffsFs.setValue("dept_uuid", fieldSet.getUUID());
-
- if (null == userFs.getString("su34")) {
- //宀椾綅uuid
- staffsFs.setValue("job_post_uuid", 1);
- //宀椾綅绛夌骇uuid
- staffsFs.setValue("job_post_grade_uuid",1);
- } else {
- //閫氳繃宀椾綅id鏌ヨ宀椾綅
- String su34 = userFs.getString("su34");
- FieldSetEntity fsePosts = baseDao.getFieldSetEntityByFilter("product_sys_job_posts", " sequence = ? ", new Integer[]{Integer.parseInt(su34)}, false);
- if(fsePosts != null) {
- staffsFs.setValue("job_post_uuid", fsePosts.getUUID());
- staffsFs.setValue("job_post_grade_uuid", fsePosts.getString("job_post_grades_uuid"));
- }else {
- throw new BaseException("鏈煡璇㈠埌宀椾綅","鏈煡璇㈠埌宀椾綅");
- }
- }
- //su35鍏宠仈鏉冮檺id, 鍏宠仈澶氫釜閫楀彿鍒嗛殧
- String su35 = userFs.getString("su35");
- String[] su35s = null;
- if(!BaseUtil.strIsNull(su35)){
- su35s = su35.split(",");
- for (int j = 0; j < su35s.length; j++) {
- FieldSetEntity fse = baseDao.getFieldSetEntityByFilter("product_sys_role", " sequence = ? ", new Integer[]{Integer.parseInt(su35s[j])}, false);
- su35s[j] = fse.getUUID();
- }
- }
- //鐩村睘棰嗗
- String su40 = userFs.getString("su40");
- //涓虹┖灏辨斁绌�
- if(BaseUtil.strIsNull(su40)){
- su40 = "";
- }else {
- //澶氫釜鐩村睘棰嗗 灏卞彇绗竴涓�
- if(su40.contains(",")){
- su40 = su40.substring(0,su40.indexOf(","));
- }
- }
- staffsFs.setValue("direct_leader_code",su40);
- if(su35s != null) {
- staffsFs.setValue("role_uuids", StringUtils.join(su35s, ","));
- }
- //鍛樺伐涓婁笅绾х紪鐮�
- staffsFs.setValue("leader_tricode", codeService.createFixCode(CmnConst.PRODUCT_SYS_STAFFS, CmnConst.LEADER_TRICODE, ""));
- //鍛樺伐缂栫爜 鍛樺伐鍘熸湰id 瀛樹负缂栫爜
- staffsFs.setValue("tricode",codeService.createFixCode(CmnConst.PRODUCT_SYS_STAFFS, CmnConst.TRICODE, fieldSet.getString("org_level_code")));
- String su00 = userFs.getString("su00");
- staffsFs.setValue("sequence", su00);
- staffsFs.setValue("remark", su00);
- this.userAndTime(staffsFs);
- baseDao.add(staffsFs);
- staffsMap.put(su00, staffsFs);
- }
- //sql淇敼鐩村睘棰嗗
- baseDao.executeUpdate(" UPDATE product_sys_staffs a INNER JOIN product_sys_staffs b ON a.remark = b.direct_leader_code SET b.direct_leader_code = a.tricode ");
- //寰幆鍚屾鐩村睘棰嗗, 鑻ユ湁涓や釜鐩村睘棰嗗 鍙彇绗竴涓�
+ /**
+ * 娣诲姞鐢ㄦ埛鍜屽憳宸�
+ */
+ public void addEmployees(DataTableEntity data, String clientUUID) {
+ //fe 浜哄憳id 瀵瑰簲 userid
+ JSONObject idUserMap = new JSONObject();
+ //鑾峰彇瀹㈡埛uuid
+ FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter("product_sys_org_levels", " org_level_code = ? ", new String[]{"001"}, false);
+ String client_uuid = fieldSetEntity.getString("client_uuid");
+
+ Map<String, FieldSetEntity> staffsMap = Maps.newHashMap();
+ for (int i = 0; i < data.getRows(); i++) {
+ FieldSetEntity userFs = data.getFieldSetEntity(i);
+ FieldSetEntity usersFs = new FieldSetEntity();
+ //鍒涘缓 user 鏁版嵁
+ usersFs.setTableName("product_sys_users");
+ //鐢ㄦ埛鍚�
+ usersFs.setValue("user_name", userFs.getString("su02"));
+ //鎻忚堪
+ usersFs.setValue("user_account", userFs.getString("su01"));
+ FieldSetEntity fieldSetByFilter = baseDao.getFieldSetByFilter("product_sys_users", "user_account=?", new Object[]{userFs.getString("su01")}, false);
+ if (!FieldSetEntity.isEmpty(fieldSetByFilter)) {
+ fieldSetByFilter.setValue("status", userFs.getString("su08"));
+ //绛惧悕
+ String su23 = userFs.getString("su23");
+ if (!BaseUtil.strIsNull(su23)) {
+ usersFs.setValue("user_signature", this.signatureAndThumbnail(su23, clientUUID, "user_signature"));
+ }
+ //澶村儚
+ String su28 = userFs.getString("su28");
+ if (!BaseUtil.strIsNull(su28)) {
+ usersFs.setValue("thumbnail_img", this.signatureAndThumbnail(su28, clientUUID, "thumbnail_img"));
+ }
+ baseDao.executeUpdate("update product_sys_staffs set staff_status=? where user_id=?", new Object[]{userFs.getString("su08"), fieldSetByFilter.getString("user_id")});
+ baseDao.saveFieldSetEntity(fieldSetByFilter);
+ continue;
+ }
+ //閭
+ usersFs.setValue("user_primary_email", userFs.getString("su11"));
+ //鎬у埆杞崲
+ String su16 = userFs.getString("su16");
+ String sex = null;
+ if (su16 != null) {
+ sex = su16.equals("鐢�") ? "0" : "1";
+ }
+ usersFs.setValue("gender", sex);
+ //鐢ㄦ埛鐢佃瘽
+ usersFs.setValue("user_mobile_number", userFs.getString("su10"));
+ //鍐呯嚎鐢佃瘽
+ usersFs.setValue("inside_phone", userFs.getString("su13"));
+ //鍦板潃
+ usersFs.setValue("contact_address", userFs.getString("su18"));
+ //鍒濆鍖栫敤鎴峰瘑鐮�
+ usersFs.setValue("user_pwd", userService.createPassWord(userFs.getString("su01"), "123"));
+ //鏄惁鏄鐞嗗憳 0:鍚� 1:鏄�
+ usersFs.setValue("is_manager", 0);
+ //鍔炲叕鐢佃瘽
+ usersFs.setValue("office_phone", userFs.getString("su09"));
+ this.userAndTime(usersFs);
+ //鐘舵�� 0锛氱鐢� 1锛氭甯�
+ usersFs.setValue("status", userFs.getString("su08"));
+ //绛惧悕
+ String su23 = userFs.getString("su23");
+ if (!BaseUtil.strIsNull(su23)) {
+ usersFs.setValue("user_signature", this.signatureAndThumbnail(su23, clientUUID, "user_signature"));
+ }
+ //澶村儚
+ String su28 = userFs.getString("su28");
+ if (!BaseUtil.strIsNull(su28)) {
+ usersFs.setValue("thumbnail_img", this.signatureAndThumbnail(su28, clientUUID, "thumbnail_img"));
+ }
+
+ String usersUUID = baseDao.add(usersFs);
+ FieldSetEntity users = baseDao.getFieldSetEntity("product_sys_users", usersUUID, false);
+ //fe鐢ㄦ埛id 鍏宠仈绯荤粺琛�"product_sys_users锛塽ser_id
+ idUserMap.put(userFs.getString("su00"), users.getString("user_id"));
+
+ if (BaseUtil.strIsNull(userFs.getString("su03")) || BaseUtil.strIsNull(userFs.getString("su35")) || BaseUtil.strIsNull(userFs.getString("su39"))) {
+ continue;
+ }
+
+ FieldSetEntity staffsFs = new FieldSetEntity();
+ //鍛樺伐琛�
+ staffsFs.setTableName("product_sys_staffs");
+ //鐢ㄦ埛琛╥d
+ staffsFs.setValue("user_id", users.getString("user_id"));
+ //鏄剧ず鍚嶇О
+ staffsFs.setValue("show_name", userFs.getString("su02"));
+ //鍛樺伐鍚�
+ staffsFs.setValue("given_name", userFs.getString("su02"));
+ //鍛樺伐濮�
+ staffsFs.setValue("family_name", userFs.getString("su02"));
+ //閭
+ staffsFs.setValue("email_address", userFs.getString("su11"));
+ //绉诲姩鐢佃瘽
+ staffsFs.setValue("mobile_phone", userFs.getString("su10"));
+ //鍔炲叕鐢佃瘽
+ staffsFs.setValue("office_telephone", userFs.getString("su09"));
+
+ //鍛樺伐鎬у埆
+ staffsFs.setValue("sex", sex);
+ //鍛樺伐閭
+ String su11 = userFs.getString("su11");
+ //閭涓虹┖鍏堣1
+ if (BaseUtil.strIsNull(su11)) {
+ su11 = "1";
+ }
+ staffsFs.setValue("staff_email", su11);
+ //鐘舵�侊細0鍑嗗鍏ヨ亴 1璇曠敤 2鍑嗗杞 3鍦ㄨ亴 4鍋滆亴 5鍑嗗绂昏亴 6绂昏亴 7閫�浼�
+ staffsFs.setValue("staff_status", 3);
+
+ staffsFs.setValue("client_uuid", client_uuid);
+ //閲嶆柊缁勮鍚庣殑缁勭粐鍏ㄧО
+ FieldSetEntity fieldSet = institutionMap.get(userFs.getString("asu03"));
+ String uuid = this.getSuperiorCompanyUuid(userFs.getString("asu03"));
+ //鍏徃uuid
+ staffsFs.setValue("org_level_uuid", uuid);
+ //閮ㄩ棬uuid
+ staffsFs.setValue("dept_uuid", fieldSet.getUUID());
+
+ if (null == userFs.getString("su34")) {
+ //宀椾綅uuid
+ staffsFs.setValue("job_post_uuid", 1);
+ //宀椾綅绛夌骇uuid
+ staffsFs.setValue("job_post_grade_uuid", 1);
+ } else {
+ //閫氳繃宀椾綅id鏌ヨ宀椾綅
+ String su34 = userFs.getString("su34");
+ FieldSetEntity fsePosts = baseDao.getFieldSetEntityByFilter("product_sys_job_posts", " sequence = ? ", new Integer[]{Integer.parseInt(su34)}, false);
+ if (fsePosts != null) {
+ staffsFs.setValue("job_post_uuid", fsePosts.getUUID());
+ staffsFs.setValue("job_post_grade_uuid", fsePosts.getString("job_post_grades_uuid"));
+ } else {
+ throw new BaseException("鏈煡璇㈠埌宀椾綅", "鏈煡璇㈠埌宀椾綅");
+ }
+ }
+ //su35鍏宠仈鏉冮檺id, 鍏宠仈澶氫釜閫楀彿鍒嗛殧
+ String su35 = userFs.getString("su35");
+ String[] su35s = null;
+ if (!BaseUtil.strIsNull(su35)) {
+ su35s = su35.split(",");
+ for (int j = 0; j < su35s.length; j++) {
+ FieldSetEntity fse = baseDao.getFieldSetEntityByFilter("product_sys_role", " sequence = ? ", new Integer[]{Integer.parseInt(su35s[j])}, false);
+ su35s[j] = fse.getUUID();
+ }
+ }
+ //鐩村睘棰嗗
+ String su40 = userFs.getString("su40");
+ //涓虹┖灏辨斁绌�
+ if (BaseUtil.strIsNull(su40)) {
+ su40 = "";
+ } else {
+ //澶氫釜鐩村睘棰嗗 灏卞彇绗竴涓�
+ if (su40.contains(",")) {
+ su40 = su40.substring(0, su40.indexOf(","));
+ }
+ }
+ staffsFs.setValue("direct_leader_code", su40);
+ if (su35s != null) {
+ staffsFs.setValue("role_uuids", StringUtils.join(su35s, ","));
+ }
+ //鍛樺伐涓婁笅绾х紪鐮�
+ staffsFs.setValue("leader_tricode", codeService.createFixCode(CmnConst.PRODUCT_SYS_STAFFS, CmnConst.LEADER_TRICODE, ""));
+ //鍛樺伐缂栫爜 鍛樺伐鍘熸湰id 瀛樹负缂栫爜
+ staffsFs.setValue("tricode", codeService.createFixCode(CmnConst.PRODUCT_SYS_STAFFS, CmnConst.TRICODE, fieldSet.getString("org_level_code")));
+ String su00 = userFs.getString("su00");
+ staffsFs.setValue("sequence", su00);
+ staffsFs.setValue("remark", su00);
+ this.userAndTime(staffsFs);
+ baseDao.add(staffsFs);
+ staffsMap.put(su00, staffsFs);
+ }
+ //sql淇敼鐩村睘棰嗗
+ baseDao.executeUpdate(" UPDATE product_sys_staffs a INNER JOIN product_sys_staffs b ON a.remark = b.direct_leader_code SET b.direct_leader_code = a.tricode ");
+ //寰幆鍚屾鐩村睘棰嗗, 鑻ユ湁涓や釜鐩村睘棰嗗 鍙彇绗竴涓�
// for(String su00 : staffsMap.keySet()){
// FieldSetEntity staffsFs = staffsMap.get(su00);
// //鑾峰彇鐩村睘棰嗗
@@ -687,242 +719,268 @@
// }
// }
// }
- }
+ }
- public String signatureAndThumbnail(String su,String clientUUID, String field){
- try {
- String[] path = su.split("=");
- String filePath = path[1];
- String fileName = StringUtils.isEmpty(filePath) ? "" : filePath.substring(filePath.lastIndexOf("/") + 1);
- String newPath = this.TSPath + File.separator + fileName;
- File isField = new File(newPath);
- //濡傛灉宸茬粡鏈夎鏂囦欢 鏀瑰彉鏂囦欢鐩綍
- Integer fileNum = 0;
- while (isField.exists()) {
- fileNum++;
- newPath = this.TSPath + fileNum + File.separator + fileName;
- isField = new File(newPath);
- }
- //澶嶅埗鍒颁复鏃剁洰褰曚笅
- if (this.copyFile(filePath, newPath)) {
- RequestParameterEntity rpe = new RequestParameterEntity();
- Map<String, File> fileMap = Maps.newHashMap();
- //閫氳繃璺緞鑾峰彇File
- File file = new File(newPath);
- //鏂囦欢鍚� 鏂囦欢file
- fileMap.put(fileName, file);
- FieldSetEntity fieldSet = new FieldSetEntity();
- FieldMetaEntity f = new FieldMetaEntity();
- f.setTableName(new String[]{"product_sys_users"});
- fieldSet.setMeta(f);
- fieldSet.setValue(field, fileName);
- fieldSet.setValue("~field_name~", field);
- //鏀惧叆瀹㈡埛uuid
- fieldSet.setValue("client_uuid", clientUUID);
- rpe.setFiles(fileMap);
- rpe.setFormData(fieldSet);
- try {
- FieldSetEntity fileFse = fileManagerService.uploadFile(rpe);
- return fileFse.getString(field);
- } catch (Exception e) {
- e.getStackTrace();
- SpringMVCContextHolder.getSystemLogger().error(e);
- }
- }
- }catch (Exception e){
- e.getStackTrace();
- }
- return null;
- }
+ public String signatureAndThumbnail(String su, String clientUUID, String field) {
+ try {
+ String[] path = su.split("=");
+ String filePath = path[1];
+ String fileName = StringUtils.isEmpty(filePath) ? "" : filePath.substring(filePath.lastIndexOf("/") + 1);
+ String newPath = this.TSPath + File.separator + fileName;
+ File isField = new File(newPath);
+ //濡傛灉宸茬粡鏈夎鏂囦欢 鏀瑰彉鏂囦欢鐩綍
+ Integer fileNum = 0;
+ while (isField.exists()) {
+ fileNum++;
+ newPath = this.TSPath + fileNum + File.separator + fileName;
+ isField = new File(newPath);
+ }
+ //澶嶅埗鍒颁复鏃剁洰褰曚笅
+ if (this.copyFile(filePath, newPath)) {
+ RequestParameterEntity rpe = new RequestParameterEntity();
+ Map<String, File> fileMap = Maps.newHashMap();
+ //閫氳繃璺緞鑾峰彇File
+ File file = new File(newPath);
+ //鏂囦欢鍚� 鏂囦欢file
+ fileMap.put(fileName, file);
+ FieldSetEntity fieldSet = new FieldSetEntity();
+ FieldMetaEntity f = new FieldMetaEntity();
+ f.setTableName(new String[]{"product_sys_users"});
+ fieldSet.setMeta(f);
+ fieldSet.setValue(field, fileName);
+ fieldSet.setValue("~field_name~", field);
+ //鏀惧叆瀹㈡埛uuid
+ fieldSet.setValue("client_uuid", clientUUID);
+ rpe.setFiles(fileMap);
+ rpe.setFormData(fieldSet);
+ try {
+ FieldSetEntity fileFse = fileManagerService.uploadFile(rpe);
+ return fileFse.getString(field);
+ } catch (Exception e) {
+ e.getStackTrace();
+ SpringMVCContextHolder.getSystemLogger().error(e);
+ }
+ }
+ } catch (Exception e) {
+ e.getStackTrace();
+ }
+ return null;
+ }
- /**
- * 娣诲姞宀椾綅
- */
- public void addPost(DataTableEntity data){
- DataTableEntity dataTableEntity = new DataTableEntity();
- dataTableEntity.getMeta().setTableName(new String[]{"product_sys_job_posts"});
- for (int i = 0; i < data.getRows(); i++) {
- FieldSetEntity fieldSetEntity = data.getFieldSetEntity(i);
- FieldSetEntity field = new FieldSetEntity();
- field.setTableName("product_sys_job_posts");
- field.setValue("is_used", 1);
- field.setValue("job_post_name", fieldSetEntity.getString("sr01"));
- field.setValue("job_post_description", fieldSetEntity.getString("sr02"));
- //閫氳繃鍏ㄧО鑾峰彇鍗曚綅鍜岄儴闂╱uid
- String org_level_all = fieldSetEntity.getString("asr03");
- FieldSetEntity fieldSetEntity1 = institutionMap.get(org_level_all);
- //鍏徃uuid
- String org_level_uuid = this.getSuperiorCompanyUuid(org_level_all);
- field.setValue("org_level_uuid",org_level_uuid);
- //鏈烘瀯绫诲瀷 0 鍏徃 1閮ㄩ棬
- String orgLevelType = fieldSetEntity1.getString("org_level_type");
- //鏌ヨ宀椾綅绛夌骇
- String sr15 = fieldSetEntity.getString("sr15");
- FieldSetEntity fieldSet = baseDao.getFieldSetEntityByFilter("product_sys_job_post_grades", " org_level_uuid = ? and job_grade_class = ? ", new String[]{org_level_uuid,sr15},false);
- //宀椾綅绛夌骇
- String postGradesUuid = fieldSet.getUUID();
- field.setValue("job_post_grades_uuid", postGradesUuid);
- //鎺掑簭鏆傛椂瀛樺矖浣峣d 鏂逛究浜哄憳鏌ヨ鍒板矖浣峣d
- Integer sequence = fieldSetEntity.getInteger("sr00");
- field.setValue("sequence",sequence);
- this.userAndTime(field);
- String org_uuid = fieldSetEntity1.getUUID();
- String code = fieldSetEntity1.getString("org_level_code");
- //0涓哄叕鍙� 鑻ヤ负鍏徃灏卞垱寤哄涓浉鍚屽矖浣嶆潵鍏宠仈鍏徃涓嬫墍鏈夐儴闂�
- if("0".equals(orgLevelType)){
- DataTableEntity dataTable = baseDao.listTable("product_sys_org_levels", " org_level_type = 1 and org_level_uuid = ? ", new String[]{org_uuid});
- if(!BaseUtil.dataTableIsEmpty(dataTable)) {
- for (int j = 0; j < dataTable.getRows(); j++) {
- field.setValue("dept_uuid",dataTable.getString(j, "uuid"));
- field.remove("uuid");
- //閫氳繃鏂板鏂规硶娣诲姞宀椾綅
- String uuid = baseDao.add(field);
- //娣诲姞宀椾綅涓庡矖浣嶇瓑绾у叧绯绘槧灏勬暟鎹〃
- FieldSetEntity postsAndClass = new FieldSetEntity();
- postsAndClass.setTableName("product_sys_job_posts_grades_mapping");
- //宀椾綅绛夌骇uuid
- postsAndClass.setValue("job_grade_uuid", postGradesUuid);
- //宀椾綅uuid
- postsAndClass.setValue("job_post_uuid", uuid);
- this.userAndTime(postsAndClass);
- baseDao.add(postsAndClass);
- }
- }else {
- //鍗曚綅涓嬭嫢娌℃湁閮ㄩ棬 鍒涘缓涓�涓櫄鎷熼儴闂�
- FieldSetEntity departmentFse = new FieldSetEntity();
- departmentFse.setTableName("product_sys_org_levels");
- //閮ㄩ棬鍚嶇О
- departmentFse.setValue("sg01", fieldSetEntity1.getString("org_level_name") + "涓嬮儴闂�");
- //閮ㄩ棬缂栫爜
- departmentFse.setValue("sg10", fieldSetEntity1.getString("org_level_shortcode") + "01");
- //鎺掑簭
- departmentFse.setValue("sg00", fieldSetEntity1.getString("sequence") + "01");
- //淇濆瓨鍚庣殑閮ㄩ棬
- FieldSetEntity newDeptFse = this.addDepartment(departmentFse,code,org_uuid);
- //鏀惧叆閮ㄩ棬uuid
- field.setValue("dept_uuid",newDeptFse.getUUID());
- //閫氳繃鏂板鏂规硶娣诲姞宀椾綅
- String uuid = baseDao.add(field);
- //娣诲姞宀椾綅涓庡矖浣嶇瓑绾у叧绯绘槧灏勬暟鎹〃
- FieldSetEntity postsAndClass = new FieldSetEntity();
- postsAndClass.setTableName("product_sys_job_posts_grades_mapping");
- //宀椾綅绛夌骇uuid
- postsAndClass.setValue("job_grade_uuid", postGradesUuid);
- //宀椾綅uuid
- postsAndClass.setValue("job_post_uuid", uuid);
- this.userAndTime(postsAndClass);
- baseDao.add(postsAndClass);
- }
- //1涓洪儴闂�
- }else{
- field.setValue("dept_uuid",org_uuid);
- //閫氳繃鏂板鏂规硶娣诲姞宀椾綅
- String uuid = baseDao.add(field);
- //娣诲姞宀椾綅涓庡矖浣嶇瓑绾у叧绯绘槧灏勬暟鎹〃
- FieldSetEntity postsAndClass = new FieldSetEntity();
- postsAndClass.setTableName("product_sys_job_posts_grades_mapping");
- //宀椾綅绛夌骇uuid
- postsAndClass.setValue("job_grade_uuid", postGradesUuid);
- //宀椾綅uuid
- postsAndClass.setValue("job_post_uuid", uuid);
- this.userAndTime(postsAndClass);
- baseDao.add(postsAndClass);
- }
- }
- }
+ /**
+ * 娣诲姞宀椾綅
+ */
+ public void addPost(DataTableEntity data) {
+ DataTableEntity dataTableEntity = new DataTableEntity();
+ dataTableEntity.getMeta().setTableName(new String[]{"product_sys_job_posts"});
+ for (int i = 0; i < data.getRows(); i++) {
+ FieldSetEntity fieldSetEntity = data.getFieldSetEntity(i);
+ FieldSetEntity field = new FieldSetEntity();
+ field.setTableName("product_sys_job_posts");
+ field.setValue("is_used", 1);
+ field.setValue("job_post_name", fieldSetEntity.getString("sr01"));
+ field.setValue("job_post_description", fieldSetEntity.getString("sr02"));
+ //閫氳繃鍏ㄧО鑾峰彇鍗曚綅鍜岄儴闂╱uid
+ String org_level_all = fieldSetEntity.getString("asr03");
+ FieldSetEntity fieldSetEntity1 = institutionMap.get(org_level_all);
+ //鍏徃uuid
+ String org_level_uuid = this.getSuperiorCompanyUuid(org_level_all);
+ field.setValue("org_level_uuid", org_level_uuid);
+ //鍒ゆ柇绯荤粺涓槸鍚︽湁璇ヨ鑹�
- /**
- * 娣诲姞鍒涘缓浜哄拰鍒涘缓鏃堕棿
- * @param fieldSetEntity
- */
- public void userAndTime(FieldSetEntity fieldSetEntity){
- fieldSetEntity.setValue("created_by",SpringMVCContextHolder.getCurrentUserId());
- fieldSetEntity.setValue("created_utc_datetime",new Date());
- }
- /**
- * 娣诲姞宀椾綅绛夌骇
- */
- public void postGrades(DataTableEntity data){
- //鍏徃uuid 宀椾綅灞傜骇闆�
- Map<String,String> postHierarchyMap = Maps.newHashMap();
- //閫氳繃鍏徃uuid鏉ュ垝鍒嗗矖浣嶇瓑绾�
- for (int i = 0; i < data.getRows(); i++) {
- FieldSetEntity fieldSetEntity = data.getFieldSetEntity(i);
- FieldSetEntity field = new FieldSetEntity();
- field.setTableName("product_sys_job_post_grades");
- //宀椾綅灞傜骇 瓒婂皬绛夌骇瓒婂ぇ
- String sr15 = fieldSetEntity.getString("sr15");
- //杞崲鍚庨儴闂ㄦ垨鍏徃鍏ㄧО
- String dcName = fieldSetEntity.getString("asr03");
- //鑾峰彇鍏徃鐨剈uid
- String companyUuid = this.getSuperiorCompanyUuid(dcName);
- String value = postHierarchyMap.get(companyUuid);
- if(!BaseUtil.strIsNull(value)){
- if(value.contains(sr15)) {
- continue;
- }else {
- postHierarchyMap.put(companyUuid, value+","+sr15);
- }
- }else {
- postHierarchyMap.put(companyUuid, sr15);
- }
- FieldSetEntity levelsSet = baseDao.getFieldSetEntity("product_sys_org_levels",companyUuid,false);
- //鍏徃鍚嶇О
- String levelName = levelsSet.getString("org_level_name");
- //涓婄骇鍏徃uuid
- field.setValue("org_level_uuid",companyUuid);
- //宀椾綅绛夌骇
- field.setValue("job_grade_class", sr15);
- field.setValue("is_used", 1);
- //鍚嶇О
- field.setValue("job_grade_name",sr15+"绾у矖浣�");
- //绾у埆鐭紪鐮�
- field.setValue("job_grade_shortcode", sr15);
- //璇存槑
- field.setValue("remark", levelName+"涓嬬殑"+sr15+"绾у矖浣�");
- field.setValue("sequence", sr15);
- this.userAndTime(field);
- baseDao.add(field);
- }
- }
- /** 澶嶅埗鍗曚釜鏂囦欢
- * @param oldPath String 鍘熸枃浠惰矾寰� 濡傦細c:/fqf.txt
- * @param newPath String 澶嶅埗鍚庤矾寰� 濡傦細f:/fqf.txt
- * @return boolean
- */
- public Boolean copyFile(String oldPath, String newPath) {
- Boolean status = false;
- try {
- BufferedInputStream in = FileUtil.getInputStream(oldPath);
- BufferedOutputStream out = FileUtil.getOutputStream(newPath);
- IoUtil.copy(in, out, IoUtil.DEFAULT_BUFFER_SIZE);
- status = true;
- out.close();
- in.close();
- }catch (Exception e){
- e.getStackTrace();
- }finally {
- return status;
- }
- }
- /** 鍒犻櫎鍗曚釜鏂囦欢
- * @param fileName 琚垹闄ゆ枃浠剁殑鏂囦欢鍚�
- * @return 鍗曚釜鏂囦欢鍒犻櫎鎴愬姛杩斿洖true,鍚﹀垯杩斿洖false
- */
- public Boolean deleteFile(String fileName){
- File file = new File(fileName);
- if(file.isFile()){
- file.delete();
- System.out.println("鍒犻櫎鍗曚釜鏂囦欢"+fileName+"鎴愬姛锛�");
- return true;
- }else{
- System.out.println("鍒犻櫎鍗曚釜鏂囦欢"+fileName+"澶辫触锛�");
- return false;
- }
- }
+ //鏈烘瀯绫诲瀷 0 鍏徃 1閮ㄩ棬
+ String orgLevelType = fieldSetEntity1.getString("org_level_type");
+ //鏌ヨ宀椾綅绛夌骇
+ String sr15 = fieldSetEntity.getString("sr15");
+ FieldSetEntity fieldSet = baseDao.getFieldSetEntityByFilter("product_sys_job_post_grades", " org_level_uuid = ? and job_grade_class = ? ", new String[]{org_level_uuid, sr15}, false);
+ //宀椾綅绛夌骇
+ String postGradesUuid = fieldSet.getUUID();
+ field.setValue("job_post_grades_uuid", postGradesUuid);
+ //鎺掑簭鏆傛椂瀛樺矖浣峣d 鏂逛究浜哄憳鏌ヨ鍒板矖浣峣d
+ Integer sequence = fieldSetEntity.getInteger("sr00");
+ field.setValue("sequence", sequence);
+ this.userAndTime(field);
+ String org_uuid = fieldSetEntity1.getUUID();
+ String code = fieldSetEntity1.getString("org_level_code");
+ //0涓哄叕鍙� 鑻ヤ负鍏徃灏卞垱寤哄涓浉鍚屽矖浣嶆潵鍏宠仈鍏徃涓嬫墍鏈夐儴闂�
+ if ("0".equals(orgLevelType)) {
+ DataTableEntity dataTable = baseDao.listTable("product_sys_org_levels", " org_level_type = 1 and org_level_uuid = ? ", new String[]{org_uuid});
+ if (!BaseUtil.dataTableIsEmpty(dataTable)) {
+ for (int j = 0; j < dataTable.getRows(); j++) {
+ field.setValue("dept_uuid", dataTable.getString(j, "uuid"));
+ field.remove("uuid");
+ FieldSetEntity fieldSetByFilter = baseDao.getFieldSetByFilter("product_sys_job_posts", " job_post_name = ? and org_level_uuid = ? and dept_uuid=?", new String[]{fieldSetEntity.getString("sr01"), org_level_uuid, field.getString("dept_uuid")}, false);
+ if (fieldSetByFilter != null && !StringUtils.isEmpty(fieldSetByFilter.getUUID())) {
+ continue;
+ }
+ //閫氳繃鏂板鏂规硶娣诲姞宀椾綅
+ String uuid = baseDao.add(field);
+ //娣诲姞宀椾綅涓庡矖浣嶇瓑绾у叧绯绘槧灏勬暟鎹〃
+ FieldSetEntity postsAndClass = new FieldSetEntity();
+ postsAndClass.setTableName("product_sys_job_posts_grades_mapping");
+ //宀椾綅绛夌骇uuid
+ postsAndClass.setValue("job_grade_uuid", postGradesUuid);
+ //宀椾綅uuid
+ postsAndClass.setValue("job_post_uuid", uuid);
+ this.userAndTime(postsAndClass);
+ baseDao.add(postsAndClass);
+ }
+ } else {
+ //鍗曚綅涓嬭嫢娌℃湁閮ㄩ棬 鍒涘缓涓�涓櫄鎷熼儴闂�
+ String orgLevelName = fieldSetEntity1.getString("org_level_name") + "涓嬮儴闂�";
+ FieldSetEntity newDeptFse = baseDao.getFieldSetByFilter("product_sys_org_levels", "org_level_name = ? and org_level_type = 1 and org_level_uuid = ?", new String[]{orgLevelName, org_uuid}, false);
+ if (FieldSetEntity.isEmpty(newDeptFse)) {
+ FieldSetEntity departmentFse = new FieldSetEntity();
+ departmentFse.setTableName("product_sys_org_levels");
+ //閮ㄩ棬鍚嶇О
+ departmentFse.setValue("sg01", fieldSetEntity1.getString("org_level_name") + "涓嬮儴闂�");
+ //閮ㄩ棬缂栫爜
+ departmentFse.setValue("sg10", fieldSetEntity1.getString("org_level_shortcode") + "01");
+ //鎺掑簭
+ departmentFse.setValue("sg00", fieldSetEntity1.getString("sequence") + "01");
+ //淇濆瓨鍚庣殑閮ㄩ棬
+ newDeptFse = this.addDepartment(departmentFse, code, org_uuid);
+ }
+ //鏀惧叆閮ㄩ棬uuid
+ field.setValue("dept_uuid", newDeptFse.getUUID());
+ FieldSetEntity fieldSetByFilter = baseDao.getFieldSetByFilter("product_sys_job_posts", " job_post_name = ? and org_level_uuid = ? and dept_uuid=?", new String[]{fieldSetEntity.getString("sr01"), org_level_uuid, field.getString("dept_uuid")}, false);
+ if (fieldSetByFilter != null && !StringUtils.isEmpty(fieldSetByFilter.getUUID())) {
+ continue;
+ }
+ //閫氳繃鏂板鏂规硶娣诲姞宀椾綅
+ String uuid = baseDao.add(field);
+ //娣诲姞宀椾綅涓庡矖浣嶇瓑绾у叧绯绘槧灏勬暟鎹〃
+ FieldSetEntity postsAndClass = new FieldSetEntity();
+ postsAndClass.setTableName("product_sys_job_posts_grades_mapping");
+ //宀椾綅绛夌骇uuid
+ postsAndClass.setValue("job_grade_uuid", postGradesUuid);
+ //宀椾綅uuid
+ postsAndClass.setValue("job_post_uuid", uuid);
+ this.userAndTime(postsAndClass);
+ baseDao.add(postsAndClass);
+ }
+ //1涓洪儴闂�
+ } else {
+ field.setValue("dept_uuid", org_uuid);
+ FieldSetEntity fieldSetByFilter = baseDao.getFieldSetByFilter("product_sys_job_posts", " job_post_name = ? and org_level_uuid = ? and dept_uuid=?", new String[]{fieldSetEntity.getString("sr01"), org_level_uuid, field.getString("dept_uuid")}, false);
+ if (fieldSetByFilter != null && !StringUtils.isEmpty(fieldSetByFilter.getUUID())) {
+ continue;
+ }
+ //閫氳繃鏂板鏂规硶娣诲姞宀椾綅
+ String uuid = baseDao.add(field);
+ //娣诲姞宀椾綅涓庡矖浣嶇瓑绾у叧绯绘槧灏勬暟鎹〃
+ FieldSetEntity postsAndClass = new FieldSetEntity();
+ postsAndClass.setTableName("product_sys_job_posts_grades_mapping");
+ //宀椾綅绛夌骇uuid
+ postsAndClass.setValue("job_grade_uuid", postGradesUuid);
+ //宀椾綅uuid
+ postsAndClass.setValue("job_post_uuid", uuid);
+ this.userAndTime(postsAndClass);
+ baseDao.add(postsAndClass);
+ }
+ }
+ }
- public static void main(String[] args) {
+ /**
+ * 娣诲姞鍒涘缓浜哄拰鍒涘缓鏃堕棿
+ *
+ * @param fieldSetEntity
+ */
+ public void userAndTime(FieldSetEntity fieldSetEntity) {
+ fieldSetEntity.setValue("created_by", SpringMVCContextHolder.getCurrentUserId());
+ fieldSetEntity.setValue("created_utc_datetime", new Date());
+ }
+
+ /**
+ * 娣诲姞宀椾綅绛夌骇
+ */
+ public void postGrades(DataTableEntity data) {
+ //鍏徃uuid 宀椾綅灞傜骇闆�
+ Map<String, String> postHierarchyMap = Maps.newHashMap();
+ //閫氳繃鍏徃uuid鏉ュ垝鍒嗗矖浣嶇瓑绾�
+ for (int i = 0; i < data.getRows(); i++) {
+ FieldSetEntity fieldSetEntity = data.getFieldSetEntity(i);
+ FieldSetEntity field = new FieldSetEntity();
+ field.setTableName("product_sys_job_post_grades");
+ //宀椾綅灞傜骇 瓒婂皬绛夌骇瓒婂ぇ
+ String sr15 = fieldSetEntity.getString("sr15");
+ //杞崲鍚庨儴闂ㄦ垨鍏徃鍏ㄧО
+ String dcName = fieldSetEntity.getString("asr03");
+ //鑾峰彇鍏徃鐨剈uid
+ String companyUuid = this.getSuperiorCompanyUuid(dcName);
+ String value = postHierarchyMap.get(companyUuid);
+ if (!BaseUtil.strIsNull(value)) {
+ if (value.contains(sr15)) {
+ continue;
+ } else {
+ postHierarchyMap.put(companyUuid, value + "," + sr15);
+ }
+ } else {
+ postHierarchyMap.put(companyUuid, sr15);
+ }
+ FieldSetEntity levelsSet = baseDao.getFieldSetEntity("product_sys_org_levels", companyUuid, false);
+ //鍏徃鍚嶇О
+ String levelName = levelsSet.getString("org_level_name");
+ //涓婄骇鍏徃uuid
+ field.setValue("org_level_uuid", companyUuid);
+ //宀椾綅绛夌骇
+ field.setValue("job_grade_class", sr15);
+ field.setValue("is_used", 1);
+ //鍚嶇О
+ field.setValue("job_grade_name", sr15 + "绾у矖浣�");
+ //绾у埆鐭紪鐮�
+ field.setValue("job_grade_shortcode", sr15);
+ //璇存槑
+ field.setValue("remark", levelName + "涓嬬殑" + sr15 + "绾у矖浣�");
+ field.setValue("sequence", sr15);
+ this.userAndTime(field);
+ baseDao.add(field);
+ }
+ }
+
+ /**
+ * 澶嶅埗鍗曚釜鏂囦欢
+ *
+ * @param oldPath String 鍘熸枃浠惰矾寰� 濡傦細c:/fqf.txt
+ * @param newPath String 澶嶅埗鍚庤矾寰� 濡傦細f:/fqf.txt
+ * @return boolean
+ */
+ public Boolean copyFile(String oldPath, String newPath) {
+ Boolean status = false;
+ try {
+ BufferedInputStream in = FileUtil.getInputStream(oldPath);
+ BufferedOutputStream out = FileUtil.getOutputStream(newPath);
+ IoUtil.copy(in, out, IoUtil.DEFAULT_BUFFER_SIZE);
+ status = true;
+ out.close();
+ in.close();
+ } catch (Exception e) {
+ e.getStackTrace();
+ } finally {
+ return status;
+ }
+ }
+
+ /**
+ * 鍒犻櫎鍗曚釜鏂囦欢
+ *
+ * @param fileName 琚垹闄ゆ枃浠剁殑鏂囦欢鍚�
+ * @return 鍗曚釜鏂囦欢鍒犻櫎鎴愬姛杩斿洖true, 鍚﹀垯杩斿洖false
+ */
+ public Boolean deleteFile(String fileName) {
+ File file = new File(fileName);
+ if (file.isFile()) {
+ file.delete();
+ System.out.println("鍒犻櫎鍗曚釜鏂囦欢" + fileName + "鎴愬姛锛�");
+ return true;
+ } else {
+ System.out.println("鍒犻櫎鍗曚釜鏂囦欢" + fileName + "澶辫触锛�");
+ return false;
+ }
+ }
+
+ public static void main(String[] args) {
// File file = new File("D:\\filePackage\\瑗垮畞甯備綇鎴夸繚闅滃拰鎴垮眿绠$悊灞�闇�姹傛暣鐞哣1.0.docx");
// File file2 = new File("D:\\filePackage\\瑗垮畞甯備綇鎴夸繚闅滃拰鎴垮眿绠$悊.docx");
// System.out.println(file.exists());
@@ -930,88 +988,85 @@
// FeDataDSService feDataDSService = new FeDataDSService();
// feDataDSService.copyFile("D:\\OA\\FEGOV\\Media\\2021\\12\\15\\20211215401901\\1`FE#ENC#DA126AF35BB8E57F55C2429BDF7DC7240DF6CC6E227B0B8E", "D:\\filePackage\\????????????????????????.doc");
// feDataDSService.getFilesFolder("D:\\OA\\FEGOV\\Media\\2021\\12\\15\\20211215401901");
- }
+ }
- /**
- * 鑾峰彇鏂囦欢鍚嶇О 鏈�鏂颁慨鏀规椂闂� map
- * @param path
- * @return
- */
- public Map<String, String> getFilesFolder(String path){
- File file = new File(path); //鑾峰彇鍏秄ile瀵硅薄
- File[] fs = file.listFiles();
- if(fs == null){
- logger.info("鏈壘鍒伴檮浠剁洿鎺ヨ繑鍥瀗ull");
- return null;
- }
- Map<String, String> fileTimeName = Maps.newHashMap();
- for(File f:fs)
- {
- if(f.isFile())
- {
- String fileName = f.toString().replace(path+"\\","");
- fileTimeName.put(this.set_fileInfo(f.toString()),fileName);
- }
- }
- return fileTimeName;
- }
+ /**
+ * 鑾峰彇鏂囦欢鍚嶇О 鏈�鏂颁慨鏀规椂闂� map
+ *
+ * @param path
+ * @return
+ */
+ public Map<String, String> getFilesFolder(String path) {
+ File file = new File(path); //鑾峰彇鍏秄ile瀵硅薄
+ File[] fs = file.listFiles();
+ if (fs == null) {
+ logger.info("鏈壘鍒伴檮浠剁洿鎺ヨ繑鍥瀗ull");
+ return null;
+ }
+ Map<String, String> fileTimeName = Maps.newHashMap();
+ for (File f : fs) {
+ if (f.isFile()) {
+ String fileName = f.toString().replace(path + "\\", "");
+ fileTimeName.put(this.set_fileInfo(f.toString()), fileName);
+ }
+ }
+ return fileTimeName;
+ }
- /**
- * 鑾峰彇鏂囦欢鏈�杩戜慨鏀规椂闂�
- * @param file_name 鏂囦欢鍏ㄨ矾寰�
- * @return
- */
- public String set_fileInfo(String file_name)
- {
- Path path = Paths.get(file_name);
- BasicFileAttributeView basicview = Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
- BasicFileAttributes attr;
- String time = null;
- try
- {
+ /**
+ * 鑾峰彇鏂囦欢鏈�杩戜慨鏀规椂闂�
+ *
+ * @param file_name 鏂囦欢鍏ㄨ矾寰�
+ * @return
+ */
+ public String set_fileInfo(String file_name) {
+ Path path = Paths.get(file_name);
+ BasicFileAttributeView basicview = Files.getFileAttributeView(path, BasicFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);
+ BasicFileAttributes attr;
+ String time = null;
+ try {
- attr = basicview.readAttributes();
- //鍒涘缓鏃堕棿
- Date CreateTimeDate= new Date(attr.creationTime().toMillis());
- //涓婃淇敼鏃堕棿 *
- Date lastmodfiyTimeDate=new Date(attr.lastModifiedTime().toMillis());
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- time = df.format(lastmodfiyTimeDate);
- } catch (Exception e)
- {
- e.printStackTrace();
- }
- return time;
- }
+ attr = basicview.readAttributes();
+ //鍒涘缓鏃堕棿
+ Date CreateTimeDate = new Date(attr.creationTime().toMillis());
+ //涓婃淇敼鏃堕棿 *
+ Date lastmodfiyTimeDate = new Date(attr.lastModifiedTime().toMillis());
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ time = df.format(lastmodfiyTimeDate);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return time;
+ }
- public void clearJobList(){
- DataTableEntity dataTableEntity = baseDao.listTable("product_sys_flow_node"," default_posts is not null AND default_posts != '' ",new String[]{});
- for (int i = 0; i < dataTableEntity.getRows(); i++) {
- FieldSetEntity fse = dataTableEntity.getFieldSetEntity(i);
- String default_posts = fse.getString("default_posts");
- if(!BaseUtil.strIsNull(default_posts)){
- String[] postUuids = default_posts.split(",");
- Set<String> postSet = Sets.newHashSet();
+ public void clearJobList() {
+ DataTableEntity dataTableEntity = baseDao.listTable("product_sys_flow_node", " default_posts is not null AND default_posts != '' ", new String[]{});
+ for (int i = 0; i < dataTableEntity.getRows(); i++) {
+ FieldSetEntity fse = dataTableEntity.getFieldSetEntity(i);
+ String default_posts = fse.getString("default_posts");
+ if (!BaseUtil.strIsNull(default_posts)) {
+ String[] postUuids = default_posts.split(",");
+ Set<String> postSet = Sets.newHashSet();
// Set<String> postSet = Arrays.stream(postUuids).collect(Collectors.toSet());
- for (int j = 0; j < postUuids.length; j++) {
- DataTableEntity staffsData = baseDao.listTable("product_sys_staffs"," job_post_uuid = ? ",new String[]{postUuids[j]});
- //鏈変汉灏变繚鐣欏矖浣島uid
- if(!BaseUtil.dataTableIsEmpty(staffsData)){
- postSet.add(postUuids[j]);
- }
- }
- if(postSet.size() > 0){
- fse.setValue("default_posts", StringUtils.join(postSet, ","));
- }else {
- fse.setValue("default_posts", null);
- }
- baseDao.update(fse);
- }
- }
- //娓呯┖澶氫綑鐨勫矖浣嶆暟鎹�
- baseDao.executeUpdate("DELETE FROM product_sys_job_posts WHERE uuid not in (SELECT job_post_uuid FROM product_sys_staffs);");
- //宀椾綅鍏宠仈
- baseDao.executeUpdate("DELETE FROM product_sys_job_posts_grades_mapping WHERE job_post_uuid not in (SELECT job_post_uuid FROM product_sys_staffs);");
- }
+ for (int j = 0; j < postUuids.length; j++) {
+ DataTableEntity staffsData = baseDao.listTable("product_sys_staffs", " job_post_uuid = ? ", new String[]{postUuids[j]});
+ //鏈変汉灏变繚鐣欏矖浣島uid
+ if (!BaseUtil.dataTableIsEmpty(staffsData)) {
+ postSet.add(postUuids[j]);
+ }
+ }
+ if (postSet.size() > 0) {
+ fse.setValue("default_posts", StringUtils.join(postSet, ","));
+ } else {
+ fse.setValue("default_posts", null);
+ }
+ baseDao.update(fse);
+ }
+ }
+ //娓呯┖澶氫綑鐨勫矖浣嶆暟鎹�
+ baseDao.executeUpdate("DELETE FROM product_sys_job_posts WHERE uuid not in (SELECT job_post_uuid FROM product_sys_staffs);");
+ //宀椾綅鍏宠仈
+ baseDao.executeUpdate("DELETE FROM product_sys_job_posts_grades_mapping WHERE job_post_uuid not in (SELECT job_post_uuid FROM product_sys_staffs);");
+ }
}
diff --git a/product-server-data-sync/src/main/java/com/product/data/sync/service/SyFeDataService.java b/product-server-data-sync/src/main/java/com/product/data/sync/service/SyFeDataService.java
index 1b806e4..4a62f39 100644
--- a/product-server-data-sync/src/main/java/com/product/data/sync/service/SyFeDataService.java
+++ b/product-server-data-sync/src/main/java/com/product/data/sync/service/SyFeDataService.java
@@ -23,6 +23,7 @@
import com.product.data.sync.config.SystemCode;
import com.product.data.sync.service.ide.ISyFeDataService;
import com.product.data.sync.service.media.GdMediaUtil;
+import com.product.data.sync.util.BatchAddData;
import com.product.data.sync.util.BusinessDataSync;
import com.product.data.sync.util.DataManipulationUtils;
import com.product.file.service.FileManagerService;
@@ -101,6 +102,8 @@
//宸插悓姝ヨ〃缁撴瀯
private JSONObject dataTableObject = new JSONObject();
+ @Autowired
+ private BatchAddData batchAddData;
public Boolean isStr(String str) {
boolean a = false;
@@ -112,22 +115,28 @@
return a;
}
+
+ private Set<String> clearTable = new HashSet<>();
+
//鍏憡绠$悊1 绯荤粺鍙傛暟 闂嵎绠$悊 鑰冨嫟绠$悊 杞﹁締绠$悊 鍗忓悓鍔炲叕
@Override
public String saveSyncFedata(FieldSetEntity fs) throws SQLException, ClassNotFoundException {
//鍚屾缁勭粐鏋舵瀯
DataTableEntity dataTableEntity = baseDao.listTable("product_sys_users");
- String clientUUID = "remark";
- if (dataTableEntity.getRows() < 10) {
+ String clientUUID = "4d4679ed-c4c3-41b8-abfe-451a66fd4043";
+// if (dataTableEntity.getRows() < 10) {
// //杩佺Щ缁勭粐鏋舵瀯
-// String uuid = feDataDSService.FEDataMigration();
-// if (!BaseUtil.strIsNull(uuid)) {
-// clientUUID = uuid;
-// }
+ String uuid = feDataDSService.FEDataMigration();
+ if (!BaseUtil.strIsNull(uuid)) {
+ clientUUID = uuid;
}
+// }
//灏佽涓よ竟浜哄憳鍏宠仈鍜岄儴闂ㄥ叧鑱�
-// packageDepartmentPersonnel();
+ packageDepartmentPersonnel();
String tricode_fun = Global.getSystemConfig("data.synchronism.function", "").replaceAll(" ", "");
+ if (StringUtils.isEmpty(tricode_fun)) {
+ tricode_fun = fs.getString("function_code");
+ }
if (BaseUtil.strIsNull(tricode_fun)) {
return null;
}
@@ -227,8 +236,8 @@
//杩囨护arr涓殑null骞惰浆涓哄瓧绗︿覆鐢ㄩ�楀彿鍒嗛殧
defaultPosts = Arrays.stream(arr).filter(Objects::nonNull).collect(Collectors.joining(","));
}
- if(!StringUtils.isEmpty(defaultUsers)){
- arr=defaultUsers.split(",");
+ if (!StringUtils.isEmpty(defaultUsers)) {
+ arr = defaultUsers.split(",");
for (int j = 0; j < arr.length; j++) {
String uid = arr[j];
String uuid = userMapping.get(uid);
@@ -246,6 +255,7 @@
node.setValue("default_depts", defaultDepts);
}
+
baseDao.update(nodes);
}
@@ -254,18 +264,25 @@
// String[] tricode_funs = fs.getString("tricode_fun").split(",");
//灏佽鏈骇鍝侀渶璧嬫潈闄愮殑鎸夐挳uuid
// this.packageButton();
-// Connection conn = functionSynchrService.getConnection(fs);
+// ConnectionInterface conn = functionSynchrService.getConnection(fs);
//閫氳繃绾跨▼寰幆娣诲姞鍔熻兘淇℃伅
ExecutorService exec = Executors.newCachedThreadPool();
+ List<Set<String>> clearAttachmentSets = new ArrayList<>();
for (int i = 0; i < tricode_funs.length; i++) {
//鑾峰彇jdbc杩炴帴
BusinessDataSync async = new BusinessDataSync(tricode_funs[i]);
async.setBaseDao(baseDao);
+ async.setClearTable(clearTable);
async.setFileManagerService(fileManagerService);
async.setSystemMenusService(systemMenusService);
async.setFeDataDSService(feDataDSService);
async.setGdMediaUtil(gdMediaUtil);
async.setClientUUID(clientUUID);
+ async.setBatchAddData(batchAddData);
+ Set<String> clearAttachment = async.getClearAttachment();
+ if (clearAttachment != null) {
+ clearAttachmentSets.add(clearAttachment);
+ }
Thread t = new Thread(async);
//璋冪敤绾跨▼run鏂规硶
exec.submit(t);
@@ -310,6 +327,7 @@
}
}
systemMenusService.initSystemMenu();
+ //鍚屾
System.out.println("=================鍚屾鎴愬姛===============");
return "OK";
@@ -2424,7 +2442,7 @@
//鍚屾娑堟伅
try {
this.synchronizingProcessMessages(conn, tricode_funs, stateMap);
- } catch (BaseException e) {
+ } catch (Exception e) {
e.printStackTrace();
}
//婧愭暟鎹甶d 涓� 鏈暟鎹畊uid 鍏宠仈
@@ -2779,7 +2797,7 @@
/**
* 鍚屾娴佺▼娑堟伅琛�
*/
- 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 {
DataTableEntity OrlDt = null;
try {
StringBuffer sql = new StringBuffer();
@@ -2795,6 +2813,8 @@
String id = null;
String message_uuid = null;
String state = null;
+ DataTableEntity dt = new DataTableEntity();
+ DataTableEntity dt1 = new DataTableEntity();
for (int i = 0; i < OrlDt.getRows(); i++) {
FieldSetEntity fs = OrlDt.getFieldSetEntity(i);
//娴佺▼鑺傜偣id
@@ -2853,7 +2873,10 @@
} 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();
@@ -2884,8 +2907,20 @@
}
}
message_user.setValue("user_id", user_id);
- baseDao.add(message_user);
+// baseDao.add(message_user);
+ dt.addFieldSetEntity(message_user);
+
+ if (dt1.getRows() > 50000) {
+ batchAddData.add(dt1);
+ dt1 = new DataTableEntity();
+ }
+ if (dt.getRows() > 50000) {
+ batchAddData.add(dt);
+ dt = new DataTableEntity();
+ }
}
+ batchAddData.add(dt1);
+ batchAddData.add(dt);
}
diff --git a/product-server-data-sync/src/main/java/com/product/data/sync/util/BatchAddData.java b/product-server-data-sync/src/main/java/com/product/data/sync/util/BatchAddData.java
new file mode 100644
index 0000000..e09fd62
--- /dev/null
+++ b/product-server-data-sync/src/main/java/com/product/data/sync/util/BatchAddData.java
@@ -0,0 +1,75 @@
+package com.product.data.sync.util;
+
+import cn.hutool.core.lang.UUID;
+import com.product.common.lang.StringUtils;
+import com.product.core.cache.DataPoolCacheImpl;
+import com.product.core.connection.ConnectionManager;
+import com.product.core.entity.DataTableEntity;
+import com.product.core.entity.FieldMetaEntity;
+import com.product.core.entity.FieldSetEntity;
+import com.product.datasource.dao.Dao;
+import com.product.datasource.dao.impl.MysqlDaoImpl;
+import com.product.util.BaseUtil;
+import org.springframework.stereotype.Service;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Service
+public class BatchAddData {
+
+
+ public void add(DataTableEntity dt) throws Exception {
+ Dao dao = new MysqlDaoImpl(() -> ConnectionManager.getConnection());
+ if (DataTableEntity.isEmpty(dt)) {
+ return;
+ }
+ FieldMetaEntity meta = dt.getMeta();
+ String tableName = dt.getTableName().toString();
+ //鍦ㄧ紦瀛樿〃涓幏鍙栬琛ㄧ殑鎵�鏈夊瓧娈�
+// DataPoolCacheImpl.getInstance().getCacheData("")
+ FieldSetEntity tableMeta = BaseUtil.getSingleInfoByCache("鎵�鏈夎〃淇℃伅", new String[]{tableName});
+ String tableUuid = tableMeta.getString("uuid");
+ //琛ㄥ瓧娈�
+ DataTableEntity fieldTableMeta = DataPoolCacheImpl.getInstance().getCacheData("鎵�鏈夊瓧娈典俊鎭苟鎸夎〃鍒嗙粍", new String[]{tableUuid});
+
+ List<String> fields = new ArrayList<>();
+ for (int i = 0; i < fieldTableMeta.getRows(); i++) {
+ FieldSetEntity fieldMeta = fieldTableMeta.getFieldSetEntity(i);
+ String fieldType = fieldMeta.getString("field_type");
+ String fieldName = fieldMeta.getString("field_name");
+ if (!"pk".equalsIgnoreCase(fieldType)) {
+ fields.add(fieldName);
+ }
+ }
+ DataTableEntity addDt = new DataTableEntity();
+ List<DataTableEntity> addDtList = new ArrayList<>();
+ for (int i = 0; i < dt.getRows(); i++) {
+ if(FieldSetEntity.isEmpty(dt.getFieldSetEntity(i))){
+ continue;
+ }
+ if (i == 5000) {
+ addDtList.add(addDt);
+ addDt = new DataTableEntity();
+ }
+ FieldSetEntity ff = new FieldSetEntity(tableName);
+ for (String field : fields) {
+ ff.setValue(field, dt.getObject(i, field));
+ }
+ if (StringUtils.isEmpty(ff.getString("uuid"))) {
+ ff.setValue("uuid", UUID.randomUUID().toString());
+ dt.setFieldValue(i, "uuid", ff.getString("uuid"));
+ }
+ addDt.addFieldSetEntity(ff);
+ }
+ addDtList.add(addDt);
+ for (DataTableEntity dataTableEntity : addDtList) {
+ dao.addBatch(dataTableEntity);
+ }
+ dao.closeConnection();
+ }
+}
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