generated from dxfeng/secondev-chapanda-feishu
Compare commits
No commits in common. "secondary/ldkj" and "main" have entirely different histories.
secondary/ldkj
...
main
|
|
@ -1,4 +1,4 @@
|
|||
/weaver-hrm-recruit.iml
|
||||
.iml
|
||||
/out/
|
||||
/.idea/
|
||||
|
||||
|
|
@ -8,19 +8,12 @@ target/
|
|||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
HELP.md
|
||||
target/
|
||||
|
||||
|
||||
/src/test
|
||||
/src/rebel.xml
|
||||
/src/META-INF
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
|
||||
/log
|
||||
|
||||
/src/test
|
||||
/src/rebel.xml
|
||||
/src/META-INF
|
||||
|
||||
/log
|
||||
/build/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
description = "子模块demo项目"
|
||||
|
||||
dependencies {
|
||||
// 子项目私有依赖添加
|
||||
implementation project(':secondev-chapanda-portal')
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
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() {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
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() {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.engine.resumestorage.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ResumeIdentifyService {
|
||||
Map<String, Object> saveResumeByImageFileId(int imageFileId) throws Exception;
|
||||
|
||||
int saveResumeInDB(Map<String, Object> map) throws Exception;
|
||||
|
||||
Map<String, String> queryByDBId(String resumeid) throws Exception;
|
||||
|
||||
boolean deleteById(String resumeid) throws Exception;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,820 +0,0 @@
|
|||
package com.engine.resumestorage.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.exception.ECException;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.resumestorage.service.ResumeIdentifyService;
|
||||
import com.engine.resumestorage.util.ParseResumeQliUtil;
|
||||
import com.engine.resumestorage.util.Sql;
|
||||
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.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@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) {
|
||||
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, 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);
|
||||
if ("V2".equals(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
jsonMap.put(key, parseJsonString(value));
|
||||
}
|
||||
returnMap.put("json", jsonMap);
|
||||
return returnMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String parseJsonString(Object value) {
|
||||
if (value instanceof JSONArray) {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
JSONArray jsonArray = (JSONArray) value;
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
Object obj = jsonArray.get(i);
|
||||
String s = parseJsonString(obj);
|
||||
if (StringUtils.isBlank(s)) {
|
||||
continue;
|
||||
}
|
||||
list.add(s);
|
||||
}
|
||||
return StringUtils.join(list, "\n");
|
||||
} 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.toString();
|
||||
}
|
||||
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<>();
|
||||
mainTableMap.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, 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;
|
||||
}
|
||||
} catch (Exception var11) {
|
||||
var11.printStackTrace();
|
||||
rst.rollback();
|
||||
this.log.error(var11);
|
||||
throw new ECException("简历更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryByDBId(String resumeid) {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
rst.commit();
|
||||
return true;
|
||||
} catch (Exception var6) {
|
||||
rst.rollback();
|
||||
throw new Exception(var6);
|
||||
}
|
||||
}
|
||||
|
||||
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("姓名")) {
|
||||
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) {
|
||||
String sex = null;
|
||||
String valueSpan = this.parseArray(obj.getJSONArray("性别"));
|
||||
if ("男".equals(valueSpan)) {
|
||||
sex = "0";
|
||||
} else if ("女".equals(valueSpan)) {
|
||||
sex = "1";
|
||||
}
|
||||
rs.put(this.bb.getPropValue("resume_qianliling", "xb"), sex);
|
||||
}
|
||||
}
|
||||
|
||||
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", "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", "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");
|
||||
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", "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");
|
||||
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", "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("项目经历")));
|
||||
}
|
||||
}
|
||||
|
||||
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("v2")) {
|
||||
JSONObject v2 = obj.getJSONObject("v2");
|
||||
if (v2.containsKey("工作经历")) {
|
||||
JSONArray gzjl = v2.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(0);
|
||||
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("工作时间"));
|
||||
// 工作经验
|
||||
workMap.put("gzjy", o.getString("每段工作持续时间"));
|
||||
workList.add(workMap);
|
||||
//}
|
||||
}
|
||||
|
||||
detailMap.put("gzjl", workList);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.containsKey("学业信息")) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd");
|
||||
|
||||
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) {
|
||||
String bysj = split[1];
|
||||
try {
|
||||
dateFormat.parse(bysj);
|
||||
} catch (ParseException e) {
|
||||
bysj = "";
|
||||
}
|
||||
studyMap.put("bysj", bysj);
|
||||
}
|
||||
studyList.add(studyMap);
|
||||
}
|
||||
}
|
||||
detailMap.put("jyjl", studyList);
|
||||
if (CollectionUtils.isNotEmpty(studyList)) {
|
||||
List<Map<String, String>> sortedList = studyList.stream()
|
||||
.sorted((map1, map2) -> {
|
||||
String dateStr1 = map1.get("bysj");
|
||||
String dateStr2 = map2.get("bysj");
|
||||
if (dateStr1 == null && dateStr2 == null) return 0;
|
||||
if (dateStr1 == null || dateStr1.isEmpty()) return 1;
|
||||
if (dateStr2 == null || dateStr2.isEmpty()) return -1;
|
||||
try {
|
||||
Date date1 = dateFormat.parse(dateStr1);
|
||||
Date date2 = dateFormat.parse(dateStr2);
|
||||
return date1.compareTo(date2);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
Map<String, String> firstMap = sortedList.get(0);
|
||||
Map<String, String> lastMap = sortedList.get(sortedList.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"));
|
||||
|
||||
// 最高学历
|
||||
String zgxl = lastMap.get("xl");
|
||||
rs.put("zgxl", zgxl);
|
||||
// 最高学位
|
||||
rs.put("zgxw", lastMap.get("xw"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 原始简历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", "男".equals(this.parseArray(obj.getJSONArray("性别"))) ? "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", String.valueOf(user.getUID()));
|
||||
rs.put("modedatacreatertype", "0");
|
||||
rs.put("modedatacreatedate", DateUtil.today());
|
||||
rs.put("modedatacreatetime", DateUtil.formatTime(new Date()));
|
||||
|
||||
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换JSONArray为字符串类型
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String parseArray(Object value) {
|
||||
if (value instanceof JSONArray) {
|
||||
List<String> list = new ArrayList<>();
|
||||
|
||||
JSONArray jsonArray = (JSONArray) value;
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
Object obj = jsonArray.get(i);
|
||||
String s = parseArray(obj);
|
||||
if (StringUtils.isBlank(s)) {
|
||||
continue;
|
||||
}
|
||||
list.add(s);
|
||||
}
|
||||
return StringUtils.join(list, ",");
|
||||
} 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 "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取yyyy-MM-dd时间格式日期
|
||||
*
|
||||
* @param dateStr
|
||||
* @return
|
||||
*/
|
||||
private String getFormatDate(String dateStr) {
|
||||
if (StringUtils.isBlank(dateStr)) {
|
||||
return null;
|
||||
}
|
||||
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,305 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
package com.engine.resumestorage.util;
|
||||
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
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(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 + '}';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,311 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
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();
|
||||
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);
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
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.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;
|
||||
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);
|
||||
|
||||
private ResumeIdentifyService getService(User user) {
|
||||
return ServiceUtil.getService(ResumeIdentifyServiceImpl.class,user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/upload")
|
||||
@Produces({"application/json"})
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/queryById")
|
||||
@Produces({"application/json"})
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/deleteById")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String resumeid = (String)map.get("resumeid");
|
||||
|
||||
try {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
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.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;
|
||||
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);
|
||||
|
||||
private ResumeStorageService getService(User user) {
|
||||
return ServiceUtil.getService(ResumeStorageServiceImpl.class,user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/upload")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Integer> upload(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String imageFileId = (String) map.get("imageFileId");
|
||||
|
||||
try {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/queryById")
|
||||
@Produces({"application/json"})
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/deleteById")
|
||||
@Produces({"application/json"})
|
||||
public AjaxResult<Boolean> deleteById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String resumeid = (String) map.get("resumeid");
|
||||
|
||||
try {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.feishu.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.seconddev.feishu.service.EmployeePanelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/secondev/panel/employee")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class EmployeePanelController {
|
||||
|
||||
@Autowired
|
||||
EmployeePanelService employeePanelService;
|
||||
|
||||
@GetMapping("/getAttendInfo")
|
||||
public Object getAttendInfo(@RequestParam("beginDate") String beginDate,
|
||||
@RequestParam("endDate") String endDate,
|
||||
@RequestParam("jobNum") String jobNum) {
|
||||
log.error("beginDate:{},endDate:{},jobNum:{}", beginDate, endDate, jobNum);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("beginDate", beginDate);
|
||||
params.put("endDate", endDate);
|
||||
params.put("jobNum", jobNum);
|
||||
return employeePanelService.getAttendInfo(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.weaver.seconddev.feishu.controller;
|
||||
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.seconddev.feishu.service.EmployeePanelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sapi/secondev/panel/employee")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public class OutEmployeePanelController {
|
||||
|
||||
@Autowired
|
||||
EmployeePanelService employeePanelService;
|
||||
|
||||
@GetMapping("/getAttendInfo")
|
||||
public Object getAttendInfo(@RequestParam("beginDate") String beginDate,
|
||||
@RequestParam("endDate") String endDate,
|
||||
@RequestParam("jobNum") String jobNum) {
|
||||
log.error("beginDate:{},endDate:{},jobNum:{}", beginDate, endDate, jobNum);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("beginDate", beginDate);
|
||||
params.put("endDate", endDate);
|
||||
params.put("jobNum", jobNum);
|
||||
return employeePanelService.getAttendInfo(params);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.weaver.seconddev.feishu.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class EmployeeAttendInfoPo {
|
||||
|
||||
/**
|
||||
* 工号
|
||||
*/
|
||||
private String workCode;
|
||||
|
||||
/**
|
||||
* 应出勤天数
|
||||
*/
|
||||
private String expectedAttendance;
|
||||
/**
|
||||
* 实际出勤
|
||||
*/
|
||||
private String actualAttendance;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.weaver.seconddev.feishu.mapper;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmployeePanelMapper {
|
||||
|
||||
@MapKey("employee")
|
||||
Map<BigDecimal, Map<String, Object>> statsWorkTimeLength(@Param("param") BaseParam param, @Param(value = "empIds") List<Long> empIds, @Param(value = "beginDate") Date beginDate, @Param(value = "endDate") Date endDate,
|
||||
@Param(value = "tenantKey") String tenantKey, @Param("extraAbsenteeism") boolean extraAbsenteeism, @Param("hasDetailExtend") boolean hasDetailExtend);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.weaver.seconddev.feishu.service;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.feishu.entity.po.EmployeeAttendInfoPo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface EmployeePanelService {
|
||||
|
||||
/**
|
||||
* 获取考勤信息
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
WeaResult<EmployeeAttendInfoPo> getAttendInfo(Map<String, Object> params);
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.weaver.seconddev.feishu.service.impl;
|
||||
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.common.hr.util.Util;
|
||||
import com.weaver.seconddev.feishu.entity.po.EmployeeAttendInfoPo;
|
||||
import com.weaver.seconddev.feishu.mapper.EmployeePanelMapper;
|
||||
import com.weaver.seconddev.feishu.service.EmployeePanelService;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.workflow.common.cfg.org.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/15
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class EmployeePanelServiceImpl implements EmployeePanelService {
|
||||
|
||||
@Autowired
|
||||
EmployeePanelMapper employeePanelMapper;
|
||||
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
@Override
|
||||
public WeaResult<EmployeeAttendInfoPo> getAttendInfo(Map<String, Object> params) {
|
||||
String jobNum = Util.null2String(params.get("jobNum"));
|
||||
String beginDateStr = Util.null2String(params.get("beginDate"));
|
||||
String endDateStr = Util.null2String(params.get("endDate"));
|
||||
BaseParam baseParam = new BaseParam();
|
||||
|
||||
List<Long> userIdsByJobNum = userService.getUserIdsByJobNum(jobNum, baseParam.getTenantKey());
|
||||
if (CollectionUtils.isEmpty(userIdsByJobNum)) {
|
||||
return WeaResult.fail("未匹配到人员", true);
|
||||
}
|
||||
Long employeeId = userIdsByJobNum.get(0);
|
||||
//
|
||||
List<Long> empIds = new ArrayList<>();
|
||||
empIds.add(employeeId);
|
||||
|
||||
Date beginDate = parseDate(beginDateStr);
|
||||
Date endDate = parseDate(endDateStr);
|
||||
|
||||
Map<BigDecimal, Map<String, Object>> mapMap = employeePanelMapper.statsWorkTimeLength(baseParam, empIds, beginDate, endDate, baseParam.getTenantKey(), false, false);
|
||||
Map<String, Object> map = mapMap.get(BigDecimal.valueOf(employeeId));
|
||||
log.error("map===>{}", map);
|
||||
|
||||
EmployeeAttendInfoPo employeeAttendInfoPo = new EmployeeAttendInfoPo();
|
||||
employeeAttendInfoPo.setExpectedAttendance(formatNumber(map.get("period_length_day").toString()));
|
||||
employeeAttendInfoPo.setActualAttendance(formatNumber(map.get("work_length_day").toString()));
|
||||
return WeaResult.success(employeeAttendInfoPo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期类型转换
|
||||
*
|
||||
* @param dateStr
|
||||
* @return
|
||||
*/
|
||||
private Date parseDate(String dateStr) {
|
||||
if (dateStr == null) {
|
||||
return null;
|
||||
}
|
||||
// 定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
// 将字符串解析为LocalDate
|
||||
LocalDate localDate = LocalDate.parse(dateStr, formatter);
|
||||
|
||||
// 将LocalDate转换为java.util.Date
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 格式化数字
|
||||
*
|
||||
* @param numberStr
|
||||
* @return
|
||||
*/
|
||||
public static String formatNumber(String numberStr) {
|
||||
if (numberStr == null || numberStr.isEmpty()) {
|
||||
return numberStr;
|
||||
}
|
||||
|
||||
BigDecimal bd = new BigDecimal(numberStr);
|
||||
// 向上取整,最多保留两位小数
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
String formatted = bd.stripTrailingZeros().toPlainString();
|
||||
|
||||
// 如果结果为整数,则去掉小数点
|
||||
if (formatted.contains(".") && formatted.substring(formatted.indexOf('.') + 1).matches("0+")) {
|
||||
return formatted.substring(0, formatted.indexOf('.'));
|
||||
}
|
||||
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.weaver.seconddev.feishu.mapper.EmployeePanelMapper">
|
||||
|
||||
<sql id="lostAbsenteeismLengthHourSql">
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN
|
||||
CASE WHEN FINAL_SIGN_IN_STATUS='SIGN_IN_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_MSEC-IFNULL(abs.ABSENTEEISM_LENGTH_MESC,0)-IFNULL(EARLY_OUT_LENGTH_MESC,0) -
|
||||
IFNULL(SERIOUS_EARLY_LENGTH_MESC, 0)
|
||||
WHEN SIGN_IN_RECORD IS NOT NULL THEN
|
||||
CASE FINAL_SIGN_OUT_STATUS WHEN 'SIGN_OUT_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_MSEC-IFNULL(abs.ABSENTEEISM_LENGTH_MESC,0)-IFNULL(LATE_LENGTH_MESC,0)
|
||||
-IFNULL(SERIOUS_LATE_LENGTH_MESC,0) ELSE 0 END
|
||||
ELSE 0 END
|
||||
ELSE 0 END)*1.00/3600000 AS lost_length_hour
|
||||
</sql>
|
||||
|
||||
<sql id="lostAbsenteeismLengthDaySql">
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN
|
||||
CASE WHEN FINAL_SIGN_IN_STATUS='SIGN_IN_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_DAY-IFNULL(abs.ABSENTEEISM_LENGTH_DAY,0)-IFNULL(EARLY_OUT_LENGTH_DAY,0)-IFNULL(SERIOUS_EARLY_LENGTH_DAY,0)
|
||||
WHEN SIGN_IN_RECORD IS NOT NULL THEN
|
||||
CASE FINAL_SIGN_OUT_STATUS WHEN 'SIGN_OUT_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_DAY-IFNULL(abs.ABSENTEEISM_LENGTH_DAY,0)-IFNULL(LATE_LENGTH_DAY,0)-IFNULL(SERIOUS_LATE_LENGTH_DAY,0)
|
||||
ELSE 0 END
|
||||
ELSE 0 END
|
||||
ELSE 0 END) AS lost_length_day
|
||||
</sql>
|
||||
|
||||
<sql id="lostLengthHourSql">
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN
|
||||
CASE WHEN FINAL_SIGN_IN_STATUS='SIGN_IN_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_MSEC-IFNULL(AAD.ABSENTEEISM_LENGTH_MESC,0)-IFNULL(EARLY_OUT_LENGTH_MESC,0) -
|
||||
IFNULL(SERIOUS_EARLY_LENGTH_MESC, 0)
|
||||
WHEN SIGN_IN_RECORD IS NOT NULL THEN
|
||||
CASE FINAL_SIGN_OUT_STATUS WHEN 'SIGN_OUT_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_MSEC-IFNULL(AAD.ABSENTEEISM_LENGTH_MESC,0)-IFNULL(LATE_LENGTH_MESC,0)
|
||||
-IFNULL(SERIOUS_LATE_LENGTH_MESC,0) ELSE 0 END
|
||||
ELSE 0 END
|
||||
ELSE 0 END)*1.00/3600000 AS lost_length_hour
|
||||
</sql>
|
||||
|
||||
<sql id="lateEarlyCountLengthSql">
|
||||
sum(case when month_late_length_mesc = 1 then 1 else 0 end) AS month_late_in_count,
|
||||
sum(case when month_late_length_mesc = 1 then AAD.LATE_LENGTH_MESC else 0 end)*1.00/3600000 AS
|
||||
month_late_in_hour,
|
||||
sum(case when month_late_length_mesc = 1 then AAD.LATE_LENGTH_DAY else 0 end) AS month_late_in_day,
|
||||
sum(case when month_late_length_mesc = 2 then 1 else 0 end) AS month_late_out_count,
|
||||
sum(case when month_late_length_mesc = 2 then AAD.LATE_LENGTH_MESC else 0 end)*1.00/3600000 AS
|
||||
month_late_out_hour,
|
||||
sum(case when month_late_length_mesc = 2 then AAD.LATE_LENGTH_DAY else 0 end) AS month_late_out_day,
|
||||
sum(case when month_early_length_mesc = 1 then 1 else 0 end) AS month_early_in_count,
|
||||
sum(case when month_early_length_mesc = 1 then AAD.EARLY_OUT_LENGTH_MESC else 0 end)*1.00/3600000 AS
|
||||
month_early_in_hour,
|
||||
sum(case when month_early_length_mesc = 1 then AAD.EARLY_OUT_LENGTH_DAY else 0 end) AS month_early_in_day,
|
||||
sum(case when month_early_length_mesc = 2 then 1 else 0 end) AS month_early_out_count,
|
||||
sum(case when month_early_length_mesc = 2 then AAD.EARLY_OUT_LENGTH_MESC else 0 end)*1.00/3600000 AS
|
||||
month_early_out_hour,
|
||||
sum(case when month_early_length_mesc = 2 then AAD.EARLY_OUT_LENGTH_DAY else 0 end) AS month_early_out_day
|
||||
</sql>
|
||||
|
||||
<sql id="lostLengthDaySql">
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN
|
||||
CASE WHEN FINAL_SIGN_IN_STATUS='SIGN_IN_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_DAY-IFNULL(AAD.ABSENTEEISM_LENGTH_DAY,0)-IFNULL(EARLY_OUT_LENGTH_DAY,0)-IFNULL(SERIOUS_EARLY_LENGTH_DAY,0)
|
||||
WHEN SIGN_IN_RECORD IS NOT NULL THEN
|
||||
CASE FINAL_SIGN_OUT_STATUS WHEN 'SIGN_OUT_ABSENCE' THEN
|
||||
ABSENCE_LENGTH_DAY-IFNULL(AAD.ABSENTEEISM_LENGTH_DAY,0)-IFNULL(LATE_LENGTH_DAY,0)-IFNULL(SERIOUS_LATE_LENGTH_DAY,0)
|
||||
ELSE 0 END
|
||||
ELSE 0 END
|
||||
ELSE 0 END) AS lost_length_day
|
||||
</sql>
|
||||
<select id="statsWorkTimeLength" resultType="java.util.Map">
|
||||
SELECT
|
||||
ASD.employee,
|
||||
COUNT(CASE WHEN SIGN_IN_RECORD IS NOT NULL THEN 1 END) AS sign_in_num,
|
||||
COUNT(CASE FINAL_SIGN_IN_STATUS WHEN 'SIGN_IN_LATE' THEN 1 END) AS late_num,
|
||||
COUNT(CASE WHEN SIGN_OUT_RECORD IS NOT NULL THEN 1 END) AS sign_out_num,
|
||||
COUNT(CASE FINAL_SIGN_OUT_STATUS WHEN 'SIGN_OUT_EARLY' THEN 1 END) AS early_num,
|
||||
COUNT(CASE FINAL_SIGN_IN_STATUS WHEN 'SERIOUSLY_LATE' THEN 1 END) AS seriously_late_num,
|
||||
COUNT(CASE FINAL_SIGN_OUT_STATUS WHEN 'SERIOUSLY_EARLY' THEN 1 END) AS seriously_early_num,
|
||||
<choose>
|
||||
<when test="extraAbsenteeism == true">
|
||||
COUNT(CASE WHEN abs.sign_in_absenteeism_status is not null AND (abs.sign_in_absenteeism_status !=
|
||||
'SIGN_IN_NORMAL') THEN 1 END) AS absent_num_of_sign_in,
|
||||
sum(abs.month_absent_countous) AS month_absent_countous,
|
||||
</when>
|
||||
<otherwise>
|
||||
COUNT(CASE FINAL_SIGN_IN_STATUS WHEN 'SIGN_IN_ABSENTEEISM' THEN 1 END) AS absent_num_of_sign_in,
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="extraAbsenteeism == true">
|
||||
COUNT(CASE WHEN abs.sign_out_absenteeism_status is not null AND (abs.sign_out_absenteeism_status !=
|
||||
'SIGN_OUT_NORMAL') AND (SIGN_IN_RECORD IS NOT NULL OR SIGN_OUT_RECORD IS NOT NULL) THEN 1 END) AS
|
||||
absent_num_of_sign_out,
|
||||
</when>
|
||||
<otherwise>
|
||||
COUNT(CASE WHEN FINAL_SIGN_OUT_STATUS = 'SIGN_OUT_ABSENTEEISM' AND SIGN_IN_RECORD IS NOT NULL THEN 1
|
||||
END) AS absent_num_of_sign_out,
|
||||
</otherwise>
|
||||
</choose>
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN PERIOD_LENGTH_MSEC ELSE 0 END)*1.00/3600000 AS period_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN PERIOD_LENGTH_DAY ELSE 0 END) AS period_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN WORK_LENGTH_MSEC ELSE 0 END)*1.00/3600000 AS work_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN WORK_LENGTH_DAY ELSE 0 END) AS work_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'HOLIDAY' THEN WORK_LENGTH_MSEC ELSE 0 END)*1.00/3600000 AS holiday_work_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'HOLIDAY' THEN WORK_LENGTH_DAY ELSE 0 END) AS holiday_work_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN ACTUAL_WORK_LENGTH_MSEC ELSE 0 END)*1.00/3600000 AS actual_work_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN ACTUAL_WORK_LENGTH_DAY ELSE 0 END) AS actual_work_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN ABSENCE_LENGTH_MSEC ELSE 0 END)*1.00/3600000 AS absence_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN ABSENCE_LENGTH_DAY ELSE 0 END) AS absence_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN LATE_LENGTH_MESC ELSE 0 END)*1.00/3600000 AS late_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN LATE_LENGTH_DAY ELSE 0 END) AS late_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN SERIOUS_LATE_LENGTH_MESC ELSE 0 END)*1.00/3600000 AS
|
||||
seriously_late_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN SERIOUS_LATE_LENGTH_DAY ELSE 0 END) AS seriously_late_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN EARLY_OUT_LENGTH_MESC ELSE 0 END)*1.00/3600000 AS early_out_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN EARLY_OUT_LENGTH_DAY ELSE 0 END) AS early_out_length_day,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN SERIOUS_EARLY_LENGTH_MESC ELSE 0 END)*1.00/3600000 AS
|
||||
seriously_early_length_hour,
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN SERIOUS_EARLY_LENGTH_DAY ELSE 0 END) AS seriously_early_length_day,
|
||||
<choose>
|
||||
<when test="extraAbsenteeism == true">
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN abs.ABSENTEEISM_LENGTH_MESC ELSE 0 END)*1.00/3600000 AS
|
||||
absenteeism_length_hour,
|
||||
</when>
|
||||
<otherwise>
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN AAD.ABSENTEEISM_LENGTH_MESC ELSE 0 END)*1.00/3600000 AS
|
||||
absenteeism_length_hour,
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="extraAbsenteeism == true">
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN abs.ABSENTEEISM_LENGTH_DAY ELSE 0 END) AS absenteeism_length_day,
|
||||
</when>
|
||||
<otherwise>
|
||||
SUM(CASE DAY_TYPE WHEN 'WORK' THEN AAD.ABSENTEEISM_LENGTH_DAY ELSE 0 END) AS absenteeism_length_day,
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="extraAbsenteeism == true">
|
||||
<include refid="lostAbsenteeismLengthHourSql"/>,
|
||||
<include refid="lostAbsenteeismLengthDaySql"/>,
|
||||
</when>
|
||||
<otherwise>
|
||||
<include refid="lostLengthHourSql"/>,
|
||||
<include refid="lostLengthDaySql"/>,
|
||||
</otherwise>
|
||||
</choose>
|
||||
<include refid="lateEarlyCountLengthSql"/>,
|
||||
<if test="hasDetailExtend == true">
|
||||
SUM(ADE.salary_length_day) as salary_length_day,
|
||||
SUM(ADE.salary_length_mesc)*1.00/3600000 as salary_length_hour,
|
||||
SUM(ADE.meal_length_day) as meal_length_day,
|
||||
SUM(ADE.meal_length_mesc)*1.00/3600000 as meal_length_hour,
|
||||
SUM(ADE.out_sign_length_day) as out_sign_length_day,
|
||||
SUM(ADE.out_sign_length_mesc)*1.00/3600000 as out_sign_length_hour,
|
||||
COUNT(CASE WHEN ADE.osign_in_record is not null THEN 1 END) as osign_in_num,
|
||||
COUNT(CASE WHEN ADE.osign_out_record is not null THEN 1 END) as osign_out_num,
|
||||
</if>
|
||||
COUNT(CASE WHEN FINAL_SIGN_IN_STATUS = 'SIGN_IN_ABSENCE' AND SIGN_OUT_RECORD IS NOT NULL THEN 1 END) AS
|
||||
un_sign_in_num,
|
||||
COUNT(CASE WHEN FINAL_SIGN_OUT_STATUS = 'SIGN_OUT_ABSENCE' AND SIGN_IN_RECORD IS NOT NULL THEN 1 END) AS
|
||||
un_sign_out_num,
|
||||
COUNT(CASE WHEN FINAL_SIGN_IN_STATUS = 'SIGN_IN_ABSENCE' AND SIGN_OUT_RECORD IS NULL THEN 1 END) AS un_sign_num
|
||||
FROM ${param.e10_other_business}.ATTEND_STATUS_DETAIL ASD
|
||||
LEFT JOIN ${param.e10_other_business}.attend_absence_detail AAD ON ASD.ID = AAD.ID and
|
||||
ASD.delete_type=AAD.delete_type
|
||||
<if test="extraAbsenteeism == true">
|
||||
LEFT JOIN ${param.e10_other_business}.attend_absenteeism_detail abs on abs.id = ASD.id and abs.delete_type=0
|
||||
</if>
|
||||
<if test="hasDetailExtend == true">
|
||||
LEFT JOIN ${param.e10_other_business}.attend_status_detail_extend ADE on ADE.id = ASD.id
|
||||
</if>
|
||||
WHERE ASD.TENANT_KEY = #{tenantKey} AND ASD.ATTEND_DATE BETWEEN #{beginDate} AND #{endDate} and
|
||||
ASD.delete_type=0
|
||||
<if test="empIds != null">
|
||||
AND ASD.EMPLOYEE IN
|
||||
<foreach collection="empIds" item="empId" index="index" separator="," open="(" close=")">#{empId}</foreach>
|
||||
</if>
|
||||
GROUP BY ASD.EMPLOYEE
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue