diff --git a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java index 436254fa..aa4b353e 100644 --- a/src/com/engine/organization/service/impl/DepartmentServiceImpl.java +++ b/src/com/engine/organization/service/impl/DepartmentServiceImpl.java @@ -680,11 +680,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService RecordSet recordSet = new RecordSet(); // 部门不能到集团下 + String sourceType = sourceKey.substring(0,1); + String sourceId = sourceKey.substring(1); String targetType = targetKey.substring(0, 1); String targetId = targetKey.substring(1); String supComId = ""; String supId = ""; String querySupIdSql; + OrganizationAssert.isFalse( "s".equals(sourceType)&&"d".equals(targetType),"分部不能转移到部门下"); if ("s".equals(targetType)) {// 分部 querySupIdSql = "select companyId as supComId,supsubcomid as supId from hrmsubcompany where id = ?"; @@ -720,8 +723,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService } else { if ("s".equals(targetType)) { //转移到分部下 - deptById.setSubCompanyId1(Util.getIntValue(targetId)); - deptById.setSupDepId(null); + Map params = new HashMap<>(); + params.put("id",sourceId); + params.put("supsubcomid",targetId); + new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync(); } else { //转移到部门下 List deptListByPId = getDepartmentMapper().getDeptListByPId(Util.getIntValue(targetId)); @@ -734,13 +739,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService deptById.setSupDepId(Util.getIntValue(targetId)); DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(targetId)); deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1()); + // 更新EC部门 + updateEcDepartment(deptById); + // 刷新岗位分部 + List deptList = getDepartmentMapper().getDeptListByPId(deptById.getId()); + forbiddenChildTag(deptById.getSubCompanyId1(), deptList); } } - // 更新EC部门 - updateEcDepartment(deptById); - // 刷新岗位分部 - List deptList = getDepartmentMapper().getDeptListByPId(deptById.getId()); - forbiddenChildTag(deptById.getSubCompanyId1(), deptList); return 1; }