| | |
| | | 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; |
| | |
| | | |
| | | //已同步表结构 |
| | | private JSONObject dataTableObject = new JSONObject(); |
| | | @Autowired |
| | | private BatchAddData batchAddData; |
| | | |
| | | public Boolean isStr(String str) { |
| | | boolean a = false; |
| | |
| | | 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; |
| | | } |
| | |
| | | //过滤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); |
| | |
| | | node.setValue("default_depts", defaultDepts); |
| | | |
| | | } |
| | | |
| | | baseDao.update(nodes); |
| | | } |
| | | |
| | |
| | | // 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); |
| | |
| | | } |
| | | } |
| | | systemMenusService.initSystemMenu(); |
| | | //同步 |
| | | System.out.println("=================同步成功==============="); |
| | | |
| | | return "OK"; |
| | |
| | | //同步消息 |
| | | try { |
| | | this.synchronizingProcessMessages(conn, tricode_funs, stateMap); |
| | | } catch (BaseException e) { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //源数据id 与 本数据uuid 关联 |
| | |
| | | /** |
| | | * 同步流程消息表 |
| | | */ |
| | | 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(); |
| | |
| | | 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 |
| | |
| | | } 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(); |
| | |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | |