generated from dxfeng/secondev-chapanda-feishu
SDK简历收取,重复简历处理
This commit is contained in:
parent
a3f0e7388c
commit
c1e8a6833a
|
|
@ -1,4 +1,4 @@
|
|||
package weaver.formmode.recruit.modeexpand.util;
|
||||
package com.engine.recruit.conn;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.engine.recruit.conn;
|
||||
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
/**
|
||||
* 招聘职位信息
|
||||
*
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PositionCommonInfo {
|
||||
|
||||
/**
|
||||
* 根据千里聆岗位ID,获取招聘职位ID
|
||||
*
|
||||
* @param qllGwId
|
||||
* @return
|
||||
*/
|
||||
public static String getPositionIdByQll(Long qllGwId) {
|
||||
String positionId = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from uf_jcl_zp_zpzw where qllgwid = ?", qllGwId);
|
||||
if (rs.next()) {
|
||||
positionId = rs.getString("id");
|
||||
}
|
||||
return positionId;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取招聘职位关联的招聘流程
|
||||
*
|
||||
* @param positionId
|
||||
* @return
|
||||
*/
|
||||
public static String getRecruitFlowId(String positionId) {
|
||||
String recruitFlowId = "";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select zplc from uf_jcl_zp_zpzw where id = ?", positionId);
|
||||
if (rs.next()) {
|
||||
recruitFlowId = rs.getString("zplc");
|
||||
}
|
||||
return recruitFlowId;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -36,6 +36,19 @@ public class RecruitRecordSet {
|
|||
return dataMap;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> getRecordMapList(RecordSet rs) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
String[] columnNames = rs.getColumnName();
|
||||
Map<String, Object> dataMap = new RecruitDataMap<>();
|
||||
for (String columnName : columnNames) {
|
||||
dataMap.put(columnName.toLowerCase(), RecruitModeUtil.parseBlankToNull(rs.getString(columnName)));
|
||||
}
|
||||
list.add(dataMap);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
*
|
||||
|
|
@ -60,12 +73,39 @@ public class RecruitRecordSet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID更新数据
|
||||
*
|
||||
* @param dataMap
|
||||
* @param tableName
|
||||
*/
|
||||
public static void updateDataById(Map<String, Object> dataMap, String tableName) {
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<Object> dataList = new ArrayList<>();
|
||||
List<String> paramList = new ArrayList<>();
|
||||
String id = Util.null2String(dataMap.get("id"));
|
||||
dataMap.remove("id");
|
||||
|
||||
dataMap.forEach((key, value) -> {
|
||||
fieldList.add(key + " = ? ");
|
||||
dataList.add(value);
|
||||
paramList.add("?");
|
||||
});
|
||||
dataList.add(id);
|
||||
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeUpdate(updateSql, dataList);
|
||||
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
|
||||
throw new CustomizeRunTimeException(rs.getExceptionMsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建建模表基本数据
|
||||
*
|
||||
* @param mainDataMap 参数集合
|
||||
*/
|
||||
public static void buildModeBaseFields(Map<String, Object> mainDataMap, Object userId) {
|
||||
public static void buildModeBaseFields(Map<String, Object> mainDataMap, int userId) {
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
String[] dateSplit = dateTime.split(" ");
|
||||
mainDataMap.put("modedatacreater", userId);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,15 @@ public enum ApplicationStatusEnum {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public static ApplicationStatusEnum getStatus(String value) {
|
||||
for (ApplicationStatusEnum item : ApplicationStatusEnum.values()) {
|
||||
if (item.value.equalsIgnoreCase(value)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("不支持的应聘状态");
|
||||
}
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.engine.core.impl.Service;
|
|||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
import com.engine.recruit.service.RecruitButtonService;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.recruit.modeexpand.util.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,180 @@
|
|||
package com.engine.recruit.thread;
|
||||
|
||||
import com.engine.recruit.conn.RecruitRecordSet;
|
||||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/10/26
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CheckRepeatResume {
|
||||
|
||||
/**
|
||||
* 校验简历是否加入黑名单
|
||||
*
|
||||
* @param name 姓名
|
||||
* @param mobile 手机号
|
||||
* @return
|
||||
*/
|
||||
private boolean joinBlackList(String name, String mobile) {
|
||||
// 在这里编写你的方法逻辑
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from uf_jcl_rck where sfjrhmd =0 and xm = ? and sjhm = ?", name, mobile);
|
||||
return rs.next();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据姓名、手机号查询重复的简历数据
|
||||
*
|
||||
* @param name 姓名
|
||||
* @param mobile 手机号
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, Object>> getRepeatResumeList(String name, String mobile) {
|
||||
RecordSet rs = new RecordSet();
|
||||
// 查询状态为待分配、候选中的且未隐藏的数据
|
||||
rs.executeQuery("select * from uf_jcl_yppc where formmodeid is not null and zt != 2 and zt != 3 and xm = ? and sjhm =? order by zt", name, mobile);
|
||||
return RecruitRecordSet.getRecordMapList(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入简历数据
|
||||
*
|
||||
* @param param 数据集合
|
||||
* @return
|
||||
*/
|
||||
public synchronized int insertResumeMainTable(Map<String, Object> param) {
|
||||
String name = Util.null2String(param.get("xm"));
|
||||
String mobile = Util.null2String(param.get("sjhm"));
|
||||
String status = Util.null2String(param.get("zt"));
|
||||
String positionId = Util.null2String(param.get("ypzw"));
|
||||
// 黑名单校验,黑名单人员不入库
|
||||
boolean joinBlackList = joinBlackList(name, mobile);
|
||||
if (joinBlackList) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 按照姓名+手机号查询正常展示的简历数据
|
||||
List<Map<String, Object>> repeatResumeList = getRepeatResumeList(name, mobile);
|
||||
if (CollectionUtils.isEmpty(repeatResumeList)) {
|
||||
// 不存在重复数据,直接插入数据库
|
||||
return insertData(param);
|
||||
}
|
||||
|
||||
// 新接收的简历为待分配
|
||||
if (ApplicationStatusEnum.DISTRIBUTION.getValue().equals(status)) {
|
||||
Map<String, Object> sourceResume = repeatResumeList.get(0);
|
||||
if (ApplicationStatusEnum.DISTRIBUTION.getValue().equals(Util.null2String(sourceResume.get("zt")))) {
|
||||
// 当前存在待分配的简历
|
||||
//取新简历有值的字段,更新已入库简历没有值的字段,已入库简历有值的字段不做更新,新简历入库并隐藏
|
||||
updateSourceResume(param, sourceResume);
|
||||
return -1;
|
||||
} else {
|
||||
// 直接入库,不做任何处理
|
||||
return insertData(param);
|
||||
}
|
||||
} else if (ApplicationStatusEnum.CANDIDATE.getValue().equals(status)) {
|
||||
// 新简历为候选中
|
||||
boolean hasSamePosition = false;
|
||||
for (Map<String, Object> sourceResume : repeatResumeList) {
|
||||
if (positionId.equals(Util.null2String(sourceResume.get("ypzw")))) {
|
||||
hasSamePosition = true;
|
||||
}
|
||||
}
|
||||
if (hasSamePosition) {
|
||||
// 若有相同职位的数据,新简历直接入库并隐藏
|
||||
return insertHideData(param);
|
||||
} else {
|
||||
// 没有相同职位的数据,新简历直接入库,不做任何处理
|
||||
return insertData(param);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 直接插入简历信息
|
||||
*
|
||||
* @param dataMap 数据集合
|
||||
* @return
|
||||
*/
|
||||
private int insertData(Map<String, Object> dataMap) {
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
dataMap.put("modeuuid", uuid);
|
||||
RecordSet rs = new RecordSet();
|
||||
int formModeId = -1;
|
||||
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = 'uf_jcl_yppc' )");
|
||||
if (rs.next()) {
|
||||
formModeId = rs.getInt("id");
|
||||
}
|
||||
dataMap.put("formmodeid", formModeId);
|
||||
RecruitRecordSet.buildModeBaseFields(dataMap, 1);
|
||||
return RecruitRecordSet.refreshRight(uuid, "uf_jcl_yppc", formModeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入数据库并隐藏
|
||||
*
|
||||
* @param dataMap 数据集合
|
||||
* @return
|
||||
*/
|
||||
private int insertHideData(Map<String, Object> dataMap) {
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
dataMap.put("modeuuid", uuid);
|
||||
RecordSet rs = new RecordSet();
|
||||
RecruitRecordSet.buildModeBaseFields(dataMap, 1);
|
||||
rs.executeQuery("select id from uf_jcl_yppc where modeuuid='" + uuid + "'");
|
||||
if (rs.next()) {
|
||||
return Util.getIntValue(rs.getString("id"));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新简历信息
|
||||
*
|
||||
* @param param 新简历数据集合
|
||||
* @param sourceResume 源简历数据集合
|
||||
* @return
|
||||
*/
|
||||
private int updateSourceResume(Map<String, Object> param, Map<String, Object> sourceResume) {
|
||||
replaceNullValues(param, sourceResume);
|
||||
// 处理操作人员、操作时间
|
||||
RecruitRecordSet.buildModeBaseFields(sourceResume, 1);
|
||||
RecruitRecordSet.updateDataById(sourceResume, "uf_jcl_yppc");
|
||||
// 更新数据
|
||||
return insertHideData(param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 替换sourceResume中为null或者为空的值
|
||||
*
|
||||
* @param param 新简历数据集合
|
||||
* @param sourceResume 源简历数据集合
|
||||
*/
|
||||
private void replaceNullValues(Map<String, Object> param, Map<String, Object> sourceResume) {
|
||||
for (Map.Entry<String, Object> entry : sourceResume.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
if (value == null || "".equals(value)) {
|
||||
if (param.containsKey(key)) {
|
||||
sourceResume.put(key, param.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package weaver.formmode.recruit.modeexpand.position;
|
||||
package com.engine.recruit.thread;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.engine.recruit.conn.PositionCommonInfo;
|
||||
import com.engine.recruit.conn.RecruitDataMap;
|
||||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
import com.engine.recruit.enums.CommonBrowserTypeEnum;
|
||||
import com.engine.recruit.enums.HighestDegreeEnum;
|
||||
|
|
@ -12,11 +14,12 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.erpa.apps.entity.application.resume.dto.*;
|
||||
import weaver.formmode.recruit.modeexpand.util.ApplicantCommonInfo;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -24,12 +27,12 @@ import java.util.*;
|
|||
* @createTime: 2023/10/16
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ResumeSavedThread extends LocalRunnable {
|
||||
public class SdkResumeSavedThread extends LocalRunnable {
|
||||
|
||||
private ResumeMqMessage resumeMqMessage;
|
||||
private static final int SEC_CATEGORY = Convert.toInt(RecruitModeUtil.getRecruitPropValue("APPLICANTS_RESUMES_CATEGORY"));
|
||||
|
||||
public ResumeSavedThread(ResumeMqMessage resumeMqMessage) {
|
||||
public SdkResumeSavedThread(ResumeMqMessage resumeMqMessage) {
|
||||
this.resumeMqMessage = resumeMqMessage;
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +59,7 @@ public class ResumeSavedThread extends LocalRunnable {
|
|||
Long resumeId = resumeMqMessage.getResumeId();
|
||||
|
||||
ResumeInfoDto resumeInfoDto = resumeMqMessage.getResumeInfoDto();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
Map<String, Object> params = new RecruitDataMap<>();
|
||||
// 姓名
|
||||
params.put("xm", resumeInfoDto.getName());
|
||||
// 性别
|
||||
|
|
@ -77,34 +80,26 @@ public class ResumeSavedThread extends LocalRunnable {
|
|||
params.put("ysjl", convertStreamToE9DocId(resumeMqMessage.getResumeInfoDto().getResumeFileId(), user));
|
||||
// 千里聆简历ID
|
||||
params.put("qlljl", resumeId);
|
||||
// 状态,指定待分配
|
||||
params.put("zt", ApplicationStatusEnum.DISTRIBUTION.getValue());
|
||||
// 判断是否有发布职位信息,如有发布职位信息,完善招聘流程信息,并指定为待分配状态
|
||||
String positionId = PositionCommonInfo.getPositionIdByQll(resumeInfoDto.getJobId());
|
||||
if (StringUtils.isNotBlank(positionId)) {
|
||||
params.put("ypzw", "positionId");
|
||||
params.put("zplc", PositionCommonInfo.getRecruitFlowId(positionId));
|
||||
params.put("zt", ApplicationStatusEnum.CANDIDATE.getValue());
|
||||
} else {
|
||||
// 状态,指定待分配
|
||||
params.put("zt", ApplicationStatusEnum.DISTRIBUTION.getValue());
|
||||
}
|
||||
|
||||
// 判断简历是否重复,插入主表
|
||||
int mainId = new CheckRepeatResume().insertResumeMainTable(params);
|
||||
|
||||
// 填充建模数据基本信息
|
||||
int formModeId = ApplicantCommonInfo.getModeIdByTableName("uf_jcl_yppc");
|
||||
params.put("formmodeid", formModeId);
|
||||
params.put("modedatacreater", user.getUID());
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
String[] split = dateTime.split(" ");
|
||||
params.put("modedatacreatedate", split[0]);
|
||||
params.put("modedatacreatetime", split[1]);
|
||||
params.put("modedatamodifier", user.getUID());
|
||||
params.put("modedatamodifydatetime", dateTime);
|
||||
params.put("modedatacreatertype", "0");
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
params.put("modeuuid", uuid);
|
||||
// 插入主表
|
||||
RecordSet rs = new RecordSet();
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
List<String> fieldValueList = new ArrayList<>();
|
||||
params.forEach((key, value) -> {
|
||||
fieldList.add(key);
|
||||
fieldValueList.add(RecruitModeUtil.parseBlankToNull(value));
|
||||
});
|
||||
rs.executeUpdate("insert into uf_jcl_yppc (" + StringUtils.join(fieldList, ",") + ") values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
Thread.sleep(1000);
|
||||
int mainId = ApplicantCommonInfo.refreshRight(rs, uuid, "uf_jcl_yppc", formModeId);
|
||||
if (-1 == mainId) {
|
||||
return;
|
||||
}
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
// 插入明细表数据
|
||||
List<ResumeInfoEducationExperienceDto> educationExperience = resumeInfoDto.getEducationExperience();
|
||||
String sql = "insert into uf_jcl_yppc_dt1 (mainId,xxmc,xl,zy,kssj,jssj) values (?,?,?,?,?,?) ";
|
||||
|
|
@ -5,7 +5,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import com.engine.recruit.util.RecruitMessageUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import com.engine.recruit.enums.InterviewOperateTypeEnum;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package weaver.formmode.recruit.modeexpand.position;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.recruit.thread.SdkResumeSavedThread;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDto;
|
||||
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
|
||||
|
|
@ -79,7 +80,7 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
client.addResumeSavedListener(resumeMqMessage -> {
|
||||
// 处理获取到的简历信息
|
||||
new BaseBean().writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage));
|
||||
Thread thread = new Thread(new ResumeSavedThread(resumeMqMessage));
|
||||
Thread thread = new Thread(new SdkResumeSavedThread(resumeMqMessage));
|
||||
thread.start();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package weaver.formmode.recruit.modeexpand.util;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import com.engine.recruit.enums.PositionThirdChannelEnum;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
|
||||
|
|
|
|||
Loading…
Reference in New Issue