|
|
@ -24,6 +24,8 @@ import com.engine.organization.entity.job.po.JobPO;
|
|
|
|
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
|
|
|
|
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTree;
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTree;
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|
|
|
|
|
|
|
import com.engine.organization.enums.LogModuleNameEnum;
|
|
|
|
|
|
|
|
import com.engine.organization.enums.OperateTypeEnum;
|
|
|
|
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
|
|
|
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
import com.engine.organization.mapper.department.DepartmentMapper;
|
|
|
|
import com.engine.organization.mapper.department.DepartmentMapper;
|
|
|
@ -31,6 +33,7 @@ import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|
|
|
import com.engine.organization.mapper.job.JobMapper;
|
|
|
|
import com.engine.organization.mapper.job.JobMapper;
|
|
|
|
import com.engine.organization.service.DepartmentService;
|
|
|
|
import com.engine.organization.service.DepartmentService;
|
|
|
|
import com.engine.organization.service.ExtService;
|
|
|
|
import com.engine.organization.service.ExtService;
|
|
|
|
|
|
|
|
import com.engine.organization.thread.OrganizationRunable;
|
|
|
|
import com.engine.organization.util.*;
|
|
|
|
import com.engine.organization.util.*;
|
|
|
|
import com.engine.organization.util.coderule.CodeRuleUtil;
|
|
|
|
import com.engine.organization.util.coderule.CodeRuleUtil;
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
@ -192,18 +195,24 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
// 判断是否开启自动编号
|
|
|
|
// 判断是否开启自动编号
|
|
|
|
deptNo = repeatDetermine(deptNo);
|
|
|
|
deptNo = repeatDetermine(deptNo);
|
|
|
|
params.put("dept_no", deptNo);
|
|
|
|
params.put("dept_no", deptNo);
|
|
|
|
if (StringUtils.isBlank((String) params.get("show_order"))) {
|
|
|
|
if (StringUtils.isBlank(Util.null2String(params.get("show_order")))) {
|
|
|
|
int maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
|
|
|
int maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
|
|
|
params.put("show_order", maxShowOrder + 1);
|
|
|
|
params.put("show_order", maxShowOrder + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Long departmentId = getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", null);
|
|
|
|
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", null);
|
|
|
|
params.put("id", departmentId);
|
|
|
|
|
|
|
|
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, params)).start();
|
|
|
|
|
|
|
|
return departmentId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int updateForbiddenTagById(DeptSearchParam params) {
|
|
|
|
public int updateForbiddenTagById(DeptSearchParam params) {
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
|
|
|
DepartmentPO departmentPO = DepartmentPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("id", departmentPO.getId());
|
|
|
|
|
|
|
|
map.put("forbiddenTag", departmentPO.getForbiddenTag());
|
|
|
|
|
|
|
|
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map)).start();
|
|
|
|
return getDepartmentMapper().updateForbiddenTagById(departmentPO);
|
|
|
|
return getDepartmentMapper().updateForbiddenTagById(departmentPO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -224,6 +233,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 更新主表数据
|
|
|
|
// 更新主表数据
|
|
|
|
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", searchParam.getId());
|
|
|
|
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPT, params, "", searchParam.getId());
|
|
|
|
|
|
|
|
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params)).start();
|
|
|
|
// 更新主表拓展表
|
|
|
|
// 更新主表拓展表
|
|
|
|
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPTEXT, params, groupId, searchParam.getId());
|
|
|
|
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_DEPTEXT, params, groupId, searchParam.getId());
|
|
|
|
//更新明细表
|
|
|
|
//更新明细表
|
|
|
@ -236,6 +246,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
|
|
|
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("id", StringUtils.join(ids, ","));
|
|
|
|
|
|
|
|
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map)).start();
|
|
|
|
return getDepartmentMapper().deleteByIds(ids);
|
|
|
|
return getDepartmentMapper().deleteByIds(ids);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -392,6 +405,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
// 显示顺序字段
|
|
|
|
// 显示顺序字段
|
|
|
|
deptById.setShowOrder(maxShowOrder + i + 1);
|
|
|
|
deptById.setShowOrder(maxShowOrder + i + 1);
|
|
|
|
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
|
|
|
|
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
|
|
|
|
|
|
|
|
// 更新EC表部门
|
|
|
|
|
|
|
|
updateEcDepartment(deptById);
|
|
|
|
|
|
|
|
// TODO 新增岗位信息
|
|
|
|
if ("1".equals(copyParam.getCopyJob())) {
|
|
|
|
if ("1".equals(copyParam.getCopyJob())) {
|
|
|
|
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(idList.get(i));
|
|
|
|
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(idList.get(i));
|
|
|
|
Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
|
|
|
|
Integer maxJobOrder = MapperProxyFactory.getProxy(JobMapper.class).getMaxShowOrder();
|
|
|
@ -441,6 +457,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
// 禁用
|
|
|
|
// 禁用
|
|
|
|
mergeDepartment.setForbiddenTag(1);
|
|
|
|
mergeDepartment.setForbiddenTag(1);
|
|
|
|
updateCount += getDepartmentMapper().updateBaseDept(mergeDepartment);
|
|
|
|
updateCount += getDepartmentMapper().updateBaseDept(mergeDepartment);
|
|
|
|
|
|
|
|
// 更新EC表部门
|
|
|
|
|
|
|
|
updateEcDepartment(mergeDepartment);
|
|
|
|
|
|
|
|
// 封存EC表部门
|
|
|
|
|
|
|
|
cancelEcDepartment(mergeDepartment.getId());
|
|
|
|
// 合并后部门及子部门禁用
|
|
|
|
// 合并后部门及子部门禁用
|
|
|
|
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
|
|
|
|
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(mergeParam.getId());
|
|
|
|
forbiddenChildTag(parentComp, deptList);
|
|
|
|
forbiddenChildTag(parentComp, deptList);
|
|
|
@ -486,9 +506,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
Long department = moveParam.getDepartment();
|
|
|
|
Long department = moveParam.getDepartment();
|
|
|
|
OrganizationAssert.notNull(department, "请选择要转移到的部门");
|
|
|
|
OrganizationAssert.notNull(department, "请选择要转移到的部门");
|
|
|
|
deptById.setParentDept(department);
|
|
|
|
deptById.setParentDept(department);
|
|
|
|
deptById.setParentComp(null);
|
|
|
|
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(department);
|
|
|
|
|
|
|
|
deptById.setParentComp(parentDepartment.getParentComp());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return getDepartmentMapper().updateBaseDept(deptById);
|
|
|
|
int updateBaseDept = getDepartmentMapper().updateBaseDept(deptById);
|
|
|
|
|
|
|
|
// 更新EC部门
|
|
|
|
|
|
|
|
updateEcDepartment(deptById);
|
|
|
|
|
|
|
|
return updateBaseDept;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -503,6 +527,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
departmentPO.setParentComp(parentComp);
|
|
|
|
departmentPO.setParentComp(parentComp);
|
|
|
|
departmentPO.setForbiddenTag(1);
|
|
|
|
departmentPO.setForbiddenTag(1);
|
|
|
|
getDepartmentMapper().updateBaseDept(departmentPO);
|
|
|
|
getDepartmentMapper().updateBaseDept(departmentPO);
|
|
|
|
|
|
|
|
// 更新EC表部门
|
|
|
|
|
|
|
|
updateEcDepartment(departmentPO);
|
|
|
|
|
|
|
|
// 封存EC表部门
|
|
|
|
|
|
|
|
cancelEcDepartment(departmentPO.getId());
|
|
|
|
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
|
|
|
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
|
|
|
forbiddenChildTag(parentComp, childList);
|
|
|
|
forbiddenChildTag(parentComp, childList);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -619,4 +647,33 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 更新EC表部门
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param departmentPO
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void updateEcDepartment(DepartmentPO departmentPO) {
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("dept_name_short", departmentPO.getDeptNameShort());
|
|
|
|
|
|
|
|
map.put("dept_name", departmentPO.getDeptName());
|
|
|
|
|
|
|
|
map.put("parent_comp", departmentPO.getParentComp());
|
|
|
|
|
|
|
|
map.put("parent_dept", departmentPO.getParentDept());
|
|
|
|
|
|
|
|
map.put("show_order", departmentPO.getShowOrder());
|
|
|
|
|
|
|
|
map.put("dept_no", departmentPO.getDeptNo());
|
|
|
|
|
|
|
|
map.put("dept_principal", departmentPO.getDeptPrincipal());
|
|
|
|
|
|
|
|
map.put("id", departmentPO.getId());
|
|
|
|
|
|
|
|
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map)).start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 封存EC表部门
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param id
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void cancelEcDepartment(Long id) {
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("id", id);
|
|
|
|
|
|
|
|
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map)).start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|