更新字段

This commit is contained in:
liuliang 2025-07-16 11:41:53 +08:00
parent ef63d1dab5
commit 564c03c19c
1 changed files with 129 additions and 61 deletions

View File

@ -186,16 +186,31 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
@Override
public List<String> synchronousField(SimpleEmployee employee) {
Map<String, String> uf_jcl_employee_information_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_INFORMATION);
String uf_jcl_employee_information = uf_jcl_employee_information_Info.get("table_name");
Map<String, String> uf_jcl_employee_xxbgsq_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_XXBGSQ);
String uf_jcl_employee_xxbgsq = uf_jcl_employee_xxbgsq_Info.get("table_name");
Map<String, String> uf_jcl_rzgl_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.UF_JCL_RZGL);
String uf_jcl_rzgl = uf_jcl_rzgl_Info.get("table_name");
log.error("uf_jcl_employee_information : [{}]",uf_jcl_employee_information);
log.error("uf_jcl_employee_xxbgsq : [{}]",uf_jcl_employee_xxbgsq);
log.error("uf_jcl_rzgl : [{}]",uf_jcl_rzgl);
List<String> paramList = Lists.newArrayList();
paramList.add("'"+Constants.EMPLOYEE_INFORMATION+"'");
paramList.add("'"+Constants.EMPLOYEE_XXBGSQ+"'");
paramList.add("'"+Constants.UF_JCL_RZGL+"'");
paramList.add("'"+ uf_jcl_employee_information+"'");
paramList.add("'"+uf_jcl_employee_xxbgsq+"'");
paramList.add("'"+uf_jcl_rzgl+"'");
String sql = "select form_id,table_name from form_table where table_name in ("+String.join(",",paramList)+") and delete_type='0'";
Map<String,String> formMap = databaseUtils.getSqlList(sql).stream().collect(Collectors.toMap(e->e.get("table_name").toString(),e->e.get("form_id").toString()));
String employee_form_id = formMap.get(Constants.EMPLOYEE_INFORMATION);
String employee_form_id = formMap.get(uf_jcl_employee_information);
sql = "select id,module from FORM where (module='hrm' and ownership='personal') or module='hruserinfo' and delete_type='0'";
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql);
sql = "select id,module from FORM where ((module='hrm' and ownership='personal') or module='hruserinfo') and delete_type='0' and tenant_key=?";
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee.getTenantKey()));
log.info("personFormList : [{}]",personFormList);
log.info("tenantKey :[{}]",employee.getTenantKey());
Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
//基本信息自定义字段表
String personCustomfieldFormid=personFormMap.get("hrm");
@ -205,8 +220,8 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<String> formIdParamList = Lists.newArrayList();
formIdParamList.add(employee_form_id);
formIdParamList.add(formMap.get(Constants.EMPLOYEE_XXBGSQ));
formIdParamList.add(formMap.get(Constants.UF_JCL_RZGL));
formIdParamList.add(formMap.get(uf_jcl_employee_xxbgsq));
formIdParamList.add(formMap.get(uf_jcl_rzgl));
sql = "select id,group_name,form_id from form_field_group where form_id in ("+String.join(",",formIdParamList)+") and delete_type='0'";
List<Map<String, Object>> fieldGroupList = databaseUtils.getSqlList(sql);
Map<String,List<Map<String, Object>>> fieldGroupBy = fieldGroupList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
@ -229,7 +244,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
//员工信息主表-基本信息字段
List<Map<Object, Object>> mainFormBasicFieldList = employeeFieldList.stream().filter(e->e.get("groupId").equals(fieldGroup.get(Constants.BASIC_INFORMATION)) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
//员工信息主表-账户信息字段
// List<Map<Object, Object>> mainFormAccountFieldList = employeeFieldList.stream().filter(e->fieldGroup.get(Constants.ACCOUNT_INFORMATION).equals(e.get("groupId")) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
// List<Map<Object, Object>> mainFormAccountFieldList = employeeFieldList.stream().filter(e->fieldGroup.get(Constants.ACCOUNT_INFORMATION).equals(e.get("groupId")) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
//员工信息主表-个人信息字段
List<Map<Object, Object>> mainFormPersonFieldList = employeeFieldList.stream().filter(e->e.get("groupId").equals(fieldGroup.get(Constants.PERSONAL_INFORMATION)) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
@ -293,11 +308,15 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
* 批量保存
*/
//员工信息表
sql = "select b.id formtableid,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id in ("+String.join(",",formIdParamList)+") and a.delete_type='0'";
sql = "select b.id formtableid,b.table_name,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id in ("+String.join(",",formIdParamList)+") and a.delete_type='0'";
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql);
Map<String,List<Map<String, Object>>> dataGroup = dataList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
List<String> errorMessage = Lists.newArrayList();
WeaResult<Map<String, Object>> result = batchSaveInformation(employee_form_id,employeeFieldList,dataGroup.get(employee_form_id),ModuleSource.ebuilderform,null,null,employee,employEeFormList);
FormFieldManageSearchEntity searchEntity = FormFieldManageSearchEntity.Builder.builder().formId(Long.valueOf(employee_form_id)).deleteState(Collections.singletonList(0)).module(ModuleSource.ebuilderform.name()).build();
List<FormTableDto> detailFormDtos = fieldManageController.getRealService(ModuleSource.ebuilderform.name(),"FormFieldManageService",FormFieldManageService.class).listFormByParam(searchEntity, employee);
detailFormDtos = detailFormDtos.stream().filter(e->e.getFormId()==null).collect(Collectors.toList());
WeaResult<Map<String, Object>> result = batchSaveInformation(employee_form_id,employeeFieldList,null,ModuleSource.ebuilderform,null,null,employee,employEeFormList,detailFormDtos);
if (result.getCode() != 200){
errorMessage.add("员工信息表"+result.getMsg());
}else {
@ -321,14 +340,14 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
//保存人力资源-基本信息
Map<String, Object> customParam = Maps.newHashMap();
customParam.put("formId",personCustomfieldFormid);
WeaResult<Map<String, Object>> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,dataGroup.get(personCustomfieldFormid),ModuleSource.hrm,customParam,null,employee,personCustomFormList);
WeaResult<Map<String, Object>> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,dataGroup.get(personCustomfieldFormid),ModuleSource.hrm,customParam,null,employee,personCustomFormList,Lists.newArrayList());
if (result2.getCode() != 200){
errorMessage.add("人力资源基本信息自定义表"+result2.getMsg());
}
//保存人力资源-个人信息
Map<String, Object> customParam2 = Maps.newHashMap();
customParam2.put("apiModule","hr");
WeaResult<Map<String, Object>> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,dataGroup.get(personInfCustomFormid),ModuleSource.hruserinfo,customParam2,null,employee,personInfCustomFormList);
WeaResult<Map<String, Object>> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,dataGroup.get(personInfCustomFormid),ModuleSource.hruserinfo,customParam2,null,employee,personInfCustomFormList,Lists.newArrayList());
if (result3.getCode() != 200){
errorMessage.add("人力资源个人信息自定义表"+result3.getMsg());
}
@ -338,17 +357,27 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
@Override
public List<String> synchronousFieldByEmployee(SimpleEmployee employee) {
Map<String, String> uf_jcl_employee_information_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_INFORMATION);
String uf_jcl_employee_information = uf_jcl_employee_information_Info.get("table_name");
Map<String, String> uf_jcl_employee_xxbgsq_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_XXBGSQ);
String uf_jcl_employee_xxbgsq = uf_jcl_employee_xxbgsq_Info.get("table_name");
Map<String, String> uf_jcl_rzgl_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.UF_JCL_RZGL);
String uf_jcl_rzgl = uf_jcl_rzgl_Info.get("table_name");
List<String> paramList = Lists.newArrayList();
paramList.add("'"+Constants.EMPLOYEE_INFORMATION+"'");
paramList.add("'"+Constants.EMPLOYEE_XXBGSQ+"'");
paramList.add("'"+Constants.UF_JCL_RZGL+"'");
paramList.add("'"+uf_jcl_employee_information+"'");
paramList.add("'"+uf_jcl_employee_xxbgsq+"'");
paramList.add("'"+uf_jcl_rzgl+"'");
String sql = "select form_id,table_name from form_table where table_name in ("+String.join(",",paramList)+") and delete_type='0'";
Map<String,String> formMap = databaseUtils.getSqlList(sql).stream().collect(Collectors.toMap(e->e.get("table_name").toString(),e->e.get("form_id").toString()));
String employee_form_id = formMap.get(Constants.EMPLOYEE_INFORMATION);
String employee_form_id = formMap.get(uf_jcl_employee_information);
sql = "select id,module from FORM where (module='hrm' and ownership='personal') or module='hruserinfo' and delete_type='0'";
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql);
sql = "select id,module from FORM where ((module='hrm' and ownership='personal') or module='hruserinfo') and delete_type='0' and tenant_key=?";
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee.getTenantKey()));
Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
//基本信息自定义字段表
String personCustomfieldFormid=personFormMap.get("hrm");
@ -358,8 +387,8 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<String> formIdParamList = Lists.newArrayList();
formIdParamList.add(employee_form_id);
formIdParamList.add(formMap.get(Constants.EMPLOYEE_XXBGSQ));
formIdParamList.add(formMap.get(Constants.UF_JCL_RZGL));
formIdParamList.add(formMap.get(uf_jcl_employee_xxbgsq));
formIdParamList.add(formMap.get(uf_jcl_rzgl));
sql = "select id,group_name,form_id from form_field_group where form_id in ("+String.join(",",formIdParamList)+") and delete_type='0'";
List<Map<String, Object>> fieldGroupList = databaseUtils.getSqlList(sql);
Map<String,List<Map<String, Object>>> fieldGroupBy = fieldGroupList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
@ -406,7 +435,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<Map<Object, Object>> personCustomFieldList = getFieldList(personCustomEntity,employee);
//组装批量保存信息
Map<String,Object> personCustomResult = packageBatchSaveParamHaveDelete(personCustomFieldList,mainFormBasicFieldList,"-1",mapping,employeeBasicFieldList,allSubFormList);
Map<String,Object> personCustomResult = packageBatchSaveParamHaveDelete(personCustomFieldList,mainFormBasicFieldList,"-1",mapping,employeeBasicFieldList,allSubFormList,null);
List<Long> personCustomids = (List<Long>)personCustomResult.get("deleteIds");
List<Map<String, String>> personCustomAddForms = (List<Map<String, String>>)personCustomResult.get("forms");
/**
@ -415,7 +444,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
FieldManageParam personInfCustomEntity = getFieldManageParam(personInfCustomFormid,ModuleSource.hruserinfo);
List<Map<Object, Object>> personInfCustomFieldList = getFieldList(personInfCustomEntity,employee);
//组装批量保存信息
Map<String,Object> personInfCustomResult = packageBatchSaveParamHaveDelete(personInfCustomFieldList,mainFormPersonFieldList,"-1",mapping,employeePesonFieldList,allSubFormList);
Map<String,Object> personInfCustomResult = packageBatchSaveParamHaveDelete(personInfCustomFieldList,mainFormPersonFieldList,"-1",mapping,employeePesonFieldList,allSubFormList,null);
List<Long> personInfCustomIds = (List<Long>)personInfCustomResult.get("deleteIds");
List<Map<String, String>> personInfCustomAddForms = (List<Map<String, String>>)personInfCustomResult.get("forms");
@ -426,26 +455,26 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
/**
* 批量保存
*/
List<String> errorMessage = Lists.newArrayList();
List<String> errorMessage = Lists.newArrayList();
//保存人力资源-基本信息
Map<String, Object> customParam = Maps.newHashMap();
customParam.put("formId",personCustomfieldFormid);
WeaResult<Map<String, Object>> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,personCustomids,employee,personCustomAddForms);
WeaResult<Map<String, Object>> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,personCustomids,employee,personCustomAddForms,Lists.newArrayList());
if (result2.getCode() != 200){
errorMessage.add("基本信息表"+result2.getMsg());
}
//保存人力资源-个人信息
Map<String, Object> customParam2 = Maps.newHashMap();
customParam2.put("apiModule","hr");
WeaResult<Map<String, Object>> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,null,ModuleSource.hruserinfo,customParam2,personInfCustomIds,employee,personInfCustomAddForms);
WeaResult<Map<String, Object>> result3 = batchSaveInformation(personInfCustomFormid,personInfCustomFieldList,null,ModuleSource.hruserinfo,customParam2,personInfCustomIds,employee,personInfCustomAddForms,Lists.newArrayList());
if (result3.getCode() != 200){
errorMessage.add("个人信息表"+result3.getMsg());
}
//同步员工信息变更表和入职管理
sql = "select b.id formtableid,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id in ("+String.join(",",formIdParamList)+") and a.delete_type='0'";
sql = "select b.id formtableid,b.table_name,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id in ("+String.join(",",formIdParamList)+") and a.delete_type='0'";
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql);
Map<String,List<Map<String, Object>>> dataGroup = dataList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
@ -468,17 +497,26 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
@Override
public List<String> synchronousFieldByHrm(SimpleEmployee employee) {
Map<String, String> uf_jcl_employee_information_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_INFORMATION);
String uf_jcl_employee_information = uf_jcl_employee_information_Info.get("table_name");
Map<String, String> uf_jcl_employee_xxbgsq_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_XXBGSQ);
String uf_jcl_employee_xxbgsq = uf_jcl_employee_xxbgsq_Info.get("table_name");
Map<String, String> uf_jcl_rzgl_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.UF_JCL_RZGL);
String uf_jcl_rzgl = uf_jcl_rzgl_Info.get("table_name");
List<String> paramList = Lists.newArrayList();
paramList.add("'"+Constants.EMPLOYEE_INFORMATION+"'");
paramList.add("'"+Constants.EMPLOYEE_XXBGSQ+"'");
paramList.add("'"+Constants.UF_JCL_RZGL+"'");
paramList.add("'"+uf_jcl_employee_information+"'");
paramList.add("'"+uf_jcl_employee_xxbgsq+"'");
paramList.add("'"+uf_jcl_rzgl+"'");
String sql = "select form_id,table_name from form_table where table_name in ("+String.join(",",paramList)+") and delete_type='0'";
Map<String,String> formMap = databaseUtils.getSqlList(sql).stream().collect(Collectors.toMap(e->e.get("table_name").toString(),e->e.get("form_id").toString()));
String employee_form_id = formMap.get(Constants.EMPLOYEE_INFORMATION);
String employee_form_id = formMap.get(uf_jcl_employee_information);
sql = "select id,module from FORM where (module='hrm' and ownership='personal') or module='hruserinfo' and delete_type='0'";
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql);
sql = "select id,module from FORM where ((module='hrm' and ownership='personal') or module='hruserinfo') and delete_type='0' and tenant_key=?";
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee.getTenantKey()));
Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
//基本信息自定义字段表
String personCustomfieldFormid=personFormMap.get("hrm");
@ -488,8 +526,8 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<String> formIdParamList = Lists.newArrayList();
formIdParamList.add(employee_form_id);
formIdParamList.add(formMap.get(Constants.EMPLOYEE_XXBGSQ));
formIdParamList.add(formMap.get(Constants.UF_JCL_RZGL));
formIdParamList.add(formMap.get(uf_jcl_employee_xxbgsq));
formIdParamList.add(formMap.get(uf_jcl_rzgl));
sql = "select id,group_name,form_id from form_field_group where form_id in ("+String.join(",",formIdParamList)+") and delete_type='0'";
List<Map<String, Object>> fieldGroupList = databaseUtils.getSqlList(sql);
Map<String,List<Map<String, Object>>> fieldGroupBy = fieldGroupList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
@ -536,12 +574,12 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
//组装员工信息
Map<String,Object> result1 = packageBatchSaveParamHaveDelete(employeeFieldList,customMainFieldList,fieldGroup.get(Constants.BASIC_INFORMATION),mapping,customDetailFieldList,allSubFormList);
Map<String,Object> result1 = packageBatchSaveParamHaveDelete(employeeFieldList,customMainFieldList,fieldGroup.get(Constants.BASIC_INFORMATION),mapping,customDetailFieldList,allSubFormList,null);
List<Long> deleteIds = (List<Long>)result1.get("deleteIds");
List<Map<String, String>> personAddForms = (List<Map<String, String>>)result1.get("forms");
Map<String,Object> result2 = packageBatchSaveParamHaveDelete(employeeFieldList,infcustomMainFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION),mapping,infcustomDetailFieldList,allSubFormList);
Map<String,Object> result2 = packageBatchSaveParamHaveDelete(employeeFieldList,infcustomMainFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION),mapping,infcustomDetailFieldList,allSubFormList,null);
List<Long> deleteIds2 = (List<Long>)result2.get("deleteIds");
List<Map<String, String>> personAddForms2 = (List<Map<String, String>>)result2.get("forms");
deleteIds.addAll(deleteIds2);
@ -557,12 +595,16 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
* 批量保存
*/
//员工信息表
sql = "select b.id formtableid,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id in ("+String.join(",",formIdParamList)+") and a.delete_type='0'";
sql = "select b.id formtableid,b.table_name,a.* from sub_form a left join form_table b on a.id=b.form_id where a.form_id in ("+String.join(",",formIdParamList)+") and a.delete_type='0'";
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql);
Map<String,List<Map<String, Object>>> dataGroup = dataList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
FormFieldManageSearchEntity searchEntity = FormFieldManageSearchEntity.Builder.builder().formId(Long.valueOf(employee_form_id)).deleteState(Collections.singletonList(0)).module(ModuleSource.ebuilderform.name()).build();
List<FormTableDto> detailFormDtos = fieldManageController.getRealService(ModuleSource.ebuilderform.name(),"FormFieldManageService",FormFieldManageService.class).listFormByParam(searchEntity, employee);
detailFormDtos = detailFormDtos.stream().filter(e->e.getFormId()==null).collect(Collectors.toList());
List<String> errorMessage = Lists.newArrayList();
WeaResult<Map<String, Object>> result = batchSaveInformation(employee_form_id,employeeFieldList,dataGroup.get(employee_form_id),ModuleSource.ebuilderform,null,deleteIds,employee,personAddForms);
WeaResult<Map<String, Object>> result = batchSaveInformation(employee_form_id,employeeFieldList,null,ModuleSource.ebuilderform,null,deleteIds,employee,personAddForms,detailFormDtos);
if (result.getCode() != 200){
errorMessage.add("员工信息表"+result.getMsg());
}else {
@ -775,6 +817,15 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
*/
public List<String> synchronousOurForm(Map<String,Object> param){
Map<String, String> uf_jcl_employee_information_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_INFORMATION);
String uf_jcl_employee_information = uf_jcl_employee_information_Info.get("table_name");
Map<String, String> uf_jcl_employee_xxbgsq_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.EMPLOYEE_XXBGSQ);
String uf_jcl_employee_xxbgsq = uf_jcl_employee_xxbgsq_Info.get("table_name");
Map<String, String> uf_jcl_rzgl_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.UF_JCL_RZGL);
String uf_jcl_rzgl = uf_jcl_rzgl_Info.get("table_name");
SimpleEmployee employee = (SimpleEmployee)param.get("employee");
List<Map<Object, Object>> employeeFieldList = (List<Map<Object, Object>>)param.get("employeeFieldList");
Map<String,List<Map<String, Object>>> fieldGroupBy = (Map<String,List<Map<String, Object>>>)param.get("fieldGroupBy");
@ -790,7 +841,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
/**
* 员工信息表所有字段
*/
Map<String,String> fieldGroup = fieldGroupBy.get(formMap.get(Constants.EMPLOYEE_INFORMATION)).stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
Map<String,String> fieldGroup = fieldGroupBy.get(formMap.get(uf_jcl_employee_information)).stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
//员工信息主表-基本信息字段
List<Map<Object, Object>> mainFormBasicFieldList = employeeFieldList.stream().filter(e->e.get("groupId").equals(fieldGroup.get(Constants.BASIC_INFORMATION)) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
@ -806,17 +857,17 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
/**
* 入职管理字段
*/
String hireManageMentId = CommonUtils.null2String(formMap.get(Constants.UF_JCL_RZGL));
String hireManageMentId = CommonUtils.null2String(formMap.get(uf_jcl_rzgl));
FieldManageParam ownEntity = getFieldManageParam(hireManageMentId,ModuleSource.ebuilderform);
List<Map<Object, Object>> hireManageMentFieldList = getFieldList(ownEntity,employee);
Map<String,String> hireManageMentFieldGroup = fieldGroupBy.get(formMap.get(Constants.UF_JCL_RZGL)).stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
Map<String,String> hireManageMentFieldGroup = fieldGroupBy.get(formMap.get(uf_jcl_rzgl)).stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
Map<String,Object> result1 = packageBatchSaveParamHaveDelete(hireManageMentFieldList,mainFormBasicFieldList,hireManageMentFieldGroup.get(Constants.BASIC_INFORMATION),null,employeeBasicFieldList,allSubFormList);
Map<String,Object> result1 = packageBatchSaveParamHaveDelete(hireManageMentFieldList,mainFormBasicFieldList,hireManageMentFieldGroup.get(Constants.BASIC_INFORMATION),null,employeeBasicFieldList,allSubFormList,"hire_");
List<Long> hireManageMentdeleteIds = (List<Long>)result1.get("deleteIds");
List<Map<String, String>> hireManageMentPersonAddForms = (List<Map<String, String>>)result1.get("forms");
Map<String,Object> result2 = packageBatchSaveParamHaveDelete(hireManageMentFieldList,mainFormPersonFieldList,hireManageMentFieldGroup.get(Constants.PERSONAL_INFORMATION),null,employeePesonFieldList,allSubFormList);
Map<String,Object> result2 = packageBatchSaveParamHaveDelete(hireManageMentFieldList,mainFormPersonFieldList,hireManageMentFieldGroup.get(Constants.PERSONAL_INFORMATION),null,employeePesonFieldList,allSubFormList,"hire_");
List<Long> deleteIds2 = (List<Long>)result2.get("deleteIds");
List<Map<String, String>> personAddForms2 = (List<Map<String, String>>)result2.get("forms");
hireManageMentdeleteIds.addAll(deleteIds2);
@ -826,17 +877,17 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
/**
* 信息变更字段
*/
String informationChangeId = CommonUtils.null2String(formMap.get(Constants.EMPLOYEE_XXBGSQ));
String informationChangeId = CommonUtils.null2String(formMap.get(uf_jcl_employee_xxbgsq));
FieldManageParam informationEntity = getFieldManageParam(informationChangeId,ModuleSource.ebuilderform);
List<Map<Object, Object>> informationChangeFieldList = getFieldList(informationEntity,employee);
Map<String,String> informationChangeFieldGroup = fieldGroupBy.get(formMap.get(Constants.EMPLOYEE_XXBGSQ)).stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
Map<String,String> informationChangeFieldGroup = fieldGroupBy.get(formMap.get(uf_jcl_employee_xxbgsq)).stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
Map<String,Object> informationChangeResult1 = packageBatchSaveParamHaveDelete(informationChangeFieldList,mainFormBasicFieldList,informationChangeFieldGroup.get(Constants.BASIC_INFORMATION),null,employeeBasicFieldList,allSubFormList);
Map<String,Object> informationChangeResult1 = packageBatchSaveParamHaveDelete(informationChangeFieldList,mainFormBasicFieldList,informationChangeFieldGroup.get(Constants.BASIC_INFORMATION),null,employeeBasicFieldList,allSubFormList,"change_");
List<Long> informationChangedeleteIds = (List<Long>)informationChangeResult1.get("deleteIds");
List<Map<String, String>> informationChangeAddForms = (List<Map<String, String>>)informationChangeResult1.get("forms");
Map<String,Object> informationChangeResult2 = packageBatchSaveParamHaveDelete(informationChangeFieldList,mainFormPersonFieldList,informationChangeFieldGroup.get(Constants.PERSONAL_INFORMATION),null,employeePesonFieldList,allSubFormList);
Map<String,Object> informationChangeResult2 = packageBatchSaveParamHaveDelete(informationChangeFieldList,mainFormPersonFieldList,informationChangeFieldGroup.get(Constants.PERSONAL_INFORMATION),null,employeePesonFieldList,allSubFormList,"change_");
List<Long> informationChangeDeleteIds2 = (List<Long>)informationChangeResult2.get("deleteIds");
List<Map<String, String>> informationChangeddForms2 = (List<Map<String, String>>)informationChangeResult2.get("forms");
informationChangedeleteIds.addAll(informationChangeDeleteIds2);
@ -844,14 +895,24 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<String> errorMessage = Lists.newArrayList();
//保存入职管理
WeaResult<Map<String, Object>> result = batchSaveInformation(CommonUtils.null2String(formMap.get(Constants.UF_JCL_RZGL)),hireManageMentFieldList,detailFormDataList.get(formMap.get(Constants.UF_JCL_RZGL)),ModuleSource.ebuilderform,null,hireManageMentdeleteIds,employee,hireManageMentPersonAddForms);
FormFieldManageSearchEntity searchEntity = FormFieldManageSearchEntity.Builder.builder().formId(Long.valueOf(CommonUtils.null2String(formMap.get(uf_jcl_rzgl)))).deleteState(Collections.singletonList(0)).module(ModuleSource.ebuilderform.name()).build();
List<FormTableDto> detailFormDtos = fieldManageController.getRealService(ModuleSource.ebuilderform.name(),"FormFieldManageService",FormFieldManageService.class).listFormByParam(searchEntity, employee);
detailFormDtos = detailFormDtos.stream().filter(e->e.getFormId()==null).collect(Collectors.toList());
WeaResult<Map<String, Object>> result = batchSaveInformation(CommonUtils.null2String(formMap.get(uf_jcl_rzgl)),hireManageMentFieldList,null,ModuleSource.ebuilderform,null,hireManageMentdeleteIds,employee,hireManageMentPersonAddForms,detailFormDtos);
if (result.getCode() != 200){
errorMessage.add("入职管理"+result.getMsg());
}
//保存信息变更
WeaResult<Map<String, Object>> informationChangeResult = batchSaveInformation(CommonUtils.null2String(formMap.get(Constants.EMPLOYEE_XXBGSQ)),informationChangeFieldList,detailFormDataList.get(formMap.get(Constants.EMPLOYEE_XXBGSQ)),ModuleSource.ebuilderform,null,informationChangedeleteIds,employee,informationChangeAddForms);
FormFieldManageSearchEntity searchEntity2 = FormFieldManageSearchEntity.Builder.builder().formId(Long.valueOf(CommonUtils.null2String(formMap.get(uf_jcl_employee_xxbgsq)))).deleteState(Collections.singletonList(0)).module(ModuleSource.ebuilderform.name()).build();
List<FormTableDto> detailFormDtos2 = fieldManageController.getRealService(ModuleSource.ebuilderform.name(),"FormFieldManageService",FormFieldManageService.class).listFormByParam(searchEntity2, employee);
detailFormDtos2 = detailFormDtos2.stream().filter(e->e.getFormId()==null).collect(Collectors.toList());
WeaResult<Map<String, Object>> informationChangeResult = batchSaveInformation(CommonUtils.null2String(formMap.get(uf_jcl_employee_xxbgsq)),informationChangeFieldList,null,ModuleSource.ebuilderform,null,informationChangedeleteIds,employee,informationChangeAddForms,detailFormDtos2);
if (informationChangeResult.getCode() != 200){
errorMessage.add("信息变更申请表"+informationChangeResult.getMsg());
}
@ -1184,7 +1245,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
* @param conditionList
* @param groupId
*/
public Map<String,Object> packageBatchSaveParamHaveDelete(List<Map<Object, Object>> packageList,List<Map<Object, Object>> conditionList,String groupId,Map<String, String> mapping,List<Map<Object, Object>> detailFieldList,List<Map<String, Object>> allSubFormList){
public Map<String,Object> packageBatchSaveParamHaveDelete(List<Map<Object, Object>> packageList,List<Map<Object, Object>> conditionList,String groupId,Map<String, String> mapping,List<Map<Object, Object>> detailFieldList,List<Map<String, Object>> allSubFormList,String tableKey){
Map<String,Object> resultMap = Maps.newHashMap();
List<Map<String, String>> addForms = Lists.newArrayList();
Map<String,List<Map<String, Object>>> allSubFormGroup = allSubFormList.stream().collect(Collectors.groupingBy(e->e.get("id").toString()));
@ -1283,12 +1344,16 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
if (detailFieldList != null && detailFieldList.size() > 0){
String dataKey = "";
if ("-1".equals(groupId)){
//组装人力资源系统表packageList为人力资源数据conditionList为员工信息数据
dataKey = "dt_";
if (tableKey != null){
dataKey=tableKey;
}else {
//组装人力资源系统表packageList为员工信息数据conditionList为人力资源数据
dataKey = "uf_";
if ("-1".equals(groupId)){
//组装人力资源系统表packageList为人力资源数据conditionList为员工信息数据
dataKey = "dt_";
}else {
//组装人力资源系统表packageList为员工信息数据conditionList为人力资源数据
dataKey = "uf_";
}
}
Map<String,List<Map<Object, Object>>> detailFieldGroup = detailFieldList.stream().collect(Collectors.groupingBy(e->e.get("subFormId").toString()));
for (Map.Entry<String,List<Map<Object, Object>>> entry :detailFieldGroup.entrySet()){
@ -1300,7 +1365,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<Map<String, Object>> list = allSubFormList.stream().filter(e->e.get("data_key").equals(finalDataKey)).collect(Collectors.toList());
List<Map<String, Object>> subList = Lists.newArrayList();
if (subDataKey.split("_").length >1 ){
if (subDataKey.split("_").length >1 && subDataKey.split("_")[0].equals(dataKey)){
subList = allSubFormGroup.get(subDataKey.split("_")[1]) == null ? Lists.newArrayList():allSubFormGroup.get(subDataKey.split("_")[1]);
}
@ -1423,12 +1488,12 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
* 批量保存
* @return
*/
public WeaResult<Map<String, Object>> batchSaveInformation(String formid,List<Map<Object, Object>> formFieldList,List<Map<String, Object>> detailFormList,ModuleSource moduleSource,Map<String, Object> customParam,List<Long> ids,SimpleEmployee employee,List<Map<String, String>> formList){
public WeaResult<Map<String, Object>> batchSaveInformation(String formid,List<Map<Object, Object>> formFieldList,List<Map<String, Object>> detailFormList,ModuleSource moduleSource,Map<String, Object> customParam,List<Long> ids,SimpleEmployee employee,List<Map<String, String>> formList,List<FormTableDto> detailFormDtos){
FormFieldManageParam saveEmployeeEntity = new FormFieldManageParam();
saveEmployeeEntity.setFormId(Long.valueOf(formid));
saveEmployeeEntity.setModule(moduleSource);
saveEmployeeEntity.setJsonObjList(getJsonObjList(formFieldList));
List<FormTableDto> forms = Lists.newArrayList();
List<FormTableDto> forms = detailFormDtos;
if (detailFormList != null){
for (Map<String, Object> map:detailFormList){
FormTableDto formTableDto = new FormTableDto();
@ -1447,7 +1512,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
formTableDto.setId(Long.valueOf(map.get("id").toString()));
formTableDto.setFormId(Long.valueOf(map.get("id").toString()));
formTableDto.setName(CommonUtils.null2String(map.get("title")));
formTableDto.setTableName(map.get("data_key").toString());
formTableDto.setTableName(map.get("table_name").toString());
formTableDto.setTableType(FormTableType.MAIN);
formTableDto.setOrder(CommonUtils.null2String(map.get("show_order")));
forms.add(formTableDto);
@ -1466,11 +1531,14 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
forms.add(formTableDto);
}
}
saveEmployeeEntity.setIds(ids);
saveEmployeeEntity.setForms(forms);
saveEmployeeEntity.setCustomParam(customParam);
Gson gson = new Gson();
log.error("saveEmployeeEntity result:[{}]",forms.size());
// log.error("saveEmployeeEntity result:[{}]",gson.toJson(forms,List.class));
WeaResult<Map<String, Object>>result = batchSaveFormField(saveEmployeeEntity,employee);
log.error("batchSaveInformation result :[{}]",gson.toJson(result));
return result;