weaver-hrm-recruit/src/com/engine/jc/service/impl/JcRecruitInfoCollectService...

248 lines
9.7 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.engine.jc.service.impl;
import cn.hutool.core.convert.Convert;
import com.engine.core.impl.Service;
import com.engine.jc.service.JcRecruitInfoCollectService;
import com.engine.recruit.conn.ModeBrowserCommonInfo;
import com.engine.recruit.conn.RecruitDataMap;
import com.engine.recruit.conn.RecruitRecordSet;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.time.LocalDate;
import java.time.Period;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/07/22
* @version: 1.0
*/
public class JcRecruitInfoCollectServiceImpl extends Service implements JcRecruitInfoCollectService {
private String mainTableName = "edc_uf_table92";
private String workDetailTableName = "edc_uf_table92_dt1";
private String educationDetailTableName = "edc_uf_table92_dt2";
@Override
public String getCandidateName(Map<String, Object> params) {
int candidateId = Convert.toInt(params.get("candidateId"), 0);
String candidateName = "";
if (candidateId == 0) {
return candidateName;
}
RecordSet rs = new RecordSet();
rs.executeQuery("select xm from uf_jcl_yppc where id = ? ", candidateId);
if (rs.next()) {
candidateName = rs.getString("xm");
}
return candidateName;
}
@Override
public Map<String, Object> updateApplicantsInfo(Map<String, Object> params) {
// 应聘者ID
int candidateId = Convert.toInt(params.get("candidateId"), 0);
// 面试ID
int interviewId = Convert.toInt(params.get("interviewId"), 0);
// 数据中心数据ID
int dataId = Convert.toInt(params.get("dataId"), 0);
RecordSet rs = new RecordSet();
rs.executeQuery("select * from " + mainTableName + " where id = ? ", dataId);
Map<String, Object> mainDataMap = RecruitRecordSet.getSingleRecordMap(rs);
// 更新应聘者信息
RecruitDataMap<Object> applicantDataMap = new RecruitDataMap<>();
applicantDataMap.put("id", candidateId);
// 姓名
applicantDataMap.put("xm", mainDataMap.get("field003"));
// 手机号码
applicantDataMap.put("sjhm", mainDataMap.get("field005"));
// 现税前月薪K
applicantDataMap.put("xsqyxk", mainDataMap.get("field006"));
// 出生日期
applicantDataMap.put("csrq", mainDataMap.get("field007"));
// 年龄 根据出生日期计算
applicantDataMap.put("nl", ageCalculator(Util.null2String(mainDataMap.get("field007"))));
// 性别
applicantDataMap.put("xb", mainDataMap.get("field008"));
// 身份证号
applicantDataMap.put("sfz", mainDataMap.get("field009"));
// 民族
applicantDataMap.put("mz", mainDataMap.get("field010"));
// 政治面貌
applicantDataMap.put("zzmm", getPoliticalLandscape(Util.null2String(mainDataMap.get("field011"))));
// 职称/证书
applicantDataMap.put("zczs", mainDataMap.get("field012"));
// 简历照片
applicantDataMap.put("jlzp", mainDataMap.get("field013"));
// 婚姻状况
applicantDataMap.put("hyzk", getMaritalStatus(Util.null2String(mainDataMap.get("field014"))));
// 最高学历 转换为浏览按钮对应的值
applicantDataMap.put("zgxl", getEducationLevelId(Util.null2String(mainDataMap.get("field015"))));
// 现居住地
applicantDataMap.put("xjzd", mainDataMap.get("field016"));
// 户口性质
applicantDataMap.put("hkxz", getSelectValueByName(rs, "hkxz", Util.null2String(mainDataMap.get("field016"))));
// 户籍所在地
applicantDataMap.put("hjszd", mainDataMap.get("field018"));
// 电子邮箱
applicantDataMap.put("dzyx", mainDataMap.get("field019"));
// 英文水平
applicantDataMap.put("ywsp", getSelectValueByName(rs, "ywsp", Util.null2String(mainDataMap.get("field020"))));
// 是否可配合出差、加班及关联企业调派
applicantDataMap.put("sfkphccjbjglqydp", getSelectValueByName(rs, "sfkphccjbjglqydp", Util.null2String(mainDataMap.get("field021"))));
// 过去五年是否有与就业有关的争议
applicantDataMap.put("gqwnsfyyjyygdzy", getSelectValueByName(rs, "gqwnsfyyjyygdzy", Util.null2String(mainDataMap.get("field022"))));
// 是否有竞业限制及保密协议
applicantDataMap.put("sfyjyxzjbmxy", getSelectValueByName(rs, "sfyjyxzjbmxy", Util.null2String(mainDataMap.get("field023"))));
// 是否存在疾病、有无疾病史
applicantDataMap.put("sfczjbywjbs", getSelectValueByName(rs, "sfczjbywjbs", Util.null2String(mainDataMap.get("field024"))));
// 是否患过职业病或工伤?
applicantDataMap.put("sfhgzybhgs", getSelectValueByName(rs, "sfhgzybhgs", Util.null2String(mainDataMap.get("field025"))));
RecruitRecordSet.updateDataById(applicantDataMap, "uf_jcl_yppc");
// 插入工作经历明细表
rs.executeQuery("select * from " + workDetailTableName + " where mainid = ? ", dataId);
List<Map<String, Object>> workDetailDataList = RecruitRecordSet.getRecordMapList(rs);
if (CollectionUtils.isNotEmpty(workDetailDataList)) {
for (Map<String, Object> item : workDetailDataList) {
RecruitDataMap<Object> insertDataMap = new RecruitDataMap<>();
insertDataMap.put("mainid", candidateId);
// 公司名称
insertDataMap.put("gsmc", item.get("field002"));
// 开始时间
insertDataMap.put("kssj", item.get("field008"));
// 结束时间
insertDataMap.put("jssj", item.get("field009"));
// 岗位
insertDataMap.put("gw", item.get("field003"));
// 工作职责
// insertDataMap.put("gzzz", item.get("jssj"));
// 税前月薪k
insertDataMap.put("sqyxk", item.get("field004"));
RecruitRecordSet.insertData(insertDataMap, "uf_jcl_yppc_dt2");
}
}
// 插入教育经历明细表
rs.executeQuery("select * from " + educationDetailTableName + " where mainid = ? ", dataId);
List<Map<String, Object>> educationDetailDataList = RecruitRecordSet.getRecordMapList(rs);
if (CollectionUtils.isNotEmpty(educationDetailDataList)) {
for (Map<String, Object> item : educationDetailDataList) {
RecruitDataMap<Object> insertDataMap = new RecruitDataMap<>();
insertDataMap.put("mainid", candidateId);
// 学校名称
insertDataMap.put("xxmc", item.get("field002"));
// 学历
insertDataMap.put("xl", getEducationLevelId(Util.null2String(item.get("field005"))));
// 专业
insertDataMap.put("zy", item.get("field003"));
// 开始时间
insertDataMap.put("kssj", item.get("field007"));
// 结束时间
insertDataMap.put("jssj", item.get("field008"));
RecruitRecordSet.insertData(insertDataMap, "uf_jcl_yppc_dt1");
}
}
// 更新面试表信息
RecruitDataMap<Object> interviewInfoMap = new RecruitDataMap<>();
interviewInfoMap.put("id", interviewId);
// 手机号码
interviewInfoMap.put("sjhm", applicantDataMap.get("sjhm"));
// 电子邮箱
interviewInfoMap.put("dzyx", applicantDataMap.get("dzyx"));
RecruitRecordSet.updateDataById(interviewInfoMap, "uf_jcl_ms");
return null;
}
/**
* 计算年龄
*
* @param birthDateStr
* @return
*/
private Integer ageCalculator(String birthDateStr) {
if (StringUtils.isBlank(birthDateStr)) {
return null;
}
// 获取当前日期
LocalDate today = LocalDate.now();
LocalDate birthDate = LocalDate.parse(birthDateStr);
// 计算年龄
Period age = Period.between(birthDate, today);
return age.getYears();
}
/**
* 获取学历
*
* @param name
* @return
*/
private String getEducationLevelId(String name) {
if ("小学".equals(name)) {
name = "其他";
}
return ModeBrowserCommonInfo.getEducationLevelId(name);
}
/**
* 获取下拉框值
*
* @param rs
* @param fieldName
* @param selectName
* @return
*/
private String getSelectValueByName(RecordSet rs, String fieldName, String selectName) {
rs.executeQuery("select selectvalue from workflow_selectitem where fieldid = ( select id from workflow_billfield where FIELDNAME = ? and BILLID =( select id from workflow_bill where tablename = 'uf_jcl_yppc')) and SELECTNAME = ? ", fieldName, selectName);
if (rs.next()) {
return rs.getString("selectvalue");
}
return null;
}
/**
* 获取婚姻状况
*
* @param name
* @return
*/
private String getMaritalStatus(String name) {
if (StringUtils.isBlank(name)) {
return null;
}
if (!"未婚".equals(name)) {
name = "已婚";
}
return ModeBrowserCommonInfo.getBrowserId(ModeBrowserCommonInfo.TYPE_MARITAL_STATUS, name);
}
/**
* 获取政治面貌
*
* @param name
* @return
*/
private String getPoliticalLandscape(String name) {
return ModeBrowserCommonInfo.getBrowserId(ModeBrowserCommonInfo.TYPE_POLITICAL_LANDSCAPE, name);
}
}