部门拖拽优化0802
This commit is contained in:
parent
1ac72f3519
commit
3bb8c35fb5
|
|
@ -667,35 +667,29 @@ 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 sourceType = sourceKey.substring(0, 1);
|
||||
String sourceId = sourceKey.substring(1);
|
||||
String targetType = targetKey.substring(0, 1);
|
||||
String targetId = targetKey.substring(1);
|
||||
String supComId = "";
|
||||
String supId = "";
|
||||
String querySupIdSql;
|
||||
OrganizationAssert.isFalse( "s".equals(sourceType)&&"d".equals(targetType),"分部不能转移到部门下");
|
||||
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 {
|
||||
} 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()) {
|
||||
|
|
@ -718,32 +712,31 @@ 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));
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(supId) == 0 ? Util.getIntValue(supComId) : Util.getIntValue(supId));
|
||||
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
||||
}
|
||||
|
||||
} else {
|
||||
if ("s".equals(targetType)) {
|
||||
//转移到分部下
|
||||
// 转移到分部下
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id",sourceId);
|
||||
params.put("supsubcomid",targetId);
|
||||
params.put("id", sourceId);
|
||||
params.put("supsubcomid", targetId);
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
|
||||
} else if ("c".equals(targetType)) {
|
||||
OrganizationAssert.isFalse("d".equals(sourceType),"部门不能拖拽到集团下");
|
||||
OrganizationAssert.isFalse("d".equals(sourceType), "部门不能拖拽到集团下");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id",sourceId);
|
||||
params.put("supsubcomid","0");
|
||||
params.put("id", sourceId);
|
||||
params.put("supsubcomid", "0");
|
||||
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
|
||||
} else {
|
||||
//转移到部门下
|
||||
// 转移到部门下
|
||||
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(Util.getIntValue(targetId));
|
||||
Set<Integer> disableIds = new HashSet<>();
|
||||
disableIds.add(Util.getIntValue(sourceKey.substring(1)));
|
||||
if (CollectionUtils.isNotEmpty(deptListByPId)) {
|
||||
addDisableIds(disableIds, deptListByPId);
|
||||
}
|
||||
OrganizationAssert.isFalse( "d".equals(targetType)&&disableIds.contains(Util.getIntValue(targetId)), "请勿选择当前部门本身及其子部门");
|
||||
OrganizationAssert.isFalse("d".equals(targetType) && disableIds.contains(Util.getIntValue(targetId)), "请勿选择当前部门本身及其子部门");
|
||||
deptById.setSupDepId(Util.getIntValue(targetId));
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(Util.getIntValue(targetId));
|
||||
deptById.setSubCompanyId1(parentDepartment.getSubCompanyId1());
|
||||
|
|
|
|||
Loading…
Reference in New Issue