拖拽优化

pull/200/head
Mlin 2 years ago
parent 8b894bbaa3
commit 6247129bcf

@ -681,21 +681,23 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
String targetId = targetKey.substring(1); String targetId = targetKey.substring(1);
String supComId = ""; String supComId = "";
String supId = ""; String supId = "";
String ftype = "";
String querySupIdSql; String querySupIdSql;
OrganizationAssert.isFalse("s".equals(sourceType) && "d".equals(targetType), "分部不能转移到部门下"); OrganizationAssert.isFalse("s".equals(sourceType) && "d".equals(targetType), "分部不能转移到部门下");
OrganizationAssert.isFalse("-1".equals(dragPostion), "分部、部门不能转移至与集团平级"); OrganizationAssert.isFalse("-1".equals(dragPostion), "分部、部门不能转移至与集团平级");
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,'s' as ftype from hrmsubcompany where id = ?";
} else { } 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)) { 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)) { if ("s".equals(targetType)) {
OrganizationAssert.isFalse("0".equals(supId), "部门不能拖拽至集团下"); OrganizationAssert.isFalse("0".equals(supId), "部门不能拖拽至集团下");
@ -712,8 +714,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
} }
// 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) == 0 ? Util.getIntValue(supComId) : 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());
deptById.setSubCompanyId1(Util.getIntValue(supComId));
} }
} else { } else {
if ("s".equals(targetType)) { if ("s".equals(targetType)) {
@ -722,6 +725,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
params.put("id", sourceId); params.put("id", sourceId);
params.put("supsubcomid", targetId); params.put("supsubcomid", targetId);
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync(); 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)) { } else if ("c".equals(targetType)) {
OrganizationAssert.isFalse("d".equals(sourceType), "部门不能拖拽到集团下"); OrganizationAssert.isFalse("d".equals(sourceType), "部门不能拖拽到集团下");
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
@ -740,13 +747,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部门
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; return 1;
} }

Loading…
Cancel
Save