|
|
@ -666,13 +666,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int dragDepartment(Map<String, Object> params) {
|
|
|
|
public int dragDepartment(DepartmentDragParam departmentDragParam) {
|
|
|
|
// OrganizationAssert.notNull(params.get("sourcekey"), "请选择一个拖拽源");
|
|
|
|
// OrganizationAssert.notNull(params.get("sourcekey"), "请选择一个拖拽源");
|
|
|
|
// OrganizationAssert.notNull(params.get("targetkey"), "请选择一个拖拽目的地");
|
|
|
|
// OrganizationAssert.notNull(params.get("targetkey"), "请选择一个拖拽目的地");
|
|
|
|
|
|
|
|
|
|
|
|
String sourceKey = Util.null2String(params.get("sourcekey"));// 原目标
|
|
|
|
String sourceKey = Util.null2String(departmentDragParam.getSourcekey());// 原目标
|
|
|
|
String targetKey = Util.null2String(params.get("targetkey"));// 目的地
|
|
|
|
String targetKey = Util.null2String(departmentDragParam.getTargetkey());// 目的地
|
|
|
|
String dragPostion = Util.null2String(params.get("dragpostion"));// 0:目的里面 1:目的外边
|
|
|
|
String dragPostion = Util.null2String(departmentDragParam.getDropPosition());// 0:目的里面 1:目的外边
|
|
|
|
|
|
|
|
|
|
|
|
DepartmentPO deptById = getDepartmentMapper().getDeptById(Util.getIntValue(sourceKey.substring(1)));
|
|
|
|
DepartmentPO deptById = getDepartmentMapper().getDeptById(Util.getIntValue(sourceKey.substring(1)));
|
|
|
|
|
|
|
|
|
|
|
@ -682,21 +682,24 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
|
|
String targetType = targetKey.substring(0, 1);
|
|
|
|
String targetType = targetKey.substring(0, 1);
|
|
|
|
String targetId = targetKey.substring(1);
|
|
|
|
String targetId = targetKey.substring(1);
|
|
|
|
String supId = null;
|
|
|
|
String supComId = "";
|
|
|
|
String querySupIdSql = null;
|
|
|
|
String supId = "";
|
|
|
|
|
|
|
|
String querySupIdSql;
|
|
|
|
if ("s".equals(targetType)) {// 分部
|
|
|
|
if ("s".equals(targetType)) {// 分部
|
|
|
|
querySupIdSql = "select supsubcomid as supId from hrmsubcompany where id = ?";
|
|
|
|
querySupIdSql = "select companyId as supComId,supsubcomid as supId from hrmsubcompany where id = ?";
|
|
|
|
} else {
|
|
|
|
|
|
|
|
querySupIdSql = "select supdepid as supId from hrmdepartment where id = ?";
|
|
|
|
}else {
|
|
|
|
|
|
|
|
querySupIdSql = "select subcompanyid1 as supComId,supdepid as supId from hrmdepartment where id = ?";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ("1".equals(dragPostion)) {
|
|
|
|
if ("1".equals(dragPostion)) {
|
|
|
|
recordSet.executeQuery(querySupIdSql, targetId);
|
|
|
|
recordSet.executeQuery(querySupIdSql, targetId);
|
|
|
|
if (recordSet.next()) {
|
|
|
|
if (recordSet.next()) {
|
|
|
|
supId = Util.null2String(recordSet.getString("supId"));
|
|
|
|
supId = Util.null2String(recordSet.getString("supId"));
|
|
|
|
|
|
|
|
supComId = Util.null2String(recordSet.getString("supComId"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrganizationAssert.isFalse("0".equals(supId), "部门不能直接拖拽至集团下");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("s".equals(targetType)) {
|
|
|
|
if ("s".equals(targetType)) {
|
|
|
|
|
|
|
|
OrganizationAssert.isFalse("0".equals(supId), "部门不能直接拖拽至集团下");
|
|
|
|
// 转移到分部外
|
|
|
|
// 转移到分部外
|
|
|
|
deptById.setSubCompanyId1(Util.getIntValue(supId));
|
|
|
|
deptById.setSubCompanyId1(Util.getIntValue(supId));
|
|
|
|
deptById.setSupDepId(null);
|
|
|
|
deptById.setSupDepId(null);
|
|
|
@ -708,9 +711,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
if (CollectionUtils.isNotEmpty(deptListByPId)) {
|
|
|
|
if (CollectionUtils.isNotEmpty(deptListByPId)) {
|
|
|
|
addDisableIds(disableIds, deptListByPId);
|
|
|
|
addDisableIds(disableIds, deptListByPId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(Util.getIntValue(targetId)), "请勿选择当前部门本身及其子部门");
|
|
|
|
// OrganizationAssert.isFalse(disableIds.contains(Util.getIntValue(targetId)), "请勿选择当前部门本身及其子部门");
|
|
|
|
deptById.setSupDepId(Util.getIntValue(supId));
|
|
|
|
deptById.setSupDepId(Util.getIntValue(supId));
|
|
|
|
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(supId));
|
|
|
|
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(supId)==0 ? Util.getIntValue(supComId) : Util.getIntValue(supId));
|
|
|
|
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
|
|
|
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|