简历卡片、建立识别功能

This commit is contained in:
dxfeng 2023-12-13 17:09:46 +08:00
parent f00138f584
commit f31b9f8042
9 changed files with 525 additions and 449 deletions

View File

@ -0,0 +1,12 @@
package com.api.recruit.controller;
import javax.ws.rs.Path;
/**
* @author:dxfeng
* @createTime: 2023/12/12
* @version: 1.0
*/
@Path("/jcl/recruit/resume")
public class ResumeRecognitionController extends com.engine.recruit.controller.ResumeRecognitionController {
}

View File

@ -61,9 +61,11 @@ public class RecruitRecordSet {
List<String> 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();

View File

@ -0,0 +1,37 @@
package com.engine.recruit.controller;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.recruit.util.ResponseResult;
import com.engine.recruit.wrapper.ResumeRecognitionWrapper;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/12/12
* @version: 1.0
*/
public class ResumeRecognitionController {
public ResumeRecognitionWrapper getResumeRecognitionWrapper(User user) {
return ServiceUtil.getService(ResumeRecognitionWrapper.class, user);
}
@POST
@Path("/resumeUpload")
@Produces(MediaType.APPLICATION_JSON)
public String resumeUpload(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getResumeRecognitionWrapper(user)::resumeUpload, param);
}
}

View File

@ -0,0 +1,21 @@
package com.engine.recruit.service;
import java.util.Map;
/**
* 简历识别服务类
*
* @author:dxfeng
* @createTime: 2023/12/12
* @version: 1.0
*/
public interface ResumeRecognitionService {
/**
* 简历上传简历解析
*
* @param param
* @return
*/
Map<String, Object> resumeUpload(Map<String, Object> param);
}

View File

@ -0,0 +1,420 @@
package com.engine.recruit.service.impl;
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.exception.CustomizeRunTimeException;
import com.engine.recruit.service.ResumeRecognitionService;
import com.engine.resumestorage.util.HttpUtils;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import weaver.file.ImageFileManager;
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.io.File;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/12/12
* @version: 1.0
*/
public class ResumeRecognitionServiceImpl extends Service implements ResumeRecognitionService {
/**
* 简历识别类型
*/
private static final String OCR_TYPE = RecruitModeUtil.getRecruitPropValue("OCR_TYPE");
@Override
public Map<String, Object> resumeUpload(Map<String, Object> param) {
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("isOcr", true);
if (StringUtils.isBlank(OCR_TYPE)) {
returnMap.put("isOcr", false);
return returnMap;
}
String resumeId = Util.null2String(param.get("resumeId"));
if (StringUtils.isBlank(resumeId)) {
throw new CustomizeRunTimeException("原始简历文件获取失败");
}
// 调用千里聆服务
if ("1".equals(OCR_TYPE)) {
qllResumeUpload(Integer.parseInt(resumeId), returnMap);
}
// 调用阿里云服务
if ("2".equals(OCR_TYPE)) {
alyResumeUpload(Integer.parseInt(resumeId), returnMap);
}
return returnMap;
}
/**
* @param resumeId 简历ID
* @param returnMap 响应集合
*/
private void qllResumeUpload(int resumeId, Map<String, Object> returnMap) {
String response = doQllPost(resumeId);
if (StringUtils.isBlank(response)) {
throw new CustomizeRunTimeException("千里聆接口调用失败,响应结果为空");
}
JSONObject all = JSONObject.parseObject(response);
if (!all.getBoolean("isSuccess")) {
throw new CustomizeRunTimeException("千里聆接口调用失败,接口不通");
}
JSONObject resultall = all.getJSONObject("data");
String status = resultall.getString("state");
if ("fail".equals(status)) {
throw new CustomizeRunTimeException("调用千里聆接口失败,失败原因:" + resultall.getString("info"));
}
JSONObject result = resultall.getJSONObject("result");
Map<String, Object> dataMap = parseQllJsonToMap(result);
returnMap.put("data", dataMap);
}
/**
* @param resumeId 简历ID
* @param returnMap 响应集合
*/
private void alyResumeUpload(int resumeId, Map<String, Object> returnMap) {
String response = doAlyPost(resumeId);
JSONObject all = JSONObject.parseObject(response);
String error_msg = all.getString("error_msg");
if (!"成功".equals(error_msg)) {
throw new CustomizeRunTimeException("阿里云简历识别失败");
}
Map<String, String> saveResume = new HashMap<>();
JSONObject cv_parse = all.getJSONObject("data").getJSONObject("cv_parse");
saveResume.putAll(buildBasicInfo(cv_parse.getJSONObject("basic_info")));
saveResume.putAll(buildEducations(this.getJsonArrayFirstIfPresent(cv_parse.getJSONArray("educations"))));
saveResume.putAll(buildContact(cv_parse.getJSONObject("contact")));
saveResume.putAll(buildJobObjective(cv_parse.getJSONObject("job_objective")));
saveResume.putAll(buildOccupations(this.getJsonArrayFirstIfPresent(cv_parse.getJSONArray("occupations"))));
returnMap.put("data", saveResume);
}
private Map<String, Object> parseQllJsonToMap(JSONObject obj) {
Map<String, Object> dataMap = new HashMap<>();
// 姓名
String xm = parseArray(obj.getJSONArray("姓名"));
dataMap.put("xm", parseInputObject(xm));
// 电子邮箱
String dzyx = parseArray(obj.getJSONArray("电子邮箱"));
dataMap.put("dzyx", parseInputObject(dzyx));
// 手机号码
String sjhm = parseArray(obj.getJSONArray("手机号"));
dataMap.put("sjhm", parseInputObject(sjhm));
// 年龄
String nl = parseArray(obj.getJSONArray("年龄"));
dataMap.put("nl", parseInputObject(nl));
// 出生日期
String csrq = parseArray(obj.getJSONArray("出生日期"));
dataMap.put("csrq", parseDateObject(csrq));
// 民族
// 性别
String xb = "".equals(parseArray(obj.getJSONArray("性别"))) ? "0" : "1";
dataMap.put("xb", parseValueObject(xb));
// 体重KG
// 身高CM
// 籍贯
dataMap.put("jg", parseArray(obj.getJSONArray("籍贯")));
// 婚姻状况
// 当前所在地
dataMap.put("jzd", parseArray(obj.getJSONArray("现居住地")));
// 政治面貌
// 在职状态
// 工作经验
dataMap.put("gzjy", parseArray(obj.getJSONArray("工作经验")));
// 最高学位
dataMap.put("zgxw", parseArray(obj.getJSONArray("最高学位")));
// 最高学历
dataMap.put("zgxlwb", parseArray(obj.getJSONArray("最高学历")));
// 专业
String zy = parseArray(obj.getJSONArray("专业"));
dataMap.put("zy", parseInputObject(zy));
// 毕业院校
String byyx = parseArray(obj.getJSONArray("毕业院校"));
dataMap.put("byyx", parseInputObject(byyx));
// 期望税前月薪K
String qwxz = parseArray(obj.getJSONArray("期望薪资"));
dataMap.put("qwxz", parseInputObject(qwxz));
// 现税前月薪K
// 自我评价
String zwpj = parseArray(obj.getJSONArray("个人评价"));
dataMap.put("zwpj", parseInputObject(zwpj));
// 明细表数据
// 教育经历
// 工作经历
// 项目经验
// 语言能力
// TODO
// 当前所在地
// TODO
dataMap.put("mz", parseArray(obj.getJSONArray("民族")));
dataMap.put("wx", parseArray(obj.getJSONArray("微信")));
dataMap.put("qq", parseArray(obj.getJSONArray("QQ")));
dataMap.put("ah", parseArray(obj.getJSONArray("爱好")));
dataMap.put("bysj", parseArray(obj.getJSONArray("毕业时间")));
dataMap.put("zyjn", parseArray(obj.getJSONArray("专业技能")));
dataMap.put("sxjl", parseArray(obj.getJSONArray("实习经历")));
dataMap.put("yysp", parseArray(obj.getJSONArray("英语水平")));
dataMap.put("jnzs", parseArray(obj.getJSONArray("技能证书")));
dataMap.put("xyjl", parseArray(obj.getJSONArray("校园经历")));
dataMap.put("gzxg", parseArray(obj.getJSONArray("工作信息")));
dataMap.put("qwcsgw", parseArray(obj.getJSONArray("期望从事岗位")));
dataMap.put("qwgzdd", parseArray(obj.getJSONArray("期望工作地点")));
dataMap.put("xmjl", parseArray(obj.getJSONArray("项目经历")));
dataMap.put("xyxg", parseArray(obj.getJSONArray("学业信息")));
return dataMap;
}
private Map<String, String> buildBasicInfo(JSONObject basicInfo) {
Map<String, String> basic = new HashMap();
if (basicInfo.containsKey("name")) {
String jzd;
basic.put("xm", Util.null2String(basicInfo.getString("name")));
basic.put("nl", Util.null2String(basicInfo.getInteger("age")));
if ("".equals(Util.null2String(basicInfo.getString("gender")))) {
basic.put("xb", "0");
} else if ("".equals(Util.null2String(basicInfo.getString("gender")))) {
basic.put("xb", "1");
}
jzd = basicInfo.getJSONObject("location").getString("province") + basicInfo.getJSONObject("location").getString("city");
basic.put("jzd", Util.null2String(jzd));
}
return basic;
}
private Map<String, String> buildEducations(JSONObject educations) {
Map<String, String> major = new HashMap<>();
if (educations != null) {
if (educations.containsKey("major")) {
major.put("sxzy", Util.null2String(educations.getString("major")));
}
}
return major;
}
private Map<String, String> buildContact(JSONObject contact) {
Map<String, String> mobile = new HashMap();
if (contact.containsKey("mobile")) {
mobile.put("wx", Util.null2String(contact.getString("mobile")));
mobile.put("sjhm", Util.null2String(contact.getString("mobile")));
mobile.put("qq", Util.null2String(contact.getString("qq")));
mobile.put("email", Util.null2String(contact.getString("email")));
}
return mobile;
}
private Map<String, String> buildJobObjective(JSONObject job_objective) {
Map<String, String> expect_salary = new HashMap();
if (job_objective != null) {
if (job_objective.containsKey("expect_salary")) {
expect_salary.put("qwxz", Util.null2String(job_objective.getString("expect_salary")));
}
}
return expect_salary;
}
private Map<String, String> buildOccupations(JSONObject occupations) {
Map<String, String> company = new HashMap();
if (occupations != null) {
if (occupations.containsKey("company")) {
company.put("gs", Util.null2String(occupations.getString("expect_salary")));
}
}
return company;
}
private JSONObject getJsonArrayFirstIfPresent(JSONArray jsonArray) {
return jsonArray.size() > 0 ? jsonArray.getJSONObject(0) : null;
}
/**
* @param resumeId
* @return
*/
private String doQllPost(int resumeId) {
BaseBean bean = new BaseBean();
String url = bean.getPropValue("resume_qianliling", "qianlilingurl");
String appId = bean.getPropValue("resume_qianliling", "appId");
String appSecret = bean.getPropValue("resume_qianliling", "appSecret");
long currentTime = System.currentTimeMillis();
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(resumeId);
HttpPost postRequest = new HttpPost(url);
postRequest.addHeader("sign", getSign(appId, appSecret, currentTime));
postRequest.addHeader("appId", appId);
postRequest.addHeader("timestamp", String.valueOf(currentTime));
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
// TODO
builder.addTextBody("type", "pdf");
builder.addBinaryBody("resume", manager.getInputStream(), ContentType.APPLICATION_OCTET_STREAM, manager.getImageFileName());
HttpEntity entity = builder.build();
postRequest.setEntity(entity);
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(postRequest);
HttpEntity responseEntity = response.getEntity();
return EntityUtils.toString(responseEntity);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @param resumeId
* @return
*/
private String doAlyPost(int resumeId) {
try {
BaseBean bean = new BaseBean();
String PARSE_HOST = bean.getPropValue("youyun", "host");
String PATH = bean.getPropValue("youyun", "path");
String METHOD = bean.getPropValue("youyun", "method");
String APPCODE = bean.getPropValue("youyun", "appcode");
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(resumeId);
String filePath = manager.getFileRealPath();
File file = new File(filePath);
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", "APPCODE " + APPCODE);
headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
Map<String, String> queryMap = new HashMap<>();
Map<String, String> bodyMap = new HashMap<>();
byte[] bytes = FileUtils.readFileToByteArray(file);
String base64 = Base64.encodeBase64String(bytes);
bodyMap.put("content", base64);
bodyMap.put("ext", "doc");
HttpResponse response = HttpUtils.doPost(PARSE_HOST, PATH, METHOD, headers, queryMap, bodyMap);
return EntityUtils.toString(response.getEntity());
} catch (Exception var10) {
throw new ECException("简历解析失败!详情:" + var10.getMessage());
}
}
/**
* 千里聆签名
*
* @param appId 开发者AppId
* @param appSecret 开发者appSecret
* @param timestamp 当前时间戳(毫秒数)
* @return
*/
private static String getSign(String appId, String appSecret, long timestamp) {
if (appId != null && appId.length() != 0) {
if (appSecret != null && appSecret.length() != 0) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(appId.getBytes());
md5.update((timestamp + "").getBytes());
md5.update(appSecret.getBytes());
byte[] bytes = md5.digest();
return (new BigInteger(1, bytes)).toString(16);
} catch (NoSuchAlgorithmException var8) {
throw new CustomizeRunTimeException("不支持的加密算法", var8);
}
} else {
throw new CustomizeRunTimeException("appSecret不能为空");
}
} else {
throw new CustomizeRunTimeException("appId不能为空");
}
}
/**
* 文本转换
*
* @param ar
* @return
*/
private String parseArray(JSONArray ar) {
StringBuilder rs = new StringBuilder();
if (ar != null && ar.size() > 0) {
for (int i = 0; i < ar.size(); ++i) {
if (i == ar.size() - 1) {
rs.append(ar.get(i));
} else {
rs.append(ar.get(i)).append(",");
}
}
}
return rs.toString();
}
/**
* 转换文本对象
*
* @param value
* @return
*/
private String parseInputObject(String value) {
return value;
// return "{value: \"" + value + "\",showhtml: \"" + value + "\"}";
}
private String parseValueObject(String value) {
return value;
// return "{value: \"" + value + "\"}";
}
/**
* 转换日期对象
*
* @param value
* @return
*/
private String parseDateObject(String value) {
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setLenient(false);
try {
sdf.parse(value);
} catch (ParseException e) {
value = "";
}
return parseInputObject(value);
}
}

View File

@ -0,0 +1,25 @@
package com.engine.recruit.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.recruit.service.ResumeRecognitionService;
import com.engine.recruit.service.impl.ResumeRecognitionServiceImpl;
import weaver.hrm.User;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/12/12
* @version: 1.0
*/
public class ResumeRecognitionWrapper extends Service {
private ResumeRecognitionService getResumeRecognitionService(User user) {
return ServiceUtil.getService(ResumeRecognitionServiceImpl.class, user);
}
public Map<String, Object> resumeUpload(Map<String, Object> param) {
return getResumeRecognitionService(user).resumeUpload(param);
}
}

View File

@ -1,444 +0,0 @@
package com.engine.resumestorage.service.impl;
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.resumestorage.service.ResumeIdentifyService;
import com.engine.resumestorage.util.ParseResumeQliUtil;
import com.engine.resumestorage.util.Sql;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSetTrans;
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.util.*;
public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentifyService {
private final Logger log = LoggerFactory.getLogger(ResumeIdentifyService.class);
BaseBean bb = new BaseBean();
String formmodeid_tmp;
String sfsymr;
public ResumeIdentifyServiceImpl() {
this.formmodeid_tmp = this.bb.getPropValue("resume_qianliling", "model.id");
this.sfsymr = this.bb.getPropValue("resume_qianliling", "sfsymr");
}
public int saveResumeByImageFileId(int imageFileId) throws Exception {
new HashMap();
String response = ParseResumeQliUtil.doParseHostPost(imageFileId);
this.log.info("千里聆接口返回值:" + response);
if (response.length() == 0) {
this.log.info("调用千里零接口失败,返回值为空");
throw new Exception("调用千里零接口失败,返回值为空");
} else {
JSONObject all = JSONObject.parseObject(response);
if (!all.getBoolean("isSuccess")) {
this.log.info("调用千里零接口失败,接口不通");
throw new Exception("调用千里零接口失败,接口不通");
} else {
JSONObject resultall = all.getJSONObject("data");
String status = resultall.getString("state");
if ("fail".equals(status)) {
this.log.info("调用千里零接口失败,失败原因:" + resultall.getString("info"));
throw new Exception("调用千里零接口失败,失败原因:" + resultall.getString("info"));
} else {
JSONObject result = resultall.getJSONObject("result");
Map<String, String> saveResume = this.parseJsonToMap(result);
return this.saveResumeInDB(saveResume);
}
}
}
}
public int saveResumeInDB(Map<String, String> fields) throws Exception {
String tablename = "uf_jg_rmk";
if ("1".equals(this.sfsymr)) {
tablename = this.bb.getPropValue("resume_qianliling", "jlk.tablename");
}
RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false);
List<String> field = new ArrayList();
List<String> value1 = new ArrayList();
List<String> value = new ArrayList();
fields.forEach((key, v) -> {
if (StringUtils.isNotEmpty(v)) {
field.add(key);
value.add(v);
value1.add("?");
}
});
String sql = "insert into " + tablename + "(" + String.join(",", field) + ") values(" + String.join(",", value1) + ")";
this.log.error("test--------------------");
this.log.error(sql);
this.log.error("test--------------------");
try {
boolean flag = rst.executeUpdate(sql, new Object[]{value});
rst.commit();
if (flag) {
String idSql = "SELECT max(id) as mid from " + tablename;
String id = Sql.querySingleField(idSql, "mid");
this.permissionReconstruction(Util.getIntValue(id));
return Integer.parseInt(id);
} else {
return -1;
}
} catch (Exception var11) {
var11.printStackTrace();
rst.rollback();
this.log.error(var11);
throw new ECException("简历更新失败");
}
}
private void permissionReconstruction(int billId) {
ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare(1, Util.getIntValue(this.formmodeid_tmp), billId);
}
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 " + tablename + " where id=" + resumeid;
return Sql.querySingleRow(sql);
}
public boolean deleteById(String resumeid) throws Exception {
String tablename = "uf_jg_rmk";
if ("1".equals(this.sfsymr)) {
tablename = this.bb.getPropValue("youyun", "tablename");
}
String sql = "delete " + tablename + " where id=" + resumeid;
RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false);
try {
rst.executeUpdate(sql, new Object[0]);
rst.commit();
return true;
} catch (Exception var6) {
rst.rollback();
throw new Exception(var6);
}
}
private Map<String, String> parseJsonToMap(JSONObject obj) {
Map<String, String> rs = new HashMap();
if ("1".equals(this.sfsymr)) {
String v;
if (obj.containsKey("姓名")) {
v = this.bb.getPropValue("resume_qianliling", "rmxm");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "rmxm"), this.parseArray(obj.getJSONArray("姓名")));
}
}
if (obj.containsKey("性别")) {
v = this.bb.getPropValue("resume_qianliling", "xb");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "xb"), this.parseArray(obj.getJSONArray("性别")).equals("") ? "0" : "1");
}
}
if (obj.containsKey("出生日期")) {
v = this.bb.getPropValue("resume_qianliling", "csrq");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "csrq"), this.parseArray(obj.getJSONArray("出生日期")));
}
}
if (obj.containsKey("籍贯")) {
v = this.bb.getPropValue("resume_qianliling", "jg");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "jg"), this.parseArray(obj.getJSONArray("籍贯")));
}
}
if (obj.containsKey("手机号")) {
v = this.bb.getPropValue("resume_qianliling", "sjhm");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "sjhm"), this.parseArray(obj.getJSONArray("手机号")));
}
}
if (obj.containsKey("电子邮箱")) {
v = this.bb.getPropValue("resume_qianliling", "email");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "email"), this.parseArray(obj.getJSONArray("电子邮箱")));
}
}
if (obj.containsKey("微信")) {
v = this.bb.getPropValue("resume_qianliling", "wx");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "wx"), this.parseArray(obj.getJSONArray("微信")));
}
}
if (obj.containsKey("QQ")) {
v = this.bb.getPropValue("resume_qianliling", "qq");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "qq"), this.parseArray(obj.getJSONArray("QQ")));
}
}
if (obj.containsKey("现居住地")) {
v = this.bb.getPropValue("resume_qianliling", "jzd");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "jzd"), this.parseArray(obj.getJSONArray("现居住地")));
}
}
if (obj.containsKey("爱好")) {
v = this.bb.getPropValue("resume_qianliling", "ah");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "ah"), this.parseArray(obj.getJSONArray("爱好")));
}
}
if (obj.containsKey("个人评价")) {
v = this.bb.getPropValue("resume_qianliling", "grpj");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "grpj"), this.parseArray(obj.getJSONArray("个人评价")));
}
}
if (obj.containsKey("学业信息")) {
v = this.bb.getPropValue("resume_qianliling", "xyxg");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "xyxg"), obj.getJSONArray("学业信息").toJSONString());
}
}
if (obj.containsKey("毕业时间")) {
v = this.bb.getPropValue("resume_qianliling", "bysj");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "bysj"), this.parseArray(obj.getJSONArray("毕业时间")));
}
}
if (obj.containsKey("最高学历")) {
v = this.bb.getPropValue("resume_qianliling", "zgxl");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "zgxl"), this.parseArray(obj.getJSONArray("最高学历")));
}
}
if (obj.containsKey("专业技能")) {
v = this.bb.getPropValue("resume_qianliling", "zyjn");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "zyjn"), this.parseArray(obj.getJSONArray("专业技能")));
}
}
if (obj.containsKey("实习经历")) {
v = this.bb.getPropValue("resume_qianliling", "sxjl");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "sxjl"), this.parseArray(obj.getJSONArray("实习经历")));
}
}
if (obj.containsKey("英语水平")) {
v = this.bb.getPropValue("resume_qianliling", "yysp");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "yysp"), this.parseArray(obj.getJSONArray("英语水平")));
}
}
if (obj.containsKey("技能证书")) {
v = this.bb.getPropValue("resume_qianliling", "jnzs");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "jnzs"), this.parseArray(obj.getJSONArray("技能证书")));
}
}
if (obj.containsKey("校园经历")) {
v = this.bb.getPropValue("resume_qianliling", "xyjl");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "xyjl"), this.parseArray(obj.getJSONArray("校园经历")));
}
}
if (obj.containsKey("工作信息")) {
v = this.bb.getPropValue("resume_qianliling", "gzxg");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "gzxg"), obj.getJSONArray("工作信息").toJSONString());
}
}
if (obj.containsKey("期望从事岗位")) {
v = this.bb.getPropValue("resume_qianliling", "qwcsgw");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "qwcsgw"), this.parseArray(obj.getJSONArray("期望从事岗位")));
}
}
if (obj.containsKey("工作经验")) {
v = this.bb.getPropValue("resume_qianliling", "gzjy1");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "gzjy1"), this.parseArray(obj.getJSONArray("工作经验")));
}
}
if (obj.containsKey("期望薪资")) {
v = this.bb.getPropValue("resume_qianliling", "qwxz");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "qwxz"), this.parseArray(obj.getJSONArray("期望薪资")));
}
}
if (obj.containsKey("期望工作地点")) {
v = this.bb.getPropValue("resume_qianliling", "qwgzdd");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "qwgzdd"), this.parseArray(obj.getJSONArray("期望工作地点")));
}
}
if (obj.containsKey("项目经历")) {
v = this.bb.getPropValue("resume_qianliling", "xmjl");
if (v != null && v.length() > 0) {
rs.put(this.bb.getPropValue("resume_qianliling", "xmjl"), this.parseArray(obj.getJSONArray("项目经历")));
}
}
} else {
if (obj.containsKey("姓名")) {
rs.put("rmxm", this.parseArray(obj.getJSONArray("姓名")));
}
if (obj.containsKey("性别")) {
rs.put("xb", this.parseArray(obj.getJSONArray("性别")).equals("") ? "0" : "1");
}
if (obj.containsKey("出生日期")) {
rs.put("csrq", this.parseArray(obj.getJSONArray("出生日期")));
}
if (obj.containsKey("籍贯")) {
rs.put("jg", this.parseArray(obj.getJSONArray("籍贯")));
}
if (obj.containsKey("手机号")) {
rs.put("sjhm", this.parseArray(obj.getJSONArray("手机号")));
}
if (obj.containsKey("电子邮箱")) {
rs.put("email", this.parseArray(obj.getJSONArray("电子邮箱")));
}
if (obj.containsKey("微信")) {
rs.put("wx", this.parseArray(obj.getJSONArray("微信")));
}
if (obj.containsKey("QQ")) {
rs.put("qq", this.parseArray(obj.getJSONArray("QQ")));
}
if (obj.containsKey("现居住地")) {
rs.put("jzd", this.parseArray(obj.getJSONArray("现居住地")));
}
if (obj.containsKey("爱好")) {
rs.put("ah", this.parseArray(obj.getJSONArray("爱好")));
}
if (obj.containsKey("个人评价")) {
rs.put("grpj", this.parseArray(obj.getJSONArray("个人评价")));
}
if (obj.containsKey("学业信息")) {
rs.put("xyxg", obj.getJSONArray("学业信息").toJSONString());
}
if (obj.containsKey("毕业时间")) {
rs.put("bysj", this.parseArray(obj.getJSONArray("毕业时间")));
}
if (obj.containsKey("最高学历")) {
rs.put("zgxlwb", this.parseArray(obj.getJSONArray("最高学历")));
}
if (obj.containsKey("最高学位")) {
rs.put("zgxw", this.parseArray(obj.getJSONArray("最高学位")));
}
if (obj.containsKey("专业技能")) {
rs.put("zyjn", this.parseArray(obj.getJSONArray("专业技能")));
}
if (obj.containsKey("实习经历")) {
rs.put("sxjl", this.parseArray(obj.getJSONArray("实习经历")));
}
if (obj.containsKey("英语水平")) {
rs.put("yysp", this.parseArray(obj.getJSONArray("英语水平")));
}
if (obj.containsKey("技能证书")) {
rs.put("jnzs", this.parseArray(obj.getJSONArray("技能证书")));
}
if (obj.containsKey("校园经历")) {
rs.put("xyjl", this.parseArray(obj.getJSONArray("校园经历")));
}
if (obj.containsKey("工作信息")) {
rs.put("gzxg", obj.getJSONArray("工作信息").toJSONString());
}
if (obj.containsKey("期望从事岗位")) {
rs.put("qwcsgw", this.parseArray(obj.getJSONArray("期望从事岗位")));
}
if (obj.containsKey("工作经验")) {
rs.put("gzjy1", this.parseArray(obj.getJSONArray("工作经验")));
}
if (obj.containsKey("期望薪资")) {
rs.put("qwxz", this.parseArray(obj.getJSONArray("期望薪资")));
}
if (obj.containsKey("期望工作地点")) {
rs.put("qwgzdd", this.parseArray(obj.getJSONArray("期望工作地点")));
}
if (obj.containsKey("项目经历")) {
rs.put("xmjl", this.parseArray(obj.getJSONArray("项目经历")));
}
}
rs.put("formmodeid", this.formmodeid_tmp);
rs.put("modedatacreater", "1");
rs.put("modedatacreatertype", "0");
rs.put("modedatacreatedate", DateUtil.today());
rs.put("modedatacreatetime", DateUtil.formatTime(new Date()));
return rs;
}
private String parseArray(JSONArray ar) {
String rs = "";
if (ar != null && ar.size() > 0) {
for(int i = 0; i < ar.size(); ++i) {
if (i == ar.size() - 1) {
rs = rs + ar.get(i);
} else {
rs = rs + ar.get(i) + ",";
}
}
}
return rs;
}
}

View File

@ -1,6 +1,7 @@
package weaver.formmode.recruit.modeexpand.entrymanager;
import com.engine.common.util.ServiceUtil;
import com.engine.recruit.enums.ApplicationStatusEnum;
import com.engine.recruit.service.impl.ApplicantResumeServiceImpl;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
@ -20,7 +21,7 @@ import java.util.Map;
public class AddEntryModeExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<>();
Map<String, String> result = new HashMap<>(2);
try {
int billId;
int modeId;
@ -30,15 +31,17 @@ public class AddEntryModeExpand extends AbstractModeExpandJavaCodeNew {
billId = Util.getIntValue(requestInfo.getRequestid());
modeId = Util.getIntValue(requestInfo.getWorkflowid());
if (billId > 0 && modeId > 0) {
RecordSet rs = new RecordSet();
String pcId = Util.null2String(param.get("pcid"));
String offerId = Util.null2String(param.get("offerid"));
if (StringUtils.isNotBlank(pcId)) {
// 归档人才库归档原因待入职
ServiceUtil.getService(ApplicantResumeServiceImpl.class, user).archiveTalentPool(pcId, false, "13");
// 更新应聘批次为已归档
rs.executeUpdate("update uf_jcl_yppc set zt = ? where id = ? ", ApplicationStatusEnum.ARCHIVED.getValue(), pcId);
}
if (StringUtils.isNotBlank(offerId)) {
// 是否待入职字段为是
RecordSet rs = new RecordSet();
rs.executeUpdate("update uf_jcl_offer set sfzdrz = 1 where id = ? ", offerId);
}
}