|
|
|
@ -667,19 +667,14 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int dragDepartment(DepartmentDragParam departmentDragParam) {
|
|
|
|
|
// OrganizationAssert.notNull(params.get("sourcekey"), "请选择一个拖拽源");
|
|
|
|
|
// OrganizationAssert.notNull(params.get("targetkey"), "请选择一个拖拽目的地");
|
|
|
|
|
|
|
|
|
|
String sourceKey = Util.null2String(departmentDragParam.getSourcekey());// 原目标
|
|
|
|
|
String targetKey = Util.null2String(departmentDragParam.getTargetkey());// 目的地
|
|
|
|
|
String dragPostion = Util.null2String(departmentDragParam.getDropPosition());// 0:目的里面 1:目的外边
|
|
|
|
|
|
|
|
|
|
DepartmentPO deptById = getDepartmentMapper().getDeptById(Util.getIntValue(sourceKey.substring(1)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RecordSet recordSet = new RecordSet();
|
|
|
|
|
// 部门不能到集团下
|
|
|
|
|
|
|
|
|
|
// 部门不能到集团下
|
|
|
|
|
String sourceType = sourceKey.substring(0, 1);
|
|
|
|
|
String sourceId = sourceKey.substring(1);
|
|
|
|
|
String targetType = targetKey.substring(0, 1);
|
|
|
|
@ -688,14 +683,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
String supId = "";
|
|
|
|
|
String querySupIdSql;
|
|
|
|
|
OrganizationAssert.isFalse("s".equals(sourceType) && "d".equals(targetType), "分部不能转移到部门下");
|
|
|
|
|
OrganizationAssert.isFalse("-1".equals(dragPostion), "分部、部门不能转移至与集团平级");
|
|
|
|
|
if ("s".equals(targetType)) {// 分部
|
|
|
|
|
querySupIdSql = "select companyId as supComId,supsubcomid as supId from hrmsubcompany where id = ?";
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
querySupIdSql = "select subcompanyid1 as supComId,supdepid as supId from hrmdepartment where id = ?";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OrganizationAssert.isFalse("-1".equals(dragPostion),"分部、部门不能转移至与集团平级");
|
|
|
|
|
if ("1".equals(dragPostion)) {
|
|
|
|
|
recordSet.executeQuery(querySupIdSql, targetId);
|
|
|
|
|
if (recordSet.next()) {
|
|
|
|
@ -721,7 +715,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(supId) == 0 ? Util.getIntValue(supComId) : Util.getIntValue(supId));
|
|
|
|
|
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if ("s".equals(targetType)) {
|
|
|
|
|
// 转移到分部下
|
|
|
|
|