| | |
| | | private Integer sort = 0; |
| | | //公司和部门map key 为公司或部门全称 |
| | | Map<String, FieldSetEntity> institutionMap = Maps.newHashMap(); |
| | | |
| | | public Connection getJDBC() throws SQLException, ClassNotFoundException { |
| | | //获取jdbc连接 |
| | | // String diver = "oracle.jdbc.driver.OracleDriver"; |
| | |
| | | this.packInstitutionMap(); |
| | | //同步岗位等级和岗位 |
| | | this.synchronousPost(); |
| | | //同步角色 |
| | | this.synchronousRole(); |
| | | // //同步角色 |
| | | // this.synchronousRole(); |
| | | //同步管理员 |
| | | this.syncManager(clientUUID); |
| | | // 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; |
| | |
| | | |
| | | /** |
| | | * 初始化客户及客户角色(修改客户为FE的客户名称) |
| | | * |
| | | * @return |
| | | * @throws SQLException |
| | | * @throws ClassNotFoundException |
| | |
| | | |
| | | /** |
| | | * 同步管理员 |
| | | * |
| | | * @param managerData 管理员用户数据 |
| | | */ |
| | | public void syncManager(DataTableEntity managerData,String clientUUID){ |
| | |
| | | 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("/")); |
| | | //替换为一样的符号方便对比 |
| | |
| | | |
| | | /** |
| | | * 递归获取上级公司uuid |
| | | * |
| | | * @param level_all 上级公司全称 |
| | | * @return 保存后返回保存后的 fse |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 保存公司 |
| | | * |
| | | * @param fse 公司fes |
| | | * @param code_parent 公司上级code |
| | | * @return 保存后返回保存后的 fse |
| | |
| | | |
| | | /** |
| | | * 保存部门 |
| | | * |
| | | * @param fse 公司fes |
| | | * @param code_parent 公司上级code |
| | | * @return 保存后返回保存后的 fse |
| | |
| | | service.addDepartment(levelsFs); |
| | | return levelsFs; |
| | | } |
| | | |
| | | /** |
| | | * 封装公司部门全称 Map |
| | | */ |
| | |
| | | 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")); |
| | | //性别转换 |
| | |
| | | //公司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"); |
| | | //查询岗位等级 |
| | |
| | | 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); |
| | | //添加岗位与岗位等级关系映射数据表 |
| | |
| | | } |
| | | }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("sg00", fieldSetEntity1.getString("sequence") + "01"); |
| | | //保存后的部门 |
| | | FieldSetEntity newDeptFse = this.addDepartment(departmentFse,code,org_uuid); |
| | | 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); |
| | | //添加岗位与岗位等级关系映射数据表 |
| | |
| | | //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); |
| | | //添加岗位与岗位等级关系映射数据表 |
| | |
| | | |
| | | /** |
| | | * 添加创建人和创建时间 |
| | | * |
| | | * @param fieldSetEntity |
| | | */ |
| | | public void userAndTime(FieldSetEntity fieldSetEntity){ |
| | | fieldSetEntity.setValue("created_by",SpringMVCContextHolder.getCurrentUserId()); |
| | | fieldSetEntity.setValue("created_utc_datetime",new Date()); |
| | | } |
| | | |
| | | /** |
| | | * 添加岗位等级 |
| | | */ |
| | |
| | | baseDao.add(field); |
| | | } |
| | | } |
| | | /** 复制单个文件 |
| | | |
| | | /** |
| | | * 复制单个文件 |
| | | * |
| | | * @param oldPath String 原文件路径 如:c:/fqf.txt |
| | | * @param newPath String 复制后路径 如:f:/fqf.txt |
| | | * @return boolean |
| | |
| | | } |
| | | } |
| | | |
| | | /** 删除单个文件 |
| | | /** |
| | | * 删除单个文件 |
| | | * |
| | | * @param fileName 被删除文件的文件名 |
| | | * @return 单个文件删除成功返回true,否则返回false |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取文件名称 最新修改时间 map |
| | | * |
| | | * @param path |
| | | * @return |
| | | */ |
| | |
| | | return null; |
| | | } |
| | | Map<String, String> fileTimeName = Maps.newHashMap(); |
| | | for(File f:fs) |
| | | { |
| | | if(f.isFile()) |
| | | { |
| | | for (File f : fs) { |
| | | if (f.isFile()) { |
| | | String fileName = f.toString().replace(path+"\\",""); |
| | | fileTimeName.put(this.set_fileInfo(f.toString()),fileName); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 获取文件最近修改时间 |
| | | * |
| | | * @param file_name 文件全路径 |
| | | * @return |
| | | */ |
| | | public String set_fileInfo(String file_name) |
| | | { |
| | | 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 |
| | | { |
| | | try { |
| | | |
| | | attr = basicview.readAttributes(); |
| | | //创建时间 |
| | |
| | | Date lastmodfiyTimeDate=new Date(attr.lastModifiedTime().toMillis()); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | time = df.format(lastmodfiyTimeDate); |
| | | } catch (Exception e) |
| | | { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return time; |