Compare commits

..

2 Commits

@ -0,0 +1,36 @@
package com.weaver.seconddev.jcl.common;
import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.jcl.common.service.CommonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
@Slf4j
@RestController
@RequestMapping("/api/secondev/jcl/common")
public class JclCommonController {
@Autowired
CommonService commonService;
/**
* ididid
* @return
*/
@WeaPermission(publicPermission = true)
@GetMapping("/getTableContainInformation")
@ResponseBody
public WeaResult<Map<String, Object>> getTableContainInformation(@RequestParam("tableNames") String tableNames){
Map<String, Object> tableInfomationmap = commonService.getTableContainInformation(tableNames);
return WeaResult.success(tableInfomationmap);
}
}

@ -6,4 +6,6 @@ public interface CommonService {
Map<String, Object> updateCommon(Map<String,Object> param);
Map<String, Object> insertCommon(Map<String,Object> param);
Map<String, Object> getTableContainInformation(String tableNames);
}

@ -1,6 +1,8 @@
package com.weaver.seconddev.jcl.common.service.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.weaver.seconddev.jcl.common.service.CommonService;
import com.weaver.seconddev.jcl.organization.util.CommonUtils;
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils;
@ -10,6 +12,8 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -61,4 +65,35 @@ public class CommonServiceImpl implements CommonService {
log.error("needInsertDate: [{}]",dataList);
return databaseUtils.execute(insertSql,dataList);
}
@Override
public Map<String, Object> getTableContainInformation(String tableNames) {
String[] tableNameArr = tableNames.split(",");
List<String> list = Lists.newArrayList();
for (String tableName:tableNameArr){
list.add("'"+tableName+"'");
}
String sql = "select id,app_id,form_id,table_name from ebdf_obj where table_name in ("+String.join(",",list)+") and delete_type='0'";
log.error("getTableContainInformation sql "+sql);
List<Map<String, String>> objList = CommonUtils.convertList(databaseUtils.getSqlList(sql));
Set<String> formIdList = objList.stream().map(e->"'"+e.get("form_id").toString()+"'").collect(Collectors.toSet());
sql = "select id,name,form_id from form_layout_multiple where form_id in ("+String.join(",",formIdList)+") and delete_type='0'";
log.error("getTableContainInformation sql "+sql);
List<Map<String, String>> multipleIds = CommonUtils.convertList(databaseUtils.getSqlList(sql));
log.error("multipleIds [{}] "+multipleIds);
Map<String,Object> resultMap = Maps.newHashMap();
Gson gson = new Gson();
for (Map<String, String> objMap:objList){
String form_id = CommonUtils.null2String(objMap.get("form_id"));
log.error("form_id [{}] "+form_id);
List<Map<String, String>> havemultipleIds = multipleIds.stream().filter(e->CommonUtils.null2String(e.get("form_id")).equals(form_id)).collect(Collectors.toList());
log.error("havemultipleIds [{}] "+havemultipleIds);
objMap.put("multiple",gson.toJson(havemultipleIds));
resultMap.put(objMap.get("table_name"),objMap);
}
return resultMap;
}
}

@ -2,6 +2,7 @@ package com.weaver.seconddev.jcl.organization.controller;
import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.seconddev.jcl.common.web.EmployeeCommonController;
import com.weaver.seconddev.jcl.organization.entity.Employee;
import com.weaver.seconddev.jcl.organization.entity.PendingEmployee;
@ -77,16 +78,53 @@ public class EmployeeInformationController extends EmployeeCommonController {
return actionMap;
}
/**
*
*
* @return
*/
@WeaPermission(publicPermission = true)
@Produces(MediaType.APPLICATION_JSON)
@GetMapping("/synchronousField")
public Map<String, Object> synchronousField(){
@ResponseBody
public WeaResult<Map<String, Object>> synchronousField(){
Map<String, Object> actionMap = new HashMap<>();
employeeInformationService.synchronousField(this.getCurrentUser());
List<String> errorMessage = employeeInformationService.synchronousField(this.getCurrentUser());
if (errorMessage.size() > 0){
return WeaResult.fail(errorMessage.toString(),true);
}else {
return WeaResult.success(actionMap);
}
}
return actionMap;
/**
*
* @return
*/
@WeaPermission(publicPermission = true)
@GetMapping("/synchronousFieldByEmployee")
@ResponseBody
public WeaResult<Map<String, Object>> synchronousFieldByEmployee(){
Map<String, Object> actionMap = new HashMap<>();
List<String> errorMessage = employeeInformationService.synchronousFieldByEmployee(this.getCurrentUser());
if (errorMessage.size() > 0){
return WeaResult.fail(errorMessage.toString(),true);
}else {
return WeaResult.success(actionMap);
}
}
/**
*
* @return
*/
@WeaPermission(publicPermission = true)
@GetMapping("/synchronousFieldByHrm")
@ResponseBody
public WeaResult<Map<String, Object>> synchronousFieldByHrm(){
Map<String, Object> actionMap = new HashMap<>();
List<String> errorMessage = employeeInformationService.synchronousFieldByHrm(this.getCurrentUser());
if (errorMessage.size() > 0){
return WeaResult.fail(errorMessage.toString(),true);
}else {
return WeaResult.success(actionMap);
}
}
}

@ -0,0 +1,31 @@
package com.weaver.seconddev.jcl.organization.esb;
import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.jcl.organization.service.EmployeeInformationService;
import com.weaver.teams.domain.user.SimpleEmployee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
*
*/
@Service("synchronousFieldInitialization_jcl")
public class SynchronousFieldInitialization implements EsbServerlessRpcRemoteInterface {
@Autowired
EmployeeInformationService employeeInformationService;
@Override
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
List<String> errorList = employeeInformationService.synchronousField(new SimpleEmployee());
if (errorList.size() > 0){
return WeaResult.fail(errorList.toString(),true);
}else {
return WeaResult.success();
}
}
}

@ -0,0 +1,23 @@
package com.weaver.seconddev.jcl.organization.importAdvice;
import com.google.gson.Gson;
import com.weaver.ebuilder.form.client.service.batch.advice.ImportDataAdvice;
import com.weaver.ebuilder.form.client.service.batch.dto.BaseImportDataAdviceDto;
import com.weaver.ebuilder.form.client.service.batch.dto.DataForImportEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Slf4j
public class ImportEmployeeAdvice implements ImportDataAdvice {
@Override
public void dataAdvice(BaseImportDataAdviceDto req) {
List<List<DataForImportEntity>> dataList = req.getDataList();
Gson gson = new Gson();
log.error("ImportEmployeeAdvice info :[{}] ",gson.toJson(dataList));
}
}

@ -10,13 +10,31 @@ import java.util.Map;
public interface EmployeeInformationService {
/**
*
* @param employee
* @return
*/
List<Map<String, Object>> getInformation(Employee employee);
/**
*
* @param employee
* @return
*/
List<Map<String, Object>> getPendingEmployment(Employee employee);
void updatePendingEmploy(PendingEmployee pendingEmployee);
void synchronousField(SimpleEmployee employee);
/**
*
* @param employee
*/
List<String> synchronousField(SimpleEmployee employee);
List<String> synchronousFieldByEmployee(SimpleEmployee employee);
List<String> synchronousFieldByHrm(SimpleEmployee employee);
/**
*

@ -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);
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());
}
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);
//保存人力资源-基本信息
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;
}
saveEmployeeEntity.setForms(forms);
WeaResult<Map<String, Object>>result = batchSaveFormField(saveEmployeeEntity);
log.error("save saveEmployeeEntity : [{}]",gson.toJson(result));
@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;
}
}

@ -477,4 +477,16 @@ public class CommonUtils {
}
}
public static List<Map<String, String>> convertList(List<Map<String, Object>> objList){
List<Map<String, String>> resultList = Lists.newArrayList();
for (Map<String, Object> map:objList){
Map<String,String> resultMap = Maps.newHashMap();
for (Map.Entry<String, Object> entry :map.entrySet()){
resultMap.put(entry.getKey(),CommonUtils.null2String(entry.getValue()));
}
resultList.add(resultMap);
}
return resultList;
}
}

@ -14,5 +14,5 @@ public class Constants {
/**
*
*/
public static final String EMPLOYEE_INFORMATION="uf_ygxxglfzcswd";
public static final String EMPLOYEE_INFORMATION="uf_jcl_employee_information";
}

@ -343,6 +343,7 @@ public class DatabaseUtils {
return recordList;
}
/***
*
* @param sourceType

Loading…
Cancel
Save