generated from dxfeng/secondev-chapanda-feishu
联动科技_简历自动识别功能优化调整开发
This commit is contained in:
parent
4610d8671f
commit
38a492b104
|
|
@ -3,11 +3,11 @@ package com.engine.resumestorage.service;
|
|||
import java.util.Map;
|
||||
|
||||
public interface ResumeIdentifyService {
|
||||
int saveResumeByImageFileId(int var1) throws Exception;
|
||||
Map<String, Object> saveResumeByImageFileId(int imageFileId) throws Exception;
|
||||
|
||||
int saveResumeInDB(Map<String, String> var1) throws Exception;
|
||||
int saveResumeInDB(Map<String, Object> map) throws Exception;
|
||||
|
||||
Map<String, String> queryByDBId(String var1) throws Exception;
|
||||
Map<String, String> queryByDBId(String resumeid) throws Exception;
|
||||
|
||||
boolean deleteById(String var1) throws Exception;
|
||||
boolean deleteById(String resumeid) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.resumestorage.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
|
@ -8,19 +9,25 @@ 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.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.docs.docs.DocCoder;
|
||||
import weaver.docs.docs.DocComInfo;
|
||||
import weaver.docs.docs.DocImageManager;
|
||||
import weaver.docs.docs.DocManager;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
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();
|
||||
|
|
@ -32,8 +39,9 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
this.sfsymr = this.bb.getPropValue("resume_qianliling", "sfsymr");
|
||||
}
|
||||
|
||||
public int saveResumeByImageFileId(int imageFileId) throws Exception {
|
||||
new HashMap();
|
||||
@Override
|
||||
public Map<String, Object> saveResumeByImageFileId(int imageFileId) throws Exception {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
String response = ParseResumeQliUtil.doParseHostPost(imageFileId);
|
||||
this.log.info("千里聆接口返回值:" + response);
|
||||
if (response.length() == 0) {
|
||||
|
|
@ -52,25 +60,68 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
throw new Exception("调用千里零接口失败,失败原因:" + resultall.getString("info"));
|
||||
} else {
|
||||
JSONObject result = resultall.getJSONObject("result");
|
||||
Map<String, String> saveResume = this.parseJsonToMap(result);
|
||||
return this.saveResumeInDB(saveResume);
|
||||
Map<String, Object> saveResume = this.parseJsonToMap(result, imageFileId);
|
||||
|
||||
int id = saveResumeInDB(saveResume);
|
||||
returnMap.put("id", id);
|
||||
Map<String, Object> jsonMap = new HashMap<>();
|
||||
Set<String> stringSet = result.keySet();
|
||||
for (String key : stringSet) {
|
||||
Object value = result.get(key);
|
||||
|
||||
jsonMap.put(key, parseJsonString(value));
|
||||
}
|
||||
returnMap.put("json", jsonMap);
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int saveResumeInDB(Map<String, String> fields) throws Exception {
|
||||
private Object parseJsonString(Object value) {
|
||||
if (value instanceof JSONArray) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
JSONArray jsonArray = (JSONArray) value;
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
Object obj = jsonArray.get(i);
|
||||
sb.append(parseJsonString(obj));
|
||||
if (i != jsonArray.size() - 1) {
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
} else if (value instanceof JSONObject) {
|
||||
JSONObject jsonObject = (JSONObject) value;
|
||||
Set<String> stringSet = jsonObject.keySet();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String key : stringSet) {
|
||||
String objValue = jsonObject.getString(key).replaceAll("\\n", "\n\t");
|
||||
sb.append(key).append(":").append(objValue).append("\n");
|
||||
}
|
||||
return sb.toString();
|
||||
} else if (value instanceof String) {
|
||||
return value;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int saveResumeInDB(Map<String, Object> map) {
|
||||
String tablename = "uf_jg_rmk";
|
||||
if ("1".equals(this.sfsymr)) {
|
||||
tablename = this.bb.getPropValue("resume_qianliling", "jlk.tablename");
|
||||
}
|
||||
|
||||
Map<String, String> mainTableMap = (Map<String, String>) map.get("mainTable");
|
||||
Map<String, List<Map<String, String>>> detailMap = (Map<String, List<Map<String, String>>>) map.get("detailTable");
|
||||
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) -> {
|
||||
List<String> field = new ArrayList<>();
|
||||
List<String> value1 = new ArrayList<>();
|
||||
List<String> value = new ArrayList<>();
|
||||
mainTableMap.forEach((key, v) -> {
|
||||
if (StringUtils.isNotEmpty(v)) {
|
||||
field.add(key);
|
||||
value.add(v);
|
||||
|
|
@ -84,12 +135,20 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
this.log.error("test--------------------");
|
||||
|
||||
try {
|
||||
boolean flag = rst.executeUpdate(sql, new Object[]{value});
|
||||
rst.commit();
|
||||
boolean flag = rst.executeUpdate(sql, value);
|
||||
if (flag) {
|
||||
String idSql = "SELECT max(id) as mid from " + tablename;
|
||||
String id = Sql.querySingleField(idSql, "mid");
|
||||
this.permissionReconstruction(Util.getIntValue(id));
|
||||
|
||||
// 插入明细表数据
|
||||
List<Map<String, String>> workList = detailMap.get("gzjl");
|
||||
insertDetailTableData(rst, workList, tablename + "_dt1", id);
|
||||
|
||||
List<Map<String, String>> studyList = detailMap.get("jyjl");
|
||||
insertDetailTableData(rst, studyList, tablename + "_dt2", id);
|
||||
|
||||
rst.commit();
|
||||
return Integer.parseInt(id);
|
||||
} else {
|
||||
return -1;
|
||||
|
|
@ -102,13 +161,8 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
@Override
|
||||
public Map<String, String> queryByDBId(String resumeid) {
|
||||
String tablename = "uf_jg_rmk";
|
||||
if ("1".equals(this.sfsymr)) {
|
||||
tablename = this.bb.getPropValue("youyun", "tablename");
|
||||
|
|
@ -118,6 +172,7 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
return Sql.querySingleRow(sql);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String resumeid) throws Exception {
|
||||
String tablename = "uf_jg_rmk";
|
||||
if ("1".equals(this.sfsymr)) {
|
||||
|
|
@ -129,7 +184,7 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
rst.setAutoCommit(false);
|
||||
|
||||
try {
|
||||
rst.executeUpdate(sql, new Object[0]);
|
||||
rst.executeUpdate(sql);
|
||||
rst.commit();
|
||||
return true;
|
||||
} catch (Exception var6) {
|
||||
|
|
@ -138,8 +193,15 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
}
|
||||
}
|
||||
|
||||
private Map<String, String> parseJsonToMap(JSONObject obj) {
|
||||
Map<String, String> rs = new HashMap();
|
||||
private void permissionReconstruction(int billId) {
|
||||
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
ModeRightInfo.setNewRight(true);
|
||||
ModeRightInfo.editModeDataShare(1, Util.getIntValue(this.formmodeid_tmp), billId);
|
||||
}
|
||||
|
||||
private Map<String, Object> parseJsonToMap(JSONObject obj, int imageFileId) {
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
Map<String, String> rs = new HashMap<>();
|
||||
if ("1".equals(this.sfsymr)) {
|
||||
String v;
|
||||
if (obj.containsKey("姓名")) {
|
||||
|
|
@ -152,7 +214,7 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
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");
|
||||
rs.put(this.bb.getPropValue("resume_qianliling", "xb"), "男".equals(this.parseArray(obj.getJSONArray("性别"))) ? "0" : "1");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,12 +281,6 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
|
@ -239,6 +295,12 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
rs.put(this.bb.getPropValue("resume_qianliling", "zgxl"), this.parseArray(obj.getJSONArray("最高学历")));
|
||||
}
|
||||
}
|
||||
if (obj.containsKey("最高学位")) {
|
||||
v = this.bb.getPropValue("resume_qianliling", "zgxw");
|
||||
if (v != null && v.length() > 0) {
|
||||
rs.put(this.bb.getPropValue("resume_qianliling", "zgxw"), this.parseArray(obj.getJSONArray("最高学位")));
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.containsKey("专业技能")) {
|
||||
v = this.bb.getPropValue("resume_qianliling", "zyjn");
|
||||
|
|
@ -246,6 +308,12 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
rs.put(this.bb.getPropValue("resume_qianliling", "zyjn"), this.parseArray(obj.getJSONArray("专业技能")));
|
||||
}
|
||||
}
|
||||
if (obj.containsKey("专业")) {
|
||||
v = this.bb.getPropValue("resume_qianliling", "zy");
|
||||
if (v != null && v.length() > 0) {
|
||||
rs.put(this.bb.getPropValue("resume_qianliling", "zy"), this.parseArray(obj.getJSONArray("专业")));
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.containsKey("实习经历")) {
|
||||
v = this.bb.getPropValue("resume_qianliling", "sxjl");
|
||||
|
|
@ -275,12 +343,6 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
|
@ -316,13 +378,111 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
rs.put(this.bb.getPropValue("resume_qianliling", "xmjl"), this.parseArray(obj.getJSONArray("项目经历")));
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.containsKey("年龄")) {
|
||||
v = this.bb.getPropValue("resume_qianliling", "nl");
|
||||
if (v != null && v.length() > 0) {
|
||||
rs.put(this.bb.getPropValue("resume_qianliling", "nl"), this.parseArray(obj.getJSONArray("年龄")));
|
||||
}
|
||||
}
|
||||
|
||||
// 二开 处理明细表数据、补充主表数据
|
||||
Map<String, List<Map<String, String>>> detailMap = new HashMap<>();
|
||||
|
||||
if (obj.containsKey("工作信息")) {
|
||||
JSONArray gzjl = obj.getJSONArray("工作信息");
|
||||
List<Map<String, String>> workList = new ArrayList<>();
|
||||
if (null != gzjl && gzjl.size() > 0) {
|
||||
for (int i = 0; i < gzjl.size(); i++) {
|
||||
JSONObject o = (JSONObject) gzjl.get(i);
|
||||
Map<String, String> workMap = new HashMap<>();
|
||||
// 工作单位
|
||||
workMap.put("gzdw", o.getString("工作单位"));
|
||||
// 岗位名称
|
||||
workMap.put("gwmc", o.getString("工作岗位"));
|
||||
// 工作经历
|
||||
workMap.put("gzjl", o.getString("工作内容"));
|
||||
// 工作年限
|
||||
workMap.put("gznx", o.getString("工作时间"));
|
||||
workList.add(workMap);
|
||||
}
|
||||
}
|
||||
|
||||
detailMap.put("gzjl", workList);
|
||||
}
|
||||
|
||||
if (obj.containsKey("学业信息")) {
|
||||
JSONArray jyjl = obj.getJSONArray("学业信息");
|
||||
List<Map<String, String>> studyList = new ArrayList<>();
|
||||
if (null != jyjl && jyjl.size() > 0) {
|
||||
for (int i = 0; i < jyjl.size(); i++) {
|
||||
JSONObject o = (JSONObject) jyjl.get(i);
|
||||
Map<String, String> studyMap = new HashMap<>();
|
||||
// 毕业院校
|
||||
studyMap.put("byyx", o.getString("院校"));
|
||||
// 就读时期
|
||||
String jdsq = o.getString("就读时期");
|
||||
studyMap.put("jdsq", jdsq);
|
||||
// 专业
|
||||
studyMap.put("zy", o.getString("专业"));
|
||||
// 学历
|
||||
studyMap.put("xl", o.getString("学历"));
|
||||
// 学位
|
||||
studyMap.put("xw", o.getString("学位"));
|
||||
// 毕业时间
|
||||
String[] split = jdsq.split("-");
|
||||
if (split.length == 2) {
|
||||
studyMap.put("bysj", split[1]);
|
||||
}
|
||||
studyList.add(studyMap);
|
||||
}
|
||||
}
|
||||
detailMap.put("jyjl", studyList);
|
||||
if (CollectionUtils.isNotEmpty(studyList)) {
|
||||
Map<String, String> lastMap = studyList.get(0);
|
||||
Map<String, String> firstMap = studyList.get(studyList.size() - 1);
|
||||
|
||||
// 完善主表信息
|
||||
// 第一学历
|
||||
String xl = firstMap.get("xl");
|
||||
String xlId = getEducationLevelId(xl);
|
||||
rs.put("dyxl", xlId);
|
||||
// 第一学位
|
||||
rs.put("dyxw", firstMap.get("xw"));
|
||||
// 第一学历专业
|
||||
rs.put("dyxlzy", firstMap.get("zy"));
|
||||
// 第一学历就读时期
|
||||
rs.put("dyxljdsq", firstMap.get("jdsq"));
|
||||
// 第一学历毕业时间
|
||||
rs.put("dyxlbysj", getFormatDate(firstMap.get("bysj")));
|
||||
// 第一学历毕业院校
|
||||
rs.put("dyxlbyyx", firstMap.get("byyx"));
|
||||
|
||||
// 最高学历就读时期
|
||||
rs.put("zgxljdsq", lastMap.get("jdsq"));
|
||||
// 最高学历毕业时间
|
||||
rs.put("zgxlbysj", lastMap.get("bysj"));
|
||||
// 最高学历毕业院校
|
||||
rs.put("zgxlbyyx", lastMap.get("byyx"));
|
||||
// 最高学历专业
|
||||
rs.put("zgxlzy", lastMap.get("zy"));
|
||||
|
||||
// 原始简历ID
|
||||
int secCategory = Convert.toInt(bb.getPropValue("resume_qianliling", "RESUMES_CATEGORY"));
|
||||
int docId = createDocId(secCategory, imageFileId, user);
|
||||
rs.put("jlfj", Convert.toStr(docId));
|
||||
}
|
||||
|
||||
}
|
||||
returnMap.put("mainTable", rs);
|
||||
returnMap.put("detailTable", detailMap);
|
||||
} else {
|
||||
if (obj.containsKey("姓名")) {
|
||||
rs.put("rmxm", this.parseArray(obj.getJSONArray("姓名")));
|
||||
}
|
||||
|
||||
if (obj.containsKey("性别")) {
|
||||
rs.put("xb", this.parseArray(obj.getJSONArray("性别")).equals("男") ? "0" : "1");
|
||||
rs.put("xb", "男".equals(this.parseArray(obj.getJSONArray("性别"))) ? "0" : "1");
|
||||
}
|
||||
|
||||
if (obj.containsKey("出生日期")) {
|
||||
|
|
@ -423,25 +583,184 @@ public class ResumeIdentifyServiceImpl extends Service implements ResumeIdentify
|
|||
}
|
||||
|
||||
rs.put("formmodeid", this.formmodeid_tmp);
|
||||
rs.put("modedatacreater", "1");
|
||||
rs.put("modedatacreater", String.valueOf(user.getUID()));
|
||||
rs.put("modedatacreatertype", "0");
|
||||
rs.put("modedatacreatedate", DateUtil.today());
|
||||
rs.put("modedatacreatetime", DateUtil.formatTime(new Date()));
|
||||
return rs;
|
||||
|
||||
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
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) + ",";
|
||||
/**
|
||||
* 转换JSONArray为字符串类型
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String parseArray(Object value) {
|
||||
if (value instanceof JSONArray) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
JSONArray jsonArray = (JSONArray) value;
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
Object obj = jsonArray.get(i);
|
||||
sb.append(parseArray(obj));
|
||||
if (i != jsonArray.size() - 1) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
} else if (value instanceof JSONObject) {
|
||||
JSONObject jsonObject = (JSONObject) value;
|
||||
Set<String> stringSet = jsonObject.keySet();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String key : stringSet) {
|
||||
String objValue = jsonObject.getString(key).replaceAll("\\n", ",");
|
||||
sb.append(key).append(":").append(objValue);
|
||||
}
|
||||
return sb.toString();
|
||||
} else if (value instanceof String) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
return rs;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取yyyy-MM-dd时间格式日期
|
||||
*
|
||||
* @param dateStr
|
||||
* @return
|
||||
*/
|
||||
private String getFormatDate(String dateStr) {
|
||||
dateStr = dateStr.replace(".", "-");
|
||||
if (dateStr.length() == 7) {
|
||||
return dateStr + "-01";
|
||||
} else if (dateStr.length() == 10) {
|
||||
return dateStr;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学历ID
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getEducationLevelId(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
return null;
|
||||
}
|
||||
String id = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id from hrmeducationlevel where name like '%" + name + "%'");
|
||||
if (rs.next()) {
|
||||
id = rs.getString("id");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件imageFieldId生成docId
|
||||
*
|
||||
* @param secCategory
|
||||
* @param imageFieldId
|
||||
* @param user
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static int createDocId(int secCategory, int imageFieldId, User user) {
|
||||
try {
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(imageFieldId);
|
||||
String filenameqc = manager.getImageFileName();
|
||||
String filenamebc = filenameqc.substring(0, filenameqc.lastIndexOf("."));
|
||||
RecordSet rs = new RecordSet();
|
||||
DocManager dm = new DocManager();
|
||||
DocImageManager imgManger = new DocImageManager();
|
||||
|
||||
imgManger.setDocfiletype("2");
|
||||
int docId = dm.getNextDocId(rs);
|
||||
imgManger.setDocid(docId);
|
||||
imgManger.setImagefileid(imageFieldId);
|
||||
imgManger.setImagefilename(filenameqc);
|
||||
imgManger.setIsextfile("1");
|
||||
imgManger.AddDocImageInfo();
|
||||
|
||||
String date = TimeUtil.getCurrentDateString();
|
||||
String time = TimeUtil.getOnlyCurrentTimeString();
|
||||
dm.setId(docId);
|
||||
dm.setMaincategory(0);
|
||||
dm.setSubcategory(0);
|
||||
dm.setSeccategory(secCategory);
|
||||
dm.setLanguageid(user.getLanguage());
|
||||
|
||||
dm.setDocstatus("1");
|
||||
dm.setDocsubject(filenamebc);
|
||||
dm.setDoccreaterid(user.getUID());
|
||||
dm.setDocCreaterType(user.getLogintype());
|
||||
dm.setUsertype(user.getLogintype());
|
||||
dm.setOwnerid(user.getUID());
|
||||
dm.setOwnerType(user.getLogintype());
|
||||
dm.setDoclastmoduserid(user.getUID());
|
||||
dm.setDocLastModUserType(user.getLogintype());
|
||||
dm.setDoccreatedate(date);
|
||||
dm.setDoclastmoddate(date);
|
||||
dm.setDoccreatetime(time);
|
||||
dm.setDoclastmodtime(time);
|
||||
dm.setDoclangurage(user.getLanguage());
|
||||
dm.setKeyword(filenameqc);
|
||||
dm.setIsapprover("0");
|
||||
dm.setIsreply("");
|
||||
dm.setDocdepartmentid(user.getUserDepartment());
|
||||
dm.setDocreplyable("1");
|
||||
dm.setAccessorycount(1);
|
||||
dm.setParentids("" + docId);
|
||||
dm.setUserid(user.getUID());
|
||||
DocCoder docCoder = new DocCoder();
|
||||
dm.setDocCode(docCoder.getDocCoder("" + secCategory));
|
||||
dm.setDocEditionId(dm.getNextEditionId(rs));
|
||||
dm.setDocEdition(1);
|
||||
dm.AddDocInfo();
|
||||
dm.AddShareInfo();
|
||||
DocComInfo dc = new DocComInfo();
|
||||
dc.addDocInfoCache("" + docId);
|
||||
return docId;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入明细表数据
|
||||
*
|
||||
* @param rst
|
||||
* @param dataList
|
||||
* @param tableName
|
||||
* @param mainId
|
||||
* @throws Exception
|
||||
*/
|
||||
private void insertDetailTableData(RecordSetTrans rst, List<Map<String, String>> dataList, String tableName, String mainId) throws Exception {
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return;
|
||||
}
|
||||
for (Map<String, String> dataMap : dataList) {
|
||||
List<String> field = new ArrayList<>();
|
||||
List<String> value1 = new ArrayList<>();
|
||||
List<String> value = new ArrayList<>();
|
||||
dataMap.put("mainid", mainId);
|
||||
dataMap.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) + ")";
|
||||
rst.executeUpdate(sql, value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.resumestorage.util;
|
||||
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class AjaxResult<T> implements Serializable {
|
||||
|
|
@ -50,21 +52,23 @@ public class AjaxResult<T> implements Serializable {
|
|||
}
|
||||
|
||||
public static <T> AjaxResult<T> failed() {
|
||||
return new AjaxResult(400L, "fail", (Object)null);
|
||||
return new AjaxResult(400L, "fail", (Object) null);
|
||||
}
|
||||
|
||||
public static <T> AjaxResult<T> error() {
|
||||
return new AjaxResult(500L, "error", (Object)null);
|
||||
return new AjaxResult(500L, "error", (Object) null);
|
||||
}
|
||||
|
||||
public static <T> AjaxResult<T> failed(String message) {
|
||||
return new AjaxResult(400L, message, (Object)null);
|
||||
return new AjaxResult(400L, message, (Object) null);
|
||||
}
|
||||
|
||||
public static <T> AjaxResult<T> error(String message) {
|
||||
return new AjaxResult(500L, message, (Object)null);
|
||||
public static <T> AjaxResult<T> error(Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
return new AjaxResult(500L, e.getMessage(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AjaxResult{code=" + this.code + ", message='" + this.message + '\'' + ", data=" + this.data + '}';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ public final class ParseResumeQliUtil {
|
|||
postRequest.addHeader("appId", appId);
|
||||
postRequest.addHeader("timestamp", String.valueOf(currentTime));
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addTextBody("type", "pdf");
|
||||
String fileName = manager.getImageFileName();
|
||||
String fileType = fileName.substring(fileName.lastIndexOf(".")+1);
|
||||
builder.addTextBody("type", fileType);
|
||||
builder.addBinaryBody("resume", manager.getInputStream(), ContentType.APPLICATION_OCTET_STREAM, manager.getImageFileName());
|
||||
HttpEntity entity = builder.build();
|
||||
postRequest.setEntity(entity);
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.resumestorage.service.ResumeIdentifyService;
|
||||
import com.engine.resumestorage.service.impl.ResumeIdentifyServiceImpl;
|
||||
import com.engine.resumestorage.util.AjaxResult;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.integration.logging.Logger;
|
||||
import weaver.integration.logging.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
|
@ -19,55 +22,55 @@ 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);
|
||||
private ResumeIdentifyService getService(User user) {
|
||||
return ServiceUtil.getService(ResumeIdentifyServiceImpl.class,user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/upload")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Integer> upload(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Map<String, Object>> upload(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String imageFileId = (String)map.get("imageFileId");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().saveResumeByImageFileId(Integer.parseInt(imageFileId)));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(this.getService(user).saveResumeByImageFileId(Integer.parseInt(imageFileId)));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("千里零...简历上传解析失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
return AjaxResult.error(var5);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/queryById")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Map<String, String>> queryById(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Map<String, String>> queryById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String resumeid = (String)map.get("resumeid");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().queryByDBId(resumeid));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(this.getService(user).queryByDBId(resumeid));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("简历查询失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
return AjaxResult.error(var5);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/deleteById")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String resumeid = (String)map.get("resumeid");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().deleteById(resumeid));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(this.getService(user).deleteById(resumeid));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("简历删除失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
return AjaxResult.error(var5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@ 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.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
import weaver.integration.logging.Logger;
|
||||
import weaver.integration.logging.LoggerFactory;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
|
|
@ -19,55 +22,55 @@ 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);
|
||||
private ResumeStorageService getService(User user) {
|
||||
return ServiceUtil.getService(ResumeStorageServiceImpl.class,user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/upload")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Integer> upload(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Integer> upload(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String imageFileId = (String)map.get("imageFileId");
|
||||
String imageFileId = (String) map.get("imageFileId");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().saveResumeByImageFileId(Integer.parseInt(imageFileId)));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(this.getService(user).saveResumeByImageFileId(Integer.parseInt(imageFileId)));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("简历上传解析失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
return AjaxResult.error(var5);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/queryById")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Map<String, String>> queryById(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Map<String, String>> queryById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String resumeid = (String)map.get("resumeid");
|
||||
String resumeid = (String) map.get("resumeid");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().queryByDBId(resumeid));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(this.getService(user).queryByDBId(resumeid));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("简历查询失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
return AjaxResult.error(var5);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/deleteById")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request) {
|
||||
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String resumeid = (String)map.get("resumeid");
|
||||
String resumeid = (String) map.get("resumeid");
|
||||
|
||||
try {
|
||||
return AjaxResult.ok(this.getService().deleteById(resumeid));
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return AjaxResult.ok(this.getService(user).deleteById(resumeid));
|
||||
} catch (Exception var5) {
|
||||
this.log.error("简历删除失败!详情:\n" + var5.getMessage());
|
||||
return AjaxResult.error(var5.getMessage());
|
||||
return AjaxResult.error(var5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue