generated from dxfeng/secondev-chapanda-feishu
应聘者列表卡片改造,暂存
This commit is contained in:
parent
279260972c
commit
bb135ff4f2
|
|
@ -110,6 +110,24 @@ public class ModeBrowserCommonInfo {
|
|||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学历名称
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static String getEducationLevelById(String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return null;
|
||||
}
|
||||
String name = null;
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select name from hrmeducationlevel where id = ?", id);
|
||||
if (rs.next()) {
|
||||
name = rs.getString("name");
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public static String getWorkPlaceShowName(User user, String id) {
|
||||
String placeName = "";
|
||||
if (StringUtils.isBlank(id)) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.engine.recruit.conn;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
|
|
@ -26,4 +29,32 @@ public class RecruitDataMap<V> extends HashMap<String, V> {
|
|||
// 将键转为小写形式后作为真正的键
|
||||
return super.put(key.toLowerCase(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取int类型数据
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public Integer getInt(Object key) {
|
||||
if (key instanceof String) {
|
||||
// 将键转为小写形式再进行查找
|
||||
return Convert.toInt(super.get(((String) key).toLowerCase()),null);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取String类型数据
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getString(Object key) {
|
||||
if (key instanceof String) {
|
||||
// 将键转为小写形式再进行查找
|
||||
return Util.null2String(super.get(((String) key).toLowerCase()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ public class RecruitRecordSet {
|
|||
* @param rs RecordSet
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, Object> getSingleRecordMap(RecordSet rs) {
|
||||
Map<String, Object> dataMap = new RecruitDataMap<>();
|
||||
public static RecruitDataMap<Object> getSingleRecordMap(RecordSet rs) {
|
||||
RecruitDataMap<Object> dataMap = new RecruitDataMap<>();
|
||||
if (rs.next()) {
|
||||
String[] columnNames = rs.getColumnName();
|
||||
for (String columnName : columnNames) {
|
||||
dataMap.put(columnName.toLowerCase(), RecruitModeUtil.parseBlankToNull(rs.getString(columnName)));
|
||||
dataMap.put(columnName, RecruitModeUtil.parseBlankToNull(rs.getString(columnName)));
|
||||
}
|
||||
}
|
||||
return dataMap;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
package com.engine.recruit.entity.card;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class EduInfo {
|
||||
private String time;
|
||||
private String start;
|
||||
private String end;
|
||||
private String school;
|
||||
private String professional;
|
||||
|
||||
public void setStart(String start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
String dateTimeStart = formatEduDateTime(start);
|
||||
String dateTimeEnd = formatEduDateTime(end);
|
||||
if (StringUtils.isNotBlank(dateTimeStart) && StringUtils.isNotBlank(dateTimeEnd)) {
|
||||
return dateTimeStart + " - " + dateTimeEnd;
|
||||
}
|
||||
if (StringUtils.isNotBlank(dateTimeStart) && StringUtils.isBlank(dateTimeEnd)) {
|
||||
return dateTimeStart + " - 至今";
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getSchool() {
|
||||
return school;
|
||||
}
|
||||
|
||||
public void setSchool(String school) {
|
||||
this.school = school;
|
||||
}
|
||||
|
||||
public String getProfessional() {
|
||||
return professional;
|
||||
}
|
||||
|
||||
public void setProfessional(String professional) {
|
||||
this.professional = professional;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期格式化
|
||||
*
|
||||
* @param dateStr
|
||||
* @return
|
||||
*/
|
||||
private String formatEduDateTime(String dateStr) {
|
||||
if(StringUtils.isBlank(dateStr)){
|
||||
return "";
|
||||
}
|
||||
String dateTime = "";
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy.MM");
|
||||
|
||||
try {
|
||||
// 解析输入日期字符串
|
||||
Date date = inputFormat.parse(dateStr);
|
||||
// 格式化为目标格式
|
||||
dateTime = outputFormat.format(date);
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog("教育信息日期格式化失败", e);
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.engine.recruit.entity.card;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RecruitProcess {
|
||||
private String title;
|
||||
private String value;
|
||||
private String icon;
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.engine.recruit.entity.card;
|
||||
|
||||
import com.engine.recruit.conn.ModeBrowserCommonInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ResumeCardInfo {
|
||||
private Integer id;
|
||||
private String image;
|
||||
private String lastName;
|
||||
private String jobTitle;
|
||||
private String sex;
|
||||
private String age;
|
||||
private String education;
|
||||
private String workYear;
|
||||
private String submissionTime;
|
||||
private String submissionFrom;
|
||||
private List<Tags> tags;
|
||||
private List<RecruitProcess> recruitProcess;
|
||||
private List<WorkInfo> workInfo;
|
||||
private List<EduInfo> eduInfo;
|
||||
|
||||
public String getSex() {
|
||||
if (StringUtils.isNotBlank(sex)) {
|
||||
if ("0".equals(sex)) {
|
||||
return "男";
|
||||
} else {
|
||||
return "女";
|
||||
}
|
||||
}
|
||||
return sex;
|
||||
}
|
||||
|
||||
public String getAge() {
|
||||
if (StringUtils.isNotBlank(age)) {
|
||||
return age + "岁";
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
public String getWorkYear() {
|
||||
if (StringUtils.isNotBlank(workYear)) {
|
||||
return "工作" + workYear;
|
||||
}
|
||||
return workYear;
|
||||
}
|
||||
|
||||
public String getEducation() {
|
||||
return ModeBrowserCommonInfo.getEducationLevelById(education);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.engine.recruit.entity.card;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Tags {
|
||||
private String color;
|
||||
private String bgColor;
|
||||
private String bdColor;
|
||||
private String title;
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.engine.recruit.entity.card;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.general.BaseBean;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/08/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class WorkInfo {
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
private String start;
|
||||
private String end;
|
||||
private String time;
|
||||
private String company;
|
||||
private String job;
|
||||
|
||||
public void setStart(String start) {
|
||||
this.start = start;
|
||||
}
|
||||
|
||||
public void setEnd(String end) {
|
||||
this.end = end;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
if (StringUtils.isBlank(start)) {
|
||||
return "";
|
||||
}
|
||||
if (StringUtils.isBlank(end)) {
|
||||
return getDatePeriod(start, "");
|
||||
}
|
||||
return getDatePeriod(start, end);
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = company;
|
||||
}
|
||||
|
||||
public String getJob() {
|
||||
return job;
|
||||
}
|
||||
|
||||
public void setJob(String job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
|
||||
private String getDatePeriod(String start, String end) {
|
||||
try {
|
||||
String dateStr = start + " ~ " + end;
|
||||
// 解析日期字符串为 LocalDate 对象
|
||||
LocalDate startDate = LocalDate.parse(start, DATE_FORMATTER);
|
||||
if (StringUtils.isBlank(end)) {
|
||||
end = DateUtil.getCurrentDate();
|
||||
dateStr = start + " ~ 至今";
|
||||
}
|
||||
LocalDate endDate = LocalDate.parse(end, DATE_FORMATTER);
|
||||
|
||||
// 计算两个日期之间的 Period 对象
|
||||
Period period = Period.between(startDate, endDate);
|
||||
|
||||
String periodStr = "";
|
||||
// 提取相差的年和月
|
||||
int years = period.getYears();
|
||||
int months = period.getMonths();
|
||||
if (years > 0) {
|
||||
if (months == 0) {
|
||||
periodStr = years + "年";
|
||||
} else {
|
||||
periodStr = years + "年" + months + "个月";
|
||||
}
|
||||
} else {
|
||||
periodStr = months + "个月";
|
||||
}
|
||||
return dateStr + "(" + periodStr + ")";
|
||||
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog("工作信息日期计算失败", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,10 @@ package com.engine.recruit.service.impl;
|
|||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.conn.*;
|
||||
import com.engine.recruit.entity.card.EduInfo;
|
||||
import com.engine.recruit.entity.card.ResumeCardInfo;
|
||||
import com.engine.recruit.entity.card.Tags;
|
||||
import com.engine.recruit.entity.card.WorkInfo;
|
||||
import com.engine.recruit.entity.record.ApplicantRecordPo;
|
||||
import com.engine.recruit.enums.ApplicantOperateEnum;
|
||||
import com.engine.recruit.enums.ApplicationStatusEnum;
|
||||
|
|
@ -10,13 +14,16 @@ import com.engine.recruit.exception.CustomizeRunTimeException;
|
|||
import com.engine.recruit.service.ApplicantResumeService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -284,9 +291,9 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
// 提示:该职位已在应聘中,无需重复应聘
|
||||
String xm = Util.null2String(mainDataMap.get("xm"));
|
||||
String sjhm = Util.null2String(mainDataMap.get("sjhm"));
|
||||
if(StringUtils.isNotBlank(sjhm)) {
|
||||
if (StringUtils.isNotBlank(sjhm)) {
|
||||
rs.executeQuery("select id from uf_jcl_yppc where xm = ? and sjhm = ? and ypzw = ?", xm, sjhm, ypzw);
|
||||
}else{
|
||||
} else {
|
||||
rs.executeQuery("select id from uf_jcl_yppc where xm = ? and (sjhm is null or sjhm = '') and ypzw = ?", xm, ypzw);
|
||||
}
|
||||
if (rs.next()) {
|
||||
|
|
@ -371,10 +378,94 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
|
||||
@Override
|
||||
public Map<String, Object> getResumeCardInfo(Map<String, Object> param) {
|
||||
String billId = Util.null2String(param.get("billId"));
|
||||
String idsString = Util.null2String(param.get("idsString"));
|
||||
List<ResumeCardInfo> resumeCardInfos = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(idsString)) {
|
||||
String[] ids = idsString.split(",");
|
||||
for (String id : ids) {
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select id, xm, jlzp, ypzw, xb, nl, zgxl, gzjy, tdsj, jlly from uf_jcl_yppc where id = ?", id);
|
||||
RecruitDataMap<Object> map = RecruitRecordSet.getSingleRecordMap(rs);
|
||||
ResumeCardInfo resumeCardInfo = new ResumeCardInfo();
|
||||
// 基本信息构建
|
||||
resumeCardInfo.setId(map.getInt("id"));
|
||||
resumeCardInfo.setLastName(map.getString("xm"));
|
||||
// TODO 照片处理
|
||||
String jlzp = map.getString("jlzp");
|
||||
if (StringUtils.isNotBlank(jlzp)) {
|
||||
try {
|
||||
int imageFieldByDocId = ApplicantCommonInfo.getImageFieldByDocId(jlzp);
|
||||
ImageFileManager manager = new ImageFileManager();
|
||||
manager.getImageFileInfoById(imageFieldByDocId);
|
||||
InputStream inputStream = manager.getInputStream();
|
||||
// 转base64
|
||||
String base64 = Base64.getEncoder().encodeToString(IOUtils.toByteArray(inputStream));
|
||||
resumeCardInfo.setImage("data:image/png;base64," + base64);
|
||||
} catch (Exception e) {
|
||||
rs.writeLog("简历头像转换失败", e);
|
||||
}
|
||||
}
|
||||
resumeCardInfo.setJobTitle(ApplicantCommonInfo.getApplicantPosition(map.getString("ypzw")));
|
||||
resumeCardInfo.setSex(map.getString("xb"));
|
||||
resumeCardInfo.setAge(map.getString("nl"));
|
||||
resumeCardInfo.setEducation(map.getString("zgxl"));
|
||||
resumeCardInfo.setWorkYear(ApplicantCommonInfo.getRecruitCommonBrowserValue(map.getString("gzjy")));
|
||||
resumeCardInfo.setSubmissionTime(map.getString("tdsj"));
|
||||
resumeCardInfo.setSubmissionFrom(ApplicantCommonInfo.getRecruitCommonBrowserValue(map.getString("jlly")));
|
||||
// 标签构建
|
||||
List<Tags> tags = new ArrayList<>();
|
||||
List<Map<String, Object>> modeTabs = ApplicantResumeServiceImpl.getModeTabs(id, rs);
|
||||
if (CollectionUtils.isNotEmpty(modeTabs)) {
|
||||
for (Map<String, Object> modeTab : modeTabs) {
|
||||
Tags tag = new Tags();
|
||||
tag.setTitle(Util.null2String(modeTab.get("tabname")));
|
||||
tag.setColor(Util.null2String(modeTab.get("color")));
|
||||
tag.setBgColor(Util.null2String(modeTab.get("bgcolor")));
|
||||
tag.setBdColor(Util.null2String(modeTab.get("bdcolor")));
|
||||
tags.add(tag);
|
||||
}
|
||||
}
|
||||
resumeCardInfo.setTags(tags);
|
||||
|
||||
// 教育经历 默认取最新的一段,若无,则显示“暂无学习经历”
|
||||
List<EduInfo> eduInfoList = new ArrayList<>();
|
||||
rs.executeQuery("select * from uf_jcl_yppc_dt1 where mainid =? order by kssj desc", id);
|
||||
RecruitDataMap<Object> eduInfoMap = RecruitRecordSet.getSingleRecordMap(rs);
|
||||
if (!eduInfoMap.isEmpty()) {
|
||||
EduInfo eduInfo = new EduInfo();
|
||||
String kssj = eduInfoMap.getString("kssj");
|
||||
String jssj = eduInfoMap.getString("jssj");
|
||||
eduInfo.setStart(kssj);
|
||||
eduInfo.setEnd(jssj);
|
||||
eduInfo.setProfessional(eduInfoMap.getString("zy"));
|
||||
eduInfo.setSchool(eduInfoMap.getString("xxmc"));
|
||||
eduInfoList.add(eduInfo);
|
||||
}
|
||||
resumeCardInfo.setEduInfo(eduInfoList);
|
||||
|
||||
// 工作经历 默认取最新的两段,时间倒序,若无,则显示“暂无工作经历”,增加工作时间计算(结束时间-开始时间,显示年月)
|
||||
List<WorkInfo> workInfoList = new ArrayList<>();
|
||||
rs.executeQuery("select * from uf_jcl_yppc_dt2 where mainid =? order by kssj desc", id);
|
||||
while (rs.next() && workInfoList.size() < 2) {
|
||||
WorkInfo workInfo = new WorkInfo();
|
||||
workInfo.setStart(rs.getString("kssj"));
|
||||
workInfo.setEnd(rs.getString("jssj"));
|
||||
workInfo.setCompany(rs.getString("gsmc"));
|
||||
workInfo.setJob(rs.getString("gw"));
|
||||
workInfoList.add(workInfo);
|
||||
}
|
||||
|
||||
resumeCardInfo.setWorkInfo(workInfoList);
|
||||
|
||||
// 招聘过程
|
||||
resumeCardInfo.setRecruitProcess(new ArrayList<>());
|
||||
|
||||
|
||||
resumeCardInfos.add(resumeCardInfo);
|
||||
}
|
||||
}
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
|
||||
|
||||
returnMap.put("resumeCardInfos", resumeCardInfos);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
|
|
@ -665,9 +756,7 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
}
|
||||
|
||||
// 同步设置的标签
|
||||
int applicantModeId = ApplicantCommonInfo.getModeIdByTableName("uf_jcl_yppc");
|
||||
rs.executeQuery("select a.tabname , a.color , a.bgcolor , a.bdcolor , a.type , a.creator , a.orderid from modeTabs_" + applicantModeId + " a where a.id in ( select modelableid from uf_jcl_yppc where id = ?)", applicantId);
|
||||
List<Map<String, Object>> modeTabList = RecruitRecordSet.getRecordMapList(rs);
|
||||
List<Map<String, Object>> modeTabList = getModeTabs(applicantId, rs);
|
||||
String dateTime = DateUtil.getFullDate();
|
||||
String[] dateSplit = dateTime.split(" ");
|
||||
String createdate = dateSplit[0];
|
||||
|
|
@ -709,4 +798,17 @@ public class ApplicantResumeServiceImpl extends Service implements ApplicantResu
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签信息
|
||||
*
|
||||
* @param applicantId
|
||||
* @return
|
||||
*/
|
||||
private static List<Map<String, Object>> getModeTabs(String applicantId, RecordSet rs) {
|
||||
int applicantModeId = ApplicantCommonInfo.getModeIdByTableName("uf_jcl_yppc");
|
||||
rs.executeQuery("select a.tabname , a.color , a.bgcolor , a.bdcolor , a.type , a.creator , a.orderid from modeTabs_" + applicantModeId + " a where a.id in ( select modelableid from uf_jcl_yppc where id = ?)", applicantId);
|
||||
return RecruitRecordSet.getRecordMapList(rs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue