明细表同步bug修改

This commit is contained in:
liuliang 2025-07-10 14:43:59 +08:00
parent f2d2130bfe
commit 97b4eadf98
1 changed files with 66 additions and 37 deletions

View File

@ -21,6 +21,7 @@ import com.weaver.common.form.param.FieldManageParam;
import com.weaver.common.form.param.auth.FormAuthenticationParam; import com.weaver.common.form.param.auth.FormAuthenticationParam;
import com.weaver.common.form.param.field.FormFieldParam; import com.weaver.common.form.param.field.FormFieldParam;
import com.weaver.common.form.physical.enums.FormTableType; import com.weaver.common.form.physical.enums.FormTableType;
import com.weaver.common.form.searchentity.FormFieldManageSearchEntity;
import com.weaver.common.form.service.IdGeneratorService; import com.weaver.common.form.service.IdGeneratorService;
import com.weaver.common.i18n.label.SystemEnv; import com.weaver.common.i18n.label.SystemEnv;
import com.weaver.ebuilder.coms.sdk.biz.QueryFilterBiz; import com.weaver.ebuilder.coms.sdk.biz.QueryFilterBiz;
@ -43,10 +44,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -83,6 +81,10 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
Map<String, String> uf_jcl_rzgl_Info = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", Constants.UF_JCL_RZGL); 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"); 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(); List<String> paramList = Lists.newArrayList();
paramList.add("'"+ uf_jcl_employee_information+"'"); paramList.add("'"+ uf_jcl_employee_information+"'");
@ -92,8 +94,10 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
Map<String,String> formMap = databaseUtils.getSqlList(sql).stream().collect(Collectors.toMap(e->e.get("table_name").toString(),e->e.get("form_id").toString())); 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(uf_jcl_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' and tenant_key=?"; 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())); 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())); Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
//基本信息自定义字段表 //基本信息自定义字段表
String personCustomfieldFormid=personFormMap.get("hrm"); String personCustomfieldFormid=personFormMap.get("hrm");
@ -191,11 +195,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); 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())); Map<String,List<Map<String, Object>>> dataGroup = dataList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
List<String> errorMessage = Lists.newArrayList(); 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){ if (result.getCode() != 200){
errorMessage.add("员工信息表"+result.getMsg()); errorMessage.add("员工信息表"+result.getMsg());
}else { }else {
@ -219,14 +227,14 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
//保存人力资源-基本信息 //保存人力资源-基本信息
Map<String, Object> customParam = Maps.newHashMap(); Map<String, Object> customParam = Maps.newHashMap();
customParam.put("formId",personCustomfieldFormid); 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){ if (result2.getCode() != 200){
errorMessage.add("人力资源基本信息自定义表"+result2.getMsg()); errorMessage.add("人力资源基本信息自定义表"+result2.getMsg());
} }
//保存人力资源-个人信息 //保存人力资源-个人信息
Map<String, Object> customParam2 = Maps.newHashMap(); Map<String, Object> customParam2 = Maps.newHashMap();
customParam2.put("apiModule","hr"); 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){ if (result3.getCode() != 200){
errorMessage.add("人力资源个人信息自定义表"+result3.getMsg()); errorMessage.add("人力资源个人信息自定义表"+result3.getMsg());
} }
@ -255,7 +263,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
String employee_form_id = formMap.get(uf_jcl_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' and tenant_key=?"; 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())); 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())); Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
//基本信息自定义字段表 //基本信息自定义字段表
@ -314,7 +322,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<Map<Object, Object>> personCustomFieldList = getFieldList(personCustomEntity,employee); 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<Long> personCustomids = (List<Long>)personCustomResult.get("deleteIds");
List<Map<String, String>> personCustomAddForms = (List<Map<String, String>>)personCustomResult.get("forms"); List<Map<String, String>> personCustomAddForms = (List<Map<String, String>>)personCustomResult.get("forms");
/** /**
@ -323,7 +331,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
FieldManageParam personInfCustomEntity = getFieldManageParam(personInfCustomFormid,ModuleSource.hruserinfo); FieldManageParam personInfCustomEntity = getFieldManageParam(personInfCustomFormid,ModuleSource.hruserinfo);
List<Map<Object, Object>> personInfCustomFieldList = getFieldList(personInfCustomEntity,employee); 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<Long> personInfCustomIds = (List<Long>)personInfCustomResult.get("deleteIds");
List<Map<String, String>> personInfCustomAddForms = (List<Map<String, String>>)personInfCustomResult.get("forms"); List<Map<String, String>> personInfCustomAddForms = (List<Map<String, String>>)personInfCustomResult.get("forms");
@ -340,20 +348,20 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
//保存人力资源-基本信息 //保存人力资源-基本信息
Map<String, Object> customParam = Maps.newHashMap(); Map<String, Object> customParam = Maps.newHashMap();
customParam.put("formId",personCustomfieldFormid); 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){ if (result2.getCode() != 200){
errorMessage.add("基本信息表"+result2.getMsg()); errorMessage.add("基本信息表"+result2.getMsg());
} }
//保存人力资源-个人信息 //保存人力资源-个人信息
Map<String, Object> customParam2 = Maps.newHashMap(); Map<String, Object> customParam2 = Maps.newHashMap();
customParam2.put("apiModule","hr"); 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){ if (result3.getCode() != 200){
errorMessage.add("个人信息表"+result3.getMsg()); 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); 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())); Map<String,List<Map<String, Object>>> dataGroup = dataList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
@ -394,7 +402,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
String employee_form_id = formMap.get(uf_jcl_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' and tenant_key="; 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())); 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())); Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
//基本信息自定义字段表 //基本信息自定义字段表
@ -453,12 +461,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<Long> deleteIds = (List<Long>)result1.get("deleteIds");
List<Map<String, String>> personAddForms = (List<Map<String, String>>)result1.get("forms"); 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<Long> deleteIds2 = (List<Long>)result2.get("deleteIds");
List<Map<String, String>> personAddForms2 = (List<Map<String, String>>)result2.get("forms"); List<Map<String, String>> personAddForms2 = (List<Map<String, String>>)result2.get("forms");
deleteIds.addAll(deleteIds2); deleteIds.addAll(deleteIds2);
@ -474,12 +482,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); 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())); 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(); 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){ if (result.getCode() != 200){
errorMessage.add("员工信息表"+result.getMsg()); errorMessage.add("员工信息表"+result.getMsg());
}else { }else {
@ -593,11 +605,11 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
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,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<Long> hireManageMentdeleteIds = (List<Long>)result1.get("deleteIds");
List<Map<String, String>> hireManageMentPersonAddForms = (List<Map<String, String>>)result1.get("forms"); 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<Long> deleteIds2 = (List<Long>)result2.get("deleteIds");
List<Map<String, String>> personAddForms2 = (List<Map<String, String>>)result2.get("forms"); List<Map<String, String>> personAddForms2 = (List<Map<String, String>>)result2.get("forms");
hireManageMentdeleteIds.addAll(deleteIds2); hireManageMentdeleteIds.addAll(deleteIds2);
@ -613,11 +625,11 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
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,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<Long> informationChangedeleteIds = (List<Long>)informationChangeResult1.get("deleteIds");
List<Map<String, String>> informationChangeAddForms = (List<Map<String, String>>)informationChangeResult1.get("forms"); 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<Long> informationChangeDeleteIds2 = (List<Long>)informationChangeResult2.get("deleteIds");
List<Map<String, String>> informationChangeddForms2 = (List<Map<String, String>>)informationChangeResult2.get("forms"); List<Map<String, String>> informationChangeddForms2 = (List<Map<String, String>>)informationChangeResult2.get("forms");
informationChangedeleteIds.addAll(informationChangeDeleteIds2); informationChangedeleteIds.addAll(informationChangeDeleteIds2);
@ -625,14 +637,24 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<String> errorMessage = Lists.newArrayList(); List<String> errorMessage = Lists.newArrayList();
//保存入职管理 //保存入职管理
WeaResult<Map<String, Object>> result = batchSaveInformation(CommonUtils.null2String(formMap.get(uf_jcl_employee_xxbgsq)),hireManageMentFieldList,detailFormDataList.get(formMap.get(uf_jcl_employee_xxbgsq)),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){ if (result.getCode() != 200){
errorMessage.add("入职管理"+result.getMsg()); errorMessage.add("入职管理"+result.getMsg());
} }
//保存信息变更 //保存信息变更
WeaResult<Map<String, Object>> informationChangeResult = batchSaveInformation(CommonUtils.null2String(formMap.get(uf_jcl_rzgl)),informationChangeFieldList,detailFormDataList.get(formMap.get(uf_jcl_rzgl)),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){ if (informationChangeResult.getCode() != 200){
errorMessage.add("信息变更申请表"+informationChangeResult.getMsg()); errorMessage.add("信息变更申请表"+informationChangeResult.getMsg());
} }
@ -963,7 +985,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
* @param conditionList * @param conditionList
* @param groupId * @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(); Map<String,Object> resultMap = Maps.newHashMap();
List<Map<String, String>> addForms = Lists.newArrayList(); List<Map<String, String>> addForms = Lists.newArrayList();
Map<String,List<Map<String, Object>>> allSubFormGroup = allSubFormList.stream().collect(Collectors.groupingBy(e->e.get("id").toString())); Map<String,List<Map<String, Object>>> allSubFormGroup = allSubFormList.stream().collect(Collectors.groupingBy(e->e.get("id").toString()));
@ -1062,6 +1084,9 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
if (detailFieldList != null && detailFieldList.size() > 0){ if (detailFieldList != null && detailFieldList.size() > 0){
String dataKey = ""; String dataKey = "";
if (tableKey != null){
dataKey=tableKey;
}else {
if ("-1".equals(groupId)){ if ("-1".equals(groupId)){
//组装人力资源系统表packageList为人力资源数据conditionList为员工信息数据 //组装人力资源系统表packageList为人力资源数据conditionList为员工信息数据
dataKey = "dt_"; dataKey = "dt_";
@ -1069,6 +1094,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
//组装人力资源系统表packageList为员工信息数据conditionList为人力资源数据 //组装人力资源系统表packageList为员工信息数据conditionList为人力资源数据
dataKey = "uf_"; dataKey = "uf_";
} }
}
Map<String,List<Map<Object, Object>>> detailFieldGroup = detailFieldList.stream().collect(Collectors.groupingBy(e->e.get("subFormId").toString())); 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()){ for (Map.Entry<String,List<Map<Object, Object>>> entry :detailFieldGroup.entrySet()){
String subFormId = entry.getKey(); String subFormId = entry.getKey();
@ -1079,7 +1105,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>> list = allSubFormList.stream().filter(e->e.get("data_key").equals(finalDataKey)).collect(Collectors.toList());
List<Map<String, Object>> subList = Lists.newArrayList(); 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]); subList = allSubFormGroup.get(subDataKey.split("_")[1]) == null ? Lists.newArrayList():allSubFormGroup.get(subDataKey.split("_")[1]);
} }
@ -1202,12 +1228,12 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
* 批量保存 * 批量保存
* @return * @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(); FormFieldManageParam saveEmployeeEntity = new FormFieldManageParam();
saveEmployeeEntity.setFormId(Long.valueOf(formid)); saveEmployeeEntity.setFormId(Long.valueOf(formid));
saveEmployeeEntity.setModule(moduleSource); saveEmployeeEntity.setModule(moduleSource);
saveEmployeeEntity.setJsonObjList(getJsonObjList(formFieldList)); saveEmployeeEntity.setJsonObjList(getJsonObjList(formFieldList));
List<FormTableDto> forms = Lists.newArrayList(); List<FormTableDto> forms = detailFormDtos;
if (detailFormList != null){ if (detailFormList != null){
for (Map<String, Object> map:detailFormList){ for (Map<String, Object> map:detailFormList){
FormTableDto formTableDto = new FormTableDto(); FormTableDto formTableDto = new FormTableDto();
@ -1226,7 +1252,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
formTableDto.setId(Long.valueOf(map.get("id").toString())); formTableDto.setId(Long.valueOf(map.get("id").toString()));
formTableDto.setFormId(Long.valueOf(map.get("id").toString())); formTableDto.setFormId(Long.valueOf(map.get("id").toString()));
formTableDto.setName(CommonUtils.null2String(map.get("title"))); 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.setTableType(FormTableType.MAIN);
formTableDto.setOrder(CommonUtils.null2String(map.get("show_order"))); formTableDto.setOrder(CommonUtils.null2String(map.get("show_order")));
forms.add(formTableDto); forms.add(formTableDto);
@ -1245,11 +1271,14 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
forms.add(formTableDto); forms.add(formTableDto);
} }
} }
saveEmployeeEntity.setIds(ids); saveEmployeeEntity.setIds(ids);
saveEmployeeEntity.setForms(forms); saveEmployeeEntity.setForms(forms);
saveEmployeeEntity.setCustomParam(customParam); saveEmployeeEntity.setCustomParam(customParam);
Gson gson = new Gson(); Gson gson = new Gson();
log.error("saveEmployeeEntity result:[{}]",forms.size()); log.error("saveEmployeeEntity result:[{}]",forms.size());
// log.error("saveEmployeeEntity result:[{}]",gson.toJson(forms,List.class));
WeaResult<Map<String, Object>>result = batchSaveFormField(saveEmployeeEntity,employee); WeaResult<Map<String, Object>>result = batchSaveFormField(saveEmployeeEntity,employee);
log.error("batchSaveInformation result :[{}]",gson.toJson(result)); log.error("batchSaveInformation result :[{}]",gson.toJson(result));
return result; return result;