generated from dxfeng/secondev-chapanda-feishu
OCR简历抽取实时入库
This commit is contained in:
parent
9c1e45a79e
commit
f56c118978
|
|
@ -2,9 +2,11 @@ package com.engine.recruit.conn;
|
|||
|
||||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
|
@ -16,6 +18,17 @@ import java.util.UUID;
|
|||
*/
|
||||
public class CheckRepeatResume {
|
||||
|
||||
private static CheckRepeatResume instance = new CheckRepeatResume();
|
||||
|
||||
private CheckRepeatResume() {
|
||||
// 私有化构造方法
|
||||
}
|
||||
|
||||
public static CheckRepeatResume getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验简历是否加入黑名单
|
||||
*
|
||||
|
|
@ -31,9 +44,18 @@ public class CheckRepeatResume {
|
|||
}
|
||||
|
||||
public static List<Map<String, Object>> getRepeatPositionResumeList(String name, String mobile, String positionId) {
|
||||
return getRepeatPositionResumeList(name, mobile, positionId, "");
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> getRepeatPositionResumeList(String name, String mobile, String positionId, String billId) {
|
||||
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 = ? and ypzw = ? order by zt", name, mobile, positionId);
|
||||
if (StringUtils.isNotBlank(billId)) {
|
||||
rs.executeQuery("select * from uf_jcl_yppc where formmodeid is not null and zt != 2 and zt != 3 and xm = ? and sjhm = ? and ypzw = ? and id != ? order by zt", name, mobile, positionId, billId);
|
||||
|
||||
} else {
|
||||
rs.executeQuery("select * from uf_jcl_yppc where formmodeid is not null and zt != 2 and zt != 3 and xm = ? and sjhm = ? and ypzw = ? order by zt", name, mobile, positionId);
|
||||
}
|
||||
return RecruitRecordSet.getRecordMapList(rs);
|
||||
}
|
||||
|
||||
|
|
@ -55,24 +77,43 @@ public class CheckRepeatResume {
|
|||
* 插入简历数据
|
||||
*
|
||||
* @param param 数据集合
|
||||
* @return
|
||||
* @return 新插入简历的ID
|
||||
*/
|
||||
public synchronized int insertResumeMainTable(Map<String, Object> param) {
|
||||
public int insertResumeMainTable(Map<String, Object> param) {
|
||||
Map<String, Object> map = insertResumeAndReturn(param);
|
||||
return Util.getIntValue(Util.null2String(map.get("mainId")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入简历数据
|
||||
*
|
||||
* @param param 数据集合
|
||||
* @return 简历插入信息
|
||||
*/
|
||||
public Map<String, Object> insertResumeAndReturn(Map<String, Object> param) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
int mainId = -1;
|
||||
String sourceId;
|
||||
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);
|
||||
returnMap.put("joinBlackList", joinBlackList);
|
||||
returnMap.put("isUpdate", false);
|
||||
returnMap.put("mainId", mainId);
|
||||
if (joinBlackList) {
|
||||
return -1;
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
// 按照姓名+手机号查询正常展示的简历数据
|
||||
List<Map<String, Object>> repeatResumeList = getRepeatResumeList(name, mobile);
|
||||
if (CollectionUtils.isEmpty(repeatResumeList)) {
|
||||
// 不存在重复数据,直接插入数据库
|
||||
return insertData(param);
|
||||
mainId = insertData(param);
|
||||
returnMap.put("mainId", mainId);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
// 新接收的简历为待分配
|
||||
|
|
@ -80,12 +121,18 @@ public class CheckRepeatResume {
|
|||
Map<String, Object> sourceResume = repeatResumeList.get(0);
|
||||
if (ApplicationStatusEnum.DISTRIBUTION.getValue().equals(Util.null2String(sourceResume.get("zt")))) {
|
||||
// 当前存在待分配的简历
|
||||
sourceId = Util.null2String(sourceResume.get("id"));
|
||||
//取新简历有值的字段,更新已入库简历没有值的字段,已入库简历有值的字段不做更新,新简历入库并隐藏
|
||||
updateSourceResume(param, sourceResume);
|
||||
return -1;
|
||||
mainId = updateSourceResume(param, sourceResume);
|
||||
returnMap.put("mainId", mainId);
|
||||
returnMap.put("sourceId", sourceId);
|
||||
returnMap.put("isUpdate", true);
|
||||
return returnMap;
|
||||
} else {
|
||||
// 直接入库,不做任何处理
|
||||
return insertData(param);
|
||||
mainId = insertData(param);
|
||||
returnMap.put("mainId", mainId);
|
||||
return returnMap;
|
||||
}
|
||||
} else if (ApplicationStatusEnum.CANDIDATE.getValue().equals(status)) {
|
||||
// 新简历为候选中
|
||||
|
|
@ -97,14 +144,17 @@ public class CheckRepeatResume {
|
|||
}
|
||||
if (hasSamePosition) {
|
||||
// 若有相同职位的数据,新简历直接入库并隐藏
|
||||
return insertHideData(param);
|
||||
mainId = insertHideData(param);
|
||||
returnMap.put("mainId", mainId);
|
||||
return returnMap;
|
||||
} else {
|
||||
// 没有相同职位的数据,新简历直接入库,不做任何处理
|
||||
return insertData(param);
|
||||
mainId = insertData(param);
|
||||
returnMap.put("mainId", mainId);
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@ package com.engine.recruit.service.impl;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.CheckRepeatResume;
|
||||
import com.engine.recruit.conn.RecruitDataMap;
|
||||
import com.engine.recruit.conn.RecruitRecordSet;
|
||||
import com.engine.recruit.conn.*;
|
||||
import com.engine.recruit.entity.record.ApplicantRecordPo;
|
||||
import com.engine.recruit.entity.resume.OcrResumePo;
|
||||
import com.engine.recruit.enums.ApplicantOperateEnum;
|
||||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
import com.engine.recruit.enums.RecordOperateEnum;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.recruit.service.ApplicantResumeService;
|
||||
import com.engine.recruit.util.RecruitUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
|
|
@ -204,7 +203,9 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
// 分配职位
|
||||
String billid = Util.null2String(params.get("billid"));
|
||||
String ypzw = Util.null2String(params.get("ypzw"));
|
||||
rs.executeUpdate("update uf_jcl_yppc set ypzw = ? , zt = 1 where id = ?", ypzw, billid);
|
||||
if (StringUtils.isNotBlank(ypzw)) {
|
||||
rs.executeUpdate("update uf_jcl_yppc set ypzw = ? , zt = 1 where id = ?", ypzw, billid);
|
||||
}
|
||||
returnMap.put("msg", "操作成功");
|
||||
} else if (ApplicantOperateEnum.ARCHIVE.getOperateType().equals(operateType)) {
|
||||
// 归档人才库
|
||||
|
|
@ -291,6 +292,8 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
|
||||
@Override
|
||||
public Map<String, Object> fullOriginalResumeId(Map<String, Object> params) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
|
||||
int imageFileId = Convert.toInt(params.get("imageFileId"));
|
||||
int resumeId = Convert.toInt(params.get("resumeId"));
|
||||
int secCategory = Convert.toInt(RecruitModeUtil.getRecruitPropValue("APPLICANTS_RESUMES_CATEGORY"));
|
||||
|
|
@ -300,11 +303,24 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
// 更新原始简历信息
|
||||
rs.executeUpdate("update uf_jcl_jlzjb set jlfj=?,ocr=1 where id = ?", docId, resumeId);
|
||||
|
||||
// 简历入库,并返回展示的应聘者简历ID
|
||||
rs.executeQuery("select id,xm, xb, csrq, jg, yx, wx, qq, xjzd, ah, grys , jyjl , bysj , zgxl , zyjn , sxjl , yysp , zs, gzjl, ypzw, gzjy, xmjl, sjhm, nl, sfz, jlfj from uf_jcl_jlzjb where ocr = 1 and cqzt is null and id = ?", resumeId);
|
||||
Map<String, Object> recordMap = RecruitRecordSet.getSingleRecordMap(rs);
|
||||
OcrResumePo ocrResumePo = RecruitUtil.parseMap2Object(recordMap, OcrResumePo.class);
|
||||
RecruitDataMap<Object> dataMap = buildApplicantMap(ocrResumePo);
|
||||
// 校验简历信息、并插入
|
||||
Map<String, Object> map = CheckRepeatResume.getInstance().insertResumeAndReturn(dataMap);
|
||||
rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 where id = ? ", ocrResumePo.getId());
|
||||
String mainId = Util.null2String(map.get("mainId"));
|
||||
String sourceId = Util.null2String(map.get("sourceId"));
|
||||
returnMap.put("mainId", StringUtils.isNotBlank(sourceId) ? sourceId : mainId);
|
||||
returnMap.put("sourceId", sourceId);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return new HashMap<>();
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -312,13 +328,14 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
String name = Util.null2String(param.get("xm"));
|
||||
String mobile = Util.null2String(param.get("sjhm"));
|
||||
String positionId = Util.null2String(param.get("ypzw"));
|
||||
String billId = Util.null2String(param.get("billid"));
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
// 判断是否黑名单
|
||||
boolean joinBlackList = CheckRepeatResume.joinBlackList(name, mobile);
|
||||
if (joinBlackList) {
|
||||
throw new CustomizeRunTimeException("保存失败,当前录入应聘者为黑名单人员");
|
||||
}
|
||||
List<Map<String, Object>> repeatPositionResumeList = CheckRepeatResume.getRepeatPositionResumeList(name, mobile, positionId);
|
||||
List<Map<String, Object>> repeatPositionResumeList = CheckRepeatResume.getRepeatPositionResumeList(name, mobile, positionId, billId);
|
||||
if (CollectionUtils.isNotEmpty(repeatPositionResumeList)) {
|
||||
throw new CustomizeRunTimeException("保存失败,该人员已有相同的应聘中的职位");
|
||||
}
|
||||
|
|
@ -599,4 +616,53 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建应聘者数据集合
|
||||
*
|
||||
* @param ocrResumePo
|
||||
* @return
|
||||
*/
|
||||
private RecruitDataMap<Object> buildApplicantMap(OcrResumePo ocrResumePo) {
|
||||
RecruitDataMap<Object> insertMap = new RecruitDataMap<>();
|
||||
// 姓名
|
||||
insertMap.put("xm", ocrResumePo.getXm());
|
||||
// 电子邮箱
|
||||
insertMap.put("dzyx", ocrResumePo.getYx());
|
||||
// 年龄
|
||||
insertMap.put("nl", ocrResumePo.getNl());
|
||||
// 手机号码
|
||||
insertMap.put("sjhm", ocrResumePo.getSjhm());
|
||||
// 自我评价
|
||||
insertMap.put("zwpj", ocrResumePo.getGrys());
|
||||
// 身份证号
|
||||
insertMap.put("sfz", ocrResumePo.getSfz());
|
||||
// 原始简历
|
||||
insertMap.put("ysjl", ocrResumePo.getJlfj());
|
||||
// 性别
|
||||
insertMap.put("xb", ocrResumePo.getXb());
|
||||
// 投递时间
|
||||
insertMap.put("tdsj", DateUtil.getDateTime());
|
||||
String zt = ApplicationStatusEnum.DISTRIBUTION.getValue();
|
||||
// 应聘职位
|
||||
//String ypzw = ocrResumePo.getYpzw();
|
||||
//if (StringUtils.isNotBlank(ypzw)) {
|
||||
// String flowId = PositionCommonInfo.getRecruitFlowId(ypzw);
|
||||
// Map<String, String> initialStage = ApplicantCommonInfo.getInitialStage(flowId);
|
||||
// if (null != initialStage) {
|
||||
// String zpjd = initialStage.get("id");
|
||||
// String dqypjd = initialStage.get("jdlx");
|
||||
// if (StringUtils.isNotBlank(zpjd) && StringUtils.isNotBlank(dqypjd)) {
|
||||
// insertMap.put("ypzw", ypzw);
|
||||
// insertMap.put("zplc", flowId);
|
||||
// insertMap.put("zpjd", zpjd);
|
||||
// insertMap.put("dqypjd", dqypjd);
|
||||
// zt = ApplicationStatusEnum.CANDIDATE.getValue();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// 应聘状态
|
||||
insertMap.put("zt", zt);
|
||||
return insertMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class SdkResumeSavedThread extends LocalRunnable {
|
|||
}
|
||||
|
||||
// 判断简历是否重复,插入主表
|
||||
int mainId = new CheckRepeatResume().insertResumeMainTable(params);
|
||||
int mainId = CheckRepeatResume.getInstance().insertResumeMainTable(params);
|
||||
|
||||
Thread.sleep(1000);
|
||||
if (-1 == mainId) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package weaver.interfaces.recruit.cronjob;
|
||||
|
||||
import weaver.interfaces.recruit.thread.ExtractOcrResumeThread;
|
||||
import weaver.interfaces.recruit.thread.ExtractQllResumeThread;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
|
|
@ -18,8 +17,8 @@ public class ResumeExtractionJob extends BaseCronJob {
|
|||
ExtractQllResumeThread qllResumeThread = new ExtractQllResumeThread();
|
||||
qllResumeThread.start();
|
||||
|
||||
// 抽取OCR解析简历
|
||||
ExtractOcrResumeThread ocrResumeThread = new ExtractOcrResumeThread();
|
||||
ocrResumeThread.start();
|
||||
//// 抽取OCR解析简历
|
||||
//ExtractOcrResumeThread ocrResumeThread = new ExtractOcrResumeThread();
|
||||
//ocrResumeThread.start();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import java.util.Map;
|
|||
* @createTime: 2023/11/10
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Deprecated
|
||||
public class ExtractOcrResumeThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -30,7 +31,7 @@ public class ExtractOcrResumeThread extends Thread {
|
|||
OcrResumePo ocrResumePo = RecruitUtil.parseMap2Object(map, OcrResumePo.class);
|
||||
RecruitDataMap<Object> dataMap = buildApplicantMap(ocrResumePo);
|
||||
// 校验简历信息、并插入
|
||||
new CheckRepeatResume().insertResumeMainTable(dataMap);
|
||||
CheckRepeatResume.getInstance().insertResumeMainTable(dataMap);
|
||||
rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 where id = ? ", ocrResumePo.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class ExtractQllResumeThread extends Thread {
|
|||
QllResumePo qllResumePo = RecruitUtil.parseMap2Object(map, QllResumePo.class);
|
||||
RecruitDataMap<Object> dataMap = buildApplicantMap(qllResumePo);
|
||||
// 校验简历信息、并插入
|
||||
int mainId = new CheckRepeatResume().insertResumeMainTable(dataMap);
|
||||
CheckRepeatResume.getInstance().insertResumeMainTable(dataMap);
|
||||
rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 where id = ? ", qllResumePo.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue