|
|
|
@ -22,6 +22,7 @@ import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
|
|
|
|
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|
|
|
|
import com.engine.organization.entity.job.bo.JobBO;
|
|
|
|
|
import com.engine.organization.entity.job.dto.JobListDTO;
|
|
|
|
|
import com.engine.organization.entity.job.param.JobMergeParam;
|
|
|
|
|
import com.engine.organization.entity.job.param.JobSearchParam;
|
|
|
|
|
import com.engine.organization.entity.job.po.JobDTPO;
|
|
|
|
|
import com.engine.organization.entity.job.po.JobPO;
|
|
|
|
@ -438,6 +439,48 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
return result.getResultMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getMergeForm() {
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem deptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "合并到岗位", "161", "targetJob", "jobBrowser");
|
|
|
|
|
deptBrowserItem.setRules("required");
|
|
|
|
|
condition.add(deptBrowserItem);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("", true, condition));
|
|
|
|
|
return addGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int mergeJob(JobMergeParam mergeParam) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
int updateCount = 0;
|
|
|
|
|
OrganizationAssert.notNull(mergeParam.getTargetJob(), "请选择需要合并的部门");
|
|
|
|
|
Set<Long> disableIds = new HashSet<>();
|
|
|
|
|
disableIds.add(mergeParam.getId());
|
|
|
|
|
List<JobPO> jobs = getJobMapper().getJobsByPid(mergeParam.getId());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(jobs)) {
|
|
|
|
|
addDisableIds(disableIds, jobs);
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(mergeParam.getTargetJob()), "请勿选择当前岗位本身及其子岗位");
|
|
|
|
|
|
|
|
|
|
// 合并到的岗位
|
|
|
|
|
JobPO targetJob = getJobMapper().getJobById(mergeParam.getTargetJob());
|
|
|
|
|
Long parentDept = targetJob.getParentDept();
|
|
|
|
|
Long parentComp = targetJob.getParentComp();
|
|
|
|
|
|
|
|
|
|
// 原岗位禁用
|
|
|
|
|
JobPO mergeJob = getJobMapper().getJobById(mergeParam.getId());
|
|
|
|
|
mergeJob.setForbiddenTag(1);
|
|
|
|
|
updateCount += getJobMapper().updateBaseJob(mergeJob);
|
|
|
|
|
|
|
|
|
|
//TODO 合并该刚岗位下的人员
|
|
|
|
|
|
|
|
|
|
// 合并后岗位及子岗位禁用
|
|
|
|
|
List<JobPO> jobList = getJobMapper().getJobsByPid(mergeParam.getId());
|
|
|
|
|
forbiddenChildTag(parentComp, parentDept, targetJob.getId(), jobList);
|
|
|
|
|
return updateCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加查询元素的父级元素
|
|
|
|
|
*
|
|
|
|
@ -588,4 +631,39 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
return generateCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取所有子部门id
|
|
|
|
|
*
|
|
|
|
|
* @param parentComp
|
|
|
|
|
* @param parentDept
|
|
|
|
|
* @param jobList
|
|
|
|
|
*/
|
|
|
|
|
void forbiddenChildTag(Long parentComp, Long parentDept, Long parentJob, List<JobPO> jobList) {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(jobList)) {
|
|
|
|
|
for (JobPO job : jobList) {
|
|
|
|
|
job.setParentComp(parentComp);
|
|
|
|
|
job.setParentDept(parentDept);
|
|
|
|
|
job.setParentJob(parentJob);
|
|
|
|
|
job.setForbiddenTag(1);
|
|
|
|
|
getJobMapper().updateBaseJob(job);
|
|
|
|
|
List<JobPO> childJobs = getJobMapper().getJobsByPid(job.getId());
|
|
|
|
|
forbiddenChildTag(parentComp, parentDept, job.getId(), childJobs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加子元素ID
|
|
|
|
|
*
|
|
|
|
|
* @param disableIds
|
|
|
|
|
* @param jobPOS
|
|
|
|
|
*/
|
|
|
|
|
private void addDisableIds(Set<Long> disableIds, List<JobPO> jobPOS) {
|
|
|
|
|
for (JobPO jobPO : jobPOS) {
|
|
|
|
|
disableIds.add(jobPO.getId());
|
|
|
|
|
List<JobPO> jobsByPid = getJobMapper().getJobsByPid(jobPO.getId());
|
|
|
|
|
addDisableIds(disableIds, jobsByPid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|