|
|
|
|
@ -0,0 +1,867 @@
|
|
|
|
|
package com.weaver.seconddev.jcl.organization.esb.cbd;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
import com.weaver.common.base.entity.result.WeaResult;
|
|
|
|
|
import com.weaver.common.form.auth.FormAuthenticationService;
|
|
|
|
|
import com.weaver.common.form.dto.auth.FormAuthenticationDto;
|
|
|
|
|
import com.weaver.common.form.enums.auth.FormAuthenticationEnum;
|
|
|
|
|
import com.weaver.common.form.exception.FormException;
|
|
|
|
|
import com.weaver.common.form.fieldmanage.service.FormFieldManageService;
|
|
|
|
|
import com.weaver.common.form.metadata.ModuleSource;
|
|
|
|
|
import com.weaver.common.form.param.FieldManageParam;
|
|
|
|
|
import com.weaver.common.form.param.auth.FormAuthenticationParam;
|
|
|
|
|
import com.weaver.common.i18n.label.SystemEnv;
|
|
|
|
|
import com.weaver.common.mybatis.util.DatabaseUtil;
|
|
|
|
|
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
|
|
|
|
import com.weaver.form.controller.manage.FormFieldManageController;
|
|
|
|
|
import com.weaver.seconddev.jcl.organization.util.CommonUtils;
|
|
|
|
|
import com.weaver.seconddev.jcl.organization.util.Constants;
|
|
|
|
|
import com.weaver.seconddev.jcl.organization.util.DatabaseUtils;
|
|
|
|
|
import com.weaver.seconddev.jcl.organization.util.RecruitModuleUtils;
|
|
|
|
|
import com.weaver.teams.domain.user.SimpleEmployee;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @use:初始化组织人员信息到员工信息表-茶白道
|
|
|
|
|
* @date 2025年7月30日
|
|
|
|
|
* @author xuxy
|
|
|
|
|
*/
|
|
|
|
|
@Service("SyncAllYgxxInfoOfOrg_cbd")
|
|
|
|
|
public class SyncAllYgxxInfoOfOrg_cbd implements EsbServerlessRpcRemoteInterface {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private DatabaseUtils databaseUtils;
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(SyncAllYgxxInfoOfOrg_cbd.class);
|
|
|
|
|
|
|
|
|
|
private static String e10_Other_Business = "e10_other_business.";
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private FormAuthenticationService formAuthenticationService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private FormFieldManageController fieldManageController;
|
|
|
|
|
@Autowired
|
|
|
|
|
RecruitModuleUtils recruitModuleUtils;
|
|
|
|
|
private static String nowData;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
|
|
|
|
int code = 200;
|
|
|
|
|
int code2 = 200;
|
|
|
|
|
int code3 = 200;
|
|
|
|
|
int code4 = 200;
|
|
|
|
|
SimpleEmployee employee = new SimpleEmployee();
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
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"));
|
|
|
|
|
log.error("employee_form_id : [{}]",employee_form_id);
|
|
|
|
|
String tenant_key = RecruitModuleUtils.getCurrentTenantKey();
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.tenant_key:{}", tenant_key);
|
|
|
|
|
sql = "select id,module from eteams.FORM where module='hrm' and ownership='personal' and delete_type='0' and TENANT_KEY= '"+tenant_key+"'" +
|
|
|
|
|
" union all select id,module from e10_other_business.FORM where module='hruserinfo' and delete_type='0' and TENANT_KEY= '"+tenant_key+"'";
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.ecology10.FORM:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> personFormList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.personFormList:{}", personFormList);
|
|
|
|
|
|
|
|
|
|
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("hruserinfo");
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.personCustomfieldFormid:{}", personCustomfieldFormid);
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.personInfCustomFormid:{}", personInfCustomFormid);
|
|
|
|
|
/**
|
|
|
|
|
* 人力资源-基本信息自定义字段
|
|
|
|
|
*/
|
|
|
|
|
// 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());
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.personCustomFieldList:{}", personCustomFieldList);
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.customFieldList:{}", customFieldList);
|
|
|
|
|
// List<String> customFieldDataKeys = customFieldList.stream()
|
|
|
|
|
// .map(map -> (String) map.get("dataKey"))
|
|
|
|
|
// .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());
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.personInfCustomFieldList:{}", personInfCustomFieldList);
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.infcustomFieldList:{}", infcustomFieldList);
|
|
|
|
|
// List<String> infcustomFieldDataKeys = infcustomFieldList.stream()
|
|
|
|
|
// .map(map -> (String) map.get("dataKey"))
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//当前时间
|
|
|
|
|
// 获取当前时间
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
// 定义日期时间格式化器
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// 格式化当前日期
|
|
|
|
|
nowData = now.format(formatter);
|
|
|
|
|
log.error("resultCalculAtion.nowData:{}", nowData);
|
|
|
|
|
// String tableName = "ft_"+personCustomfieldFormid;
|
|
|
|
|
// String tableUserName = "ft_"+personInfCustomFormid;
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.tableName:{},tableUserName:{}", tableName,tableUserName);
|
|
|
|
|
//茶白道专属
|
|
|
|
|
String tableName = "eteams.ft_"+personCustomfieldFormid;
|
|
|
|
|
String tableUserName = e10_Other_Business+"ft_"+personInfCustomFormid;
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.tableName:{}", tableName);
|
|
|
|
|
/**
|
|
|
|
|
* 查询组织表信息:包含eteams.employee,基础信息自定义表,hr_userinfo,个人信息自定义表,明细表
|
|
|
|
|
*/
|
|
|
|
|
// sql = "select * from eteams.employee where delete_type='0' ";
|
|
|
|
|
// Map<String, Object> rs2 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
// List<Map<String, Object>> employee_infos = databaseUtils.getDataSourceList(rs2);
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.employee_infos:{}", employee_infos);
|
|
|
|
|
|
|
|
|
|
sql = "select * from "+tableName+" where delete_type='0' ";
|
|
|
|
|
Map<String, Object> rs3 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> employeeCustomize_infos = databaseUtils.getDataSourceList(rs3);
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.employeeCustomize_infos00000000:{}", employeeCustomize_infos);
|
|
|
|
|
|
|
|
|
|
// sql = "select * from ecology10.hr_userinfo where delete_type='0' ";
|
|
|
|
|
// Map<String, Object> rs4 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
// List<Map<String, Object>> user_infos = databaseUtils.getDataSourceList(rs4);
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.user_infos:{}", user_infos);
|
|
|
|
|
|
|
|
|
|
sql = "select * from "+tableUserName+" where delete_type='0' ";
|
|
|
|
|
Map<String, Object> rs5 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> userCustomize_infos = databaseUtils.getDataSourceList(rs5);
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.userCustomize_infos:{}", userCustomize_infos);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 多租户查询主表名称
|
|
|
|
|
*/
|
|
|
|
|
Map<String, String> ebTableInfo = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", "uf_jcl_employee_information_tag");
|
|
|
|
|
String objId = ebTableInfo.get("objId");
|
|
|
|
|
String ebTableName = ebTableInfo.get("table_name");
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.ebTableName:{}", ebTableName);
|
|
|
|
|
|
|
|
|
|
//1.查询uf_jcl_employee_information表字段
|
|
|
|
|
List<String> listOfEmployee = getTableColumnsOfTableName(ebTableName);
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.listOfEmployee:{}", listOfEmployee);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 映射表数据
|
|
|
|
|
*/
|
|
|
|
|
Map<String, Object> mapping = getMapping();
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.mapping:{}", mapping);
|
|
|
|
|
// for (Map<String, Object> employee_info : employee_infos) {
|
|
|
|
|
// String zzid = employee_info.get("id") != null ? String.valueOf(employee_info.get("id").toString()) : "";
|
|
|
|
|
// //关联组织员工不为空,操作
|
|
|
|
|
// if(StringUtils.isNotBlank(zzid)){
|
|
|
|
|
// cleanUpTime(employee_info);
|
|
|
|
|
// // 遍历并移除(不包含则移除掉)
|
|
|
|
|
// Map<String, Object> employee_new = new HashMap<>();
|
|
|
|
|
// for (String key : listOfEmployee) {
|
|
|
|
|
// //基础信息暂不更新
|
|
|
|
|
//// if (containsKeyIgnoreCase(employee_info,key)) {
|
|
|
|
|
//// if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
//// employee_new.put(key,"0");
|
|
|
|
|
//// String ignoreCase = getIgnoreCase(employee_info, key);
|
|
|
|
|
//// log.error("SyncAllYgxxInfoOfOrg.delete_type:{}", ignoreCase);
|
|
|
|
|
//// }else{
|
|
|
|
|
//// employee_new.put(key,getIgnoreCase(employee_info, key));
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
// //补充映射表字段
|
|
|
|
|
// if (containsKeyIgnoreCase(mapping,key)) {
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.mapping.containsKey3232:{}", key);
|
|
|
|
|
// String s = getIgnoreCase(mapping,key);
|
|
|
|
|
// String ignoreCase = getIgnoreCase(employee_info, s);
|
|
|
|
|
// employee_new.put(key,ignoreCase);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// //key为id的要移除掉,防止串改组织人员id 导致对应不上员工关系表的:关联组织人员id
|
|
|
|
|
// employee_new.remove("id");
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.employee_info:{}", employee_info);
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.employee_new:{}", employee_new);
|
|
|
|
|
// //更新employee表数据
|
|
|
|
|
// code = update("uf_jcl_employee_information", employee_new, "id", zzid);
|
|
|
|
|
// }
|
|
|
|
|
// /**
|
|
|
|
|
// * 同步更新明细表
|
|
|
|
|
// */
|
|
|
|
|
// //updateAllYgxxDetailInfo(zzid);
|
|
|
|
|
// }
|
|
|
|
|
/**
|
|
|
|
|
* 基本信息自定义表
|
|
|
|
|
*/
|
|
|
|
|
for (Map<String, Object> customize_info : employeeCustomize_infos) {
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.employeeCustomize_infos:{11111111111111111}");
|
|
|
|
|
// 遍历并移除(不包含则移除掉)
|
|
|
|
|
String form_data_id = getIgnoreCase(customize_info, "form_data_id") != null ? getIgnoreCase(customize_info, "form_data_id") : "";
|
|
|
|
|
//根据form_data_id关联查询基本信息表id
|
|
|
|
|
String employeeId = getEmployeeId(form_data_id);
|
|
|
|
|
if(StringUtils.isNotBlank(form_data_id)){
|
|
|
|
|
Map<String, Object> employeeCustomize_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
|
|
|
|
for (String key : listOfEmployee) {
|
|
|
|
|
if (containsKeyIgnoreCase(customize_info,key)&&getIgnoreCase(customize_info, key)!=null) {
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.key111:{}", key);
|
|
|
|
|
employeeCustomize_new.put(key,getIgnoreCase(customize_info, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//清理一下时间
|
|
|
|
|
//cleanUpTime(employeeCustomize_new);
|
|
|
|
|
employeeCustomize_new.remove("id");
|
|
|
|
|
employeeCustomize_new.remove("form_data_id");
|
|
|
|
|
employeeCustomize_new.remove("delete_type");
|
|
|
|
|
employeeCustomize_new.remove("IS_DELETE");
|
|
|
|
|
employeeCustomize_new.remove("ft_status");
|
|
|
|
|
employeeCustomize_new.remove("UPDATE_TIME");
|
|
|
|
|
employeeCustomize_new.remove("create_time");
|
|
|
|
|
//更新数据到基础信息表的自定义表
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.employeeCustomize_new:{}", employeeCustomize_new);
|
|
|
|
|
if(StringUtils.isNotBlank(employeeId)){
|
|
|
|
|
code2 = update(ebTableName,employeeCustomize_new,"id",employeeId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询个人信息表
|
|
|
|
|
*/
|
|
|
|
|
// for (Map<String, Object> user_info : user_infos) {
|
|
|
|
|
// // 遍历并移除(不包含则移除掉)
|
|
|
|
|
// String userid = getIgnoreCase(user_info, "user") != null ? getIgnoreCase(user_info, "user") : "";
|
|
|
|
|
// if(StringUtils.isNotBlank(userid)){
|
|
|
|
|
// Map<String, Object> userInfo_new = new HashMap<>();
|
|
|
|
|
// for (String key : listOfEmployee) {
|
|
|
|
|
// if (containsKeyIgnoreCase(user_info,key)) {
|
|
|
|
|
// if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
// userInfo_new.put(key,"0");
|
|
|
|
|
// }else{
|
|
|
|
|
// userInfo_new.put(key,getIgnoreCase(user_info, key));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// //补充映射表字段
|
|
|
|
|
// if (containsKeyIgnoreCase(mapping,key)) {
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.mapping.containsKey3232:{}", key);
|
|
|
|
|
// String s = getIgnoreCase(mapping,key);
|
|
|
|
|
// String ignoreCase = getIgnoreCase(user_info, s);
|
|
|
|
|
// userInfo_new.put(key,ignoreCase);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// //清理一下时间
|
|
|
|
|
// cleanUpTime(userInfo_new);
|
|
|
|
|
// //更新个人信息表
|
|
|
|
|
// log.error("SyncAllYgxxInfoOfOrg.userInfo_new:{}", userInfo_new);
|
|
|
|
|
// code3 = update("uf_jcl_employee_information",userInfo_new,"id",userid);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 个人信息自定义表
|
|
|
|
|
*/
|
|
|
|
|
for (Map<String, Object> userCustomize : userCustomize_infos) {
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.employeeCustomize_infos:{2222222222222222}");
|
|
|
|
|
// 遍历并移除(不包含则移除掉)
|
|
|
|
|
String form_data_id = getIgnoreCase(userCustomize, "form_data_id") != null ? getIgnoreCase(userCustomize, "form_data_id") : "";
|
|
|
|
|
//根据form_data_id关联查询基本信息表id
|
|
|
|
|
String userinfoId = getUserinfoId(form_data_id);
|
|
|
|
|
if(StringUtils.isNotBlank(form_data_id)){
|
|
|
|
|
Map<String, Object> userCustomize_new = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
|
|
|
|
for (String key : listOfEmployee) {
|
|
|
|
|
if (containsKeyIgnoreCase(userCustomize,key)&&getIgnoreCase(userCustomize, key)!=null) {
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.key222:{}", key);
|
|
|
|
|
userCustomize_new.put(key,getIgnoreCase(userCustomize, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//清理一下时间
|
|
|
|
|
//cleanUpTime(userCustomize_new);
|
|
|
|
|
userCustomize_new.remove("id");
|
|
|
|
|
userCustomize_new.remove("form_data_id");
|
|
|
|
|
userCustomize_new.remove("delete_type");
|
|
|
|
|
userCustomize_new.remove("IS_DELETE");
|
|
|
|
|
userCustomize_new.remove("ft_status");
|
|
|
|
|
userCustomize_new.remove("UPDATE_TIME");
|
|
|
|
|
userCustomize_new.remove("create_time");
|
|
|
|
|
//更新数据到基础信息表的自定义表
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.userCustomize_new:{}", userCustomize_new);
|
|
|
|
|
if(StringUtils.isNotBlank(userinfoId)){
|
|
|
|
|
code4 = update(ebTableName,userCustomize_new,"id",userinfoId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//判断新增/更新数据是否都成功
|
|
|
|
|
if(code2==200&&code4==200){
|
|
|
|
|
result.put("code",200);
|
|
|
|
|
result.put("msg","同步组织数据成功!");
|
|
|
|
|
}
|
|
|
|
|
log.error("SyncAllYgxxInfoOfOrg.result:"+result);
|
|
|
|
|
return WeaResult.success(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询个人信息表表user
|
|
|
|
|
* @param form_data_id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String getUserinfoId(String form_data_id) {
|
|
|
|
|
String userid = "";
|
|
|
|
|
String sql = "SELECT "+ "USER"+" FROM hr_userinfo WHERE FORM_DATA = '" + form_data_id+ "' and delete_type=0";
|
|
|
|
|
log.error("getUserinfoId.sql:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getUserinfoId.recordList:{}", recordList);
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
Object formdataValue = recordList.get(0).get("user");
|
|
|
|
|
if (formdataValue instanceof Long) {
|
|
|
|
|
userid = String.valueOf(formdataValue); // 转换为 String
|
|
|
|
|
} else if (formdataValue instanceof String) {
|
|
|
|
|
userid = (String) formdataValue; // 如果是 String 类型,直接赋值
|
|
|
|
|
}else {
|
|
|
|
|
userid = String.valueOf(formdataValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return userid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询基本信息表id
|
|
|
|
|
* @param form_data_id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String getEmployeeId(String form_data_id) {
|
|
|
|
|
String employeeid = "";
|
|
|
|
|
String sql = "SELECT id FROM eteams.employee WHERE formdata = '" + form_data_id+ "' and delete_type=0";
|
|
|
|
|
log.error("getEmployeeId.sql:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getEmployeeId.recordList:{}", recordList);
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
Object formdataValue = recordList.get(0).get("id");
|
|
|
|
|
if (formdataValue instanceof Long) {
|
|
|
|
|
employeeid = String.valueOf(formdataValue); // 转换为 String
|
|
|
|
|
} else if (formdataValue instanceof String) {
|
|
|
|
|
employeeid = (String) formdataValue; // 如果是 String 类型,直接赋值
|
|
|
|
|
}else {
|
|
|
|
|
employeeid = String.valueOf(formdataValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return employeeid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询个人信息主表userid
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String getUserId(String form_data_id){
|
|
|
|
|
log.error("getUserId.form_data_id:{}", form_data_id);
|
|
|
|
|
String userid = "";
|
|
|
|
|
String sql = "select user from hr_userinfo where id = '" + form_data_id + "' and delete_type=0";
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getUserId.recordList:{}", recordList);
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
userid = String.valueOf(recordList.get(0).get("user"));
|
|
|
|
|
}
|
|
|
|
|
return userid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新所有员工信息明细表
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void updateAllYgxxDetailInfo(String zzid){
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.zzid:{}", zzid);
|
|
|
|
|
/**
|
|
|
|
|
* 工作履历表
|
|
|
|
|
* */
|
|
|
|
|
String gzsql = "select * from hr_employment_record where user_id = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> gzllInfo = getYgxxDetailInfo(gzsql);
|
|
|
|
|
List<String> listOfgzllColumns = getTableColumnsOfTableName("uf_jcl_emp_gzll");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.gzllInfo:{}", gzllInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfgzllColumns:{}", listOfgzllColumns);
|
|
|
|
|
for (Map<String, Object> map : gzllInfo) {
|
|
|
|
|
Map<String, Object> gzllInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfgzllColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
gzllInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
gzllInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新组织工作履历表
|
|
|
|
|
cleanUpTime(gzllInfo_new);
|
|
|
|
|
update("uf_jcl_emp_gzll",gzllInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 教育经历表
|
|
|
|
|
* */
|
|
|
|
|
String jysql = "select * from hr_education where employee_id = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> jyjlInfo = getYgxxDetailInfo(jysql);
|
|
|
|
|
List<String> listOfjyjlColumns = getTableColumnsOfTableName("uf_jcl_emp_jyjl");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.jyjlInfo:{}", jyjlInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfjyjlColumns:{}", listOfjyjlColumns);
|
|
|
|
|
for (Map<String, Object> map : jyjlInfo) {
|
|
|
|
|
Map<String, Object> jyjlInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfjyjlColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
jyjlInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
jyjlInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新教育经历表
|
|
|
|
|
cleanUpTime(jyjlInfo_new);
|
|
|
|
|
update("uf_jcl_emp_jyjl",jyjlInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 家庭信息表
|
|
|
|
|
* */
|
|
|
|
|
String jtxxsql = "select * from hr_family where employee_id = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> jtxxInfo = getYgxxDetailInfo(jtxxsql);
|
|
|
|
|
List<String> listOfjtxxColumns = getTableColumnsOfTableName("uf_jcl_emp_jtxx");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.jtxxInfo:{}", jtxxInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfjtxxColumns:{}", listOfjtxxColumns);
|
|
|
|
|
for (Map<String, Object> map : jtxxInfo) {
|
|
|
|
|
Map<String, Object> jtxxInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfjtxxColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
jtxxInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
jtxxInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新家庭信息表
|
|
|
|
|
cleanUpTime(jtxxInfo_new);
|
|
|
|
|
update("uf_jcl_emp_jtxx",jtxxInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 表彰与奖励
|
|
|
|
|
* */
|
|
|
|
|
String bzsql = "select * from hr_rewards_before where employeeid = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> bzInfo = getYgxxDetailInfo(bzsql);
|
|
|
|
|
List<String> listOfbzColumns = getTableColumnsOfTableName("uf_jcl_emp_bzyjl");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.bzInfo:{}", bzInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfbzColumns:{}", listOfbzColumns);
|
|
|
|
|
for (Map<String, Object> map : bzInfo) {
|
|
|
|
|
Map<String, Object> bzInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfbzColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
bzInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
bzInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新表彰表
|
|
|
|
|
cleanUpTime(bzInfo_new);
|
|
|
|
|
update("uf_jcl_emp_bzyjl",bzInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 培训经历
|
|
|
|
|
* */
|
|
|
|
|
String pxsql = "select * from hr_train where employee_id = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> pxInfo = getYgxxDetailInfo(pxsql);
|
|
|
|
|
List<String> listOfpxColumns = getTableColumnsOfTableName("uf_jcl_emp_pxjl");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.pxInfo:{}", pxInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfpxColumns:{}", listOfpxColumns);
|
|
|
|
|
for (Map<String, Object> map : pxInfo) {
|
|
|
|
|
Map<String, Object> pxInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfpxColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
pxInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
pxInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新培训表
|
|
|
|
|
cleanUpTime(pxInfo_new);
|
|
|
|
|
update("uf_jcl_emp_pxjl",pxInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 语言能力
|
|
|
|
|
* */
|
|
|
|
|
String yysql = "select * from hr_language where employee_id = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> yyInfo = getYgxxDetailInfo(yysql);
|
|
|
|
|
List<String> listOfyyColumns = getTableColumnsOfTableName("uf_jcl_emp_yynl");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.yyInfo:{}", yyInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfyyColumns:{}", listOfyyColumns);
|
|
|
|
|
for (Map<String, Object> map : yyInfo) {
|
|
|
|
|
Map<String, Object> yyInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfyyColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
yyInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
yyInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新语言能力表
|
|
|
|
|
cleanUpTime(yyInfo_new);
|
|
|
|
|
update("uf_jcl_emp_yynl",yyInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 权威机构资格
|
|
|
|
|
* */
|
|
|
|
|
String qwsql = "select * from hr_certification where employee_id = '" + zzid + "' and delete_type=0";
|
|
|
|
|
List<Map<String, Object>> qwInfo = getYgxxDetailInfo(qwsql);
|
|
|
|
|
List<String> listOfqwColumns = getTableColumnsOfTableName("uf_jcl_emp_qwjgzgrz");
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.qwInfo:{}", qwInfo);
|
|
|
|
|
log.error("updateAllYgxxDetailInfo.listOfqwColumns:{}", listOfqwColumns);
|
|
|
|
|
for (Map<String, Object> map : qwInfo) {
|
|
|
|
|
Map<String, Object> qwInfo_new = new HashMap<>();
|
|
|
|
|
for (String key : listOfqwColumns) {
|
|
|
|
|
if (containsKeyIgnoreCase(map,key)) {
|
|
|
|
|
if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){
|
|
|
|
|
qwInfo_new.put(key,"0");
|
|
|
|
|
}else{
|
|
|
|
|
qwInfo_new.put(key,getIgnoreCase(map, key));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新权威机构表
|
|
|
|
|
cleanUpTime(qwInfo_new);
|
|
|
|
|
update("uf_jcl_emp_qwjgzgrz",qwInfo_new,"id",getIgnoreCase(map, "id"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据明细表名称和关联id查询员工信息明细表数据
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Map<String, Object>> getYgxxDetailInfo(String sql){
|
|
|
|
|
log.error("getYgxxDetailInfo.sql:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getYgxxDetailInfo.recordList:{}", recordList);
|
|
|
|
|
return recordList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获得key名映射
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String,Object> getMapping(){
|
|
|
|
|
/**
|
|
|
|
|
* 多租户查询主表名称
|
|
|
|
|
*/
|
|
|
|
|
Map<String, String> ebTableInfo = recruitModuleUtils.getEbTableInfo("uf_jcl_employee_information_apptag", "uf_jcl_zdtbysb_tag");
|
|
|
|
|
String ebTableName = ebTableInfo.get("table_name");
|
|
|
|
|
log.error("getMapping.ebTableName:{}", ebTableName);
|
|
|
|
|
String sql = "select ygxxzdkey,rlxtzdkey from "+ebTableName;
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getSqlList(sql);
|
|
|
|
|
Map<String, Object> resultMap = recordList.stream().collect(Collectors.toMap(e->e.get("ygxxzdkey").toString(),e -> e.get("rlxtzdkey").toString()));
|
|
|
|
|
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int insert(String tableName, Map<String, Object> setMap){
|
|
|
|
|
int result = 400;
|
|
|
|
|
log.info("insert-setMap{}",setMap);
|
|
|
|
|
if (StringUtils.isBlank(tableName) || null==setMap || setMap.size() <= 0) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
List<String> setkey = new ArrayList<>();
|
|
|
|
|
List<Object> setvalue = new ArrayList<>();
|
|
|
|
|
setMap.forEach((key1, value) -> {
|
|
|
|
|
setkey.add(key1);
|
|
|
|
|
setvalue.add(value);
|
|
|
|
|
});
|
|
|
|
|
List<String> setvalueNew = new ArrayList<>();
|
|
|
|
|
for (Object obj : setvalue) {
|
|
|
|
|
if (obj == null) {
|
|
|
|
|
setvalueNew.add("");
|
|
|
|
|
} else {
|
|
|
|
|
setvalueNew.add(obj.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String sql = " insert into " + tableName + "(" + String.join(",", setkey) + ") values('"
|
|
|
|
|
+ String.join("','", setvalueNew)+ "')";
|
|
|
|
|
log.info("insert-sql{}",sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
log.error("insert.recordList:{}", rs);
|
|
|
|
|
result = Integer.parseInt(String.valueOf(rs.get("code")));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int update(String tableName, Map<String, Object> setMap,String condition,String id){
|
|
|
|
|
int result = 400;
|
|
|
|
|
if(StringUtils.isNotBlank(id)){
|
|
|
|
|
log.info("update-setMap{},id{}",setMap,id);
|
|
|
|
|
if (StringUtils.isBlank(tableName) || setMap == null || setMap.size() <= 0) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
|
|
sql.append("update "+tableName + " set ");
|
|
|
|
|
//查询数据库类型
|
|
|
|
|
String databaseId = DatabaseUtil.getDatabaseId();
|
|
|
|
|
log.info("update-databaseId{}",databaseId);
|
|
|
|
|
for (String key : setMap.keySet()) {
|
|
|
|
|
if(databaseId.equalsIgnoreCase("oracle")){
|
|
|
|
|
//判断是否是日期类型
|
|
|
|
|
if(isValidDateTime(String.valueOf(setMap.get(key)))){
|
|
|
|
|
sql.append(key).append("=").append("TO_DATE('").append(setMap.get(key)).append("', 'yyyy-mm-dd hh24:mi:ss')").append(",");
|
|
|
|
|
}else if(isValidDate(String.valueOf(setMap.get(key)))){
|
|
|
|
|
sql.append(key).append("=").append("TO_DATE('").append(setMap.get(key)).append("', 'yyyy-mm-dd')").append(",");
|
|
|
|
|
}else{
|
|
|
|
|
sql.append(key).append("=").append("'").append(setMap.get(key)).append("'").append(",");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
sql.append(key).append("=").append("'").append(setMap.get(key)).append("'").append(",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (sql.length() > 0) {
|
|
|
|
|
sql.deleteCharAt(sql.length() - 1); // 删除最后一个字符
|
|
|
|
|
}
|
|
|
|
|
sql.append(" where "+condition+" = "+id);
|
|
|
|
|
log.info("update888-sql{}",sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql.toString());
|
|
|
|
|
log.error("update.recordList:{}", rs);
|
|
|
|
|
result = Integer.parseInt(String.valueOf(rs.get("code")));
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean isValidDate(String dateTimeStr) {
|
|
|
|
|
// 定义日期时间格式
|
|
|
|
|
String dateTimePattern = "yyyy-MM-dd";
|
|
|
|
|
return isValidDate(dateTimeStr, dateTimePattern);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean isValidDateTime(String dateTimeStr) {
|
|
|
|
|
// 定义日期时间格式
|
|
|
|
|
String dateTimePattern = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
|
return isValidDate(dateTimeStr, dateTimePattern);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean isValidDate(String dateStr, String pattern) {
|
|
|
|
|
try {
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
|
|
|
|
sdf.setLenient(false); // 设置为严格模式,避免宽松解析
|
|
|
|
|
sdf.parse(dateStr);
|
|
|
|
|
return true;
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MySQL数据库
|
|
|
|
|
* @param employee_info
|
|
|
|
|
*/
|
|
|
|
|
private void cleanUpTime(Map<String, Object> employee_info){
|
|
|
|
|
//特殊处理
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
long create_time = 0L;
|
|
|
|
|
long update_time = 0L;
|
|
|
|
|
long hiredate_time = 0L;
|
|
|
|
|
String createDate = nowData;
|
|
|
|
|
String updateDate = nowData;
|
|
|
|
|
String hiredate = nowData;
|
|
|
|
|
if (StringUtils.isNotBlank(getIgnoreCase(employee_info, "create_time"))) {
|
|
|
|
|
String time = getIgnoreCase(employee_info, "create_time");
|
|
|
|
|
if (!time.contains("-")) {
|
|
|
|
|
create_time = Long.parseLong(time);
|
|
|
|
|
Date date = new Date(create_time);
|
|
|
|
|
createDate = sdf.format(date);
|
|
|
|
|
}else {
|
|
|
|
|
createDate=time;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(getIgnoreCase(employee_info, "update_time"))) {
|
|
|
|
|
String time = getIgnoreCase(employee_info, "update_time");
|
|
|
|
|
if (!time.contains("-")) {
|
|
|
|
|
update_time = Long.parseLong(time);
|
|
|
|
|
Date date = new Date(update_time);
|
|
|
|
|
updateDate = sdf.format(date);
|
|
|
|
|
}else {
|
|
|
|
|
updateDate=time;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
employee_info.put("create_time",createDate);
|
|
|
|
|
employee_info.put("update_time",updateDate);
|
|
|
|
|
//employee_info.put("hiredate",hiredate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean containsKeyIgnoreCase(Map<String, Object> map, String key) {
|
|
|
|
|
if (map == null || key == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (String mapKey : map.keySet()) {
|
|
|
|
|
if (mapKey.equalsIgnoreCase(key)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getEmployeeFormData(String ygid) {
|
|
|
|
|
String formData = "";
|
|
|
|
|
String sql = "SELECT formdata FROM eteams.employee WHERE id = '" + ygid + "' ";
|
|
|
|
|
log.error("getEmployeeFormData11111.sql:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getEmployeeFormData.recordList:{}", recordList);
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
Object formdataValue = recordList.get(0).get("formdata");
|
|
|
|
|
if (formdataValue instanceof Long) {
|
|
|
|
|
formData = String.valueOf(formdataValue); // 转换为 String
|
|
|
|
|
} else if (formdataValue instanceof String) {
|
|
|
|
|
formData = (String) formdataValue; // 如果是 String 类型,直接赋值
|
|
|
|
|
}else {
|
|
|
|
|
formData = String.valueOf(formdataValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return formData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getUserFormData(String ygid) {
|
|
|
|
|
String form_data = "";
|
|
|
|
|
String sql = "SELECT form_data FROM hr_userinfo WHERE USER = '" + ygid + "' ";
|
|
|
|
|
log.error("getUserFormData222222.sql:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getUserFormData.recordList:{}", recordList);
|
|
|
|
|
if(CollectionUtils.isNotEmpty(recordList)){
|
|
|
|
|
Object formdataValue = recordList.get(0).get("form_data");
|
|
|
|
|
if (formdataValue instanceof Long) {
|
|
|
|
|
form_data = String.valueOf(formdataValue); // 转换为 String
|
|
|
|
|
} else if (formdataValue instanceof String) {
|
|
|
|
|
form_data = (String) formdataValue; // 如果是 String 类型,直接赋值
|
|
|
|
|
}else {
|
|
|
|
|
form_data = String.valueOf(formdataValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return form_data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public List<Map<String, Object>> getTableColumnsOfTableName(String tableName) {
|
|
|
|
|
// String sql = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + tableName + "' ";
|
|
|
|
|
// log.error("getTableColumnsOfTableName111.sql:{}", sql);
|
|
|
|
|
// Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
// List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
// log.error("getTableColumnsOfTableName.recordList:{}", recordList);
|
|
|
|
|
// return recordList;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
public List<String> getTableColumnsOfTableName(String tableName) {
|
|
|
|
|
// String sql = "SELECT * FROM " + tableName;
|
|
|
|
|
// log.error("getTableColumnsOfTableName222.sql:{}", sql);
|
|
|
|
|
// Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
// List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
// log.error("getTableColumnsOfTableName.recordList:{}", recordList);
|
|
|
|
|
// return extractFieldNames(recordList);
|
|
|
|
|
String sql = "";
|
|
|
|
|
//String sql = "SELECT * FROM " + tableName;
|
|
|
|
|
//查询数据库类型
|
|
|
|
|
String databaseId = DatabaseUtil.getDatabaseId();
|
|
|
|
|
log.info("getTableColumnsOfTableName-databaseId{}",databaseId);
|
|
|
|
|
if(databaseId.equalsIgnoreCase("oracle")){
|
|
|
|
|
//oracle
|
|
|
|
|
sql = "SELECT column_name FROM ALL_TAB_COLUMNS WHERE TABLE_NAME ='" + tableName + "' ";
|
|
|
|
|
}else{
|
|
|
|
|
//mysql
|
|
|
|
|
sql = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + tableName + "' ";
|
|
|
|
|
}
|
|
|
|
|
log.error("getTableColumnsOfTableName.sql:{}", sql);
|
|
|
|
|
Map<String, Object> rs = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
|
|
|
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(rs);
|
|
|
|
|
log.error("getTableColumnsOfTableName.recordList:{}", recordList);
|
|
|
|
|
List<String> listOfColumn = recordList.stream()
|
|
|
|
|
.map(map -> map.get("column_name").toString())
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
return listOfColumn;
|
|
|
|
|
//return extractFieldNames(recordList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Set<String> extractFieldNames(List<Map<String, Object>> recordList) {
|
|
|
|
|
// 使用 Stream API 提取所有字段名
|
|
|
|
|
return recordList.stream()
|
|
|
|
|
.flatMap(record -> record.keySet().stream())
|
|
|
|
|
.collect(Collectors.toSet());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String getIgnoreCase(Map<String, Object> map, String key) {
|
|
|
|
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
|
|
|
if (entry.getKey().equalsIgnoreCase(key)) {
|
|
|
|
|
return entry.getValue().toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null; // 或者抛出异常,取决于你的需求
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Map<Object, Object>> getFieldList(FieldManageParam entity, SimpleEmployee employee) {
|
|
|
|
|
HashMap result = new HashMap(6);
|
|
|
|
|
WeaResult<Map<String, Object>> wearesult =null;
|
|
|
|
|
try {
|
|
|
|
|
ModuleSource module = entity.getModule();
|
|
|
|
|
Long formId = entity.getFormId();
|
|
|
|
|
if (formId == null) {
|
|
|
|
|
result.put("actionMsg", SystemEnv.getHtmlLabelName(181389L, "formId不能为空。"));
|
|
|
|
|
wearesult = WeaResult.fail(result.toString(), true);
|
|
|
|
|
} else {
|
|
|
|
|
WeaResult<FormAuthenticationDto> authentication = formAuthenticationService.authentication(new FormAuthenticationParam(module, entity.getFormId(), FormAuthenticationEnum.FORM_FIELD_MANAGE_SELECT_LIST, (Map)null), employee);
|
|
|
|
|
if (!authentication.isStatus()) {
|
|
|
|
|
wearesult = WeaResult.fail(authentication.getMsg(), true);
|
|
|
|
|
} else {
|
|
|
|
|
if (entity.getNeedI18N() == null) {
|
|
|
|
|
entity.setNeedI18N(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Map<Object, Object>> fieldList = ((FormFieldManageService)fieldManageController.getRealService(module.name(), "FormFieldManageService", FormFieldManageService.class)).getFormFieldJsonByFormId(entity, employee);
|
|
|
|
|
result.put("data", fieldList);
|
|
|
|
|
wearesult = WeaResult.success(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (FormException var8) {
|
|
|
|
|
log.error("getFormFieldList 异常:", var8);
|
|
|
|
|
wearesult = WeaResult.fail(SystemEnv.getHtmlLabelName(181391L, "获取批量编辑字段列表失败:") + var8.getMessage(), true);
|
|
|
|
|
} catch (Exception var9) {
|
|
|
|
|
log.error("getFormFieldList 异常2:", var9);
|
|
|
|
|
wearesult = WeaResult.fail(SystemEnv.getHtmlLabelName(181391L, "获取批量编辑字段列表失败:") + var9.getMessage(), true);
|
|
|
|
|
}
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
log.error("getFieldList :[{}]",gson.toJson(wearesult));
|
|
|
|
|
Map<String, Object> resultMap = wearesult.getData();
|
|
|
|
|
return (List<Map<Object, Object>>)resultMap.get("data");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|