generated from dxfeng/secondev-chapanda-feishu
BUG修复
This commit is contained in:
parent
242c632800
commit
3448821fc2
|
|
@ -0,0 +1,313 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.integration.logging.Logger;
|
||||
import weaver.integration.logging.LoggerFactory;
|
||||
|
||||
public class 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;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue