拖拽优化
This commit is contained in:
parent
8b894bbaa3
commit
6247129bcf
|
|
@ -681,21 +681,23 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
String targetId = targetKey.substring(1);
|
||||
String supComId = "";
|
||||
String supId = "";
|
||||
String ftype = "";
|
||||
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 = ?";
|
||||
querySupIdSql = "select companyId as supComId,supsubcomid as supId,'s' as ftype from hrmsubcompany where id = ?";
|
||||
} else {
|
||||
querySupIdSql = "select subcompanyid1 as supComId,supdepid as supId from hrmdepartment where id = ?";
|
||||
querySupIdSql = "select subcompanyid1 as supComId,supdepid as supId,'d' as ftype from hrmdepartment where id = ?";
|
||||
}
|
||||
|
||||
recordSet.executeQuery(querySupIdSql, targetId);
|
||||
if (recordSet.next()) {
|
||||
supId = Util.null2String(recordSet.getString("supId"));
|
||||
supComId = Util.null2String(recordSet.getString("supComId"));
|
||||
ftype = Util.null2String(recordSet.getString("ftype"));
|
||||
}
|
||||
if ("1".equals(dragPostion)) {
|
||||
recordSet.executeQuery(querySupIdSql, targetId);
|
||||
if (recordSet.next()) {
|
||||
supId = Util.null2String(recordSet.getString("supId"));
|
||||
supComId = Util.null2String(recordSet.getString("supComId"));
|
||||
}
|
||||
|
||||
if ("s".equals(targetType)) {
|
||||
OrganizationAssert.isFalse("0".equals(supId), "部门不能拖拽至集团下");
|
||||
|
|
@ -712,8 +714,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
}
|
||||
// OrganizationAssert.isFalse(disableIds.contains(Util.getIntValue(targetId)), "请勿选择当前部门本身及其子部门");
|
||||
deptById.setSupDepId(Util.getIntValue(supId));
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(supId) == 0 ? Util.getIntValue(supComId) : Util.getIntValue(supId));
|
||||
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
||||
// DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(supId) == 0 ? Util.getIntValue(supComId) : Util.getIntValue(supId));
|
||||
// deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
||||
deptById.setSubCompanyId1(Util.getIntValue(supComId));
|
||||
}
|
||||
} else {
|
||||
if ("s".equals(targetType)) {
|
||||
|
|
@ -722,6 +725,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
params.put("id", sourceId);
|
||||
params.put("supsubcomid", targetId);
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
|
||||
if ("d".equals(sourceType)) {
|
||||
deptById.setSupDepId(0);
|
||||
deptById.setSubCompanyId1("s".equals(ftype) ? Util.getIntValue(targetId) : Util.getIntValue(supComId));
|
||||
}
|
||||
} else if ("c".equals(targetType)) {
|
||||
OrganizationAssert.isFalse("d".equals(sourceType), "部门不能拖拽到集团下");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
|
@ -740,13 +747,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<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
|
||||
forbiddenChildTag(deptById.getSubCompanyId1(), deptList);
|
||||
}
|
||||
}
|
||||
// 更新EC部门
|
||||
updateEcDepartment(deptById);
|
||||
// 刷新岗位分部
|
||||
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(deptById.getId());
|
||||
forbiddenChildTag(deptById.getSubCompanyId1(), deptList);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue