Merge branch '20231124' of http://221.226.25.34:3000/dxfeng/weaver-hrm-recruit into feature/dxf

This commit is contained in:
dxfeng 2023-12-25 16:44:45 +08:00
commit 3fd37db866
36 changed files with 1688 additions and 2 deletions

View File

@ -0,0 +1,10 @@
package com.api.resumestorage.web;
import com.engine.resumestorage.web.ResumeIdentifyQliAction;
import javax.ws.rs.Path;
@Path("/resume/identifyQli")
public class ResumeIdentifyQliApi extends ResumeIdentifyQliAction {
public ResumeIdentifyQliApi() {
}
}

View File

@ -0,0 +1,10 @@
package com.api.resumestorage.web;
import com.engine.resumestorage.web.ResumeStorageAction;
import javax.ws.rs.Path;
@Path("/demo/resume")
public class ResumeStorageApi extends ResumeStorageAction {
public ResumeStorageApi() {
}
}

View File

@ -2,6 +2,7 @@ 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;
@ -53,7 +54,6 @@ public class CheckRepeatResume {
}
/**
*
* @param name
* @param mobile
* @param positionId
@ -63,7 +63,13 @@ public class CheckRepeatResume {
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 = ? and id != ? order by zt", name, mobile, positionId, billId);
String whereSql = "";
if (StringUtils.isBlank(positionId)) {
whereSql = " and (ypzw = ? or ypzw is null) ";
} else {
whereSql = " and ypzw = ? ";
}
rs.executeQuery("select * from uf_jcl_yppc where formmodeid is not null and zt != 2 and zt != 3 and xm = ? and sjhm = ? " + whereSql + " and id != ? order by zt", name, mobile, positionId, billId);
return RecruitRecordSet.getRecordMapList(rs);
}

View File

@ -351,6 +351,9 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
}
List<Map<String, Object>> repeatPositionResumeList = CheckRepeatResume.getRepeatPositionResumeList(name, mobile, positionId, billId);
if (CollectionUtils.isNotEmpty(repeatPositionResumeList)) {
if (StringUtils.isBlank(positionId)) {
throw new CustomizeRunTimeException("保存失败,该人员已有待分配状态数据");
}
throw new CustomizeRunTimeException("保存失败,该人员已有相同的应聘中的职位");
}
return returnMap;

View File

@ -0,0 +1,13 @@
package com.engine.resumestorage.service;
import java.util.Map;
public interface ResumeIdentifyService {
int saveResumeByImageFileId(int var1) throws Exception;
int saveResumeInDB(Map<String, String> var1) throws Exception;
Map<String, String> queryByDBId(String var1) throws Exception;
boolean deleteById(String var1) throws Exception;
}

View File

@ -0,0 +1,13 @@
package com.engine.resumestorage.service;
import java.util.Map;
public interface ResumeStorageService {
int saveResumeByImageFileId(int var1) throws Exception;
int saveResumeInDB(Map<String, String> var1) throws Exception;
Map<String, String> queryByDBId(String var1) throws Exception;
boolean deleteById(String var1) throws Exception;
}

View File

@ -0,0 +1,447 @@
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 java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
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

@ -0,0 +1,305 @@
package com.engine.resumestorage.service.impl;
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.resumestorage.service.ResumeStorageService;
import com.engine.resumestorage.util.ParseResumeUtil;
import com.engine.resumestorage.util.Sql;
import com.engine.resumestorage.web.ResumeStorageAction;
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 ResumeStorageServiceImpl extends Service implements ResumeStorageService {
private final Logger log = LoggerFactory.getLogger(ResumeStorageAction.class);
BaseBean bb = new BaseBean();
String formmodeid_tmp;
String sfsymr;
public ResumeStorageServiceImpl() {
this.formmodeid_tmp = this.bb.getPropValue("youyun", "formmodeid");
this.sfsymr = this.bb.getPropValue("youyun", "sfsymr");
}
public int saveResumeByImageFileId(int imageFileId) throws Exception {
String response = ParseResumeUtil.parse(imageFileId);
JSONObject all = JSONObject.parseObject(response);
String error_msg = all.getString("error_msg");
if (!"成功".equals(error_msg)) {
return -1;
} else {
Map<String, String> saveResume = this.genResumeSaveTemplate();
JSONObject cv_parse = all.getJSONObject("data").getJSONObject("cv_parse");
saveResume.putAll(this.buildBasicInfo(cv_parse.getJSONObject("basic_info")));
this.log.info("error_msg111111");
saveResume.putAll(this.buildEducations(this.getJsonArrayFirstIfPresent(cv_parse.getJSONArray("educations"))));
this.log.info("error_msg222");
saveResume.putAll(this.buildContact(cv_parse.getJSONObject("contact")));
this.log.info("error_msg33333");
saveResume.putAll(this.buildJobObjective(cv_parse.getJSONObject("job_objective")));
this.log.info("error_msg44444");
saveResume.putAll(this.buildOccupations(this.getJsonArrayFirstIfPresent(cv_parse.getJSONArray("occupations"))));
this.log.info("error_msg5555");
this.log.info("saveResume: " + JSON.toJSONString(saveResume));
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("youyun", "tablename");
}
RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false);
List<String> field = new ArrayList();
List<String> value_zhanweifu = new ArrayList();
List<String> value = new ArrayList();
fields.forEach((key, v) -> {
if (StringUtils.isNotEmpty(v)) {
field.add(key);
value.add(v);
value_zhanweifu.add("?");
}
});
String sql = "insert into " + tablename + "(" + String.join(",", field) + ") values(" + String.join(",", value_zhanweifu) + ")";
this.log.info(sql);
try {
boolean flag = rst.executeUpdate(sql, new Object[]{value});
this.log.info(flag);
rst.commit();
if (flag) {
String idSql = "SELECT max(id) as mid from " + tablename;
this.log.info(idSql);
String id = Sql.querySingleField(idSql, "mid");
this.permissionReconstruction(Util.getIntValue(id));
return Integer.parseInt(id);
} else {
return -1;
}
} catch (Exception var11) {
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 JSONObject getJsonArrayFirstIfPresent(JSONArray jsonArray) {
return jsonArray.size() > 0 ? jsonArray.getJSONObject(0) : null;
}
private Map<String, String> buildOccupations(JSONObject occupations) {
Map<String, String> company = new HashMap();
if (occupations == null) {
return company;
} else {
if (occupations.containsKey("company")) {
if ("1".equals(this.sfsymr)) {
company.put(this.bb.getPropValue("youyun", "gs"), Util.null2String(occupations.getString("expect_salary")));
} else {
company.put("gs", Util.null2String(occupations.getString("expect_salary")));
}
}
return company;
}
}
private Map<String, String> buildJobObjective(JSONObject job_objective) {
Map<String, String> expect_salary = new HashMap();
if (job_objective == null) {
return expect_salary;
} else {
if (job_objective.containsKey("expect_salary")) {
if ("1".equals(this.sfsymr)) {
expect_salary.put(this.bb.getPropValue("youyun", "qwxz"), Util.null2String(job_objective.getString("expect_salary")));
} else {
expect_salary.put("qwxz", Util.null2String(job_objective.getString("expect_salary")));
}
}
return expect_salary;
}
}
private Map<String, String> buildContact(JSONObject contact) {
Map<String, String> mobile = new HashMap();
if (contact.containsKey("mobile")) {
if ("1".equals(this.sfsymr)) {
mobile.put(this.bb.getPropValue("youyun", "wx"), Util.null2String(contact.getString("mobile")));
mobile.put(this.bb.getPropValue("youyun", "sjhm"), Util.null2String(contact.getString("mobile")));
mobile.put(this.bb.getPropValue("youyun", "qq"), Util.null2String(contact.getString("qq")));
mobile.put(this.bb.getPropValue("youyun", "email"), Util.null2String(contact.getString("email")));
} else {
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> buildEducations(JSONObject educations) {
Map<String, String> major = new HashMap();
if (educations == null) {
return major;
} else {
if (educations.containsKey("major")) {
if ("1".equals(this.sfsymr)) {
major.put(this.bb.getPropValue("youyun", "sxzy"), Util.null2String(educations.getString("major")));
} else {
major.put("sxzy", Util.null2String(educations.getString("major")));
}
}
return major;
}
}
private Map<String, String> buildBasicInfo(JSONObject basicInfo) {
Map<String, String> basic = new HashMap();
if (basicInfo.containsKey("name")) {
String jzd;
if ("1".equals(this.sfsymr)) {
basic.put(this.bb.getPropValue("youyun", "rmxm"), Util.null2String(basicInfo.getString("name")));
basic.put(this.bb.getPropValue("youyun", "nl"), Util.null2String(basicInfo.getInteger("age")));
if ("".equals(Util.null2String(basicInfo.getString("gender")))) {
basic.put(this.bb.getPropValue("youyun", "xb"), "0");
} else if ("".equals(Util.null2String(basicInfo.getString("gender")))) {
basic.put(this.bb.getPropValue("youyun", "xb"), "1");
}
jzd = basicInfo.getJSONObject("location").getString("province") + basicInfo.getJSONObject("location").getString("city");
basic.put(this.bb.getPropValue("youyun", "jzd"), Util.null2String(jzd));
} else {
basic.put("rmxm", 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> genResumeSaveTemplate() {
Map<String, String> resumes = new HashMap();
resumes.put("gxsj", "");
resumes.put("gwppdnew", "");
resumes.put("zhaopinh", "");
resumes.put("xx", "");
resumes.put("requesti", "");
resumes.put("cz", "");
resumes.put("ryid", "");
resumes.put("gwckr", "");
resumes.put("rcjl", "");
resumes.put("xb", "");
resumes.put("gzjy", "");
resumes.put("msjl", "");
resumes.put("msry", "");
resumes.put("sfsc", "");
resumes.put("rmxm", "");
resumes.put("khjl", "");
resumes.put("lyqd", "");
resumes.put("sf", "");
resumes.put("cs", "");
resumes.put("sjhm", "");
resumes.put("sjhm2", "");
resumes.put("zj", "");
resumes.put("email", "");
resumes.put("email2", "");
resumes.put("qq", "");
resumes.put("wx", "");
resumes.put("grjl", "");
resumes.put("gs", "");
resumes.put("ysry", "");
resumes.put("rmjb", "");
resumes.put("kgjxfx", "");
resumes.put("rmldfx", "");
resumes.put("rmbq", "");
resumes.put("zmhyx", "");
resumes.put("zmhsjchqk", "");
resumes.put("bz", "");
resumes.put("fjsc", "");
resumes.put("jhmssj", "");
resumes.put("sjmssj", "");
resumes.put("msxs", "");
resumes.put("msjg", "");
resumes.put("jzd", "");
resumes.put("zgxl", "");
resumes.put("sxzy", "");
resumes.put("drgw", "");
resumes.put("bm", "");
resumes.put("qszt", "");
resumes.put("lxrq", "");
resumes.put("ppgw_new", "");
resumes.put("nl", "");
resumes.put("qwxz", "");
resumes.put("sfz", "");
resumes.put("sfgz", "");
resumes.put("jlfl", "");
resumes.put("formmodeid", this.formmodeid_tmp);
resumes.put("modedatacreater", "1");
resumes.put("modedatacreatertype", "0");
resumes.put("modedatacreatedate", DateUtil.today());
resumes.put("modedatacreatetime", DateUtil.formatTime(new Date()));
return resumes;
}
}

View File

@ -0,0 +1,71 @@
package com.engine.resumestorage.util;
import java.io.Serializable;
public class AjaxResult<T> implements Serializable {
private static final long serialVersionUID = -4302377008637324176L;
private long code;
private String message;
private T data;
public long getCode() {
return this.code;
}
public void setCode(long code) {
this.code = code;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return this.data;
}
public void setData(T data) {
this.data = data;
}
public AjaxResult() {
}
public AjaxResult(long code, String message, T data) {
this.code = code;
this.message = message;
this.data = data;
}
public static <T> AjaxResult<T> ok(T data) {
return new AjaxResult(200L, "", data);
}
public static <T> AjaxResult<T> ok(T data, String message) {
return new AjaxResult(200L, message, data);
}
public static <T> AjaxResult<T> failed() {
return new AjaxResult(400L, "fail", (Object)null);
}
public static <T> AjaxResult<T> error() {
return new AjaxResult(500L, "error", (Object)null);
}
public static <T> AjaxResult<T> failed(String message) {
return new AjaxResult(400L, message, (Object)null);
}
public static <T> AjaxResult<T> error(String message) {
return new AjaxResult(500L, message, (Object)null);
}
public String toString() {
return "AjaxResult{code=" + this.code + ", message='" + this.message + '\'' + ", data=" + this.data + '}';
}
}

View File

@ -0,0 +1,39 @@
package com.engine.resumestorage.util;
import java.util.List;
import java.util.Map;
public final class Assert {
public Assert() {
}
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
} else if (obj instanceof String) {
return ((String)obj).trim().equals("");
} else if (obj instanceof List) {
return ((List)obj).isEmpty();
} else {
return obj instanceof Map ? ((Map)obj).isEmpty() : false;
}
}
public static void isEmpty(Object obj, String msg) {
isTrue(isEmpty(obj), msg);
}
public static boolean notEmpty(Object obj) {
return !isEmpty(obj);
}
public static void notEmpty(Object obj, String msg) {
isTrue(notEmpty(obj), msg);
}
public static void isTrue(Boolean flag, String msg) {
if (flag) {
throw new IllegalArgumentException(msg);
}
}
}

View File

@ -0,0 +1,311 @@
package com.engine.resumestorage.util;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpUtils {
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpGet request = new HttpGet(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
Map<String, String> bodys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (bodys != null) {
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
for (String key : bodys.keySet()) {
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
}
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
request.setEntity(formEntity);
}
return httpClient.execute(request);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(host);
if (!StringUtils.isBlank(path)) {
sbUrl.append(path);
}
if (null != querys) {
StringBuilder sbQuery = new StringBuilder();
for (Map.Entry<String, String> query : querys.entrySet()) {
if (0 < sbQuery.length()) {
sbQuery.append("&");
}
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
sbQuery.append(query.getValue());
}
if (!StringUtils.isBlank(query.getKey())) {
sbQuery.append(query.getKey());
if (!StringUtils.isBlank(query.getValue())) {
sbQuery.append("=");
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
}
}
}
if (0 < sbQuery.length()) {
sbUrl.append("?").append(sbQuery);
}
}
return sbUrl.toString();
}
private static HttpClient wrapClient(String host) {
HttpClient httpClient = new DefaultHttpClient();
if (host.startsWith("https://")) {
sslClient(httpClient);
}
return httpClient;
}
private static void sslClient(HttpClient httpClient) {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = httpClient.getConnectionManager();
SchemeRegistry registry = ccm.getSchemeRegistry();
registry.register(new Scheme("https", 443, ssf));
} catch (KeyManagementException ex) {
throw new RuntimeException(ex);
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}
}

View File

@ -0,0 +1,89 @@
package com.engine.resumestorage.util;
import org.apache.http.HttpEntity;
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.general.BaseBean;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public final class ParseResumeQliUtil {
private static final BaseBean bb = new BaseBean();
private static final Logger log = LoggerFactory.getLogger(ParseResumeQliUtil.class);
private static final String url;
private static final String appId;
private static final String appSecret;
public ParseResumeQliUtil() {
}
public static String doParseHostPost(int imageFileId) {
long currentTime = System.currentTimeMillis();
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(imageFileId);
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();
builder.addTextBody("type", "pdf");
builder.addBinaryBody("resume", manager.getInputStream(), ContentType.APPLICATION_OCTET_STREAM, manager.getImageFileName());
HttpEntity entity = builder.build();
postRequest.setEntity(entity);
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String responseBody = "";
try {
response = httpClient.execute(postRequest);
HttpEntity responseEntity = response.getEntity();
responseBody = EntityUtils.toString(responseEntity);
return responseBody;
} catch (IOException var11) {
throw new RuntimeException(var11);
}
}
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();
String hex = (new BigInteger(1, bytes)).toString(16);
for(int fix0 = bytes.length * 2 - hex.length(); fix0-- > 0; hex = "0" + hex) {
}
return hex;
} catch (NoSuchAlgorithmException var8) {
throw new RuntimeException("不支持的加密算法", var8);
}
} else {
throw new RuntimeException("appSecret不能为空");
}
} else {
throw new RuntimeException("appId不能为空");
}
}
static {
url = bb.getPropValue("resume_qianliling", "qianlilingurl");
appId = bb.getPropValue("resume_qianliling", "appId");
appSecret = bb.getPropValue("resume_qianliling", "appSecret");
}
}

View File

@ -0,0 +1,74 @@
package com.engine.resumestorage.util;
import com.engine.core.exception.ECException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
public final class ParseResumeUtil {
private static final BaseBean bb = new BaseBean();
private static final Logger log = LoggerFactory.getLogger(ParseResumeUtil.class);
private static String PARSE_HOST;
private static String PATH;
private static String METHOD;
private static String APPCODE;
public ParseResumeUtil() {
}
private static String doParseHostPost(int imageFileId) throws Exception {
bb.writeLog("PARSE_HOST=" + PARSE_HOST);
bb.writeLog("PATH=" + PATH);
bb.writeLog("METHOD=" + METHOD);
bb.writeLog("APPCODE=" + APPCODE);
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(imageFileId);
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> querys = new HashMap();
Map<String, String> bodys = new HashMap();
byte[] bytes = FileUtils.readFileToByteArray(file);
String base64 = Base64.encodeBase64String(bytes);
bodys.put("content", base64);
bodys.put("ext", "doc");
try {
HttpResponse response = HttpUtils.doPost(PARSE_HOST, PATH, METHOD, headers, querys, bodys);
return EntityUtils.toString(response.getEntity());
} catch (Exception var10) {
throw new ECException("简历解析失败!详情:" + var10.getMessage());
}
}
public static String parse(int imageFileId) {
try {
log.info("简历imageFileId" + imageFileId);
log.info("doParseHostPost start..");
String response = doParseHostPost(imageFileId);
log.info("end.. \n" + response);
return response;
} catch (Exception var2) {
log.error("catch error: " + var2.getMessage());
return "";
}
}
static {
PARSE_HOST = bb.getPropValue("youyun", "host");
PATH = bb.getPropValue("youyun", "path");
METHOD = bb.getPropValue("youyun", "method");
APPCODE = bb.getPropValue("youyun", "appcode");
}
}

View File

@ -0,0 +1,149 @@
package com.engine.resumestorage.util;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.*;
public final class Sql {
public Sql() {
}
public static String querySingleField(String sql) {
Assert.isEmpty(sql, "sql");
RecordSet rs = new RecordSet();
rs.execute(sql);
rs.next();
return rs.getString(1);
}
public static String querySingleField(String sql, String field) {
Assert.isEmpty(sql, "execute sql");
Assert.isEmpty(sql, "field");
RecordSet rs = new RecordSet();
rs.execute(sql);
rs.next();
return Util.null2String(rs.getString(field));
}
public static String querySingleFieldWithPlaceholder(String sql, String field, Object... params) {
Assert.isEmpty(sql, "execute sql");
Assert.isEmpty(sql, "field");
RecordSet rs = new RecordSet();
rs.executeQuery(sql, params);
rs.next();
return Util.null2String(rs.getString(field));
}
public static Map<String, String> querySingleRow(String sql) {
Assert.isEmpty(sql, "sql");
RecordSet rs = new RecordSet();
rs.executeQuery(sql, new Object[0]);
rs.next();
return mapFromRecordRow(rs);
}
public static Map<String, String> querySingleRow(String sql, Object... params) {
Assert.isEmpty(sql, "sql null");
RecordSet rs = new RecordSet();
rs.executeQuery(sql, params);
rs.next();
return mapFromRecordRow(rs);
}
private static Map<String, String> mapFromRecordRow(RecordSet rs) {
Assert.isEmpty(rs, "RecordSet");
String[] cols = rs.getColumnName();
Map<String, String> result = new HashMap(cols.length + (cols.length >> 1));
String[] var3 = cols;
int var4 = cols.length;
for(int var5 = 0; var5 < var4; ++var5) {
String key = var3[var5];
if (key != null && !key.equals("")) {
String value = Util.null2String(rs.getString(key));
result.put(key.toLowerCase(), value);
}
}
return result;
}
public static List<Map<String, String>> query(String table, String fields, String... conditions) {
Assert.isEmpty(table);
if (fields == null || fields.equals("")) {
fields = "*";
}
StringBuilder builder = null;
if (conditions != null && conditions.length > 0) {
builder = new StringBuilder(" where ");
for(int i = 0; i < conditions.length; ++i) {
if (i > 0) {
builder.append(" and ");
}
builder.append(conditions[i]);
}
}
return query("select " + fields + " from " + table + (builder == null ? "" : builder.toString()));
}
public static List<Map<String, String>> queryWithPlaceholder(String table, String fields, String conditions, Object... params) {
Assert.isEmpty(table);
if (fields == null || fields.equals("")) {
fields = "*";
}
StringBuilder builder = null;
List<String> conditionList = Arrays.asList(conditions.split(","));
if (Assert.notEmpty(conditionList)) {
builder = new StringBuilder(" where ");
for(int i = 0; i < conditionList.size(); ++i) {
if (i > 0) {
builder.append(" and ");
}
builder.append((String)conditionList.get(i)).append("=?");
}
}
return queryWithPlaceholder("select " + fields + " from " + table + (builder == null ? "" : builder.toString()), params);
}
public static List<Map<String, String>> query(String sql) {
RecordSet rs = new RecordSet();
rs.execute(sql);
return query(rs);
}
public static List<Map<String, String>> queryWithOrder(String sql) {
RecordSet rs = new RecordSet();
rs.execute(sql);
return query(rs);
}
public static List<Map<String, String>> queryWithPlaceholder(String sql, Object... conditions) {
RecordSet rs = new RecordSet();
if (conditions != null && conditions.length > 0) {
rs.executeQuery(sql, conditions);
} else {
rs.executeQuery(sql, new Object[0]);
}
return query(rs);
}
public static List<Map<String, String>> query(RecordSet rs) {
List<Map<String, String>> result = new ArrayList();
while(rs.next()) {
result.add(mapFromRecordRow(rs));
}
return result;
}
}

View File

@ -0,0 +1,73 @@
package com.engine.resumestorage.web;
import com.engine.common.util.ParamUtil;
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.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import java.util.Map;
public class ResumeIdentifyQliAction {
private final Logger log = LoggerFactory.getLogger(ResumeIdentifyQliAction.class);
public ResumeIdentifyQliAction() {
}
private ResumeIdentifyService getService() {
return (ResumeIdentifyService)ServiceUtil.getService(ResumeIdentifyServiceImpl.class);
}
@POST
@Path("/upload")
@Produces({"application/json"})
public AjaxResult<Integer> upload(@Context HttpServletRequest request) {
Map<String, Object> map = ParamUtil.request2Map(request);
String imageFileId = (String)map.get("imageFileId");
try {
return AjaxResult.ok(this.getService().saveResumeByImageFileId(Integer.parseInt(imageFileId)));
} catch (Exception var5) {
this.log.error("千里零...简历上传解析失败!详情:\n" + var5.getMessage());
return AjaxResult.error(var5.getMessage());
}
}
@GET
@Path("/queryById")
@Produces({"application/json"})
public AjaxResult<Map<String, String>> queryById(@Context HttpServletRequest request) {
Map<String, Object> map = ParamUtil.request2Map(request);
String resumeid = (String)map.get("resumeid");
try {
return AjaxResult.ok(this.getService().queryByDBId(resumeid));
} catch (Exception var5) {
this.log.error("简历查询失败!详情:\n" + var5.getMessage());
return AjaxResult.error(var5.getMessage());
}
}
@GET
@Path("/deleteById")
@Produces({"application/json"})
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request) {
Map<String, Object> map = ParamUtil.request2Map(request);
String resumeid = (String)map.get("resumeid");
try {
return AjaxResult.ok(this.getService().deleteById(resumeid));
} catch (Exception var5) {
this.log.error("简历删除失败!详情:\n" + var5.getMessage());
return AjaxResult.error(var5.getMessage());
}
}
}

View File

@ -0,0 +1,73 @@
package com.engine.resumestorage.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.resumestorage.service.ResumeStorageService;
import com.engine.resumestorage.service.impl.ResumeStorageServiceImpl;
import com.engine.resumestorage.util.AjaxResult;
import weaver.integration.logging.Logger;
import weaver.integration.logging.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import java.util.Map;
public class ResumeStorageAction {
private final Logger log = LoggerFactory.getLogger(ResumeStorageAction.class);
public ResumeStorageAction() {
}
private ResumeStorageService getService() {
return (ResumeStorageService)ServiceUtil.getService(ResumeStorageServiceImpl.class);
}
@POST
@Path("/upload")
@Produces({"application/json"})
public AjaxResult<Integer> upload(@Context HttpServletRequest request) {
Map<String, Object> map = ParamUtil.request2Map(request);
String imageFileId = (String)map.get("imageFileId");
try {
return AjaxResult.ok(this.getService().saveResumeByImageFileId(Integer.parseInt(imageFileId)));
} catch (Exception var5) {
this.log.error("简历上传解析失败!详情:\n" + var5.getMessage());
return AjaxResult.error(var5.getMessage());
}
}
@GET
@Path("/queryById")
@Produces({"application/json"})
public AjaxResult<Map<String, String>> queryById(@Context HttpServletRequest request) {
Map<String, Object> map = ParamUtil.request2Map(request);
String resumeid = (String)map.get("resumeid");
try {
return AjaxResult.ok(this.getService().queryByDBId(resumeid));
} catch (Exception var5) {
this.log.error("简历查询失败!详情:\n" + var5.getMessage());
return AjaxResult.error(var5.getMessage());
}
}
@GET
@Path("/deleteById")
@Produces({"application/json"})
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request) {
Map<String, Object> map = ParamUtil.request2Map(request);
String resumeid = (String)map.get("resumeid");
try {
return AjaxResult.ok(this.getService().deleteById(resumeid));
} catch (Exception var5) {
this.log.error("简历删除失败!详情:\n" + var5.getMessage());
return AjaxResult.error(var5.getMessage());
}
}
}

File diff suppressed because one or more lines are too long