|
|
|
@ -105,7 +105,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getPendingEmployment(Employee employee) {
|
|
|
|
|
String sql = "select * from uf_jcl_rzgl where delete_type<>'0' and (";
|
|
|
|
|
String sql = "select * from uf_jcl_rzgl where delete_type ='0' and (";
|
|
|
|
|
List<String> paramList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
if (employee.getMobile() != null && !"".equals(employee.getMobile())){
|
|
|
|
@ -149,13 +149,19 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void synchronousField(SimpleEmployee employee) {
|
|
|
|
|
public List<String> synchronousField(SimpleEmployee employee) {
|
|
|
|
|
String sql = "select form_id from form_table where table_name=? and delete_type='0'";
|
|
|
|
|
List<String> paramList = Lists.newArrayList();
|
|
|
|
|
paramList.add(Constants.EMPLOYEE_INFORMATION);
|
|
|
|
|
String employee_form_id = CommonUtils.null2String(databaseUtils.getSqlList(sql,paramList).get(0).get("form_id"));
|
|
|
|
|
|
|
|
|
|
sql = "select id,module from FORM where (module='hrm' and ownership='personal') or module='hruserinfo'";
|
|
|
|
|
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql);
|
|
|
|
|
Map<String,String> personFormMap = personFormList.stream().collect(Collectors.toMap(e->e.get("module").toString(),e->e.get("id").toString()));
|
|
|
|
|
//基本信息自定义字段表
|
|
|
|
|
String personCustomfieldFormid="1088177870727446575";
|
|
|
|
|
String personCustomfieldFormid=personFormMap.get("hrm");
|
|
|
|
|
//人力资源-个人信息自定义字段
|
|
|
|
|
String personInfCustomFormid=personFormMap.get("hrm");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> formIdParamList = Lists.newArrayList();
|
|
|
|
@ -164,18 +170,11 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
|
|
|
|
|
List<Map<String, Object>> fieldGroupList = databaseUtils.getSqlList(sql,formIdParamList);
|
|
|
|
|
Map<String,String> fieldGroup = fieldGroupList.stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
|
|
|
|
|
formIdParamList.add(personCustomfieldFormid);
|
|
|
|
|
// sql = "select * from form_field where form_id in ("+String.join(",",formIdParamList)+") and delete_type='0'";
|
|
|
|
|
// List<Map<String, Object>> fieldList = databaseUtils.getSqlList(sql,formIdParamList);
|
|
|
|
|
// Map<String,List<Map<String, Object>>> fieldGroupMapping = fieldList.stream().collect(Collectors.groupingBy(e->e.get("form_id").toString()));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 员工信息表所有字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam ownEntity = new FieldManageParam();
|
|
|
|
|
ownEntity.setFormId(Long.valueOf(employee_form_id));
|
|
|
|
|
ownEntity.setModule(ModuleSource.ebuilderform);
|
|
|
|
|
ownEntity.setNeedDataCount(true);
|
|
|
|
|
ownEntity.setNeedPanelField(true);
|
|
|
|
|
FieldManageParam ownEntity = getFieldManageParam(employee_form_id,ModuleSource.ebuilderform);
|
|
|
|
|
List<Map<Object, Object>> employeeFieldList = getFieldList(ownEntity,employee);
|
|
|
|
|
//员工信息主表-基本信息字段
|
|
|
|
|
List<Map<Object, Object>> mainFormBasicFieldList = employeeFieldList.stream().filter(e->fieldGroup.get(Constants.BASIC_INFORMATION).equals(e.get("groupId")) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
|
|
|
|
@ -187,39 +186,33 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-基本信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam personCustomEntity = new FieldManageParam();
|
|
|
|
|
personCustomEntity.setFormId(Long.valueOf(personCustomfieldFormid));
|
|
|
|
|
personCustomEntity.setModule(ModuleSource.hrm);
|
|
|
|
|
personCustomEntity.setNeedDataCount(true);
|
|
|
|
|
personCustomEntity.setNeedPanelField(true);
|
|
|
|
|
FieldManageParam personCustomEntity = getFieldManageParam(personCustomfieldFormid,ModuleSource.hrm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
//组装批量保存信息
|
|
|
|
|
packageBatchSaveParam(personCustomFieldList,mainFormBasicFieldList,"-1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-个人信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
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());
|
|
|
|
|
//组装批量保存信息
|
|
|
|
|
packageBatchSaveParam(personInfCustomFieldList,mainFormPersonFieldList,"-1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//组装员工信息
|
|
|
|
|
packageBatchSaveParam(employeeFieldList,customFieldList,fieldGroup.get(Constants.BASIC_INFORMATION));
|
|
|
|
|
packageBatchSaveParam(employeeFieldList,infcustomFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Map<Object, Object> customField:customFieldList){
|
|
|
|
|
List<Map<Object, Object>> list = mainFormBasicFieldList.stream().filter(e->e.get("dataKey").equals(customField.get("dataKey"))).collect(Collectors.toList());
|
|
|
|
|
if (list.size() == 0){
|
|
|
|
|
customField.put("formId",employeeFieldList.get(0).get("formId"));
|
|
|
|
|
customField.put("formTableId",employeeFieldList.get(0).get("formTableId"));
|
|
|
|
|
customField.put("groupId",fieldGroup.get(Constants.BASIC_INFORMATION));
|
|
|
|
|
customField.put("fieldId",idGeneratorService.generatorIds(1)[0]);
|
|
|
|
|
employeeFieldList.add(customField);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Map<Object, Object> formBasicField:mainFormBasicFieldList){
|
|
|
|
|
List<Map<Object, Object>> list = customFieldList.stream().filter(e->e.get("dataKey").equals(formBasicField.get("dataKey"))).collect(Collectors.toList());
|
|
|
|
|
if (list.size() == 0){
|
|
|
|
|
formBasicField.put("formId",personCustomFieldList.get(0).get("formId"));
|
|
|
|
|
formBasicField.put("formTableId",personCustomFieldList.get(0).get("formTableId"));
|
|
|
|
|
formBasicField.put("groupId","-1");
|
|
|
|
|
formBasicField.put("fieldId",idGeneratorService.generatorIds(1)[0]);
|
|
|
|
|
personCustomFieldList.add(formBasicField);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
log.error("employeeFieldList : [{}]",employeeFieldList);
|
|
|
|
|
log.error("personCustomFieldList : [{}]",personCustomFieldList);
|
|
|
|
|
log.error("personInfCustomFieldList : [{}]",personInfCustomFieldList);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量保存
|
|
|
|
@ -227,49 +220,176 @@ 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=?";
|
|
|
|
|
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee_form_id));
|
|
|
|
|
FormFieldManageParam saveEmployeeEntity = new FormFieldManageParam();
|
|
|
|
|
saveEmployeeEntity.setFormId(Long.valueOf(employee_form_id));
|
|
|
|
|
saveEmployeeEntity.setModule(ModuleSource.ebuilderform);
|
|
|
|
|
saveEmployeeEntity.setJsonObjList(getJsonObjList(employeeFieldList));
|
|
|
|
|
List<FormTableDto> forms = Lists.newArrayList();
|
|
|
|
|
for (Map<String, Object> map:dataList){
|
|
|
|
|
FormTableDto formTableDto = new FormTableDto();
|
|
|
|
|
formTableDto.setDataCount(1);
|
|
|
|
|
formTableDto.setDataKey(map.get("data_key").toString());
|
|
|
|
|
if (map.get("delete_type").equals("0")){
|
|
|
|
|
formTableDto.setDelete(false);
|
|
|
|
|
formTableDto.setDeleteType(false);
|
|
|
|
|
}else {
|
|
|
|
|
formTableDto.setDelete(true);
|
|
|
|
|
formTableDto.setDeleteType(true);
|
|
|
|
|
}
|
|
|
|
|
formTableDto.setDescribe(map.get("describe").toString());
|
|
|
|
|
formTableDto.setEditTable(true);
|
|
|
|
|
formTableDto.setFormTableId(Long.valueOf(map.get("formtableid").toString()));
|
|
|
|
|
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.setTableType(FormTableType.MAIN);
|
|
|
|
|
formTableDto.setOrder(CommonUtils.null2String(map.get("show_order")));
|
|
|
|
|
forms.add(formTableDto);
|
|
|
|
|
List<String> errorMessage = Lists.newArrayList();
|
|
|
|
|
WeaResult<Map<String, Object>> result = batchSaveInformation(employee_form_id,employeeFieldList,dataList,ModuleSource.ebuilderform,null,null);
|
|
|
|
|
if (result.getCode() != 200){
|
|
|
|
|
errorMessage.add("员工信息表"+result.getMsg());
|
|
|
|
|
}
|
|
|
|
|
saveEmployeeEntity.setForms(forms);
|
|
|
|
|
WeaResult<Map<String, Object>>result = batchSaveFormField(saveEmployeeEntity);
|
|
|
|
|
|
|
|
|
|
log.error("save saveEmployeeEntity : [{}]",gson.toJson(result));
|
|
|
|
|
//保存人力资源-基本信息
|
|
|
|
|
Map<String, Object> customParam = Maps.newHashMap();
|
|
|
|
|
customParam.put("formId",personCustomfieldFormid);
|
|
|
|
|
WeaResult<Map<String, Object>> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,null);
|
|
|
|
|
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,null);
|
|
|
|
|
if (result3.getCode() != 200){
|
|
|
|
|
errorMessage.add("人力资源个人信息自定义表"+result3.getMsg());
|
|
|
|
|
}
|
|
|
|
|
return errorMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> synchronousFieldByEmployee(SimpleEmployee employee) {
|
|
|
|
|
String sql = "select form_id from form_table where table_name=? and delete_type='0'";
|
|
|
|
|
List<String> paramList = Lists.newArrayList();
|
|
|
|
|
paramList.add(Constants.EMPLOYEE_INFORMATION);
|
|
|
|
|
String employee_form_id = CommonUtils.null2String(databaseUtils.getSqlList(sql,paramList).get(0).get("form_id"));
|
|
|
|
|
|
|
|
|
|
sql = "select id,module from FORM where (module='hrm' and ownership='personal') or module='hruserinfo'";
|
|
|
|
|
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql);
|
|
|
|
|
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 personInfCustomFormid=personFormMap.get("hrm");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> formIdParamList = Lists.newArrayList();
|
|
|
|
|
formIdParamList.add(employee_form_id);
|
|
|
|
|
sql = "select id,group_name from form_field_group where form_id=? and delete_type='0'";
|
|
|
|
|
List<Map<String, Object>> fieldGroupList = databaseUtils.getSqlList(sql,formIdParamList);
|
|
|
|
|
Map<String,String> fieldGroup = fieldGroupList.stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
|
|
|
|
|
formIdParamList.add(personCustomfieldFormid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 员工信息表所有字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam ownEntity = getFieldManageParam(employee_form_id,ModuleSource.ebuilderform);
|
|
|
|
|
List<Map<Object, Object>> employeeFieldList = getFieldList(ownEntity,employee);
|
|
|
|
|
//员工信息主表-基本信息字段
|
|
|
|
|
List<Map<Object, Object>> mainFormBasicFieldList = employeeFieldList.stream().filter(e->fieldGroup.get(Constants.BASIC_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->fieldGroup.get(Constants.PERSONAL_INFORMATION).equals(e.get("groupId")) && "".equals(CommonUtils.null2String(e.get("subFormId")))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-基本信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam personCustomEntity = getFieldManageParam(personCustomfieldFormid,ModuleSource.hrm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<Object, Object>> personCustomFieldList = getFieldList(personCustomEntity,employee);
|
|
|
|
|
//组装批量保存信息
|
|
|
|
|
List<Long> personCustomids = packageBatchSaveParamHaveDelete(personCustomFieldList,mainFormBasicFieldList,"-1");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-个人信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam personInfCustomEntity = getFieldManageParam(personInfCustomFormid,ModuleSource.hruserinfo);
|
|
|
|
|
List<Map<Object, Object>> personInfCustomFieldList = getFieldList(personInfCustomEntity,employee);
|
|
|
|
|
//组装批量保存信息
|
|
|
|
|
List<Long> personInfCustomIds = packageBatchSaveParamHaveDelete(personInfCustomFieldList,mainFormPersonFieldList,"-1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.error("personCustomFieldList : [{}]",personCustomFieldList);
|
|
|
|
|
log.error("personInfCustomFieldList : [{}]",personInfCustomFieldList);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量保存
|
|
|
|
|
*/
|
|
|
|
|
List<String> errorMessage = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存人力资源-基本信息
|
|
|
|
|
FormFieldManageParam savePersonCustomEntiy = new FormFieldManageParam();
|
|
|
|
|
savePersonCustomEntiy.setFormId(Long.valueOf(personCustomfieldFormid));
|
|
|
|
|
savePersonCustomEntiy.setModule(ModuleSource.hrm);
|
|
|
|
|
savePersonCustomEntiy.setJsonObjList(getJsonObjList(personCustomFieldList));
|
|
|
|
|
Map<String, Object> customParam = Maps.newHashMap();
|
|
|
|
|
customParam.put("formId",personCustomfieldFormid);
|
|
|
|
|
savePersonCustomEntiy.setCustomParam(customParam);
|
|
|
|
|
WeaResult<Map<String, Object>> result2 = batchSaveFormField(savePersonCustomEntiy);
|
|
|
|
|
log.error("save PersonCustom : [{}]",gson.toJson(result2));
|
|
|
|
|
WeaResult<Map<String, Object>> result2 = batchSaveInformation(personCustomfieldFormid,personCustomFieldList,null,ModuleSource.hrm,customParam,personCustomids);
|
|
|
|
|
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);
|
|
|
|
|
if (result3.getCode() != 200){
|
|
|
|
|
errorMessage.add("个人信息表"+result3.getMsg());
|
|
|
|
|
}
|
|
|
|
|
return errorMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> synchronousFieldByHrm(SimpleEmployee employee) {
|
|
|
|
|
String sql = "select form_id from form_table where table_name=? and delete_type='0'";
|
|
|
|
|
List<String> paramList = Lists.newArrayList();
|
|
|
|
|
paramList.add(Constants.EMPLOYEE_INFORMATION);
|
|
|
|
|
String employee_form_id = CommonUtils.null2String(databaseUtils.getSqlList(sql,paramList).get(0).get("form_id"));
|
|
|
|
|
|
|
|
|
|
sql = "select id,module from FORM where (module='hrm' and ownership='personal') or module='hruserinfo'";
|
|
|
|
|
List<Map<String, Object>> personFormList = databaseUtils.getSqlList(sql);
|
|
|
|
|
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 personInfCustomFormid=personFormMap.get("hrm");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> formIdParamList = Lists.newArrayList();
|
|
|
|
|
formIdParamList.add(employee_form_id);
|
|
|
|
|
sql = "select id,group_name from form_field_group where form_id=? and delete_type='0'";
|
|
|
|
|
List<Map<String, Object>> fieldGroupList = databaseUtils.getSqlList(sql,formIdParamList);
|
|
|
|
|
Map<String,String> fieldGroup = fieldGroupList.stream().collect(Collectors.toMap(e->e.get("group_name").toString(),e->e.get("id").toString()));
|
|
|
|
|
formIdParamList.add(personCustomfieldFormid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 员工信息表所有字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam ownEntity = getFieldManageParam(employee_form_id,ModuleSource.ebuilderform);
|
|
|
|
|
List<Map<Object, Object>> employeeFieldList = getFieldList(ownEntity,employee);
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-基本信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
FieldManageParam personCustomEntity = getFieldManageParam(personCustomfieldFormid,ModuleSource.hrm);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-个人信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
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<Long> deleteIds = packageBatchSaveParamHaveDelete(employeeFieldList,customFieldList,fieldGroup.get(Constants.BASIC_INFORMATION));
|
|
|
|
|
deleteIds.addAll(packageBatchSaveParamHaveDelete(employeeFieldList,infcustomFieldList,fieldGroup.get(Constants.PERSONAL_INFORMATION)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.error("employeeFieldList : [{}]",employeeFieldList);
|
|
|
|
|
log.error("personCustomFieldList : [{}]",personCustomFieldList);
|
|
|
|
|
log.error("personInfCustomFieldList : [{}]",personInfCustomFieldList);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量保存
|
|
|
|
|
*/
|
|
|
|
|
//员工信息表
|
|
|
|
|
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=?";
|
|
|
|
|
List<Map<String, Object>> dataList = databaseUtils.getSqlList(sql,CommonUtils.getParamList(employee_form_id));
|
|
|
|
|
List<String> errorMessage = Lists.newArrayList();
|
|
|
|
|
WeaResult<Map<String, Object>> result = batchSaveInformation(employee_form_id,employeeFieldList,dataList,ModuleSource.ebuilderform,null,deleteIds);
|
|
|
|
|
if (result.getCode() != 200){
|
|
|
|
|
errorMessage.add("员工信息表"+result.getMsg());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return errorMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -283,6 +403,7 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
|
|
|
|
|
return (List<Map<Object, Object>>)resultMap.get("data");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量保存
|
|
|
|
|
* @param entity
|
|
|
|
@ -300,4 +421,122 @@ public class EmployeeInformationServiceImpl implements EmployeeInformationServic
|
|
|
|
|
}
|
|
|
|
|
return josnObjList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FieldManageParam getFieldManageParam(String formid,ModuleSource moduleSource){
|
|
|
|
|
FieldManageParam entity = new FieldManageParam();
|
|
|
|
|
entity.setFormId(Long.valueOf(formid));
|
|
|
|
|
entity.setModule(moduleSource);
|
|
|
|
|
entity.setNeedDataCount(true);
|
|
|
|
|
entity.setNeedPanelField(true);
|
|
|
|
|
return entity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 组装批量保存参数
|
|
|
|
|
* @param packageList
|
|
|
|
|
* @param conditionList
|
|
|
|
|
* @param groupId
|
|
|
|
|
*/
|
|
|
|
|
public void packageBatchSaveParam(List<Map<Object, Object>> packageList,List<Map<Object, Object>> conditionList,String groupId){
|
|
|
|
|
for (Map<Object, Object> customField:conditionList){
|
|
|
|
|
List<Map<Object, Object>> list = packageList.stream().filter(e->e.get("dataKey").equals(customField.get("dataKey"))).collect(Collectors.toList());
|
|
|
|
|
if (list.size() == 0){
|
|
|
|
|
Map<Object, Object> map = Maps.newHashMap();
|
|
|
|
|
map.putAll(customField);
|
|
|
|
|
map.put("formId",packageList.get(0).get("formId"));
|
|
|
|
|
map.put("formTableId",packageList.get(0).get("formTableId"));
|
|
|
|
|
map.put("groupId",groupId);
|
|
|
|
|
map.put("fieldId",idGeneratorService.generatorIds(1)[0]);
|
|
|
|
|
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){
|
|
|
|
|
option.put("selectionId","");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
packageList.add(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 组装批量保存参数
|
|
|
|
|
* @param packageList
|
|
|
|
|
* @param conditionList
|
|
|
|
|
* @param groupId
|
|
|
|
|
*/
|
|
|
|
|
public List<Long> packageBatchSaveParamHaveDelete(List<Map<Object, Object>> packageList,List<Map<Object, Object>> conditionList,String groupId){
|
|
|
|
|
for (Map<Object, Object> customField:conditionList){
|
|
|
|
|
List<Map<Object, Object>> list = packageList.stream().filter(e->e.get("dataKey").equals(customField.get("dataKey"))).collect(Collectors.toList());
|
|
|
|
|
if (list.size() == 0){
|
|
|
|
|
Map<Object, Object> map = Maps.newHashMap();
|
|
|
|
|
map.putAll(customField);
|
|
|
|
|
map.put("formId",packageList.get(0).get("formId"));
|
|
|
|
|
map.put("formTableId",packageList.get(0).get("formTableId"));
|
|
|
|
|
map.put("groupId",groupId);
|
|
|
|
|
map.put("fieldId",idGeneratorService.generatorIds(1)[0]);
|
|
|
|
|
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){
|
|
|
|
|
option.put("selectionId","");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
packageList.add(map);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Long> ids = Lists.newArrayList();
|
|
|
|
|
for (int i=0;i<packageList.size();i++){
|
|
|
|
|
Map<Object, Object> packageMap = packageList.get(i);
|
|
|
|
|
List<Map<Object, Object>> list = conditionList.stream().filter(e->e.get("dataKey").equals(packageMap.get("dataKey"))).collect(Collectors.toList());
|
|
|
|
|
if (list.size() == 0){
|
|
|
|
|
ids.add(Long.valueOf(packageMap.get("fieldId").toString()));
|
|
|
|
|
packageList.remove(i);
|
|
|
|
|
i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ids;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量保存
|
|
|
|
|
* @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){
|
|
|
|
|
FormFieldManageParam saveEmployeeEntity = new FormFieldManageParam();
|
|
|
|
|
saveEmployeeEntity.setFormId(Long.valueOf(formid));
|
|
|
|
|
saveEmployeeEntity.setModule(moduleSource);
|
|
|
|
|
saveEmployeeEntity.setJsonObjList(getJsonObjList(formFieldList));
|
|
|
|
|
List<FormTableDto> forms = Lists.newArrayList();
|
|
|
|
|
if (detailFormList != null){
|
|
|
|
|
for (Map<String, Object> map:detailFormList){
|
|
|
|
|
FormTableDto formTableDto = new FormTableDto();
|
|
|
|
|
formTableDto.setDataCount(1);
|
|
|
|
|
formTableDto.setDataKey(map.get("data_key").toString());
|
|
|
|
|
if (map.get("delete_type").equals("0")){
|
|
|
|
|
formTableDto.setDelete(false);
|
|
|
|
|
formTableDto.setDeleteType(false);
|
|
|
|
|
}else {
|
|
|
|
|
formTableDto.setDelete(true);
|
|
|
|
|
formTableDto.setDeleteType(true);
|
|
|
|
|
}
|
|
|
|
|
formTableDto.setDescribe(map.get("describe").toString());
|
|
|
|
|
formTableDto.setEditTable(true);
|
|
|
|
|
formTableDto.setFormTableId(Long.valueOf(map.get("formtableid").toString()));
|
|
|
|
|
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.setTableType(FormTableType.MAIN);
|
|
|
|
|
formTableDto.setOrder(CommonUtils.null2String(map.get("show_order")));
|
|
|
|
|
forms.add(formTableDto);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
saveEmployeeEntity.setIds(ids);
|
|
|
|
|
saveEmployeeEntity.setForms(forms);
|
|
|
|
|
saveEmployeeEntity.setCustomParam(customParam);
|
|
|
|
|
WeaResult<Map<String, Object>>result = batchSaveFormField(saveEmployeeEntity);
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
log.error("batchSaveInformation result :[{}]",gson.toJson(result));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|