部门拖拽:分部优化

pull/200/head
Mlin 2 years ago
parent 63491e9906
commit 2fdd604872

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

Loading…
Cancel
Save