diff --git a/src/com/engine/recruit/conn/CheckRepeatResume.java b/src/com/engine/recruit/conn/CheckRepeatResume.java index 2d5d8ad..fac6174 100644 --- a/src/com/engine/recruit/conn/CheckRepeatResume.java +++ b/src/com/engine/recruit/conn/CheckRepeatResume.java @@ -4,6 +4,7 @@ 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.BaseBean; import weaver.general.Util; import java.util.HashMap; @@ -98,6 +99,42 @@ public class CheckRepeatResume { return Util.getIntValue(Util.null2String(map.get("mainId"))); } + + /** + * 插入、更新明细表数据 + * + * @param detailDataList + * @param tableName + * @param mainId + * @param sourceId + */ + public void insertResumeDetailTable(List> detailDataList, String tableName, String mainId, String sourceId) { + if (CollectionUtils.isEmpty(detailDataList)) { + return; + } + boolean isUpdate = false; + if (StringUtils.isNotBlank(sourceId)) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select * from " + tableName + " where mainid = ? ", sourceId); + isUpdate = rs.getCounts() == 0; + } + try { + for (RecruitDataMap dataMap : detailDataList) { + // 明细表关联新数据 + dataMap.put("mainid", mainId); + RecruitRecordSet.insertData(dataMap, tableName); + // 明细表关联已有数据 + if (isUpdate) { + dataMap.put("mainid", sourceId); + RecruitRecordSet.insertData(dataMap, tableName); + } + + } + } catch (Exception e) { + new BaseBean().writeLog(tableName + "明细表数据插入失败", e); + } + } + /** * 插入简历数据 * @@ -250,4 +287,60 @@ public class CheckRepeatResume { } + /** + * 获取开始时间和结束时间 + * + * @param date + * @return + */ + public static RecruitDataMap getDateRange(String date, boolean isStudy) { + RecruitDataMap dataRangeMap = new RecruitDataMap<>(); + if (StringUtils.isBlank(date)) { + return dataRangeMap; + } + String[] split = date.split("-"); + if (split.length == 2) { + String start = getFormatDate(split[0]); + String end = getFormatDate(split[1]); + if (start.length() == 4) { + if (isStudy) { + start += "-09-01"; + } else { + start = ""; + } + } + if (end.length() == 4) { + if (isStudy) { + end += "-07-01"; + } else { + end = ""; + } + } + + dataRangeMap.put("kssj", start); + dataRangeMap.put("jssj", end); + } + return dataRangeMap; + } + + /** + * 获取yyyy-MM-dd时间格式日期 + * + * @param dateStr + * @return + */ + private static 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 ""; + } + + } diff --git a/src/com/engine/recruit/conn/PositionCommonInfo.java b/src/com/engine/recruit/conn/PositionCommonInfo.java index 19e4241..0a3694e 100644 --- a/src/com/engine/recruit/conn/PositionCommonInfo.java +++ b/src/com/engine/recruit/conn/PositionCommonInfo.java @@ -1,5 +1,6 @@ package com.engine.recruit.conn; +import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; /** @@ -36,6 +37,9 @@ public class PositionCommonInfo { */ public static String getRecruitFlowId(String positionId) { String recruitFlowId = ""; + if (StringUtils.isBlank(positionId)) { + return recruitFlowId; + } RecordSet rs = new RecordSet(); rs.executeQuery("select zplc from uf_jcl_zp_zpzw where id = ?", positionId); if (rs.next()) { diff --git a/src/com/engine/recruit/conn/RecruitRecordSet.java b/src/com/engine/recruit/conn/RecruitRecordSet.java index e4a6e1d..9adc278 100644 --- a/src/com/engine/recruit/conn/RecruitRecordSet.java +++ b/src/com/engine/recruit/conn/RecruitRecordSet.java @@ -61,9 +61,11 @@ public class RecruitRecordSet { List paramList = new ArrayList<>(); dataMap.forEach((key, value) -> { - fieldList.add(key); - dataList.add(value); - paramList.add("?"); + if (null != value) { + fieldList.add(key); + dataList.add(value); + paramList.add("?"); + } }); String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")"; RecordSet rs = new RecordSet(); diff --git a/src/com/engine/recruit/entity/resume/QllResumePo.java b/src/com/engine/recruit/entity/resume/QllResumePo.java index 4bb1755..a925cbf 100644 --- a/src/com/engine/recruit/entity/resume/QllResumePo.java +++ b/src/com/engine/recruit/entity/resume/QllResumePo.java @@ -6,7 +6,9 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.engine.recruit.conn.CheckRepeatResume; import com.engine.recruit.conn.ModeBrowserCommonInfo; +import com.engine.recruit.conn.RecruitDataMap; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -17,6 +19,8 @@ import weaver.general.BaseBean; import weaver.hrm.User; import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; /** * @author:dxfeng @@ -70,6 +74,7 @@ public class QllResumePo { JSONObject jsonObject = (JSONObject) jsonArray.get(0); String name = jsonObject.getString("name"); String content = jsonObject.getString("content"); + new BaseBean().writeLog("千里聆简历附件解析,id=" + id + ",jslf=" + jlfj); HttpResponse response = HttpRequest.get(content).execute(); if (response.isOk()) { String disposition = response.header("Content-Disposition"); @@ -78,7 +83,11 @@ public class QllResumePo { int imageFileId = RecruitModeUtil.generateImageFileId(inputStream, name); int docId = RecruitModeUtil.createDocId(SEC_CATEGORY, imageFileId, new User(1)); resumeId = String.valueOf(docId); + } else { + new BaseBean().writeLog("千里聆附件下载失败,Content-Disposition为空===" + response.body()); } + } else { + new BaseBean().writeLog("千里聆附件下载失败,URL响应失败"); } } catch (Exception e) { new BaseBean().writeLog("千里聆附件下载失败", e); @@ -103,7 +112,6 @@ public class QllResumePo { if (StringUtils.isBlank(gzjy)) { return null; } - ; int parseInt = Integer.parseInt(gzjy); String year = parseInt + "年"; if (0 == parseInt) { @@ -118,4 +126,89 @@ public class QllResumePo { public String getZgxl() { return ModeBrowserCommonInfo.getEducationLevelId(zgxl); } + + + public List> getGzjl() { + List> list = new ArrayList<>(); + if (StringUtils.isNotBlank(gzjl)) { + try { + JSONArray jsonArray = JSONArray.parseArray(gzjl); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String gsmc = jsonObject.getString("公司名称:"); + String zwmc = jsonObject.getString("职位名称:"); + String sj = jsonObject.getString("时间:"); + String gznr = jsonObject.getString("工作内容:"); + RecruitDataMap map = CheckRepeatResume.getDateRange(sj, false); + map.put("gsmc", gsmc); + map.put("gw", zwmc); + map.put("gzzz", formatStr(gznr)); + list.add(map); + } + } catch (Exception e) { + new BaseBean().writeLog("工作经历解析失败", e); + } + } + return list; + } + + public List> getXmjl() { + List> list = new ArrayList<>(); + if (StringUtils.isNotBlank(xmjl)) { + try { + JSONArray jsonArray = JSONArray.parseArray(xmjl); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String xmmc = jsonObject.getString("项目名称:"); + //String rzgs = jsonObject.getString("任职公司:"); + String sj = jsonObject.getString("时间:"); + String xmnr = jsonObject.getString("项目内容:"); + RecruitDataMap map = CheckRepeatResume.getDateRange(sj, false); + map.put("xmmc", xmmc); + map.put("xmms", formatStr(xmnr)); + list.add(map); + } + } catch (Exception e) { + new BaseBean().writeLog("项目经历解析失败", e); + } + } + return list; + } + + public List> getJyjl() { + List> list = new ArrayList<>(); + if (StringUtils.isNotBlank(jyjl)) { + try { + JSONArray jsonArray = JSONArray.parseArray(jyjl); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String byyx = jsonObject.getString("毕业院校:"); + String xl = jsonObject.getString("学历:"); + String sj = jsonObject.getString("时间:"); + String zy = jsonObject.getString("专业:"); + RecruitDataMap map = CheckRepeatResume.getDateRange(sj, true); + map.put("xxmc", byyx); + map.put("xl", ModeBrowserCommonInfo.getEducationLevelId(xl)); + map.put("zy", zy); + list.add(map); + } + } catch (Exception e) { + new BaseBean().writeLog("教育经历解析失败", e); + } + } + return list; + } + + public String getYpzw() { + // TODO 如果关联招聘职位 + //return ypzw; + return null; + } + + private String formatStr(String str) { + if (StringUtils.isBlank(str)) { + return ""; + } + return str.replace("\\n", "\n"); + } } diff --git a/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java b/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java index 7be7eda..4b6911a 100644 --- a/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java +++ b/src/com/engine/recruit/service/impl/InitRecruitDataServiceImpl.java @@ -41,7 +41,10 @@ public class InitRecruitDataServiceImpl extends Service implements InitRecruitDa rs.executeUpdate("delete from uf_jcl_zpjdsz_dt2;"); rs.executeUpdate("delete from uf_jcl_lcczan;"); // 刷新页面菜单 - refreshMenuUrl(); + rs.executeQuery("select * from hp_nonstandard_function_info where num='163' and name ='招聘管理'"); + if (rs.next()) { + refreshMenuUrl(); + } // 插入操作按钮数据, int buttonModeId = ApplicantCommonInfo.getModeIdByTableName("uf_jcl_lcczan"); diff --git a/src/com/engine/recruit/thread/SdkResumeSavedThread.java b/src/com/engine/recruit/thread/SdkResumeSavedThread.java index cc15666..1742f0a 100644 --- a/src/com/engine/recruit/thread/SdkResumeSavedThread.java +++ b/src/com/engine/recruit/thread/SdkResumeSavedThread.java @@ -1,6 +1,8 @@ package com.engine.recruit.thread; import cn.hutool.core.convert.Convert; +import com.alibaba.fastjson.JSON; +import com.engine.recruit.conn.ApplicantCommonInfo; import com.engine.recruit.conn.CheckRepeatResume; import com.engine.recruit.conn.PositionCommonInfo; import com.engine.recruit.conn.RecruitDataMap; @@ -16,6 +18,8 @@ import weaver.common.DateUtil; import weaver.conn.RecordSet; import weaver.erpa.apps.entity.application.resume.dto.*; import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil; +import weaver.general.BaseBean; +import weaver.general.Util; import weaver.hrm.User; import java.util.ArrayList; @@ -49,6 +53,9 @@ public class SdkResumeSavedThread extends LocalRunnable { * @throws Exception */ private void parseResume(ResumeMqMessage resumeMqMessage) throws Exception { + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("千里聆SDK简历开始解析------"); + baseBean.writeLog("resumeMqMessage===" + JSON.toJSONString(resumeMqMessage)); String userId = resumeMqMessage.getUserId(); User user = new User(); if (StringUtils.isNotBlank(userId)) { @@ -83,60 +90,77 @@ public class SdkResumeSavedThread extends LocalRunnable { params.put("qlljl", resumeId); // 判断是否有发布职位信息,如有发布职位信息,完善招聘流程信息,并指定为待分配状态 String positionId = PositionCommonInfo.getPositionIdByQll(resumeInfoDto.getJobId()); + String zt = ApplicationStatusEnum.DISTRIBUTION.getValue(); + // 应聘职位 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()); + String flowId = PositionCommonInfo.getRecruitFlowId(positionId); + Map initialStage = ApplicantCommonInfo.getInitialStage(flowId); + if (null != initialStage) { + String zpjd = initialStage.get("zpjd"); + String dqypjd = initialStage.get("jdlx"); + if (StringUtils.isNotBlank(zpjd) && StringUtils.isNotBlank(dqypjd)) { + params.put("ypzw", positionId); + params.put("zplc", flowId); + params.put("zpjd", zpjd); + params.put("dqypjd", dqypjd); + zt = ApplicationStatusEnum.CANDIDATE.getValue(); + } + } } + // 应聘状态 + params.put("zt", zt); // 判断简历是否重复,插入主表 - int mainId = CheckRepeatResume.getInstance().insertResumeMainTable(params); + CheckRepeatResume instance = CheckRepeatResume.getInstance(); + Map checkMap = instance.insertResumeAndReturn(params); + String mainId = Util.null2String(checkMap.get("mainId")); + String sourceId = Util.null2String(checkMap.get("sourceId")); Thread.sleep(1000); - if (-1 == mainId) { + if ("-1".equals(mainId)) { return; } - RecordSet rs = new RecordSet(); // 插入明细表数据 + List> jyjl = new ArrayList<>(); List educationExperience = resumeInfoDto.getEducationExperience(); - String sql = "insert into uf_jcl_yppc_dt1 (mainId,xxmc,xl,zy,kssj,jssj) values (?,?,?,?,?,?) "; for (ResumeInfoEducationExperienceDto educationExperienceDto : educationExperience) { - List data = new ArrayList<>(); - data.add(mainId); - data.add(educationExperienceDto.getSchoolName()); - data.add(HighestDegreeEnum.getDegreeId(educationExperienceDto.getDegree()).getId()); - data.add(educationExperienceDto.getMajor()); - data.add(DateUtil.getDate(educationExperienceDto.getBeginTime())); - data.add(DateUtil.getDate(educationExperienceDto.getEndTime())); - rs.executeUpdate(sql, data); + RecruitDataMap map = new RecruitDataMap<>(); + map.put("xxmc", educationExperienceDto.getSchoolName()); + map.put("xl", HighestDegreeEnum.getDegreeId(educationExperienceDto.getDegree()).getId()); + map.put("zy", educationExperienceDto.getMajor()); + map.put("kssj", DateUtil.getDate(educationExperienceDto.getBeginTime())); + map.put("jssj", DateUtil.getDate(educationExperienceDto.getEndTime())); + jyjl.add(map); } - sql = "insert into uf_jcl_yppc_dt2 (mainId,gsmc,gw,gzzz,kssj,jssj) values (?,?,?,?,?,?) "; + instance.insertResumeDetailTable(jyjl, "uf_jcl_yppc_dt1", mainId, sourceId); + + List> gzjl = new ArrayList<>(); List workExperience = resumeInfoDto.getWorkExperience(); for (ResumeInfoWorkExperienceDto workExperienceDto : workExperience) { - List data = new ArrayList<>(); - data.add(mainId); - data.add(workExperienceDto.getCompanyName()); - data.add(workExperienceDto.getJobName()); - data.add(workExperienceDto.getContent()); - data.add(DateUtil.getDate(workExperienceDto.getBeginTime())); - data.add(DateUtil.getDate(workExperienceDto.getEndTime())); - rs.executeUpdate(sql, data); + RecruitDataMap map = new RecruitDataMap<>(); + map.put("gsmc", workExperienceDto.getCompanyName()); + map.put("gw", workExperienceDto.getJobName()); + map.put("gzzz", workExperienceDto.getContent()); + map.put("kssj", DateUtil.getDate(workExperienceDto.getBeginTime())); + map.put("jssj", DateUtil.getDate(workExperienceDto.getEndTime())); + gzjl.add(map); + } - sql = "insert into uf_jcl_yppc_dt3 (mainId,xmmc,xmms,kssj,jssj) values (?,?,?,?,?) "; + instance.insertResumeDetailTable(gzjl, "uf_jcl_yppc_dt2", mainId, sourceId); + + List> xmjl = new ArrayList<>(); List projectExperience = resumeInfoDto.getProjectExperience(); for (ResumeInfoProjectExperienceDto projectExperienceDto : projectExperience) { - List data = new ArrayList<>(); - data.add(mainId); - data.add(projectExperienceDto.getProjectName()); - data.add(projectExperienceDto.getContent()); - data.add(DateUtil.getDate(projectExperienceDto.getBeginTime())); - data.add(DateUtil.getDate(projectExperienceDto.getEndTime())); - rs.executeUpdate(sql, data); + RecruitDataMap map = new RecruitDataMap<>(); + map.put("xmmc", projectExperienceDto.getProjectName()); + map.put("xmms", projectExperienceDto.getContent()); + map.put("kssj", DateUtil.getDate(projectExperienceDto.getBeginTime())); + map.put("jssj", DateUtil.getDate(projectExperienceDto.getEndTime())); + xmjl.add(map); } + instance.insertResumeDetailTable(xmjl, "uf_jcl_yppc_dt3", mainId, sourceId); + } @@ -184,14 +208,19 @@ public class SdkResumeSavedThread extends LocalRunnable { * @return */ private String convertStreamToE9DocId(Long resumeFileId, User user) { + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("解析千里聆SDK原始简历,resumeFileId===" + resumeFileId); List docIdList = new ArrayList<>(); ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient(); client.start(); client.downloadResumeFile(resumeFileId, (fileName, stream) -> { try { + baseBean.writeLog("解析千里聆SDK原始简历,fileName===" + fileName); int imageFileId = RecruitModeUtil.generateImageFileId(stream, fileName); + baseBean.writeLog("解析千里聆SDK原始简历,imageFileId===" + imageFileId); docIdList.add(RecruitModeUtil.createDocId(SEC_CATEGORY, imageFileId, user)); } catch (Exception e) { + baseBean.writeLog("解析千里聆SDK原始简历失败", e); throw new RuntimeException(e); } }); diff --git a/src/weaver/interfaces/recruit/thread/ExtractQllResumeThread.java b/src/weaver/interfaces/recruit/thread/ExtractQllResumeThread.java index 3d5c2cc..d1e60bd 100644 --- a/src/weaver/interfaces/recruit/thread/ExtractQllResumeThread.java +++ b/src/weaver/interfaces/recruit/thread/ExtractQllResumeThread.java @@ -1,5 +1,6 @@ package weaver.interfaces.recruit.thread; +import com.alibaba.fastjson.JSON; import com.engine.recruit.conn.*; import com.engine.recruit.entity.resume.QllResumePo; import com.engine.recruit.enums.ApplicationStatusEnum; @@ -8,6 +9,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import weaver.common.DateUtil; import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; import java.util.List; import java.util.Map; @@ -28,10 +31,23 @@ public class ExtractQllResumeThread extends Thread { } for (Map map : mapList) { QllResumePo qllResumePo = RecruitUtil.parseMap2Object(map, QllResumePo.class); - RecruitDataMap dataMap = buildApplicantMap(qllResumePo); - // 校验简历信息、并插入 - CheckRepeatResume.getInstance().insertResumeMainTable(dataMap); - rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 where id = ? ", qllResumePo.getId()); + try { + RecruitDataMap dataMap = buildApplicantMap(qllResumePo); + // 校验简历信息、并插入 + CheckRepeatResume instance = CheckRepeatResume.getInstance(); + Map checkMap = instance.insertResumeAndReturn(dataMap); + String mainId = Util.null2String(checkMap.get("mainId")); + String sourceId = Util.null2String(checkMap.get("sourceId")); + rs.executeUpdate("update uf_jcl_jlzjb set cqzt = 1 where id = ? ", qllResumePo.getId()); + + // 插入明细表数据 + instance.insertResumeDetailTable(qllResumePo.getJyjl(), "uf_jcl_yppc_dt1", mainId, sourceId); + instance.insertResumeDetailTable(qllResumePo.getGzjl(), "uf_jcl_yppc_dt2", mainId, sourceId); + instance.insertResumeDetailTable(qllResumePo.getXmjl(), "uf_jcl_yppc_dt3", mainId, sourceId); + } catch (Exception e) { + new BaseBean().writeLog("简历解析失败" + JSON.toJSONString(qllResumePo), e); + } + } } @@ -45,24 +61,24 @@ public class ExtractQllResumeThread extends Thread { RecruitDataMap insertMap = new RecruitDataMap<>(); // 姓名 insertMap.put("xm", qllResumePo.getXm()); - // 简历来源 - insertMap.put("jlly", qllResumePo.getLyqd()); - // 电子邮箱 - insertMap.put("dzyx", qllResumePo.getYx()); - // 手机号码 - insertMap.put("sjhm", qllResumePo.getSjhm()); - // 年龄 - insertMap.put("nl", qllResumePo.getNl()); // 性别 insertMap.put("xb", qllResumePo.getXb()); + // 年龄 + insertMap.put("nl", qllResumePo.getNl()); // 工作经验 insertMap.put("gzjy", qllResumePo.getGzjy()); - // 最高学历 - insertMap.put("zgxl", qllResumePo.getZgxl()); - // 投递时间 - insertMap.put("tdsj", DateUtil.getDateTime()); + // 手机号码 + insertMap.put("sjhm", qllResumePo.getSjhm()); + // 电子邮箱 + insertMap.put("dzyx", qllResumePo.getYx()); // 自我评价 insertMap.put("zwpj", qllResumePo.getGrys()); + // 最高学历 + insertMap.put("zgxl", qllResumePo.getZgxl()); + // 简历来源 + insertMap.put("jlly", qllResumePo.getLyqd()); + // 投递时间 + insertMap.put("tdsj", DateUtil.getDateTime()); // 原始简历 insertMap.put("ysjl", qllResumePo.getJlfj());