同步明细表

This commit is contained in:
liuliang 2025-05-06 09:48:57 +08:00
parent 685047ec96
commit 3a6a1acc3a
1 changed files with 22 additions and 14 deletions

View File

@ -238,7 +238,9 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
List<Map<Object, Object>> personCustomFieldList = getFieldList(personCustomEntity,employee);
List<Map<Object, Object>> customFieldList = personCustomFieldList.stream().filter(e->!e.get("componentKey").equals("BaseField")).collect(Collectors.toList());
List<Map<Object, Object>> customDetailFieldList = personCustomFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList());
List<Map<Object, Object>> customMainFieldList = customFieldList.stream().filter(e->CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList());
List<Map<Object, Object>> customDetailFieldList = customFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList());
//组装批量保存信息
List<Map<String, String>> personCustomFormList = packageBatchSaveParam(personCustomFieldList,mainFormBasicFieldList,"-1",mapping,employeeBasicFieldList,allSubFormList);
@ -249,18 +251,20 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
FieldManageParam personInfCustomEntity = getFieldManageParam(personInfCustomFormid,ModuleSource.hruserinfo);
List<Map<Object, Object>> personInfCustomFieldList = getFieldList(personInfCustomEntity,employee);
List<Map<Object, Object>> infcustomFieldList = personInfCustomFieldList.stream().filter(e->!e.get("componentKey").equals("BaseField")).collect(Collectors.toList());
List<Map<Object, Object>> infcustomDetailFieldList = personInfCustomFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList());
List<Map<Object, Object>> infcustomMainFieldList = infcustomFieldList.stream().filter(e->CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList());
List<Map<Object, Object>> infcustomDetailFieldList = infcustomFieldList.stream().filter(e->!CommonUtils.null2String(e.get("subFormId")).equals("")).collect(Collectors.toList());
//组装批量保存信息
List<Map<String, String>> personInfCustomFormList = packageBatchSaveParam(personInfCustomFieldList,mainFormPersonFieldList,"-1",mapping,employeePesonFieldList,allSubFormList);
//组装员工信息
List<Map<String, String>> employEeFormList = packageBatchSaveParam(employeeFieldList,customFieldList,fieldGroup.get(Constants.BASIC_INFORMATION),mapping,customDetailFieldList,allSubFormList);
List<Map<String, String>> employEeFormList = packageBatchSaveParam(employeeFieldList,customMainFieldList,fieldGroup.get(Constants.BASIC_INFORMATION),mapping,customDetailFieldList,allSubFormList);
for (Map<String, String> map :employEeFormList){
map.put("describe","基本信息");
}
List<Map<String, String>> employInfCustomFormList = packageBatchSaveParam(employeeFieldList,infcustomFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION),mapping,infcustomDetailFieldList,allSubFormList);
List<Map<String, String>> employInfCustomFormList = packageBatchSaveParam(employeeFieldList,infcustomMainFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION),mapping,infcustomDetailFieldList,allSubFormList);
for (Map<String, String> 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<Map<Object, Object>> packageFormList = packageList.stream().filter(e->finalCreateSubFormId.equals(e.get("subFormId"))).collect(Collectors.toList());
for (Map<Object, Object> detailFieldMap:detailFields){
String fieldDataKey = CommonUtils.null2String(detailFieldMap.get("dataKey"));
List<Map<Object, Object>> detailList = packageList.stream().filter(e->fieldDataKey.equals(e.get("dataKey"))).collect(Collectors.toList());
List<Map<Object, Object>> detailList = packageList.stream().filter(e->fieldDataKey.equals(e.get("dataKey")) && finalCreateSubFormId.equals(e.get("subFormId"))).collect(Collectors.toList());
Map<Object, Object> 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<Object, Object>>)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<Object, Object>>)map.get("options")).size() >0){
@ -823,10 +831,10 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
Map<Object, Object> 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<Object, Object>>)map.get("options")).size() >0){
List<Map<Object, Object>> options = (List<Map<Object, Object>>)map.get("options");
for (Map<Object, Object> 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<String, String> form:formList){
FormTableDto formTableDto = new FormTableDto();
formTableDto.setDataKey(form.get("dataKey"));