@ -21,7 +21,6 @@ import com.engine.organization.entity.department.bo.DepartmentBO;
import com.engine.organization.entity.department.po.DepartmentPO ;
import com.engine.organization.entity.department.po.DepartmentPO ;
import com.engine.organization.entity.employee.vo.EmployeeTableVO ;
import com.engine.organization.entity.employee.vo.EmployeeTableVO ;
import com.engine.organization.entity.extend.po.ExtendTitlePO ;
import com.engine.organization.entity.extend.po.ExtendTitlePO ;
import com.engine.organization.entity.hrmresource.po.HrmResourcePO ;
import com.engine.organization.entity.job.bo.JobBO ;
import com.engine.organization.entity.job.bo.JobBO ;
import com.engine.organization.entity.job.dto.JobListDTO ;
import com.engine.organization.entity.job.dto.JobListDTO ;
import com.engine.organization.entity.job.param.JobMergeParam ;
import com.engine.organization.entity.job.param.JobMergeParam ;
@ -32,6 +31,7 @@ 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.LogModuleNameEnum ;
import com.engine.organization.enums.OperateTypeEnum ;
import com.engine.organization.enums.OperateTypeEnum ;
import com.engine.organization.exception.OrganizationRunTimeException ;
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 ;
@ -44,8 +44,6 @@ import com.engine.organization.mapper.resource.ResourceMapper;
import com.engine.organization.mapper.scheme.GradeMapper ;
import com.engine.organization.mapper.scheme.GradeMapper ;
import com.engine.organization.service.ExtService ;
import com.engine.organization.service.ExtService ;
import com.engine.organization.service.JobService ;
import com.engine.organization.service.JobService ;
import com.engine.organization.thread.HrmResourceTriggerRunnable ;
import com.engine.organization.thread.JobTriggerRunnable ;
import com.engine.organization.thread.OrganizationSyncEc ;
import com.engine.organization.thread.OrganizationSyncEc ;
import com.engine.organization.util.* ;
import com.engine.organization.util.* ;
import com.engine.organization.util.coderule.CodeRuleUtil ;
import com.engine.organization.util.coderule.CodeRuleUtil ;
@ -57,7 +55,6 @@ import com.engine.organization.util.page.PageUtil;
import com.engine.organization.util.tree.SearchTreeUtil ;
import com.engine.organization.util.tree.SearchTreeUtil ;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.lang.StringUtils ;
import org.apache.commons.lang.StringUtils ;
import weaver.conn.RecordSet ;
import weaver.general.StringUtil ;
import weaver.general.StringUtil ;
import weaver.general.Util ;
import weaver.general.Util ;
import weaver.hrm.User ;
import weaver.hrm.User ;
@ -203,7 +200,16 @@ public class JobServiceImpl extends Service implements JobService {
@Override
@Override
public Map < String , List < MenuBtn > > getHasRight ( ) {
public Map < String , List < MenuBtn > > getHasRight ( ) {
return MenuBtn . getDatasNoBtnColum ( ) ;
Map < String , List < MenuBtn > > btnDatas = new HashMap < > ( ) ;
ArrayList < MenuBtn > topMenuList = new ArrayList < > ( ) ;
ArrayList < MenuBtn > rightMenuList = new ArrayList < > ( ) ;
// 批量删除
topMenuList . add ( MenuBtn . topMenu_batchDelete ( ) ) ;
btnDatas . put ( "topMenu" , topMenuList ) ;
// 日志
rightMenuList . add ( MenuBtn . rightMenu_btnLog ( ) ) ;
btnDatas . put ( "rightMenu" , rightMenuList ) ;
return btnDatas ;
}
}
@Override
@Override
@ -214,23 +220,11 @@ public class JobServiceImpl extends Service implements JobService {
// 编号
// 编号
SearchConditionItem jobNoItem = OrganizationFormItemUtil . inputItem ( user , 2 , 16 , 2 , 50 , "编号" , "jobNo" ) ;
SearchConditionItem jobNoItem = OrganizationFormItemUtil . inputItem ( user , 2 , 16 , 2 , 50 , "编号" , "jobNo" ) ;
// 名称
// 名称
SearchConditionItem job NameItem = OrganizationFormItemUtil . inputItem ( user , 2 , 16 , 2 , 50 , "名称" , "job Name") ;
SearchConditionItem job Title NameItem = OrganizationFormItemUtil . inputItem ( user , 2 , 16 , 2 , 50 , "名称" , "job Title Name") ;
// 所属分部
// 所属分部
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "所属分部" , "164" , "ecCompany" , "" ) ;
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "所属分部" , "164" , "ecCompany" , "" ) ;
// 所属部门
// 所属部门
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "所属部门" , "4" , "ecDepartment" , "" ) ;
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "所属部门" , "4" , "ecDepartment" , "" ) ;
// 岗位序列
SearchConditionItem sequenceBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "岗位序列" , "161" , "sequenceId" , "sequenceBrowser" ) ;
// 等级方案
SearchConditionItem schemeBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "等级方案" , "161" , "schemeId" , "schemeBrowser" ) ;
// 上级岗位
SearchConditionItem parentJobBrowserItem = OrganizationFormItemUtil . browserItem ( user , 2 , 16 , 2 , false , "上级岗位" , "666" , "parentJob" , "" ) ;
BrowserBean browserBean = parentJobBrowserItem . getBrowserConditionParam ( ) ;
String s = JSONObject . toJSONString ( browserBean ) ;
CustomBrowserBean customBrowserBean = JSONObject . parseObject ( s , CustomBrowserBean . class ) ;
customBrowserBean . setHasLeftTree ( true ) ;
customBrowserBean . setLeftToSearchKey ( "treeKey" ) ;
parentJobBrowserItem . setBrowserConditionParam ( customBrowserBean ) ;
// 是否关键岗
// 是否关键岗
List < SearchConditionOption > isKeyOptions = new ArrayList < > ( ) ;
List < SearchConditionOption > isKeyOptions = new ArrayList < > ( ) ;
SearchConditionOption yesOption = new SearchConditionOption ( "0" , "否" ) ;
SearchConditionOption yesOption = new SearchConditionOption ( "0" , "否" ) ;
@ -249,12 +243,9 @@ public class JobServiceImpl extends Service implements JobService {
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil . selectItem ( user , selectOptions , 2 , 16 , 6 , false , "禁用标记" , "forbiddenTag" ) ;
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil . selectItem ( user , selectOptions , 2 , 16 , 6 , false , "禁用标记" , "forbiddenTag" ) ;
conditionItems . add ( jobNoItem ) ;
conditionItems . add ( jobNoItem ) ;
conditionItems . add ( job NameItem) ;
conditionItems . add ( job Title NameItem) ;
conditionItems . add ( parentCompBrowserItem ) ;
conditionItems . add ( parentCompBrowserItem ) ;
conditionItems . add ( parentDeptBrowserItem ) ;
conditionItems . add ( parentDeptBrowserItem ) ;
conditionItems . add ( sequenceBrowserItem ) ;
conditionItems . add ( schemeBrowserItem ) ;
conditionItems . add ( parentJobBrowserItem ) ;
conditionItems . add ( isKeyItem ) ;
conditionItems . add ( isKeyItem ) ;
conditionItems . add ( workplaceItem ) ;
conditionItems . add ( workplaceItem ) ;
conditionItems . add ( forbiddenTagItem ) ;
conditionItems . add ( forbiddenTagItem ) ;
@ -321,7 +312,7 @@ public class JobServiceImpl extends Service implements JobService {
List < ExtendTitlePO > extendTitles = getExtendTitleMapper ( ) . getTitlesByGroupID ( Long . parseLong ( groupId ) , "1" ) ;
List < ExtendTitlePO > extendTitles = getExtendTitleMapper ( ) . getTitlesByGroupID ( Long . parseLong ( groupId ) , "1" ) ;
if ( CollectionUtils . isNotEmpty ( extendTitles ) ) {
if ( CollectionUtils . isNotEmpty ( extendTitles ) ) {
for ( ExtendTitlePO extendTitle : extendTitles ) {
for ( ExtendTitlePO extendTitle : extendTitles ) {
List < SearchConditionItem > items = getExtService ( user ) . getExtForm ( user , EXTEND_TYPE + "" , GROUP_ID . equals ( Long . parseLong ( groupId ) ) ? JCL_ORG_JOB : JCL_ORG_JOBEXT , viewAttr , id , extendTitle . getId ( ) . toString ( ) , " scheme_id", "parent_comp ") ;
List < SearchConditionItem > items = getExtService ( user ) . getExtForm ( user , EXTEND_TYPE + "" , GROUP_ID . equals ( Long . parseLong ( groupId ) ) ? JCL_ORG_JOB : JCL_ORG_JOBEXT , viewAttr , id , extendTitle . getId ( ) . toString ( ) , " ec_jobTitle", "ec_department" , "ec_company ") ;
if ( CollectionUtils . isNotEmpty ( items ) ) {
if ( CollectionUtils . isNotEmpty ( items ) ) {
addGroups . add ( new SearchConditionGroup ( extendTitle . getTitle ( ) , true , items ) ) ;
addGroups . add ( new SearchConditionGroup ( extendTitle . getTitle ( ) , true , items ) ) ;
}
}
@ -357,7 +348,6 @@ public class JobServiceImpl extends Service implements JobService {
public Long saveBaseForm ( Map < String , Object > params ) {
public Long saveBaseForm ( Map < String , Object > params ) {
HasRightUtil . hasRight ( user , RIGHT_NAME , false ) ;
HasRightUtil . hasRight ( user , RIGHT_NAME , false ) ;
JobSearchParam searchParam = JSONObject . parseObject ( JSONObject . toJSONString ( params ) , JobSearchParam . class ) ;
JobSearchParam searchParam = JSONObject . parseObject ( JSONObject . toJSONString ( params ) , JobSearchParam . class ) ;
assertNameRepeat ( null , searchParam . getEcDepartment ( ) , searchParam . getParentJob ( ) , searchParam . getJobName ( ) ) ;
String jobNo = ( String ) params . get ( "job_no" ) ;
String jobNo = ( String ) params . get ( "job_no" ) ;
// 判断是否开启自动编号
// 判断是否开启自动编号
jobNo = repeatDetermine ( jobNo ) ;
jobNo = repeatDetermine ( jobNo ) ;
@ -365,18 +355,13 @@ public class JobServiceImpl extends Service implements JobService {
params . put ( "is_key" , null = = searchParam . getIsKey ( ) ? 0 : searchParam . getIsKey ( ) ) ;
params . put ( "is_key" , null = = searchParam . getIsKey ( ) ? 0 : searchParam . getIsKey ( ) ) ;
if ( null ! = searchParam . getParentJob ( ) ) {
if ( null ! = searchParam . getParentJob ( ) ) {
JobPO parentJob = getJobMapper ( ) . getJobById ( searchParam . getParentJob ( ) ) ;
JobPO parentJob = getJobMapper ( ) . getJobById ( searchParam . getParentJob ( ) ) ;
params . put ( "parent_dept" , parentJob . getParentDept ( ) ) ;
params . put ( "parent_comp" , parentJob . getParentComp ( ) ) ;
params . put ( "ec_company" , parentJob . getEcCompany ( ) ) ;
params . put ( "ec_company" , parentJob . getEcCompany ( ) ) ;
params . put ( "ec_department" , parentJob . getEcDepartment ( ) ) ;
params . put ( "ec_department" , parentJob . getEcDepartment ( ) ) ;
} else {
} else {
Integer ecDepartment = searchParam . getEcDepartment ( ) ;
Integer ecDepartment = searchParam . getEcDepartment ( ) ;
DepartmentPO jclDepartment = getDepartmentMapper ( ) . getDeptById ( ecDepartment ) ;
DepartmentPO jclDepartment = getDepartmentMapper ( ) . getDeptById ( ecDepartment ) ;
params . put ( "parent_dept" , jclDepartment . getId ( ) ) ;
params . put ( "ec_company" , jclDepartment . getId ( ) ) ;
params . put ( "parent_comp" , jclDepartment . getSubCompanyId1 ( ) ) ;
params . put ( "ec_department" , jclDepartment . getSubCompanyId1 ( ) ) ;
if ( null ! = jclDepartment . getSubCompanyId1 ( ) ) {
params . put ( "ec_company" , jclDepartment . getSubCompanyId1 ( ) ) ;
}
}
}
if ( StringUtils . isBlank ( params . get ( "show_order" ) . toString ( ) ) ) {
if ( StringUtils . isBlank ( params . get ( "show_order" ) . toString ( ) ) ) {
@ -395,7 +380,6 @@ public class JobServiceImpl extends Service implements JobService {
public Long updateForm ( Map < String , Object > params ) {
public Long updateForm ( Map < String , Object > params ) {
HasRightUtil . hasRight ( user , RIGHT_NAME , false ) ;
HasRightUtil . hasRight ( user , RIGHT_NAME , false ) ;
JobSearchParam searchParam = JSONObject . parseObject ( JSONObject . toJSONString ( params ) , JobSearchParam . class ) ;
JobSearchParam searchParam = JSONObject . parseObject ( JSONObject . toJSONString ( params ) , JobSearchParam . class ) ;
assertNameRepeat ( searchParam . getId ( ) , searchParam . getEcDepartment ( ) , searchParam . getParentJob ( ) , searchParam . getJobName ( ) ) ;
String groupId = ( String ) params . get ( "viewCondition" ) ;
String groupId = ( String ) params . get ( "viewCondition" ) ;
searchParam . setIsKey ( null = = searchParam . getIsKey ( ) ? 0 : searchParam . getIsKey ( ) ) ;
searchParam . setIsKey ( null = = searchParam . getIsKey ( ) ? 0 : searchParam . getIsKey ( ) ) ;
// 上级岗位不能选择本身
// 上级岗位不能选择本身
@ -416,27 +400,22 @@ public class JobServiceImpl extends Service implements JobService {
params . put ( "is_key" , searchParam . getIsKey ( ) ) ;
params . put ( "is_key" , searchParam . getIsKey ( ) ) ;
if ( null ! = searchParam . getParentJob ( ) ) {
if ( null ! = searchParam . getParentJob ( ) ) {
JobPO parentJob = getJobMapper ( ) . getJobById ( searchParam . getParentJob ( ) ) ;
JobPO parentJob = getJobMapper ( ) . getJobById ( searchParam . getParentJob ( ) ) ;
params . put ( "parent_dept" , parentJob . getParentDept ( ) ) ;
params . put ( "parent_comp" , parentJob . getParentComp ( ) ) ;
params . put ( "ec_company" , parentJob . getEcCompany ( ) ) ;
params . put ( "ec_company" , parentJob . getEcCompany ( ) ) ;
params . put ( "ec_department" , parentJob . getEcDepartment ( ) ) ;
params . put ( "ec_department" , parentJob . getEcDepartment ( ) ) ;
} else {
} else {
Integer ecDepartment = searchParam . getEcDepartment ( ) ;
Integer ecDepartment = searchParam . getEcDepartment ( ) ;
DepartmentPO jclDepartment = getDepartmentMapper ( ) . getDeptById ( ecDepartment ) ;
DepartmentPO jclDepartment = getDepartmentMapper ( ) . getDeptById ( ecDepartment ) ;
params . put ( "parent_dept" , jclDepartment . getId ( ) ) ;
params . put ( "ec_department" , jclDepartment . getId ( ) ) ;
params . put ( "parent_comp" , jclDepartment . getSubCompanyId1 ( ) ) ;
if ( null ! = jclDepartment . getSubCompanyId1 ( ) ) {
params . put ( "ec_company" , jclDepartment . getSubCompanyId1 ( ) ) ;
params . put ( "ec_company" , jclDepartment . getSubCompanyId1 ( ) ) ;
}
}
}
params . put ( "jobactivityid" , JOB_ACTIVITY_ID ) ;
params . put ( "jobactivityid" , JOB_ACTIVITY_ID ) ;
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . UPDATE , params , oldJobPO ) . sync ( ) ;
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . UPDATE , params , oldJobPO ) . sync ( ) ;
getExtService ( user ) . updateExtForm ( user , EXTEND_TYPE , JCL_ORG_JOB , params , "" , searchParam . getId ( ) ) ;
getExtService ( user ) . updateExtForm ( user , EXTEND_TYPE , JCL_ORG_JOB , params , "" , searchParam . getId ( ) ) ;
JobPO jobById = getJobMapper ( ) . getJobById ( searchParam . getId ( ) ) ;
JobPO jobById = getJobMapper ( ) . getJobById ( searchParam . getId ( ) ) ;
new JobTriggerRunnable ( oldJobPO , jobById ) . run ( ) ;
//TODO new JobTriggerRunnable(oldJobPO, jobById).run();
// 更新人员关联字段
// 更新人员关联字段
updateResourceJob ( jobById ) ;
// updateResourceJob(jobById);
}
}
// 更新主表拓展表
// 更新主表拓展表
getExtService ( user ) . updateExtForm ( user , EXTEND_TYPE , JCL_ORG_JOBEXT , params , "" , searchParam . getId ( ) ) ;
getExtService ( user ) . updateExtForm ( user , EXTEND_TYPE , JCL_ORG_JOBEXT , params , "" , searchParam . getId ( ) ) ;
@ -463,18 +442,15 @@ public class JobServiceImpl extends Service implements JobService {
jobById . setEcDepartment ( Integer . parseInt ( department ) ) ;
jobById . setEcDepartment ( Integer . parseInt ( department ) ) ;
DepartmentPO jclDepartmentId = getDepartmentMapper ( ) . getDeptById ( jobById . getEcDepartment ( ) ) ;
DepartmentPO jclDepartmentId = getDepartmentMapper ( ) . getDeptById ( jobById . getEcDepartment ( ) ) ;
if ( null ! = jclDepartmentId ) {
if ( null ! = jclDepartmentId ) {
jobById . setParentDept ( jclDepartmentId . getId ( ) ) ;
//分部赋值
//分部赋值
jobById . setEcCompany ( jclDepartmentId . getSubCompanyId1 ( ) ) ;
jobById . setEcCompany ( jclDepartmentId . getSubCompanyId1 ( ) ) ;
jobById . setParentComp ( jclDepartmentId . getSubCompanyId1 ( ) ) ;
}
}
// 清空上级岗位
// 清空上级岗位
jobById . setParentJob ( null ) ;
jobById . setParentJob ( null ) ;
jobById . setShowOrder ( orderNum ) ;
jobById . setShowOrder ( orderNum ) ;
assertNameRepeat ( null , jobById . getEcDepartment ( ) , jobById . getParentJob ( ) , jobById . getJobName ( ) ) ;
insertCount + = getJobMapper ( ) . insertIgnoreNull ( jobById ) ;
insertCount + = getJobMapper ( ) . insertIgnoreNull ( jobById ) ;
// 更新组织架构图
// 更新组织架构图
new JobTriggerRunnable ( jobById . getId ( ) ) . run ( ) ;
//TODO new JobTriggerRunnable(jobById.getId()).run();
}
}
return insertCount ;
return insertCount ;
@ -484,10 +460,10 @@ public class JobServiceImpl extends Service implements JobService {
public int updateForbiddenTagById ( JobSearchParam params ) {
public int updateForbiddenTagById ( JobSearchParam params ) {
HasRightUtil . hasRight ( user , RIGHT_NAME , false ) ;
HasRightUtil . hasRight ( user , RIGHT_NAME , false ) ;
JobPO jobById = getJobMapper ( ) . getJobById ( params . getId ( ) ) ;
JobPO jobById = getJobMapper ( ) . getJobById ( params . getId ( ) ) ;
JobPO jobPO = JobPO . builder ( ) . id ( params . getId ( ) ) . forbiddenTag ( params . getForbiddenTag ( ) ? 0 : 1 ) . jobName( jobById . getJobName ( ) ) . build( ) ;
JobPO jobPO = JobPO . builder ( ) . id ( params . getId ( ) ) . forbiddenTag ( params . getForbiddenTag ( ) ? 0 : 1 ) . build( ) ;
if ( params . getForbiddenTag ( ) ) {
if ( params . getForbiddenTag ( ) ) {
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
// 启用:判断上级部门是否启用,上级部门启用,岗位才可启用
DepartmentPO parentDepartment = getDepartmentMapper ( ) . getDeptById ( jobById . get ParentDep t( ) ) ;
DepartmentPO parentDepartment = getDepartmentMapper ( ) . getDeptById ( jobById . get EcDepartmen t( ) ) ;
OrganizationAssert . isTrue ( 0 = = parentDepartment . getCanceled ( ) , "该岗位不能解封,请先解封上级部门" ) ;
OrganizationAssert . isTrue ( 0 = = parentDepartment . getCanceled ( ) , "该岗位不能解封,请先解封上级部门" ) ;
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
// 启用:判断上级岗位是否启用,上级岗位启用,岗位才可启用
@ -497,8 +473,9 @@ public class JobServiceImpl extends Service implements JobService {
}
}
} else {
} else {
//禁用:判断当前岗位下是否有人员,如有人员则不能禁用
//禁用:判断当前岗位下是否有人员,如有人员则不能禁用
int hasResource = getJobMapper ( ) . isHasResource ( params . getId ( ) ) ;
// int hasResource = getJobMapper().isHasResource(params.getId());
OrganizationAssert . isTrue ( hasResource = = 0 , "该岗位存在人员,不能封存" ) ;
// OrganizationAssert.isTrue(hasResource == 0, "该岗位存在人员,不能封存");
throw new OrganizationRunTimeException ( "该岗位不能封存" ) ;
}
}
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . CANCELED , null , jobPO ) . sync ( ) ;
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . CANCELED , null , jobPO ) . sync ( ) ;
return getJobMapper ( ) . updateForbiddenTagById ( jobPO . getId ( ) , jobPO . getForbiddenTag ( ) ) ;
return getJobMapper ( ) . updateForbiddenTagById ( jobPO . getId ( ) , jobPO . getForbiddenTag ( ) ) ;
@ -522,7 +499,8 @@ public class JobServiceImpl extends Service implements JobService {
@Override
@Override
public Map < String , Object > getHrmListByJobId ( Long jobId ) {
public Map < String , Object > getHrmListByJobId ( Long jobId ) {
OrganizationWeaTable < EmployeeTableVO > table = new OrganizationWeaTable < > ( user , EmployeeTableVO . class ) ;
OrganizationWeaTable < EmployeeTableVO > table = new OrganizationWeaTable < > ( user , EmployeeTableVO . class ) ;
table . setSqlwhere ( " where job_title = '" + jobId + "' and status<4" ) ;
// TODO BUG修复
table . setSqlwhere ( " where jobtitle = '" + jobId + "' and status<4" ) ;
WeaResultMsg result = new WeaResultMsg ( false ) ;
WeaResultMsg result = new WeaResultMsg ( false ) ;
result . putAll ( table . makeDataResult ( ) ) ;
result . putAll ( table . makeDataResult ( ) ) ;
result . success ( ) ;
result . success ( ) ;
@ -543,11 +521,6 @@ public class JobServiceImpl extends Service implements JobService {
deptBrowserItem . setBrowserConditionParam ( customBrowserBean ) ;
deptBrowserItem . setBrowserConditionParam ( customBrowserBean ) ;
SearchConditionItem mergeNameItem = OrganizationFormItemUtil . inputItem ( user , 2 , 16 , 3 , 50 , "合并后名称" , "mergeName" ) ;
SearchConditionItem mergeNameItem = OrganizationFormItemUtil . inputItem ( user , 2 , 16 , 3 , 50 , "合并后名称" , "mergeName" ) ;
mergeNameItem . setRules ( "required|string" ) ;
mergeNameItem . setRules ( "required|string" ) ;
JobPO jobById = getJobMapper ( ) . getJobById ( id ) ;
if ( null ! = jobById ) {
String jobName = jobById . getJobName ( ) ;
mergeNameItem . setValue ( jobName ) ;
}
condition . add ( deptBrowserItem ) ;
condition . add ( deptBrowserItem ) ;
condition . add ( mergeNameItem ) ;
condition . add ( mergeNameItem ) ;
addGroups . add ( new SearchConditionGroup ( "" , true , condition ) ) ;
addGroups . add ( new SearchConditionGroup ( "" , true , condition ) ) ;
@ -576,45 +549,42 @@ public class JobServiceImpl extends Service implements JobService {
// 待合并的部门
// 待合并的部门
JobPO jobById = getJobMapper ( ) . getJobById ( mergeParam . getId ( ) ) ;
JobPO jobById = getJobMapper ( ) . getJobById ( mergeParam . getId ( ) ) ;
assertNameRepeat ( targetJob . getId ( ) , targetJob . getEcDepartment ( ) , targetJob . getParentJob ( ) , mergeParam . getMergeName ( ) ) ;
// 递归处理子岗位所属分部、所部部门、上级岗位
// 递归处理子岗位所属分部、所部部门、上级岗位
recursionMergeJob ( jobs , targetJob . get ParentComp( ) , targetJob . get EcCompany( ) , targetJob . getParentDept ( ) , targetJob . getEcDepartment ( ) , targetJob . getId ( ) ) ;
recursionMergeJob ( jobs , targetJob . get EcCompany( ) , targetJob . getEcDepartment ( ) , targetJob . getId ( ) ) ;
// 人员信息变动,更新分部、部门、岗位
// 人员信息变动,更新分部、部门、岗位
updateResourceJob ( jobById , targetJob ) ;
// updateResourceJob(jobById, targetJob);
// 更新合并后的岗位,更新组织架构图
// 更新合并后的岗位,更新组织架构图
updateEcJob ( targetJob , mergeParam . getMergeName ( ) ) ;
// updateEcJob(targetJob, mergeParam.getMergeName());
targetJob . setJobName ( mergeParam . getMergeName ( ) ) ;
// TODO targetJob.setJobName(mergeParam.getMergeName());
getJobMapper ( ) . updateBaseJob ( targetJob ) ;
getJobMapper ( ) . updateBaseJob ( targetJob ) ;
new JobTriggerRunnable ( jobById . getId ( ) , targetJob . getId ( ) ) . run ( ) ;
//TODO new JobTriggerRunnable(jobById.getId(), targetJob.getId()).run();
// 原岗位删除
// 原岗位删除
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . CANCELED , null , jobById ) . sync ( ) ;
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . CANCELED , null , jobById ) . sync ( ) ;
getJobMapper ( ) . deleteByIds ( Collections . singletonList ( jobById . getId ( ) ) ) ;
getJobMapper ( ) . deleteByIds ( Collections . singletonList ( jobById . getId ( ) ) ) ;
// 更新组织架构图
// 更新组织架构图
new JobTriggerRunnable ( jobById ) . run ( ) ;
//TODO new JobTriggerRunnable(jobById).run();
return updateCount ;
return updateCount ;
}
}
void recursionMergeJob ( List < JobPO > jobs , Integer parentCompany, Integer ecCompany, Integer parentDepartment , Integer ecDepartment , Long parentJob ) {
void recursionMergeJob ( List < JobPO > jobs , Integer ecCompany, Integer ecDepartment , Long parentJob ) {
for ( JobPO job : jobs ) {
for ( JobPO job : jobs ) {
job . setParentComp ( parentCompany ) ;
job . setEcCompany ( ecCompany ) ;
job . setEcCompany ( ecCompany ) ;
job . setParentDept ( parentDepartment ) ;
job . setEcDepartment ( ecDepartment ) ;
job . setEcDepartment ( ecDepartment ) ;
job . setParentJob ( parentJob ) ;
job . setParentJob ( parentJob ) ;
getJobMapper ( ) . updateBaseJob ( job ) ;
getJobMapper ( ) . updateBaseJob ( job ) ;
// 更新人员信息
// 更新人员信息
updateResourceJob ( job ) ;
// updateResourceJob(job);
// 更新组织架构图
// 更新组织架构图
new JobTriggerRunnable ( job . getId ( ) ) . run ( ) ;
//TODO new JobTriggerRunnable(job.getId()).run();
// 递归处理子级元素
// 递归处理子级元素
List < JobPO > jobsByPid = getJobMapper ( ) . getJobsByPid ( job . getId ( ) ) ;
List < JobPO > jobsByPid = getJobMapper ( ) . getJobsByPid ( job . getId ( ) ) ;
recursionMergeJob ( jobsByPid , parentCompany, ecCompany, parentDepartment , ecDepartment , parentJob ) ;
recursionMergeJob ( jobsByPid , ecCompany, ecDepartment , parentJob ) ;
}
}
}
}
@ -724,13 +694,11 @@ public class JobServiceImpl extends Service implements JobService {
* /
* /
private boolean isFilter ( JobPO jobPO ) {
private boolean isFilter ( JobPO jobPO ) {
return ! ( StringUtil . isEmpty ( jobPO . getJobNo ( ) )
return ! ( StringUtil . isEmpty ( jobPO . getJobNo ( ) )
& & StringUtil . isEmpty ( jobPO . getJob Name( ) )
& & StringUtil . isEmpty ( jobPO . getJob Title Name( ) )
& & StringUtil . isEmpty ( jobPO . getWorkplace ( ) )
& & StringUtil . isEmpty ( jobPO . getWorkplace ( ) )
& & StringUtil . isEmpty ( jobPO . getDescription ( ) )
& & StringUtil . isEmpty ( jobPO . getDescription ( ) )
& & StringUtil . isEmpty ( jobPO . getWorkDuty ( ) )
& & StringUtil . isEmpty ( jobPO . getWorkDuty ( ) )
& & StringUtil . isEmpty ( jobPO . getWorkAuthority ( ) )
& & StringUtil . isEmpty ( jobPO . getWorkAuthority ( ) )
& & null = = jobPO . getParentComp ( )
& & null = = jobPO . getParentDept ( )
& & null = = jobPO . getParentJob ( )
& & null = = jobPO . getParentJob ( )
& & null = = jobPO . getSequenceId ( )
& & null = = jobPO . getSequenceId ( )
& & null = = jobPO . getSchemeId ( )
& & null = = jobPO . getSchemeId ( )
@ -738,6 +706,7 @@ public class JobServiceImpl extends Service implements JobService {
& & null = = jobPO . getForbiddenTag ( )
& & null = = jobPO . getForbiddenTag ( )
& & null = = jobPO . getEcCompany ( )
& & null = = jobPO . getEcCompany ( )
& & null = = jobPO . getEcDepartment ( )
& & null = = jobPO . getEcDepartment ( )
& & null = = jobPO . getEcJobTitle ( )
) ;
) ;
}
}
@ -787,95 +756,19 @@ public class JobServiceImpl extends Service implements JobService {
}
}
}
}
/ * *
///**
* 更 新 EC 岗 位
// * 更新EC岗位
*
// *
* @param jobPO
// * @param jobPO
* /
// */
private void updateEcJob ( JobPO jobPO , String newName ) {
//private void updateEcJob(JobPO jobPO, String newName) {
Map < String , Object > params = new HashMap < > ( ) ;
// Map<String, Object> params = new HashMap<>();
params . put ( "job_name" , newName ) ;
// params.put("job_name", newName);
params . put ( "jobactivityid" , JOB_ACTIVITY_ID ) ;
// params.put("jobactivityid", JOB_ACTIVITY_ID);
params . put ( "work_duty" , jobPO . getWorkDuty ( ) ) ;
// params.put("work_duty", jobPO.getWorkDuty());
params . put ( "work_authority" , jobPO . getWorkAuthority ( ) ) ;
// params.put("work_authority", jobPO.getWorkAuthority());
params . put ( "description" , jobPO . getDescription ( ) ) ;
// params.put("description", jobPO.getDescription());
params . put ( "job_no" , jobPO . getJobNo ( ) ) ;
// params.put("job_no", jobPO.getJobNo());
new OrganizationSyncEc ( user , LogModuleNameEnum . JOB , OperateTypeEnum . UPDATE , params , jobPO ) . sync ( ) ;
// new OrganizationSyncEc(user, LogModuleNameEnum.JOB, OperateTypeEnum.UPDATE, params, jobPO).sync();
}
//}
/ * *
* 判 断 相 同 层 级 下 有 无 同 名 岗 位
* /
public static void assertNameRepeat ( Long jobId , Integer departmentId , Long parentJobId , String jobName ) {
assertNameRepeat ( jobId , departmentId , parentJobId , jobName , true ) ;
}
/ * *
* 判 断 相 同 层 级 下 有 无 同 名 岗 位
* /
public static boolean assertNameRepeat ( String jobId , String departmentId , String parentJobId , String jobName ) {
return assertNameRepeat ( StringUtils . isBlank ( jobId ) ? null : Long . parseLong ( jobId ) , StringUtils . isBlank ( departmentId ) ? null : Integer . parseInt ( departmentId ) , StringUtils . isBlank ( parentJobId ) ? null : Long . parseLong ( parentJobId ) , jobName , false ) ;
}
/ * *
* 判 断 相 同 层 级 下 有 无 同 名 岗 位
*
* @param jobId
* @param departmentId
* @param parentJobId
* @param jobName
* @param throwException
* @return
* /
public static boolean assertNameRepeat ( Long jobId , Integer departmentId , Long parentJobId , String jobName , boolean throwException ) {
int count ;
// 有上级岗位、判断相同层级下有无相同名称岗位
if ( null ! = jobId ) {
count = getJobMapper ( ) . countRepeatNameByPid ( jobName , jobId , parentJobId , departmentId ) ;
} else {
// 无上级岗位,判断当前部门下,有无同名岗位
count = getJobMapper ( ) . countRepeatNameByPid ( jobName , jobId , null , departmentId ) ;
}
if ( throwException ) {
OrganizationAssert . isTrue ( count = = 0 , "岗位名称已存在" ) ;
}
return count = = 0 ;
}
/ * *
* 更 新 人 员 岗 位 信 息
*
* @param originalJob
* @param targetJob
* /
private void updateResourceJob ( JobPO originalJob , JobPO targetJob ) {
// 更新岗位下的人员
Long originalJobId = originalJob . getId ( ) ;
Long targetJobId = targetJob . getId ( ) ;
Integer parentComp = targetJob . getParentComp ( ) ;
Integer parentDept = targetJob . getParentDept ( ) ;
Integer ecCompany = targetJob . getEcCompany ( ) ;
Integer ecDepartment = targetJob . getEcDepartment ( ) ;
List < HrmResourcePO > resourceList = getResourceMapper ( ) . getResourceListByJobId ( originalJobId ) ;
getResourceMapper ( ) . updateResourceJob ( originalJobId , targetJobId , parentComp , parentDept , ecCompany , ecDepartment ) ;
// 更新Ec人员分部、部门、岗位
for ( HrmResourcePO hrmResourcePO : resourceList ) {
new RecordSet ( ) . executeUpdate ( "UPDATE HRMRESOURCE SET SUBCOMPANYID1 = ? , DEPARTMENTID = ? WHERE UUID =? " , ecCompany , ecDepartment , hrmResourcePO . getUuid ( ) ) ;
// 更新人员Map表信息
new HrmResourceTriggerRunnable ( hrmResourcePO . getId ( ) ) . run ( ) ;
}
}
/ * *
* 更 新 人 员 岗 位 信 息
*
* @param job
* /
private void updateResourceJob ( JobPO job ) {
updateResourceJob ( job , job ) ;
}
}
}