From 3a6a1acc3a53a4adee6bb0bc94996b8edf74bd75 Mon Sep 17 00:00:00 2001 From: liuliang <401809302@qq.com> Date: Tue, 6 May 2025 09:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=98=8E=E7=BB=86=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EmployeeInformationServiceImpl.java | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java index f5fddc7..9b8cded 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeInformationServiceImpl.java @@ -238,7 +238,9 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic List> personCustomFieldList = getFieldList(personCustomEntity,employee); List> customFieldList = personCustomFieldList.stream().filter(e->!e.get("componentKey").equals("BaseField")).collect(Collectors.toList()); - List> customDetailFieldList = personCustomFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList()); + + List> customMainFieldList = customFieldList.stream().filter(e->CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList()); + List> customDetailFieldList = customFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList()); //组装批量保存信息 List> personCustomFormList = packageBatchSaveParam(personCustomFieldList,mainFormBasicFieldList,"-1",mapping,employeeBasicFieldList,allSubFormList); @@ -249,18 +251,20 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic FieldManageParam personInfCustomEntity = getFieldManageParam(personInfCustomFormid,ModuleSource.hruserinfo); List> personInfCustomFieldList = getFieldList(personInfCustomEntity,employee); List> infcustomFieldList = personInfCustomFieldList.stream().filter(e->!e.get("componentKey").equals("BaseField")).collect(Collectors.toList()); - List> infcustomDetailFieldList = personInfCustomFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList()); + + List> infcustomMainFieldList = infcustomFieldList.stream().filter(e->CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList()); + List> infcustomDetailFieldList = infcustomFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList()); //组装批量保存信息 List> personInfCustomFormList = packageBatchSaveParam(personInfCustomFieldList,mainFormPersonFieldList,"-1",mapping,employeePesonFieldList,allSubFormList); //组装员工信息 - List> employEeFormList = packageBatchSaveParam(employeeFieldList,customFieldList,fieldGroup.get(Constants.BASIC_INFORMATION),mapping,customDetailFieldList,allSubFormList); + List> employEeFormList = packageBatchSaveParam(employeeFieldList,customMainFieldList,fieldGroup.get(Constants.BASIC_INFORMATION),mapping,customDetailFieldList,allSubFormList); for (Map map :employEeFormList){ map.put("describe","基本信息"); } - List> employInfCustomFormList = packageBatchSaveParam(employeeFieldList,infcustomFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION),mapping,infcustomDetailFieldList,allSubFormList); + List> employInfCustomFormList = packageBatchSaveParam(employeeFieldList,infcustomMainFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION),mapping,infcustomDetailFieldList,allSubFormList); for (Map employInf:employInfCustomFormList){ employInf.put("describe","个人信息"); } @@ -767,16 +771,20 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic if (list.size() > 0){ //更新明细表 createSubFormId = CommonUtils.null2String(list.get(0).get("id")); + String finalCreateSubFormId = createSubFormId; + List> packageFormList = packageList.stream().filter(e->finalCreateSubFormId.equals(e.get("subFormId"))).collect(Collectors.toList()); + for (Map detailFieldMap:detailFields){ String fieldDataKey = CommonUtils.null2String(detailFieldMap.get("dataKey")); - List> detailList = packageList.stream().filter(e->fieldDataKey.equals(e.get("dataKey"))).collect(Collectors.toList()); + + List> detailList = packageList.stream().filter(e->fieldDataKey.equals(e.get("dataKey")) && finalCreateSubFormId.equals(e.get("subFormId"))).collect(Collectors.toList()); Map map = Maps.newHashMap(); if (detailList.size() >0){ //更新字段 map.putAll(detailFieldMap); - map.put("formId",packageList.get(0).get("formId")); - map.put("formTableId",packageList.get(0).get("formTableId")); - map.put("groupId",groupId); + map.put("formId",detailList.get(0).get("formId")); + map.put("formTableId",detailList.get(0).get("formTableId")); + map.put("groupId","-1"); map.put("fieldId",detailList.get(0).get("fieldId")); map.put("subFormId",createSubFormId); if (map.get("options") != null && ((List>)map.get("options")).size() >0){ @@ -790,9 +798,9 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic }else { //新增字段 map.putAll(detailFieldMap); - map.put("formId",packageList.get(0).get("formId")); - map.put("formTableId",packageList.get(0).get("formTableId")); - map.put("groupId",groupId); + map.put("formId",packageFormList.get(0).get("formId")); + map.put("formTableId",packageFormList.get(0).get("formTableId")); + map.put("groupId","-1"); map.put("fieldId",idGeneratorService.generatorIds(1)[0]); map.put("subFormId",createSubFormId); if (map.get("options") != null && ((List>)map.get("options")).size() >0){ @@ -823,10 +831,10 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic Map map = Maps.newHashMap(); map.putAll(detailField); map.put("formId",packageList.get(0).get("formId")); - map.put("formTableId",packageList.get(0).get("formTableId")); - map.put("groupId",groupId); + map.put("groupId","-1"); map.put("fieldId",idGeneratorService.generatorIds(1)[0]); map.put("subFormId",createSubFormId); + map.remove("formTableId"); if (map.get("options") != null && ((List>)map.get("options")).size() >0){ List> options = (List>)map.get("options"); for (Map option :options){ @@ -966,7 +974,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic forms.add(formTableDto); } } - if (formList.size() > 0){ + if (formList !=null && formList.size() > 0){ for (Map form:formList){ FormTableDto formTableDto = new FormTableDto(); formTableDto.setDataKey(form.get("dataKey"));