generated from dxfeng/secondev-chapanda-feishu
MODIFY-简历识别对接V2版本改造
This commit is contained in:
parent
b3f53f8c99
commit
3e310f6f7e
|
|
@ -9,7 +9,54 @@ import weaver.conn.RecordSet;
|
|||
* @version: 1.0
|
||||
*/
|
||||
public class ModeBrowserCommonInfo {
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
public static final String TYPE_GENDER = "1";
|
||||
/**
|
||||
* 简历来源
|
||||
*/
|
||||
public static final String TYPE_RESUME_SOURCE = "2";
|
||||
/**
|
||||
* 招聘渠道
|
||||
*/
|
||||
public static final String TYPE_RECRUITMENT_CHANNELS = "3";
|
||||
/**
|
||||
* 职位性质
|
||||
*/
|
||||
public static final String TYPE_JOB_NATURE = "4";
|
||||
/**
|
||||
* 职位学历要求
|
||||
*/
|
||||
public static final String TYPE_JOB_EDUCATION_REQUIREMENTS = "5";
|
||||
/**
|
||||
* 婚姻状况
|
||||
*/
|
||||
public static final String TYPE_MARITAL_STATUS = "6";
|
||||
/**
|
||||
* 在职状态
|
||||
*/
|
||||
public static final String TYPE_ON_THE_JOB_STATUS = "7";
|
||||
/**
|
||||
* 招聘原因
|
||||
*/
|
||||
public static final String TYPE_RECRUITMENT_REASON = "8";
|
||||
/**
|
||||
* 工作年限
|
||||
*/
|
||||
public static final String TYPE_YEARS_OF_WORK = "9";
|
||||
/**
|
||||
* 工作经验
|
||||
*/
|
||||
public static final String TYPE_WORK_EXPERIENCE = "10";
|
||||
/**
|
||||
* 政治面貌
|
||||
*/
|
||||
public static final String TYPE_POLITICAL_LANDSCAPE = "11";
|
||||
/**
|
||||
* 学位
|
||||
*/
|
||||
public static final String TYPE_DEGREE = "12";
|
||||
|
||||
/**
|
||||
* 根据名称,获取简历来源ID
|
||||
|
|
@ -18,19 +65,25 @@ public class ModeBrowserCommonInfo {
|
|||
* @return
|
||||
*/
|
||||
public static String getResumeSource(String name) {
|
||||
return getBrowserId("2", name);
|
||||
return getBrowserId(TYPE_RESUME_SOURCE, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称,获取简历来源ID
|
||||
* 根据名称,获取工作经验ID
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getWorkExperience(String name) {
|
||||
return getBrowserId("10", name);
|
||||
return getBrowserId(TYPE_WORK_EXPERIENCE, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学历ID
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getEducationLevelId(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return null;
|
||||
|
|
@ -45,7 +98,8 @@ public class ModeBrowserCommonInfo {
|
|||
}
|
||||
|
||||
|
||||
private static String getBrowserId(String zdlxmc, String xxnr) {
|
||||
|
||||
public static String getBrowserId(String zdlxmc, String xxnr) {
|
||||
if (StringUtils.isBlank(xxnr)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ 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;
|
||||
|
|
@ -308,27 +307,10 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
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"));
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
int docId = RecruitModeUtil.createDocId(secCategory, imageFileId, user);
|
||||
// 更新原始简历信息
|
||||
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);
|
||||
returnMap.put("mainId", resumeId);
|
||||
returnMap.put("sourceId", resumeId);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,37 @@
|
|||
package com.engine.resumestorage.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.exception.ECException;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.conn.CheckRepeatResume;
|
||||
import com.engine.recruit.conn.ModeBrowserCommonInfo;
|
||||
import com.engine.recruit.conn.RecruitDataMap;
|
||||
import com.engine.recruit.conn.RecruitRecordSet;
|
||||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.resumestorage.service.ResumeIdentifyService;
|
||||
import com.engine.resumestorage.util.ParseResumeQliUtil;
|
||||
import com.engine.resumestorage.util.Sql;
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.integration.logging.Logger;
|
||||
import weaver.integration.logging.LoggerFactory;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentifyService {
|
||||
private final Logger log = LoggerFactory.getLogger(ResumeIdentifyService.class);
|
||||
|
|
@ -31,7 +46,9 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
|
||||
@Override
|
||||
public int saveResumeByImageFileId(int imageFileId) throws Exception {
|
||||
new HashMap();
|
||||
if(user==null){
|
||||
throw new CustomizeRunTimeException("--------------------");
|
||||
}
|
||||
String response = ParseResumeQliUtil.doParseHostPost(imageFileId);
|
||||
this.log.info("千里聆接口返回值:" + response);
|
||||
if (response.length() == 0) {
|
||||
|
|
@ -50,8 +67,41 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
throw new Exception("调用千里聆接口失败,失败原因:" + resultall.getString("info"));
|
||||
} else {
|
||||
JSONObject result = resultall.getJSONObject("result");
|
||||
Map<String, String> saveResume = this.parseJsonToMap(result);
|
||||
return this.saveResumeInDB(saveResume);
|
||||
Map<String, Object> resumeData = this.parseQllJsonToMapV2(result, false);
|
||||
// 添加原始附件字段信息
|
||||
int secCategory = Convert.toInt(RecruitModeUtil.getRecruitPropValue("APPLICANTS_RESUMES_CATEGORY"));;
|
||||
try {
|
||||
int docId = RecruitModeUtil.createDocId(secCategory, imageFileId, user);
|
||||
resumeData.put("ysjl", docId);
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
List<RecruitDataMap<Object>> studyList = (List<RecruitDataMap<Object>>) resumeData.remove("jyjl");
|
||||
List<RecruitDataMap<Object>> workList = (List<RecruitDataMap<Object>>) resumeData.remove("gzjl");
|
||||
List<RecruitDataMap<Object>> projectList = (List<RecruitDataMap<Object>>) resumeData.remove("xmjy");
|
||||
|
||||
// 状态
|
||||
resumeData.put("zt", ApplicationStatusEnum.DISTRIBUTION.getValue());
|
||||
|
||||
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_yppc");
|
||||
Set<String> keySet = fieldList.stream().map(Formfield::getFieldname).collect(Collectors.toSet());
|
||||
|
||||
// 移除不在 keySet 中的键值对
|
||||
resumeData.entrySet().removeIf(entry -> !keySet.contains(entry.getKey()));
|
||||
|
||||
|
||||
// 判断简历信息
|
||||
CheckRepeatResume instance = CheckRepeatResume.getInstance();
|
||||
Map<String, Object> map = instance.insertResumeAndReturn(resumeData);
|
||||
String mainId = Util.null2String(map.get("mainId"));
|
||||
String sourceId = Util.null2String(map.get("sourceId"));
|
||||
|
||||
String id = StringUtils.isNotBlank(sourceId) ? sourceId : mainId;
|
||||
instance.insertResumeDetailTable(studyList, "uf_jcl_yppc_dt1", mainId, sourceId);
|
||||
instance.insertResumeDetailTable(workList, "uf_jcl_yppc_dt2", mainId, sourceId);
|
||||
instance.insertResumeDetailTable(projectList, "uf_jcl_yppc_dt3", mainId, sourceId);
|
||||
return Integer.parseInt(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -101,6 +151,336 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> parseQllJsonToMapV2(JSONObject obj, boolean isCard) {
|
||||
new BaseBean().writeLog(obj.toJSONString());
|
||||
Map<String, Object> dataMap = new HashMap<>(16);
|
||||
JSONObject personalInformation = obj.getJSONObject("个人信息");
|
||||
// 投递时间
|
||||
dataMap.put("tdsj", weaver.common.DateUtil.getDateTime());
|
||||
// 姓名
|
||||
String xm = personalInformation.getString("姓名");
|
||||
dataMap.put("xm", xm);
|
||||
// 电子邮箱
|
||||
String dzyx = personalInformation.getString("电子邮箱");
|
||||
dataMap.put("dzyx", dzyx);
|
||||
// 手机号码
|
||||
String sjhm = personalInformation.getString("手机号");
|
||||
dataMap.put("sjhm", sjhm);
|
||||
// 年龄
|
||||
String nl = personalInformation.getString("年龄");
|
||||
dataMap.put("nl", nl);
|
||||
// 出生日期
|
||||
String csrq = personalInformation.getString("出生日期");
|
||||
dataMap.put("csrq", parseDateObject(csrq));
|
||||
// 性别 默认为男
|
||||
String xb = "女".equals(personalInformation.getString("性别")) ? "1" : "0";
|
||||
dataMap.put("xb", xb);
|
||||
// 体重(KG)
|
||||
String tz = personalInformation.getString("体重");
|
||||
dataMap.put("tzkg", Convert.toDouble(tz));
|
||||
// 身高(CM)
|
||||
String sg = personalInformation.getString("身高");
|
||||
dataMap.put("sgcm", Convert.toDouble(sg));
|
||||
// 籍贯(字段类型不支持)
|
||||
String jg = personalInformation.getString("籍贯");
|
||||
//dataMap.put("jg", parseArray(obj.getJSONArray("籍贯")));
|
||||
// 婚姻状况
|
||||
List<Map<String, String>> hyzk = getBrowserArray(personalInformation.getString("婚姻状况"), ModeBrowserCommonInfo.TYPE_MARITAL_STATUS);
|
||||
if (CollectionUtils.isNotEmpty(hyzk)) {
|
||||
dataMap.put("hyzk", hyzk);
|
||||
if (!isCard) {
|
||||
dataMap.put("hyzk", hyzk.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
// 当前所在地(字段类型不支持)
|
||||
String jdz = personalInformation.getString("现居住地");
|
||||
//dataMap.put("jzd", parseArray(obj.getJSONArray("现居住地")));
|
||||
// 政治面貌
|
||||
List<Map<String, String>> zzmm = getBrowserArray(personalInformation.getString("政治面貌"), ModeBrowserCommonInfo.TYPE_POLITICAL_LANDSCAPE);
|
||||
if (CollectionUtils.isNotEmpty(zzmm)) {
|
||||
dataMap.put("zzmm", zzmm);
|
||||
if (!isCard) {
|
||||
dataMap.put("zzmm", zzmm.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
// 在职状态
|
||||
List<Map<String, String>> zzzt = getBrowserArray(personalInformation.getString("在职状态"), ModeBrowserCommonInfo.TYPE_ON_THE_JOB_STATUS);
|
||||
if (CollectionUtils.isNotEmpty(zzzt)) {
|
||||
dataMap.put("zzzt", zzzt);
|
||||
if (!isCard) {
|
||||
dataMap.put("zzzt", zzzt.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
||||
// 工作经验
|
||||
String gzjyStr = personalInformation.getString("工作经验");
|
||||
if (gzjyStr.contains("到")) {
|
||||
String[] split = gzjyStr.split("到");
|
||||
if (split.length == 2) {
|
||||
gzjyStr = split[1];
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> gzjy = getBrowserArray(gzjyStr, ModeBrowserCommonInfo.TYPE_WORK_EXPERIENCE);
|
||||
if (CollectionUtils.isNotEmpty(gzjy)) {
|
||||
dataMap.put("gzjy", gzjy);
|
||||
if (!isCard) {
|
||||
dataMap.put("gzjy", gzjy.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
// 最高学位
|
||||
List<Map<String, String>> zgxw = getBrowserArray(personalInformation.getString("最高学位"), ModeBrowserCommonInfo.TYPE_DEGREE);
|
||||
if (CollectionUtils.isNotEmpty(zgxw)) {
|
||||
dataMap.put("zgxw", zgxw);
|
||||
if (!isCard) {
|
||||
dataMap.put("zgxw", zgxw.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
// 最高学历
|
||||
String highestEduLevel = personalInformation.getString("最高学历");
|
||||
List<Map<String, String>> zgxl = getBrowserArray(highestEduLevel, this::getEducationLevelArray);
|
||||
if (CollectionUtils.isNotEmpty(zgxl)) {
|
||||
dataMap.put("zgxl", zgxl);
|
||||
if (!isCard) {
|
||||
dataMap.put("zgxl", zgxl.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
||||
// 毕业院校
|
||||
String byyx = personalInformation.getString("毕业院校");
|
||||
dataMap.put("byyx", byyx);
|
||||
// 现税前月薪(K)
|
||||
// 自我评价
|
||||
String zwpj = personalInformation.getString("个人评价");
|
||||
dataMap.put("zwpj", zwpj);
|
||||
// 民族
|
||||
dataMap.put("mz", personalInformation.getString("民族"));
|
||||
|
||||
JSONObject jobSearchInformation = obj.getJSONObject("求职信息");
|
||||
// 期望税前月薪(K)
|
||||
String qwxz = jobSearchInformation.getString("期望薪资");
|
||||
dataMap.put("qwxz", qwxz);
|
||||
|
||||
|
||||
// 明细表数据
|
||||
// 教育经历
|
||||
JSONArray jyjl = obj.getJSONArray("学业信息");
|
||||
List<RecruitDataMap<Object>> studyList = new ArrayList<>();
|
||||
if (null != jyjl && jyjl.size() > 0) {
|
||||
for (int i = 0; i < jyjl.size(); i++) {
|
||||
JSONObject o = (JSONObject) jyjl.get(i);
|
||||
String studyDate = o.getString("就读时期");
|
||||
RecruitDataMap<Object> studyMap = new RecruitDataMap<>();
|
||||
studyMap.putAll(getDateRange(studyDate, true));
|
||||
String schoolName = o.getString("学校名称");
|
||||
studyMap.put("xxmc", schoolName);
|
||||
String educationLevel = o.getString("学历");
|
||||
List<Map<String, String>> xl = getBrowserArray(educationLevel, this::getEducationLevelArray);
|
||||
studyMap.put("xl", xl);
|
||||
if (!isCard && CollectionUtils.isNotEmpty(xl)) {
|
||||
studyMap.put("xl", xl.stream().map(item -> item.get("id")).collect(Collectors.joining(",")));
|
||||
}
|
||||
String professionalName = o.getString("专业名称");
|
||||
studyMap.put("zy", professionalName);
|
||||
// 主表 专业字段
|
||||
if (byyx.equals(schoolName) && highestEduLevel.equals(educationLevel)) {
|
||||
dataMap.put("zy", professionalName);
|
||||
}
|
||||
studyList.add(studyMap);
|
||||
}
|
||||
}
|
||||
dataMap.put("jyjl", studyList);
|
||||
|
||||
// 工作经历
|
||||
JSONArray gzjl = obj.getJSONArray("工作经历");
|
||||
List<RecruitDataMap<Object>> workList = new ArrayList<>();
|
||||
if (null != gzjl && gzjl.size() > 0) {
|
||||
for (int i = 0; i < gzjl.size(); i++) {
|
||||
JSONObject o = (JSONObject) gzjl.get(i);
|
||||
String workDate = o.getString("工作时间");
|
||||
RecruitDataMap<Object> workMap = new RecruitDataMap<>();
|
||||
workMap.putAll(getDateRange(workDate, false));
|
||||
workMap.put("gsmc", o.getString("工作单位"));
|
||||
workMap.put("gw", o.getString("岗位名称"));
|
||||
workMap.put("gzzz", o.getString("工作内容"));
|
||||
workList.add(workMap);
|
||||
}
|
||||
}
|
||||
|
||||
dataMap.put("gzjl", workList);
|
||||
|
||||
|
||||
// 项目经验
|
||||
JSONArray xmjy = obj.getJSONArray("项目经验");
|
||||
List<RecruitDataMap<Object>> projectList = new ArrayList<>();
|
||||
if (null != xmjy && xmjy.size() > 0) {
|
||||
for (int i = 0; i < xmjy.size(); i++) {
|
||||
JSONObject o = (JSONObject) xmjy.get(i);
|
||||
String startDate = getFormatDate(o.getString("开始时间"));
|
||||
String endDate = getFormatDate(o.getString("结束时间"));
|
||||
RecruitDataMap<Object> projectMap = new RecruitDataMap<>();
|
||||
projectMap.put("kssj",startDate);
|
||||
projectMap.put("jssj",endDate);
|
||||
projectMap.put("xmmc", o.getString("项目名称"));
|
||||
projectMap.put("drjs", o.getString("担任角色"));
|
||||
projectMap.put("xmms", o.getString("项目描述"));
|
||||
projectList.add(projectMap);
|
||||
}
|
||||
}
|
||||
|
||||
dataMap.put("xmjy", projectList);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换日期对象
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String parseDateObject(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
value = value.replace(".", "-");
|
||||
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
sdf.setLenient(false);
|
||||
try {
|
||||
sdf.parse(value);
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog("日期格式化失败", e);
|
||||
value = null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建浏览按钮字段信息格式
|
||||
*
|
||||
* @param text
|
||||
* @param fun
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, String>> getBrowserArray(String text, Function<String, Map<String, String>> fun) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(text)) {
|
||||
String[] split = text.split(",");
|
||||
for (String s : split) {
|
||||
Map<String, String> apply = fun.apply(s);
|
||||
list.add(apply);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建浏览按钮字段信息格式
|
||||
*
|
||||
* @param text
|
||||
* @param browserType
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, String>> getBrowserArray(String text, String browserType) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(text)) {
|
||||
String[] split = text.split(",");
|
||||
for (String s : split) {
|
||||
Map<String, String> map = new HashMap<>(2);
|
||||
if (StringUtils.isNotBlank(text)) {
|
||||
String id = ModeBrowserCommonInfo.getBrowserId(browserType, text);
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
map.put("id", id);
|
||||
map.put("name", text);
|
||||
}
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建学历字段信息
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> getEducationLevelArray(String text) {
|
||||
Map<String, String> map = new HashMap<>(2);
|
||||
if (StringUtils.isNotBlank(text)) {
|
||||
String id = ModeBrowserCommonInfo.getEducationLevelId(text);
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
map.put("id", id);
|
||||
map.put("name", text);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开始时间和结束时间
|
||||
*
|
||||
* @param date
|
||||
* @return
|
||||
*/
|
||||
private RecruitDataMap<Object> getDateRange(String date, boolean isStudy) {
|
||||
RecruitDataMap<Object> dataRangeMap = new RecruitDataMap();
|
||||
if (StringUtils.isBlank(date)) {
|
||||
return dataRangeMap;
|
||||
} else {
|
||||
String[] split = date.split("-");
|
||||
String end;
|
||||
if (split.length > 0) {
|
||||
end = getFormatDate(split[0]);
|
||||
if (end.length() == 4) {
|
||||
if (isStudy) {
|
||||
end = end + "-09-01";
|
||||
} else {
|
||||
end = "";
|
||||
}
|
||||
}
|
||||
|
||||
dataRangeMap.put("kssj", end);
|
||||
}
|
||||
|
||||
if (split.length > 1) {
|
||||
end = getFormatDate(split[1]);
|
||||
if (end.length() == 4) {
|
||||
if (isStudy) {
|
||||
end = end + "-07-01";
|
||||
} else {
|
||||
end = "";
|
||||
}
|
||||
}
|
||||
|
||||
dataRangeMap.put("jssj", end);
|
||||
}
|
||||
|
||||
return dataRangeMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取yyyy-MM-dd时间格式日期
|
||||
*
|
||||
* @param dateStr
|
||||
* @return
|
||||
*/
|
||||
private String getFormatDate(String dateStr) {
|
||||
dateStr = dateStr.replace(".", "-").replace("\\/", "-");
|
||||
if (dateStr.length() == 7) {
|
||||
return dateStr + "-01";
|
||||
} else if (dateStr.length() == 10) {
|
||||
return dateStr;
|
||||
} else if (dateStr.length() == 4) {
|
||||
return dateStr;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private void permissionReconstruction(int billId) {
|
||||
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
ModeRightInfo.setNewRight(true);
|
||||
|
|
@ -109,13 +489,29 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
|
||||
@Override
|
||||
public Map<String, String> queryByDBId(String resumeid) throws Exception {
|
||||
String tablename = "uf_jg_rmk";
|
||||
if ("1".equals(this.sfsymr)) {
|
||||
tablename = this.bb.getPropValue("youyun", "tablename");
|
||||
String sql = "select * from uf_jcl_yppc where id = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql, resumeid);
|
||||
Map<String, Object> dataMap = RecruitRecordSet.getSingleRecordMap(rs);
|
||||
|
||||
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_yppc");
|
||||
Map<String, Formfield> fieldMap = fieldList.stream().collect(Collectors.toMap(Formfield::getFieldname, item -> item, (k1, k2) -> k1));
|
||||
|
||||
|
||||
Map<String, String> returnMap = new HashMap<>();
|
||||
for (String key : dataMap.keySet()) {
|
||||
Object value = dataMap.get(key);
|
||||
if (StringUtils.isBlank(Convert.toStr(value))) {
|
||||
continue;
|
||||
}
|
||||
// 计算新的value值
|
||||
Formfield formfield = fieldMap.get(key);
|
||||
value = RecruitModeUtil.getFieldShowName(formfield, Convert.toStr(value)).replaceAll("<[^>]*>", "");
|
||||
// 更新value值
|
||||
returnMap.put(key, String.valueOf(value));
|
||||
}
|
||||
|
||||
String sql = "select * from " + tablename + " where id=" + resumeid;
|
||||
return Sql.querySingleRow(sql);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -448,7 +844,7 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
private String parseArray(JSONArray ar) {
|
||||
String rs = "";
|
||||
if (ar != null && ar.size() > 0) {
|
||||
for(int i = 0; i < ar.size(); ++i) {
|
||||
for (int i = 0; i < ar.size(); ++i) {
|
||||
if (i == ar.size() - 1) {
|
||||
rs = rs + ar.get(i);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,22 @@
|
|||
package com.engine.resumestorage.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.exception.ECException;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.conn.RecruitRecordSet;
|
||||
import com.engine.resumestorage.service.ResumeStorageService;
|
||||
import com.engine.resumestorage.util.ParseResumeUtil;
|
||||
import com.engine.resumestorage.util.Sql;
|
||||
import com.engine.resumestorage.web.ResumeStorageAction;
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
|
@ -19,6 +24,7 @@ import weaver.integration.logging.Logger;
|
|||
import weaver.integration.logging.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ResumeStorageServiceImpl extends Service implements ResumeStorageService {
|
||||
private final Logger log = LoggerFactory.getLogger(ResumeStorageAction.class);
|
||||
|
|
@ -104,13 +110,33 @@ public class ResumeStorageServiceImpl extends Service implements ResumeStorageSe
|
|||
}
|
||||
|
||||
public Map<String, String> queryByDBId(String resumeid) throws Exception {
|
||||
String tablename = "uf_jg_rmk";
|
||||
if ("1".equals(this.sfsymr)) {
|
||||
tablename = this.bb.getPropValue("youyun", "tablename");
|
||||
String sql = "select * from uf_jcl_yppc where id = ? ";
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery(sql, resumeid);
|
||||
Map<String, Object> dataMap = RecruitRecordSet.getSingleRecordMap(rs);
|
||||
|
||||
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_yppc");
|
||||
Map<String, Formfield> fieldMap = fieldList.stream().collect(Collectors.toMap(Formfield::getFieldname, item -> item, (k1, k2) -> k1));
|
||||
|
||||
|
||||
Map<String, String> returnMap = new HashMap<>();
|
||||
for (String key : dataMap.keySet()) {
|
||||
Object value = dataMap.get(key);
|
||||
if (StringUtils.isBlank(Convert.toStr(value))) {
|
||||
continue;
|
||||
}
|
||||
// 计算新的value值
|
||||
if ("xb".equals(key)) {
|
||||
returnMap.put(key, String.valueOf(value));
|
||||
} else {
|
||||
Formfield formfield = fieldMap.get(key);
|
||||
value = RecruitModeUtil.getFieldShowName(formfield, Convert.toStr(value)).replaceAll("<[^>]*>", "");
|
||||
// 更新value值
|
||||
returnMap.put(key, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
||||
String sql = "select * from " + tablename + " where id=" + resumeid;
|
||||
return Sql.querySingleRow(sql);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public boolean deleteById(String resumeid) throws Exception {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@ public final class ParseResumeQliUtil {
|
|||
postRequest.addHeader("appId", appId);
|
||||
postRequest.addHeader("timestamp", String.valueOf(currentTime));
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addTextBody("type", "pdf");
|
||||
String fileName = manager.getImageFileName();
|
||||
builder.addTextBody("type", fileName.substring(fileName.lastIndexOf('.') + 1));
|
||||
// 对接新版抽取服务
|
||||
builder.addTextBody("version", "V2");
|
||||
builder.addBinaryBody("resume", manager.getInputStream(), ContentType.APPLICATION_OCTET_STREAM, manager.getImageFileName());
|
||||
HttpEntity entity = builder.build();
|
||||
postRequest.setEntity(entity);
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.resumestorage.service.ResumeIdentifyService;
|
||||
import com.engine.resumestorage.service.impl.ResumeIdentifyServiceImpl;
|
||||
import com.engine.resumestorage.util.AjaxResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.integration.logging.Logger;
|
||||
import weaver.integration.logging.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
|
@ -22,19 +25,24 @@ public class ResumeIdentifyQliAction {
|
|||
public ResumeIdentifyQliAction() {
|
||||
}
|
||||
|
||||
private ResumeIdentifyService getService(User user) {
|
||||
return ServiceUtil.getService(ResumeIdentifyServiceImpl.class,user);
|
||||
}
|
||||
|
||||
private ResumeIdentifyService getService() {
|
||||
return (ResumeIdentifyService)ServiceUtil.getService(ResumeIdentifyServiceImpl.class);
|
||||
return ServiceUtil.getService(ResumeIdentifyServiceImpl.class);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/upload")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Integer> upload(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Integer> upload(@Context HttpServletRequest request,@Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String imageFileId = (String)map.get("imageFileId");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().saveResumeByImageFileId(Integer.parseInt(imageFileId)));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(getService(user).saveResumeByImageFileId(Integer.parseInt(imageFileId)));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("千里零...简历上传解析失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public class ExtractQllResumeThread extends Thread {
|
|||
String sourceId = Util.null2String(checkMap.get("sourceId"));
|
||||
baseBean.writeLog("千里聆简历主表数据插入完成,mainId==【" + mainId + "】,sourceId==【" + sourceId + "】");
|
||||
|
||||
// 避免未设置字段,造成重复解析的问题
|
||||
rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 where id = ? ", qllResumePo.getId());
|
||||
// 数据写入完成后,更新抽取状态为新插入的数据ID
|
||||
rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 ,mainid = ? ,sourceid = ? where id = ? ", Convert.toInt(mainId,0), Convert.toInt(sourceId,0), qllResumePo.getId());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue