package com.engine.recruit.service.impl; import cn.hutool.core.convert.Convert; import com.engine.core.impl.Service; import com.engine.recruit.enums.ApplicantOperateEnum; import com.engine.recruit.enums.ApplicationStatusEnum; import com.engine.recruit.service.ApplicantResumeService; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil; import weaver.general.Util; import weaver.hrm.resource.ResourceComInfo; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author:dxfeng * @createTime: 2023/09/20 * @version: 1.0 */ public class ApplicantResumeServiceImpl extends Service implements ApplicantResumeService { @Override public Map getApplicantsName(String ids) { Map returnMap = new HashMap<>(1); RecordSet rs = new RecordSet(); String[] split = ids.split(","); List> list = new ArrayList<>(); for (String id : split) { rs.executeQuery("select xm from uf_jcl_yppc where id = ?", id); if (rs.next()) { Map rowMap = new HashMap<>(); rowMap.put("id", id); rowMap.put("name", rs.getString("xm")); list.add(rowMap); } } returnMap.put("rows", list); return returnMap; } @Override public Map getInterviewInfoById(String id) { Map returnMap = new HashMap<>(16); String sql = "select a.ypz,b.xm,a.ypzw,b.tdsj,b.sjhm,b.dzyx,a.msfs,a.mshj ,a.msc,a.msg ,a.ptmsg,a.msrq,a.msdd ,a.msfkr from uf_jcl_ms a inner join uf_jcl_yppc b on a.ypz = b.id where a.id = ?"; RecordSet rs = new RecordSet(); rs.executeQuery(sql, id); if (rs.next()) { // 应聘者 returnMap.put("ypz", createApplicantBrowserMap(rs.getString("ypz"), rs.getString("xm"))); // 应聘职位 returnMap.put("ypzw", createAppliedPositionBrowserMap(rs.getString("ypzw"))); // 投递时间 returnMap.put("tdsj", createApplicantBrowserMap(rs.getString("tdsj"))); // 手机号码 returnMap.put("sjhm", createApplicantBrowserMap(rs.getString("sjhm"))); // 电子邮箱 returnMap.put("dzyx", createApplicantBrowserMap(rs.getString("dzyx"))); // 面试方式 returnMap.put("msfs", createApplicantBrowserMap(rs.getString("msfs"))); // 面试环节 returnMap.put("mshj", createApplicantBrowserMap(rs.getString("mshj"))); // 面试轮次 returnMap.put("msc", createApplicantBrowserMap(rs.getString("msc"))); // 面试官 returnMap.put("msg", createResourceBrowserMap(rs.getString("msg"))); // 陪同面试官 returnMap.put("ptmsg", createResourceBrowserMap(rs.getString("ptmsg"))); // 面试日期 returnMap.put("msrq", createApplicantBrowserMap(rs.getString("msrq"))); // 面试地址 returnMap.put("msdd", createApplicantBrowserMap(rs.getString("msdd"))); } return returnMap; } @Override public Map getDisplayLayoutId(Map params) { Map returnMap = new HashMap<>(); String layoutId = Util.null2String(params.get("layoutid")); String modeId = Util.null2String(params.get("modeId")); returnMap.put("layoutId", layoutId); RecordSet rs = new RecordSet(); rs.executeQuery("select layoutname from modehtmllayout where modeid = ? and id = ?", modeId, layoutId); if (rs.next()) { String layoutName = rs.getString("layoutname"); // 获取相同名称的显示布局ID rs.executeQuery("select id from modehtmllayout where type = 0 and modeid = ? and layoutname =?", modeId, layoutName); if (rs.next()) { returnMap.put("layoutId", rs.getString("id")); } } return returnMap; } @Override public Map getTabCount(Map params) { Map returnMap = new HashMap<>(); String billId = Util.null2String(params.get("billid")); List countList = new ArrayList<>(); RecordSet rs = new RecordSet(); // 部门筛选反馈 rs.executeQuery("select count(id) as num from uf_jcl_bmsxfk where ypz = ?", billId); if (rs.next()) { countList.add(rs.getInt("num")); } // 笔试 rs.executeQuery("select count(id) as num from uf_jcl_bs where ypz = ?", billId); if (rs.next()) { countList.add(rs.getInt("num")); } // 面试 rs.executeQuery("select count(id) as num from uf_jcl_ms where ypz = ?", billId); if (rs.next()) { countList.add(rs.getInt("num")); } // 背调 rs.executeQuery("select count(id) as num from uf_jcl_bd where ypz = ?", billId); if (rs.next()) { countList.add(rs.getInt("num")); } // 薪酬谈判 rs.executeQuery("select count(id) as num from uf_jcl_xctp where ypz = ?", billId); if (rs.next()) { countList.add(rs.getInt("num")); } // 历史投递记录 rs.executeQuery("select xm,sjhm from uf_jcl_yppc where id = ?", billId); if (rs.next()) { rs.executeQuery("select count(id) as num from uf_jcl_yppc where xm=? and sjhm =?", rs.getString("xm"), rs.getString("sjhm")); if (rs.next()) { countList.add(rs.getInt("num")); } } else { countList.add(0); } returnMap.put("countList", countList); return returnMap; } @Override public Map updateApplicantsInfo(Map params) { Map returnMap = new HashMap<>(); String operateType = Util.null2String(params.get("operateType")); RecordSet rs = new RecordSet(); if (ApplicantOperateEnum.ELIMINATE.getOperateType().equals(operateType)) { String ids = Util.null2String(params.get("ids")); rs.executeUpdate("update uf_jcl_yppc set zt = ? where id in (" + ids + ")", ApplicationStatusEnum.OBSOLETE.getValue()); } if (ApplicantOperateEnum.TRANSFER.getOperateType().equals(operateType)) { String dqypjd = Util.null2String(params.get("dqypjd")); String billid = Util.null2String(params.get("billid")); rs.executeUpdate("update uf_jcl_yppc set dqypjd = ? where id = ?", dqypjd, billid); } return returnMap; } @Override public Map fullOriginalResumeId(Map params) { int imageFileId = Convert.toInt(params.get("imageFileId")); int resumeId = Convert.toInt(params.get("resumeId")); int secCategory = Convert.toInt(RecruitModeUtil.getRecruitPropValue("APPLICANTS_RESUMES_CATEGORY")); RecordSet rs = new RecordSet(); try { int docId = RecruitModeUtil.createDocId(secCategory, imageFileId, user); // 更新原始简历信息,设置应聘状态未待分配 rs.executeUpdate("update uf_jcl_yppc set ysjl=?,zt=? where id = ?", docId, 0, resumeId); } catch (Exception e) { throw new RuntimeException(e); } return new HashMap<>(); } /** * 构建普通数据格式 * * @param value * @return */ private Map createApplicantBrowserMap(String value) { if (StringUtils.isBlank(value)) { return null; } Map browserMap = new HashMap<>(1); browserMap.put("value", value); return browserMap; } /** * 构建应聘者浏览按钮值 * * @param id * @param name * @return */ private Map createApplicantBrowserMap(String id, String name) { Map browserMap = new HashMap<>(2); if (StringUtils.isBlank(id)) { return browserMap; } browserMap.put("value", id); List> objList = new ArrayList<>(); Map obj = new HashMap<>(2); obj.put("id", id); obj.put("name", name); objList.add(obj); browserMap.put("specialobj", objList); return browserMap; } /** * 构建应聘职位浏览按钮 * * @param id * @return */ private Map createAppliedPositionBrowserMap(String id) { Map browserMap = new HashMap<>(2); if (StringUtils.isBlank(id)) { return browserMap; } browserMap.put("value", id); RecordSet rs = new RecordSet(); rs.executeQuery("select zpzwmc from uf_jcl_zp_zpzw where id = ?", id); if (rs.next()) { List> objList = new ArrayList<>(); Map obj = new HashMap<>(2); obj.put("id", id); obj.put("name", rs.getString("zpzwmc")); objList.add(obj); browserMap.put("specialobj", objList); } return browserMap; } /** * 构建人员浏览按钮值 * * @param ids * @return */ private Map createResourceBrowserMap(String ids) { Map browserMap = new HashMap<>(2); if (StringUtils.isBlank(ids)) { return browserMap; } browserMap.put("value", ids); List> objList = new ArrayList<>(); String[] split = ids.split(","); try { ResourceComInfo resourceComInfo = new ResourceComInfo(); for (String s : split) { Map obj = new HashMap<>(2); obj.put("id", s); obj.put("name", resourceComInfo.getLastname(s)); objList.add(obj); } } catch (Exception e) { throw new RuntimeException(e); } browserMap.put("specialobj", objList); return browserMap; } }