部门合并、组织导入

pull/234/MERGE^2
dxfeng 3 years ago
parent f6c41a3467
commit 5c66744468

@ -437,7 +437,7 @@
select
<include refid="baseColumns"/>
from jcl_field_extendinfo t
where t.delete_type = 0 and t.isenable = 1 and t.extend_type = #{extendType}
where t.delete_type = 0 and list_show = 1 and t.isenable = 1 and t.extend_type = #{extendType}
and t.field_name_desc = #{labelName}
</select>

@ -590,12 +590,17 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
new Thread(new DepartmentTriggerRunnable(departmentPO.getId())).start();
}
// 查询该部门一级岗位、更新岗位所属分部、所属部门
//List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId());
List<JobPO> firstChildJobList = getJobMapper().listJobsByDepartmentId(mergeParam.getId());
// 批量更新部门、所属分部
RecordSet rs = new RecordSet();
String targetEcDeptId = EcHrmRelationUtil.getEcDepartmentId(targetDepartment.getId().toString());
String mergeEcDeptId = EcHrmRelationUtil.getEcDepartmentId(mergeParam.getId().toString());
rs.executeUpdate("update jcl_org_job set parent_comp =?,ec_company =?,parent_dept =?,ec_department =? where parent_dept =?", targetDepartment.getParentComp(), targetDepartment.getEcCompany(), targetDepartment.getId(), targetEcDeptId, mergeParam.getId());
// 更新岗位组织架构图
for (JobPO jobPO : firstChildJobList) {
// 刷新组织架构图
new Thread(new JobTriggerRunnable(jobPO.getId())).start();
}
// 更新当前部门下的人员
List<Long> hrmResourceIds = getSystemDataMapper().getHrmResourceIdsByDept(mergeEcDeptId);
rs.executeUpdate("update hrmresource set SUBCOMPANYID1 =?,DEPARTMENTID =? where DEPARTMENTID =?", targetDepartment.getEcCompany(), targetEcDeptId, mergeEcDeptId);
@ -609,6 +614,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
forbiddenChildTag(targetDepartment.getParentComp(), Util.null2String(targetDepartment.getEcCompany()), deptList);
}
// 原部门删除
DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
Map<String, Object> map = new HashMap<>();
map.put("id", mergeParam.getId());
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
@ -617,7 +623,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_deptext_dt1", mergeParam.getId());
getDepartmentMapper().deleteByIds(DeleteParam.builder().ids(mergeParam.getId().toString()).build().getIds());
// 更新组织架构图
new Thread(new DepartmentTriggerRunnable(getDepartmentMapper().getDeptById(mergeParam.getId()))).start();
new Thread(new DepartmentTriggerRunnable(mergeDepartment)).start();
// 更新部门合并后名称
targetDepartment.setDeptName(mergeParam.getMergeName());
targetDepartment.setDeptNameShort(mergeParam.getMergeName());
@ -916,6 +922,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
if (CollectionUtils.isNotEmpty(jobPOS)) {
String ecCompanyId = EcHrmRelationUtil.getEcCompanyId(parentComp.toString());
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, ecCompanyId);
for (JobPO jobPO : jobPOS) {
// 刷新组织架构图
new Thread(new JobTriggerRunnable(jobPO.getId())).start();
}
}
}

@ -12,6 +12,7 @@ import com.engine.hrm.entity.FieldSelectOptionBean;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.SelectOptionParam;
import com.engine.organization.entity.commom.RecordInfo;
import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.fieldset.param.FieldTransferParam;
@ -104,11 +105,13 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
extendType = "1";
tableName = "JCL_ORG_COMP";
excludeFields.add("parent_company");
excludeFields.add("ec_company");
break;
case "department":
extendType = "2";
tableName = "JCL_ORG_DEPT";
excludeFields.add("parent_dept");
excludeFields.add("ec_department");
break;
case "jobtitle":
extendType = "3";
@ -154,15 +157,15 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
mergeList.addAll(customFieldList);
List<FieldTransferParam> fieldDatas = mergeList.stream().map(item -> FieldTransferParam.builder().id(item.getTableName() + +item.getFieldId()).name(item.getFieldLabel()).build()).collect(Collectors.toList());
List<String> selectedKeys = mergeList.stream().filter(item -> ("1".equals(item.getRequired()) || "workcode".equals(item.getFieldName()) || "subcompanyid1".equals(item.getFieldName()) || "departmentid".equals(item.getFieldName()))).map(item->item.getTableName()+item.getFieldId()).collect(Collectors.toList());
List<String> selectedKeys = mergeList.stream().filter(item -> ("1".equals(item.getRequired()) || "workcode".equals(item.getFieldName()) || "subcompanyid1".equals(item.getFieldName()) || "departmentid".equals(item.getFieldName()))).map(item -> item.getTableName() + item.getFieldId()).collect(Collectors.toList());
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
} else {
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, "", "1");
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.LIST.getValue(), "1");
List<ExtendInfoPO> filterList = infoPOList.stream().filter(item -> !excludeFields.contains(item.getFieldName()) && 6 != item.getControlType()).collect(Collectors.toList());
List<FieldTransferParam> fieldDatas = filterList.stream().map(item -> FieldTransferParam.builder().id(item.getId().toString()).name(item.getFieldNameDesc()).build()).collect(Collectors.toList());
List<Long> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(ExtendInfoPO::getId).collect(Collectors.toList());
List<String> selectedKeys = filterList.stream().filter(item -> (0 == item.getIsSystemDefault()) && 1 == item.getIsrequired()).map(item -> item.getId().toString()).collect(Collectors.toList());
returnMaps.put("data", fieldDatas);
returnMaps.put("selectedKeys", selectedKeys);
}
@ -332,7 +335,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
lsPromptLabel.add(522355);
lsPromptLabel.add(522356);
lsPromptLabel.add(522357);
lsPromptLabel.add(530411);
//lsPromptLabel.add(530411);
for (int i = 0; i < lsPromptLabel.size(); i++) {
Map<String, Object> item = new HashMap<>();
@ -394,7 +397,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
lsPromptLabel.add(522355);
lsPromptLabel.add(522356);
lsPromptLabel.add(522357);
lsPromptLabel.add(530411);
//lsPromptLabel.add(530411);
for (int i = 0; i < lsPromptLabel.size(); i++) {
Map<String, Object> item = new HashMap<>();
@ -629,6 +632,9 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
}
}
map.put("parent_company", parentCompanyId);
if (null != parentCompanyId) {
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString()));
}
companyName = split[split.length - 1];
map.put("comp_name", companyName);
}
@ -792,7 +798,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
}
map.put(infoPO.getFieldName(), reallyValue);
// 上级分部
if ("parent_comp".equals(infoPO.getFieldName())) {
if ("ec_company".equals(infoPO.getFieldName())) {
String[] split = cellValue.split(">");
if (split.length > 0) {
if (split.length > 8) {
@ -840,7 +846,11 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
}
}
map.put("parent_comp", parentCompanyId);
map.put("ec_company", EcHrmRelationUtil.getEcCompanyId(parentCompanyId.toString()));
map.put("parent_dept", parentDepartmentId);
if(null!=parentDepartmentId){
map.put("ec_department", EcHrmRelationUtil.getEcDepartmentId(parentCompanyId.toString()));
}
departmentName = split[split.length - 1];
map.put("dept_name", departmentName);
}

@ -420,7 +420,12 @@ public class JobServiceImpl extends Service implements JobService {
DepartmentPO jclDepartmentId = EcHrmRelationUtil.getJclDepartmentId(department);
if (null != jclDepartmentId) {
jobById.setParentDept(jclDepartmentId.getId());
//分部赋值
jobById.setEcCompany(jclDepartmentId.getEcCompany());
jobById.setParentComp(jclDepartmentId.getParentComp());
}
// 清空上级岗位
jobById.setParentJob(null);
jobById.setShowOrder(orderNum);
insertCount += getJobMapper().insertIgnoreNull(jobById);
// 更新组织架构图

@ -56,7 +56,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
//标准模板字段
private String tempField = "所属分部,部门," +
"编号,姓名,登录名,密码,安全级别,性别," +
"岗位,职务,职务类别,职称,职级," +
"岗位,职务,职务类别,职称," +
"职责描述,直接上级,助理,状态," +
"办公室,办公地点,办公电话,移动电话,其他电话," +
"传真,电子邮件,系统语言,出生日期,民族," +
@ -82,7 +82,7 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
//标准导入字段
private String voField = "subcompanyid1,departmentid," +
"workcode,lastname,loginid,password,seclevel,sex," +
"jobtitle,jobactivityid,jobgroupid,jobcall,joblevel," +
"jobtitle,jobactivityid,jobgroupid,jobcall," +
"jobactivitydesc,managerid,assistantid,status," +
"workroom,locationid,telephone,mobile,mobilecall," +
"fax,email,systemlanguage,birthday,folk," +

@ -232,7 +232,7 @@ public class HrmImportProcessE9 extends BaseBean {
Class<HrmResourceVo> voClass = HrmResourceVo.class;
String field = "id,subcompanyid1,departmentid,workcode,lastname,"
+ "loginid,password,seclevel,sex,jobtitle,jobcall,joblevel,"
+ "loginid,password,seclevel,sex,jobtitle,jobcall,"
+ "jobactivitydesc,managerid,assistantid,status,locationid,workroom,"
+ "telephone,mobile,mobilecall,fax,email,"
+ "systemlanguage,birthday,folk,nativeplace,regresidentplace,"
@ -634,12 +634,12 @@ public class HrmImportProcessE9 extends BaseBean {
}
//职级
if (isInteger(vo.getJoblevel())) {
int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
hrm.setJoblevel((short) joblevel);
} else {
hrm.setJoblevel((short) 0);
}
//if (isInteger(vo.getJoblevel())) {
// int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
// hrm.setJoblevel((short) joblevel);
//} else {
// hrm.setJoblevel((short) 0);
//}
//用工性质
if (vo.getUsekind() != null) {
int usekind = getUseKind(vo.getUsekind());
@ -1203,10 +1203,10 @@ public class HrmImportProcessE9 extends BaseBean {
}
//职级
if (isInteger(vo.getJoblevel())) {
int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
hrm.setJoblevel((short) joblevel);
}
//if (isInteger(vo.getJoblevel())) {
// int joblevel = vo.getJoblevel().equals("") ? 0 : Integer.parseInt(vo.getJoblevel());
// hrm.setJoblevel((short) joblevel);
//}
//用工性质
if (vo.getUsekind() != null) {

Loading…
Cancel
Save