职位发布SDK升级

This commit is contained in:
dxfeng 2024-06-28 15:38:27 +08:00
parent 77bb6c926e
commit ac0fc2fd9a
19 changed files with 1621 additions and 211 deletions

View File

@ -1,7 +1,9 @@
package com.engine.recruit.conn;
import com.engine.recruit.util.WeaBrowserUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.hrm.User;
/**
* @author:dxfeng
@ -97,6 +99,35 @@ public class ModeBrowserCommonInfo {
return id;
}
public static String getWorkPlaceShowName(User user, String id) {
String placeName = "";
if (StringUtils.isBlank(id)) {
return placeName;
}
RecordSet rs = new RecordSet();
rs.executeQuery("select ssq,xxdz from uf_zpgzdd where id = ?", id);
if (rs.next()) {
String ssq = rs.getString("ssq");
String xxdz = rs.getString("xxdz");
// 区县浏览按钮类型263
String areaName = WeaBrowserUtil.getBrowserShowNames(user, 263, ssq);
rs.writeLog("areaName===" + areaName);
if (StringUtils.isNotBlank(areaName) && StringUtils.isNotBlank(xxdz)) {
String[] split = areaName.split("/");
if (split.length == 4) {
areaName = split[1] + "-" + split[2] + "-" + split[3];
placeName = areaName + "-" + xxdz;
} else if (split.length == 3) {
areaName = split[0] + "-" + split[1] + "-" + split[2];
placeName = areaName + "-" + xxdz;
}
} else {
rs.writeLog("id=" + id + ",ssq=" + ssq + ",xxdz=" + xxdz);
}
}
return placeName;
}
public static String getBrowserId(String zdlxmc, String xxnr) {

View File

@ -103,6 +103,20 @@ public class RecruitRecordSet {
}
}
/**
* 删除数据
*
* @param deleteSql
*/
public static void deleteData(String deleteSql) {
RecordSet rs = new RecordSet();
rs.executeUpdate(deleteSql);
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
throw new CustomizeRunTimeException(rs.getExceptionMsg());
}
}
/**
* 构建建模表基本数据
*

View File

@ -9,6 +9,7 @@ import weaver.hrm.User;
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;
@ -34,4 +35,58 @@ public class RecruitPositionController {
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::updatePostInfo, param);
}
@POST
@Path("/getFormCondition")
@Produces(MediaType.APPLICATION_JSON)
public String getFormCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::getFormCondition, param);
}
@POST
@Path("/releaseResumeJob")
@Produces(MediaType.APPLICATION_JSON)
public String releaseResumeJob(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::releaseResumeJob, param);
}
@POST
@Path("/saveAndReleaseResumeJob")
@Produces(MediaType.APPLICATION_JSON)
public String saveAndReleaseResumeJob(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::saveAndReleaseResumeJob, param);
}
@POST
@Path("/closeResumeJob")
@Produces(MediaType.APPLICATION_JSON)
public String closeResumeJob(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::closeResumeJob, param);
}
@POST
@Path("/refreshResumeJob")
@Produces(MediaType.APPLICATION_JSON)
public String refreshResumeJob(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::refreshResumeJob, param);
}
@GET
@Path("/getReportList")
@Produces(MediaType.APPLICATION_JSON)
public String getReportList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> param = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::getReportList, param);
}
}

View File

@ -0,0 +1,45 @@
package com.engine.recruit.entity.position;
/**
* @author:dxfeng
* @createTime: 2024/06/12
* @version: 1.0
*/
public class PositionRelease {
private Integer id;
private String title;
private String status;
private String tips;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getTips() {
return tips;
}
public void setTips(String tips) {
this.tips = tips;
}
}

View File

@ -0,0 +1,222 @@
package com.engine.recruit.entity.position;
import com.alibaba.fastjson.JSON;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import weaver.formmode.recruit.modeexpand.util.RecruitPositionUtil;
import weaver.general.BaseBean;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author:dxfeng
* @createTime: 2024/05/27
* @version: 1.0
*/
public class PositionSdkInstance {
private ERPAResumeSDKClient resumeSDKClient;
// 职位类型
private List<ResumeJobDynamicField.Item> boss_type;
private List<ResumeJobDynamicField.Item> liepin_type;
private List<ResumeJobDynamicField.Item> lagou_type;
private List<ResumeJobDynamicField.Item> job51_type;
private List<ResumeJobDynamicField.Item> zhilian_type;
// BOSS直聘 是否外驻
private List<ResumeJobDynamicField.Item> boss_resident;
private List<ResumeJobDynamicField.Item> boss_resident_country;
private List<ResumeJobDynamicField.Item> boss_resident_language;
private List<ResumeJobDynamicField.Item> boss_resident_time;
private List<ResumeJobDynamicField.Item> boss_resident_time_2;
// 前程无忧-发布城市
private List<ResumeJobDynamicField.Item> job51_city;
// 前程无忧-所属行业
private List<ResumeJobDynamicField.Item> job51_industry;
private static volatile PositionSdkInstance positionSdkInstance;
private PositionSdkInstance() {
}
public static PositionSdkInstance getPositionSdkInstance() {
if (positionSdkInstance == null) {
synchronized (PositionSdkInstance.class) {
if (positionSdkInstance == null) {
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
if (!RecruitPositionUtil.checkAvailable(client)) {
throw new CustomizeRunTimeException("checkAvailable失败千里聆SDK不可用");
}
ResumeJobDynamicField resumeJobDynamicField = client.getResumeJobDynamicField();
positionSdkInstance = new PositionSdkInstance();
positionSdkInstance.setResumeSDKClient(client);
client.addResumeSavedListener(resumeMqMessage -> {
// 处理获取到的简历信息
new BaseBean().writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage));
//Thread thread = new Thread(new SdkResumeSavedThread(resumeMqMessage));
//thread.start();
});
client.start();
positionSdkInstance.setBoss_resident(resumeJobDynamicField.getBoss_resident());
// 去除千里聆返回的重复数据
List<ResumeJobDynamicField.Item> boss_resident_country1 = resumeJobDynamicField.getBoss_resident_country();
List<ResumeJobDynamicField.Item> collect = new ArrayList<>(boss_resident_country1.stream()
.collect(Collectors.toMap(
ResumeJobDynamicField.Item::getValue,
item -> item,
(existing, replacement) -> existing
))
.values());
positionSdkInstance.setBoss_resident_country(collect);
positionSdkInstance.setBoss_resident_language(resumeJobDynamicField.getBoss_resident_language());
positionSdkInstance.setBoss_resident_time_2(resumeJobDynamicField.getBoss_resident_time_2());
positionSdkInstance.setBoss_resident_time(resumeJobDynamicField.getBoss_resident_time());
positionSdkInstance.setJob51_city(resumeJobDynamicField.getJob51_city());
positionSdkInstance.setJob51_industry(resumeJobDynamicField.getJob51_industry_txt());
positionSdkInstance.setBoss_type(resumeJobDynamicField.getBoss_type());
positionSdkInstance.setLiepin_type(resumeJobDynamicField.getLiepin_type());
positionSdkInstance.setLagou_type(resumeJobDynamicField.getLagou_type());
positionSdkInstance.setJob51_type(resumeJobDynamicField.getJob51_type());
positionSdkInstance.setZhilian_type(resumeJobDynamicField.getZhilian_type());
}
}
}
return positionSdkInstance;
}
/**
* 判断千里聆SDK是否可用
*
* @return
*/
public static boolean enableSdkClient() {
BaseBean baseBean = new BaseBean();
try {
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
if (client == null || !client.available()) {
baseBean.writeLog("checkAvailable failedclient=" + JSON.toJSONString(client));
return false;
} else {
return true;
}
} catch (Exception e) {
baseBean.writeLog("checkAvailable failed", e);
return false;
}
}
public ERPAResumeSDKClient getResumeSDKClient() {
return resumeSDKClient;
}
public void setResumeSDKClient(ERPAResumeSDKClient resumeSDKClient) {
this.resumeSDKClient = resumeSDKClient;
}
public List<ResumeJobDynamicField.Item> getBoss_type() {
return boss_type;
}
public void setBoss_type(List<ResumeJobDynamicField.Item> boss_type) {
this.boss_type = boss_type;
}
public List<ResumeJobDynamicField.Item> getLiepin_type() {
return liepin_type;
}
public void setLiepin_type(List<ResumeJobDynamicField.Item> liepin_type) {
this.liepin_type = liepin_type;
}
public List<ResumeJobDynamicField.Item> getLagou_type() {
return lagou_type;
}
public void setLagou_type(List<ResumeJobDynamicField.Item> lagou_type) {
this.lagou_type = lagou_type;
}
public List<ResumeJobDynamicField.Item> getJob51_type() {
return job51_type;
}
public void setJob51_type(List<ResumeJobDynamicField.Item> job51_type) {
this.job51_type = job51_type;
}
public List<ResumeJobDynamicField.Item> getZhilian_type() {
return zhilian_type;
}
public void setZhilian_type(List<ResumeJobDynamicField.Item> zhilian_type) {
this.zhilian_type = zhilian_type;
}
public List<ResumeJobDynamicField.Item> getBoss_resident() {
return boss_resident;
}
public void setBoss_resident(List<ResumeJobDynamicField.Item> boss_resident) {
this.boss_resident = boss_resident;
}
public List<ResumeJobDynamicField.Item> getBoss_resident_country() {
return boss_resident_country;
}
public void setBoss_resident_country(List<ResumeJobDynamicField.Item> boss_resident_country) {
this.boss_resident_country = boss_resident_country;
}
public List<ResumeJobDynamicField.Item> getBoss_resident_language() {
return boss_resident_language;
}
public void setBoss_resident_language(List<ResumeJobDynamicField.Item> boss_resident_language) {
this.boss_resident_language = boss_resident_language;
}
public List<ResumeJobDynamicField.Item> getBoss_resident_time() {
return boss_resident_time;
}
public void setBoss_resident_time(List<ResumeJobDynamicField.Item> boss_resident_time) {
this.boss_resident_time = boss_resident_time;
}
public List<ResumeJobDynamicField.Item> getBoss_resident_time_2() {
return boss_resident_time_2;
}
public void setBoss_resident_time_2(List<ResumeJobDynamicField.Item> boss_resident_time_2) {
this.boss_resident_time_2 = boss_resident_time_2;
}
public List<ResumeJobDynamicField.Item> getJob51_city() {
return job51_city;
}
public void setJob51_city(List<ResumeJobDynamicField.Item> job51_city) {
this.job51_city = job51_city;
}
public List<ResumeJobDynamicField.Item> getJob51_industry() {
return job51_industry;
}
public void setJob51_industry(List<ResumeJobDynamicField.Item> job51_industry) {
this.job51_industry = job51_industry;
}
}

View File

@ -0,0 +1,54 @@
package com.engine.recruit.entity.position;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 千里聆职位动态字段转换为多选下拉框数据格式
*
* @author:dxfeng
* @createTime: 2024/05/22
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PositionSelectItem {
private String key;
private String showname;
private boolean selected;
public static Set<PositionSelectItem> convertDynamicFieldItem(List<ResumeJobDynamicField.Item> dynamicFieldItemList) {
Set<PositionSelectItem> list = new LinkedHashSet<>();
for (ResumeJobDynamicField.Item item : dynamicFieldItemList) {
PositionSelectItem positionSelectItem = new PositionSelectItem();
positionSelectItem.setShowname(item.getLabel());
try {
double parseDouble = Double.parseDouble(item.getValue());
positionSelectItem.setKey(String.valueOf((int) parseDouble));
} catch (Exception e) {
positionSelectItem.setKey(item.getValue());
}
list.add(positionSelectItem);
}
return list;
}
public static ResumeJobDynamicField.Item getItemByValue(List<ResumeJobDynamicField.Item> dynamicFieldItemList, String value) {
return dynamicFieldItemList.stream().filter(item -> (String.valueOf((int) Double.parseDouble(item.getValue())).equals(value))).findFirst().orElse(null);
}
public static List<ResumeJobDynamicField.Item> getItemsByValues(List<ResumeJobDynamicField.Item> dynamicFieldItemList, String value) {
String[] split = value.split(",");
List<String> valueList = Arrays.asList(split);
return dynamicFieldItemList.stream().filter(item -> valueList.contains(item.getLabel())).distinct().collect(Collectors.toList());
}
}

View File

@ -0,0 +1,61 @@
package com.engine.recruit.enums;
import com.engine.recruit.exception.CustomizeRunTimeException;
/**
* @author:dxfeng
* @createTime: 2024/06/13
* @version: 1.0
*/
public enum PositionReleaseStatusEnum {
/**
* 未发布
*/
UNPUBLISHED(0, "未发布"),
/**
* 已发布
*/
PUBLISHED(2, "已发布"),
/**
* 发布失败
*/
PUBLISHING_FAILED(3, "发布失败"),
/**
* 已下架
*/
CLOSED(5, "已下架"),
;
PositionReleaseStatusEnum(Integer value, String label) {
this.value = value;
this.label = label;
}
public static PositionReleaseStatusEnum getEnumByValue(Integer value) {
for (PositionReleaseStatusEnum item : PositionReleaseStatusEnum.values()) {
if (item.value.equals(value)) {
return item;
}
}
throw new CustomizeRunTimeException("不支持的发布状态");
}
private Integer value;
private String label;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

View File

@ -1,6 +1,7 @@
package com.engine.recruit.enums;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.weaver.rpa.sdk.clients.application.resume.common.ResumePlatform;
/**
* 发布渠道枚举类
@ -13,19 +14,21 @@ public enum PositionThirdChannelEnum {
/**
* 发布渠道
*/
BOSSZHIPIN("0", "BOSS直聘"),
ZHILIANZHAOPIN("1", "智联"),
QIANCHENGWUYOU("2", "前程无忧"),
LAGO("3", "拉勾"),
LIEPIN("4", "猎聘");
BOSSZHIPIN("0", "BOSS直聘", ResumePlatform.BOSSZHIPIN),
ZHILIANZHAOPIN("1", "智联招聘", ResumePlatform.ZHILIANZHAOPIN),
QIANCHENGWUYOU("2", "前程无忧", ResumePlatform.QIANCHENGWUYOU),
LAGO("3", "拉勾", ResumePlatform.LAGO),
LIEPIN("4", "猎聘", ResumePlatform.LIEPIN);
PositionThirdChannelEnum(String value, String desc) {
PositionThirdChannelEnum(String value, String desc, int resumePlatformId) {
this.value = value;
this.desc = desc;
this.resumePlatformId = resumePlatformId;
}
private String value;
private String desc;
private int resumePlatformId;
public String getValue() {
return value;
@ -43,7 +46,15 @@ public enum PositionThirdChannelEnum {
this.desc = desc;
}
public static PositionThirdChannelEnum getEnum(String value) {
public int getResumePlatformId() {
return resumePlatformId;
}
public void setResumePlatformId(int resumePlatformId) {
resumePlatformId = resumePlatformId;
}
public static PositionThirdChannelEnum getEnumByValue(String value) {
for (PositionThirdChannelEnum item : PositionThirdChannelEnum.values()) {
if (item.value.equalsIgnoreCase(value)) {
return item;
@ -51,4 +62,13 @@ public enum PositionThirdChannelEnum {
}
throw new CustomizeRunTimeException("不支持的发布渠道");
}
public static PositionThirdChannelEnum getEnumByPlatformId(int resumePlatformId) {
for (PositionThirdChannelEnum item : PositionThirdChannelEnum.values()) {
if (item.resumePlatformId == resumePlatformId) {
return item;
}
}
throw new CustomizeRunTimeException("不支持的发布渠道");
}
}

View File

@ -17,4 +17,51 @@ public interface RecruitPositionService {
*/
Map<String, Object> updatePostInfo(Map<String, Object> param);
/**
* 获取表单字段
*
* @param param
* @return
*/
Map<String, Object> getFormCondition(Map<String, Object> param);
/**
* 发布职位
*
* @param param
* @return
*/
Map<String, Object> releaseResumeJob(Map<String, Object> param);
/**
* 保存并发布职位
* @param param
* @return
*/
Map<String, Object> saveAndReleaseResumeJob(Map<String, Object> param);
/**
* 下架职位
*
* @param param
* @return
*/
Map<String, Object> closeResumeJob(Map<String, Object> param);
/**
* 刷新职位
*
* @param param
* @return
*/
Map<String, Object> refreshResumeJob(Map<String, Object> param);
/**
* 获取发布状态
*
* @param param
* @return
*/
Map<String, Object> getReportList(Map<String, Object> param);
}

View File

@ -1,14 +1,37 @@
package com.engine.recruit.service.impl;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.engine.core.impl.Service;
import com.engine.recruit.conn.ApplicantCommonInfo;
import com.engine.recruit.conn.RecruitRecordSet;
import com.engine.recruit.entity.position.PositionRelease;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.engine.recruit.entity.position.PositionSelectItem;
import com.engine.recruit.enums.PositionReleaseStatusEnum;
import com.engine.recruit.enums.PositionThirdChannelEnum;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.engine.recruit.service.RecruitPositionService;
import com.weaver.formmodel.data.model.Formfield;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.common.ResumeJobStatus;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobV2Dto;
import com.weaver.rpa.sdk.exception.RpaSdkException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.conn.RecordSet;
import weaver.erpa.apps.entity.application.resume.dto.ResumeTaskResult;
import weaver.erpa.apps.entity.application.resume.enums.TaskResult;
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
import weaver.formmode.recruit.modeexpand.util.RecruitPositionUtil;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author:dxfeng
@ -35,4 +58,528 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
}
return returnMap;
}
@Override
public Map<String, Object> getFormCondition(Map<String, Object> param) {
Map<String, Object> apidatas = new HashMap<>();
apidatas.put("hasRight", true);
String conditionType = Util.null2String(param.get("conditionType"));
String selectValue = Util.null2String(param.get("selectValue"));
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
if (!enableSdkClient) {
throw new CustomizeRunTimeException("千里聆SDK校验失败无法获取职位动态字段请检查千里聆非标配置");
}
PositionSdkInstance positionSdkInstance = PositionSdkInstance.getPositionSdkInstance();
// 获取职位类别表单
if ("positionType".equals(conditionType)) {
String dsfqd = Util.null2String(param.get("dsfqd"));
getPositionType(dsfqd, selectValue, apidatas, positionSdkInstance);
}
// 前程无忧-发布城市
if ("job51City".equals(conditionType)) {
getCityType(selectValue, apidatas, positionSdkInstance);
}
// 前程无忧-所属行业
if ("industryType".equals(conditionType)) {
getIndustryType(selectValue, apidatas, positionSdkInstance);
}
// BOSS直聘-驻外语言要求
if ("residentLanguage".equals(conditionType)) {
getResidentLanguage(selectValue, apidatas, positionSdkInstance);
}
// BOSS直聘-驻外国家或地区
if ("residentCountry".equals(conditionType)) {
getResidentCountry(selectValue, apidatas, positionSdkInstance);
}
// BOSS直聘-是否驻外
if ("multiSelect".equals(conditionType)) {
getMultiSelect(apidatas, positionSdkInstance);
}
return apidatas;
}
@Override
public Map<String, Object> releaseResumeJob(Map<String, Object> param) {
try {
String billId = Util.null2String(param.get("billId"));
String platformIds = Util.null2String(param.get("platformIds"));
if (StringUtils.isBlank(platformIds)) {
throw new CustomizeRunTimeException("请选择要发布的平台");
}
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_jcl_zp_zpzw where id = ?", billId);
Map<String, Object> map = RecruitRecordSet.getSingleRecordMap(rs);
String msg = "发布操作完成";
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
if (enableSdkClient) {
long jobId = -1;
String qllgwid = Util.null2String(map.get("qllgwid"));
if (StringUtils.isNotBlank(qllgwid)) {
jobId = Long.parseLong(qllgwid);
}
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
ResumeJobV2Dto resumeJobDto = RecruitPositionUtil.convertMap2ResumeJobV2Dto(user, map);
RecruitPositionUtil.checkRequiredFields(resumeJobDto);
String userId = String.valueOf(user.getUID());
// 未创建职位则先创建职位
if (jobId == -1) {
rs.writeLog("【创建职位】,[id=" + billId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 创建千里聆职位
jobId = client.addResumeJobV2(userId, resumeJobDto);
// 更新千里聆ID到建模表单
rs.executeUpdate("update uf_jcl_zp_zpzw set qllgwid = ? where id = ?", jobId, billId);
} else {
rs.writeLog("【更新职位】,[id=" + billId + "],[qllgwid=" + jobId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 已发布的职位更新职位信息
client.editResumeJobV2(userId, jobId, jobDto -> {
BeanUtils.copyProperties(resumeJobDto, jobDto);
});
}
String[] split = platformIds.split(",");
for (String platformId : split) {
PositionThirdChannelEnum positionThirdChannelEnum = PositionThirdChannelEnum.getEnumByValue(platformId);
ResumeTaskResult result = client.releaseResumeJob(userId, jobId, positionThirdChannelEnum.getResumePlatformId());
// 直接查看结果正在执行中会返回PENGING成功后会返回SUCCEED失败后会返回FAILED
TaskResult current = result.getResult();
rs.writeLog(current);
// 使用回调函数获取成功或者失败时的消息
result.onResult(() -> {
rs.writeLog("发布成功回调");
}, (reason) -> {
rs.writeLog("发布失败回调,原因:" + reason);
});
// 等待直到状态不再是PENDING
TaskResult taskResult = result.waitResult();
rs.writeLog(taskResult);
Integer status;
if (taskResult == TaskResult.SUCCEED) {
status = PositionReleaseStatusEnum.PUBLISHED.getValue();
} else {
msg = "发布操作完成," + result.getFailReason();
status = PositionReleaseStatusEnum.PUBLISHING_FAILED.getValue();
}
recordPublishingStatus(billId, platformId, status, result.getFailReason());
}
} else {
msg = "未配置发布插件,第三方平台请至各招聘网站自行发布";
String[] splits = platformIds.split(",");
for (String platformId : splits) {
recordPublishingStatus(billId, platformId, PositionReleaseStatusEnum.PUBLISHED.getValue(), msg);
}
}
Map<String, Object> reportList = getReportList(param);
reportList.put("msg", msg);
return reportList;
} catch (InterruptedException | RpaSdkException e) {
throw new CustomizeRunTimeException(e.getMessage(),e);
}
}
@Override
public Map<String, Object> closeResumeJob(Map<String, Object> param) {
try {
String billId = Util.null2String(param.get("billId"));
// 当前仅支持所有渠道一键下架
//String platformIds = Util.null2String(param.get("platformIds"));
//if (StringUtils.isBlank(platformIds)) {
// throw new CustomizeRunTimeException("请选择要发布的平台");
//}
RecordSet rs = new RecordSet();
// 查询已发布渠道的信息
String platformIds = Util.null2String(param.get("platformIds"));
List<String> platformList = new ArrayList<>();
rs.executeQuery("select inner_channel from uf_jcl_qdfb where position = ? and status = ? ", billId, PositionReleaseStatusEnum.PUBLISHED.getValue());
while (rs.next()) {
platformList.add(rs.getString("inner_channel"));
}
// 判断是否配置千里聆若未配置千里聆信息则不执行下架职位操作只更新状态
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
String msg = "";
if (enableSdkClient) {
rs.executeQuery("select qllgwid from uf_jcl_zp_zpzw where id = ?", billId);
if (rs.next()) {
String qllgwid = rs.getString("qllgwid");
// 第三方渠道未发布不调用千里聆执行职位下架操作
if (StringUtils.isBlank(qllgwid)) {
throw new CustomizeRunTimeException("billId=" + billId + ",当前职位暂未同步至千里聆发布,无需进行下架操作");
}
if (CollectionUtils.isEmpty(platformList)) {
throw new CustomizeRunTimeException("当前职位暂未发布,无需进行下架操作");
}
long jobId = Long.parseLong(qllgwid);
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
String userId = String.valueOf(user.getUID());
ResumeTaskResult result = client.closeResumeJob(userId, jobId);
TaskResult current = result.getResult();
rs.writeLog(current);
// 使用回调函数获取成功或者失败时的消息
result.onResult(() -> {
rs.writeLog("下架成功回调");
}, (reason) -> {
rs.writeLog("下架失败回调,原因:" + reason);
});
// 等待直到状态不再是PENDING
TaskResult taskResult = result.waitResult();
rs.writeLog(taskResult);
if (taskResult == TaskResult.SUCCEED) {
msg = "下架操作完成";
} else {
msg = result.getFailReason();
}
syncResumePlatformStatus(billId, jobId, client);
}
} else {
msg = "未配置下架插件,第三方平台请至各招聘网站自行下架";
for (String platformId : platformList) {
recordPublishingStatus(billId, platformId, PositionReleaseStatusEnum.PUBLISHED.getValue(), msg);
}
}
Map<String, Object> reportList = getReportList(param);
reportList.put("msg", msg);
return reportList;
} catch (InterruptedException | RpaSdkException e) {
throw new CustomizeRunTimeException(e.getMessage(),e);
}
}
@Override
public Map<String, Object> refreshResumeJob(Map<String, Object> param) {
String billId = Util.null2String(param.get("billId"));
RecordSet rs = new RecordSet();
try {
long jobId = -1;
rs.executeQuery("select qllgwid from uf_jcl_zp_zpzw where id = ?", billId);
if (rs.next()) {
String qllgwid = rs.getString("qllgwid");
// 第三方渠道未发布不调用千里聆执行职位下架操作
if (StringUtils.isBlank(qllgwid)) {
throw new CustomizeRunTimeException("billId=" + billId + ",当前职位暂未同步至千里聆发布,无需进行下架操作");
}
jobId = Long.parseLong(qllgwid);
}
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
ResumeTaskResult result = client.refreshResumeJob(String.valueOf(user.getUID()), jobId);
String msg = "";
TaskResult current = result.getResult();
rs.writeLog(current);
// 使用回调函数获取成功或者失败时的消息
result.onResult(() -> {
rs.writeLog("刷新成功回调");
}, (reason) -> {
rs.writeLog("刷新失败回调,原因:" + reason);
});
// 等待直到状态不再是PENDING
TaskResult taskResult = result.waitResult();
rs.writeLog(taskResult);
if (taskResult == TaskResult.SUCCEED) {
msg = "刷新操作完成";
syncResumePlatformStatus(billId, jobId, client);
} else {
msg = "刷新操作完成," + result.getFailReason();
}
Map<String, Object> reportList = getReportList(param);
reportList.put("msg", msg);
return reportList;
} catch (InterruptedException | RpaSdkException e) {
throw new CustomizeRunTimeException(e.getMessage(),e);
}
}
@Override
public Map<String, Object> getReportList(Map<String, Object> param) {
String billId = Util.null2String(param.get("billId"));
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_jcl_qdfb where position = ?", billId);
List<PositionRelease> list = new ArrayList<>();
Map<String, Object> returnMap = new HashMap<>();
while (rs.next()) {
Integer status = Convert.toInt(rs.getString("status"), 0);
PositionReleaseStatusEnum releaseStatusEnum = PositionReleaseStatusEnum.getEnumByValue(status);
PositionRelease positionRelease = new PositionRelease();
positionRelease.setId(rs.getInt("inner_channel"));
positionRelease.setStatus(releaseStatusEnum.getLabel());
String tips = rs.getString("tips");
if (StringUtils.isNotBlank(tips)) {
positionRelease.setTips(tips);
}
list.add(positionRelease);
}
returnMap.put("list", list);
return returnMap;
}
@Override
public Map<String, Object> saveAndReleaseResumeJob(Map<String, Object> param) {
String billId = Util.null2String(param.get("billId"));
String submitDataStr = Util.null2String(param.get("submitData"));
if (StringUtils.isAnyBlank(billId, submitDataStr)) {
throw new CustomizeRunTimeException("职位发布失败,接口传参有误");
}
JSONObject submitData = JSONObject.parseObject(submitDataStr);
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_zp_zpzw");
Map<String, Formfield> fieldIdMap = fieldList.stream().collect(Collectors.toMap(item -> "field" + item.getId()
, item -> item, (k1, k2) -> k1));
Map<String, Object> mainDataMap = new HashMap<>();
Map<String, Object> innerMap = submitData.getInnerMap();
BaseBean baseBean = new BaseBean();
for (Map.Entry<String, Object> entry : innerMap.entrySet()) {
String key = entry.getKey();
String value = Util.null2String(entry.getValue());
Formfield formfield = fieldIdMap.get(key);
if (null != formfield) {
String fieldName = formfield.getFieldname();
if (StringUtils.isNotBlank(value)) {
mainDataMap.put(fieldName, value);
} else {
mainDataMap.put(fieldName, null);
if ("text".equals(formfield.getFielddbtype())) {
mainDataMap.put(fieldName, "");
}
}
} else {
baseBean.writeLog("未匹配到对应字段,key==" + key);
}
}
mainDataMap.put("id", billId);
RecruitRecordSet.updateDataById(mainDataMap, "uf_jcl_zp_zpzw");
return releaseResumeJob(param);
}
/**
* 获取职位类别
*
* @param dsfqd
* @param selectValue
* @param apidatas
* @param positionSdkInstance
*/
private void getPositionType(String dsfqd, String selectValue, Map<String, Object> apidatas, PositionSdkInstance positionSdkInstance) {
String[] split = selectValue.split("#");
Map<String, String> selectValueMap = new HashMap<>();
for (String s : split) {
String[] split1 = s.split(":");
if (split1.length == 2) {
selectValueMap.put(split1[0], split1[1]);
}
}
String boss_value = selectValueMap.get("BOSS直聘");
apidatas.put("boss_value", StringUtils.isBlank(boss_value) ? null : Arrays.asList(boss_value.split("-")));
String liepin_value = selectValueMap.get("猎聘");
apidatas.put("liepin_value", StringUtils.isBlank(liepin_value) ? null : Arrays.asList(liepin_value.split("-")));
String lagou_value = selectValueMap.get("拉勾");
apidatas.put("lagou_value", StringUtils.isBlank(lagou_value) ? null : Arrays.asList(lagou_value.split("-")));
String job51_value = selectValueMap.get("前程无忧");
apidatas.put("job51_value", StringUtils.isBlank(job51_value) ? null : Arrays.asList(job51_value.split("-")));
String zhilian_value = selectValueMap.get("智联");
apidatas.put("zhilian_value", StringUtils.isBlank(zhilian_value) ? null : Arrays.asList(zhilian_value.split("-")));
boolean bossShow = false;
boolean liepinShow = false;
boolean lagouShow = false;
boolean job51Show = false;
boolean zhilianShow = false;
if (dsfqd.contains("0")) {
List<ResumeJobDynamicField.Item> boss_type = positionSdkInstance.getBoss_type();
apidatas.put("boss", boss_type);
bossShow = true;
}
if (dsfqd.contains("4")) {
List<ResumeJobDynamicField.Item> liepin_type = positionSdkInstance.getLiepin_type();
apidatas.put("liepin", liepin_type);
liepinShow = true;
}
if (dsfqd.contains("3")) {
List<ResumeJobDynamicField.Item> lagou_type = positionSdkInstance.getLagou_type();
apidatas.put("lagou", lagou_type);
lagouShow = true;
}
if (dsfqd.contains("2")) {
List<ResumeJobDynamicField.Item> job51_type = positionSdkInstance.getJob51_type();
apidatas.put("job51", job51_type);
job51Show = true;
}
if (dsfqd.contains("1")) {
List<ResumeJobDynamicField.Item> zhilian_type = positionSdkInstance.getZhilian_type();
apidatas.put("zhilian", zhilian_type);
zhilianShow = true;
}
apidatas.put("bossShow", bossShow);
apidatas.put("liepinShow", liepinShow);
apidatas.put("lagouShow", lagouShow);
apidatas.put("job51Show", job51Show);
apidatas.put("zhilianShow", zhilianShow);
}
/**
* 获取发布城市
*
* @param selectValue
* @param apidatas
* @param positionSdkInstance
*/
private void getCityType(String selectValue, Map<String, Object> apidatas, PositionSdkInstance positionSdkInstance) {
List<String> valueList = new ArrayList<>();
if (StringUtils.isNotBlank(selectValue)) {
String[] split = selectValue.split(",");
valueList = Arrays.asList(split);
}
List<ResumeJobDynamicField.Item> job51_city = positionSdkInstance.getJob51_city();
apidatas.put("job51_city", job51_city);
apidatas.put("job51CityValue", valueList);
}
/**
* 获取所属行业
*
* @param selectValue
* @param apidatas
* @param positionSdkInstance
*/
private void getIndustryType(String selectValue, Map<String, Object> apidatas, PositionSdkInstance positionSdkInstance) {
List<List<String>> valueList = new ArrayList<>();
if (StringUtils.isNotBlank(selectValue)) {
String[] split = selectValue.split("#");
for (String s : split) {
String[] split1 = s.split("-");
valueList.add(Arrays.asList(split1));
}
}
List<ResumeJobDynamicField.Item> job51_industry = positionSdkInstance.getJob51_industry();
apidatas.put("job51_industry", job51_industry);
apidatas.put("job51IndustryValue", valueList);
}
/**
* 驻外语言要求
*
* @param selectValue
* @param apidatas
* @param positionSdkInstance
*/
private void getResidentLanguage(String selectValue, Map<String, Object> apidatas, PositionSdkInstance positionSdkInstance) {
List<String> valueList = new ArrayList<>();
if (StringUtils.isNotBlank(selectValue)) {
String[] split = selectValue.split(",");
valueList = Arrays.asList(split);
}
List<ResumeJobDynamicField.Item> boss_resident_language = positionSdkInstance.getBoss_resident_language();
apidatas.put("boss_resident_language", boss_resident_language);
apidatas.put("bossResidentLanguage", valueList);
}
/**
* 驻外国家或地区
*
* @param selectValue
* @param apidatas
* @param positionSdkInstance
*/
private void getResidentCountry(String selectValue, Map<String, Object> apidatas, PositionSdkInstance positionSdkInstance) {
List<String> valueList = new ArrayList<>();
if (StringUtils.isNotBlank(selectValue)) {
String[] split = selectValue.split(",");
valueList = Arrays.asList(split);
}
List<ResumeJobDynamicField.Item> boss_resident_country = positionSdkInstance.getBoss_resident_country();
apidatas.put("boss_resident_country", boss_resident_country);
apidatas.put("bossResidentCountry", valueList);
}
/**
* 获取招聘职位多线下拉框字段信息
*
* @param apidatas
* @param positionSdkInstance
*/
private void getMultiSelect(Map<String, Object> apidatas, PositionSdkInstance positionSdkInstance) {
apidatas.put("boss_resident", PositionSelectItem.convertDynamicFieldItem(positionSdkInstance.getBoss_resident()));
//apidatas.put("boss_resident_country", PositionSelectItem.convertDynamicFieldItem(positionSdkInstance.getBoss_resident_country()));
//apidatas.put("boss_resident_language", PositionSelectItem.convertDynamicFieldItem(positionSdkInstance.getBoss_resident_language()));
apidatas.put("boss_resident_time", PositionSelectItem.convertDynamicFieldItem(positionSdkInstance.getBoss_resident_time()));
apidatas.put("boss_resident_time_2", PositionSelectItem.convertDynamicFieldItem(positionSdkInstance.getBoss_resident_time_2()));
//apidatas.put("job51_city", PositionSelectItem.convertDynamicFieldItem(positionSdkInstance.getJob51_city()));
}
/**
* 记录发布状态
*
* @param position
* @param innerChannel
* @param status
* @param tips
*/
private void recordPublishingStatus(String position, String innerChannel, Integer status, String tips) {
String tableName = "uf_jcl_qdfb";
Map<String, Object> insertMap = new HashMap<>();
String uuid = UUID.randomUUID().toString();
insertMap.put("modeuuid", uuid);
int formModeId = ApplicantCommonInfo.getModeIdByTableName(tableName);
insertMap.put("formmodeid", formModeId);
RecruitRecordSet.buildModeInsertFields(insertMap, user.getUID());
insertMap.put("position", position);
insertMap.put("inner_channel", innerChannel);
insertMap.put("status", status);
if (StringUtils.isNotBlank(tips)) {
insertMap.put("tips", tips);
}
RecruitRecordSet.insertData(insertMap, tableName);
int id = RecruitRecordSet.refreshRight(uuid, tableName, formModeId, user.getUID());
// 删除原来该职位下该渠道的数据
String deleteSql = "delete from uf_jcl_qdfb where position = '" + position + "' and inner_channel = " + innerChannel + " and id != " + id;
RecruitRecordSet.deleteData(deleteSql);
}
private void syncResumePlatformStatus(String billId, long jobId, ERPAResumeSDKClient client) {
Map<Integer, ResumeJobStatus> integerResumeJobStatusMap = client.syncResumePlatformStatus(String.valueOf(user.getUID()), jobId);
for (Map.Entry<Integer, ResumeJobStatus> entry : integerResumeJobStatusMap.entrySet()) {
Integer key = entry.getKey();
ResumeJobStatus value = entry.getValue();
Integer status = PositionReleaseStatusEnum.UNPUBLISHED.getValue();
if (null == value) {
status = PositionReleaseStatusEnum.CLOSED.getValue();
} else if (value.equals(ResumeJobStatus.RELEASED)) {
status = PositionReleaseStatusEnum.PUBLISHED.getValue();
} else if (value.equals(ResumeJobStatus.UNRELEASED)) {
status = PositionReleaseStatusEnum.UNPUBLISHED.getValue();
}
PositionThirdChannelEnum positionThirdChannelEnum = PositionThirdChannelEnum.getEnumByPlatformId(key);
recordPublishingStatus(billId, positionThirdChannelEnum.getValue(), status, null);
}
}
}

View File

@ -2,10 +2,10 @@ package com.engine.recruit.service.impl;
import com.engine.core.impl.Service;
import com.engine.recruit.conn.RecruitRecordSet;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.engine.recruit.service.RpaJclService;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeEmailSetting;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import weaver.conn.RecordSet;
import weaver.general.Util;
@ -24,7 +24,7 @@ public class RpaJclServiceImpl extends Service implements RpaJclService {
rs.executeQuery("select * from uf_jcl_qllyxpz where id = ? ", billId);
Map<String, Object> dataMap = RecruitRecordSet.getSingleRecordMap(rs);
ERPAResumeSDKClient resumeSDKClient = ERPASDKClients.getResumeSDKClient();
ERPAResumeSDKClient resumeSDKClient = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
String userId = Util.null2String(dataMap.get("szr"));
String status = Util.null2String(dataMap.get("zt"));
String server = Util.null2String(dataMap.get("yjjsfwq"));

View File

@ -6,11 +6,11 @@ import com.engine.recruit.conn.ApplicantCommonInfo;
import com.engine.recruit.conn.CheckRepeatResume;
import com.engine.recruit.conn.PositionCommonInfo;
import com.engine.recruit.conn.RecruitDataMap;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.engine.recruit.enums.ApplicationStatusEnum;
import com.engine.recruit.enums.CommonBrowserTypeEnum;
import com.engine.recruit.enums.HighestDegreeEnum;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import com.weaver.util.threadPool.entity.LocalRunnable;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -211,7 +211,7 @@ public class SdkResumeSavedThread extends LocalRunnable {
BaseBean baseBean = new BaseBean();
baseBean.writeLog("解析千里聆SDK原始简历resumeFileId===" + resumeFileId);
List<Integer> docIdList = new ArrayList<>();
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
client.start();
client.downloadResumeFile(resumeFileId, (fileName, stream) -> {
try {

View File

@ -0,0 +1,34 @@
package com.engine.recruit.util;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmFieldManager;
/**
* @author:dxfeng
* @createTime: 2024/04/07
* @version: 1.0
*/
public class WeaBrowserUtil {
/**
* 获取浏览按钮的展示内容
*
* @param user
* @param browserType
* @param value
* @return
*/
public static String getBrowserShowNames(User user, int browserType, String value) {
HrmFieldManager hrmFieldManager = new HrmFieldManager();
String fieldShowName;
try {
fieldShowName = hrmFieldManager.getFieldvalue(user, null, 0, 3, browserType, value, 0);
fieldShowName = Util.formatMultiLang(fieldShowName, Util.null2String(user.getLanguage()));
} catch (Exception e) {
throw new RuntimeException(e);
}
return fieldShowName;
}
}

View File

@ -21,4 +21,29 @@ public class RecruitPositionWrapper extends Service {
public Map<String, Object> updatePostInfo(Map<String, Object> param) {
return getRecruitPositionService(user).updatePostInfo(param);
}
public Map<String, Object> getFormCondition(Map<String, Object> param) {
return getRecruitPositionService(user).getFormCondition(param);
}
public Map<String, Object> releaseResumeJob(Map<String, Object> param) {
return getRecruitPositionService(user).releaseResumeJob(param);
}
public Map<String, Object> saveAndReleaseResumeJob(Map<String, Object> param) {
return getRecruitPositionService(user).saveAndReleaseResumeJob(param);
}
public Map<String, Object> closeResumeJob(Map<String, Object> param) {
return getRecruitPositionService(user).closeResumeJob(param);
}
public Map<String, Object> refreshResumeJob(Map<String, Object> param) {
return getRecruitPositionService(user).refreshResumeJob(param);
}
public Map<String, Object> getReportList(Map<String, Object> param) {
return getRecruitPositionService(user).getReportList(param);
}
}

View File

@ -1,18 +1,20 @@
package weaver.formmode.recruit.modeexpand.position;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import org.apache.commons.lang3.StringUtils;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.engine.recruit.enums.PositionReleaseStatusEnum;
import com.weaver.rpa.sdk.clients.core.entity.SDKCore;
import com.weaver.rpa.sdk.clients.core.utils.ERPASDKInitUtils;
import org.apache.commons.collections.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.erpa.apps.entity.application.resume.dto.ResumeTaskResult;
import weaver.erpa.apps.entity.application.resume.enums.TaskResult;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -38,49 +40,24 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
modeId = Util.getIntValue(requestInfo.getWorkflowid());
if (billId > 0 && modeId > 0) {
RecordSet rs = new RecordSet();
rs.executeQuery("select qllgwid from " + tableName + " where id = ?", billId);
if (rs.next()) {
String qllgwid = rs.getString("qllgwid");
if (StringUtils.isBlank(qllgwid)) {
baseBean.writeLog("billId=" + billId + ",当前职位暂未发布,无需进行下架操作");
resultMap.put("errmsg", "当前职位暂未发布,无需进行下架操作");
resultMap.put("flag", "false");
// 判断是否配置千里聆若未配置千里聆信息则不执行下架职位操作只更新状态
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
if (enableSdkClient) {
List<String> platformList = new ArrayList<>();
rs.executeQuery("select inner_channel from uf_jcl_qdfb where position = ? and status = ? ", billId, PositionReleaseStatusEnum.PUBLISHED.getValue());
while (rs.next()) {
platformList.add(rs.getString("inner_channel"));
}
if (CollectionUtils.isNotEmpty(platformList)) {
resultMap.put("errmsg", "该职位第三方渠道仍有发布中状态,请先执行下架操作");
return resultMap;
}
long jobId = Long.parseLong(qllgwid);
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
client.start();
String userId = String.valueOf(user.getUID());
ResumeTaskResult result = client.closeResumeJob(userId, jobId);
String errorMsg = "";
TaskResult current = result.getResult();
baseBean.writeLog(current);
// 使用回调函数获取成功或者失败时的消息
result.onResult(() -> {
baseBean.writeLog("执行成功回调");
}, (reason) -> {
baseBean.writeLog("执行失败回调,原因:" + reason);
});
// 等待直到状态不再是PENDING
TaskResult taskResult = result.waitResult();
baseBean.writeLog(taskResult);
if (taskResult == TaskResult.SUCCEED) {
baseBean.writeLog("执行成功");
} else {
errorMsg = "执行失败,原因:" + result.getFailReason();
baseBean.writeLog("执行失败,原因:" + result.getFailReason());
}
if (StringUtils.isBlank(errorMsg)) {
rs.executeUpdate("update " + tableName + " set qdfbzt = ? where id = ?", 5, billId);
} else {
resultMap.put("errmsg", errorMsg);
resultMap.put("flag", "false");
return resultMap;
}
}
// 更新招聘状态为招聘结束
rs.executeUpdate("update " + tableName + " set zpzt = ? where id = ?", 1, billId);
}
}
} catch (Exception e) {
@ -91,4 +68,20 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
return resultMap;
}
/**
* 校验是否配置千里聆
*
* @return
*/
private boolean checkUseQll() {
boolean used;
try {
SDKCore sdkCore = ERPASDKInitUtils.genSDKCore();
used = sdkCore != null;
} catch (Exception e) {
used = false;
}
return used;
}
}

View File

@ -1,7 +1,7 @@
package weaver.formmode.recruit.modeexpand.position;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
@ -24,6 +24,10 @@ public class DeletePositionModeExpand extends AbstractModeExpandJavaCodeNew {
public Map<String, String> doModeExpand(Map<String, Object> param) {
String tableName = "uf_jcl_zp_zpzw";
Map<String, String> resultMap = new HashMap<>(16);
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
if (!enableSdkClient) {
return resultMap;
}
BaseBean baseBean = new BaseBean();
try {
User user = (User) param.get("user");
@ -46,7 +50,7 @@ public class DeletePositionModeExpand extends AbstractModeExpandJavaCodeNew {
String userId = String.valueOf(user.getUID());
// 未创建职位则先创建职位
if (jobId != -1) {
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
baseBean.writeLog("【删除职位】,[id=" + billId + "],[qllgwid=" + jobId + "]");
client.delResumeJob(userId, jobId);
}

View File

@ -1,11 +1,11 @@
package weaver.formmode.recruit.modeexpand.position;
import com.alibaba.fastjson.JSON;
import com.engine.recruit.thread.SdkResumeSavedThread;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDto;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobV2Dto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.conn.RecordSet;
import weaver.erpa.apps.entity.application.resume.dto.ResumeTaskResult;
import weaver.erpa.apps.entity.application.resume.enums.TaskResult;
@ -23,10 +23,13 @@ import java.util.List;
import java.util.Map;
/**
* 新版职位发布调用接口分渠道发布该页面拓展已废弃
*
* @author:dxfeng
* @createTime: 2023/10/07
* @version: 1.0
*/
@Deprecated
public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
@Override
@ -44,89 +47,81 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
billId = Util.getIntValue(requestInfo.getRequestid());
modeId = Util.getIntValue(requestInfo.getWorkflowid());
if (billId > 0 && modeId > 0) {
long jobId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select qllgwid from " + tableName + " where id = ?", billId);
if (rs.next()) {
String qllgwid = rs.getString("qllgwid");
if (StringUtils.isNotBlank(qllgwid)) {
jobId = Long.parseLong(qllgwid);
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
if (enableSdkClient) {
long jobId = -1;
rs.executeQuery("select qllgwid from " + tableName + " where id = ?", billId);
if (rs.next()) {
String qllgwid = rs.getString("qllgwid");
if (StringUtils.isNotBlank(qllgwid)) {
jobId = Long.parseLong(qllgwid);
}
}
}
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
Map<String, Object> map = new HashMap<>(16);
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
for (Property property : properties) {
map.put(property.getName(), property.getValue());
}
ResumeJobDto resumeJobDto = RecruitPositionUtil.convertMap2ResumeJobDto(map);
// 发布千里聆职位
if (!RecruitPositionUtil.checkAvailable(client)) {
baseBean.writeLog("千里聆未开通简历应用。");
resultMap.put("errmsg", "千里聆未开通简历应用。");
resultMap.put("flag", "false");
return resultMap;
}
String userId = String.valueOf(user.getUID());
// 未创建职位则先创建职位
if (jobId == -1) {
baseBean.writeLog("【创建职位】,[id=" + billId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 创建千里聆职位
jobId = client.addResumeJob(userId, resumeJobDto);
// 更新千里聆ID到建模表单
rs.executeUpdate("update " + tableName + " set qllgwid = ? where id = ?", jobId, billId);
} else {
//baseBean.writeLog("【更新职位】,[id=" + billId + "],[qllgwid=" + jobId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
//// 已发布的职位更新职位信息
//client.editResumeJob(userId, jobId, (jobDto) -> resumeJobDto);
}
// 在启动监听前需要配置好简历接收回调
client.addResumeSavedListener(resumeMqMessage -> {
// 处理获取到的简历信息
baseBean.writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage));
Thread thread = new Thread(new SdkResumeSavedThread(resumeMqMessage));
thread.start();
});
client.start();
List<Integer> platformIds;
platformIds = resumeJobDto.getPlatformIds();
String errorMsg = "";
for (Integer platformId : platformIds) {
ResumeTaskResult result = client.releaseResumeJob(userId, jobId, platformId);
// 直接查看结果正在执行中会返回PENGING成功后会返回SUCCEED失败后会返回FAILED
TaskResult current = result.getResult();
baseBean.writeLog(current);
// 使用回调函数获取成功或者失败时的消息
result.onResult(() -> {
baseBean.writeLog("执行成功回调");
}, (reason) -> {
baseBean.writeLog("执行失败回调,原因:" + reason);
});
// 等待直到状态不再是PENDING
TaskResult taskResult = result.waitResult();
baseBean.writeLog(taskResult);
if (taskResult == TaskResult.SUCCEED) {
baseBean.writeLog("执行成功");
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
Map<String, Object> map = new HashMap<>(16);
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
for (Property property : properties) {
map.put(property.getName(), property.getValue());
}
ResumeJobV2Dto resumeJobDto = RecruitPositionUtil.convertMap2ResumeJobV2Dto(user, map);
String userId = String.valueOf(user.getUID());
// 未创建职位则先创建职位
if (jobId == -1) {
baseBean.writeLog("【创建职位】,[id=" + billId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 创建千里聆职位
jobId = client.addResumeJobV2(userId, resumeJobDto);
// 更新千里聆ID到建模表单
rs.executeUpdate("update " + tableName + " set qllgwid = ? where id = ?", jobId, billId);
} else {
errorMsg = "执行失败,原因:" + result.getFailReason();
baseBean.writeLog(errorMsg);
break;
baseBean.writeLog("【更新职位】,[id=" + billId + "],[qllgwid=" + jobId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 已发布的职位更新职位信息
client.editResumeJobV2(userId, jobId, jobDto -> {
new BaseBean().writeLog("职位更新前:" + JSON.toJSONString(jobDto));
BeanUtils.copyProperties(resumeJobDto, jobDto);
new BaseBean().writeLog("职位更新后:" + JSON.toJSONString(jobDto));
});
}
}
if (StringUtils.isNotBlank(errorMsg)) {
// 发布失败下架职位
client.closeResumeJob(userId, jobId);
// 更新状态为发布失败
rs.executeUpdate("update " + tableName + " set qdfbzt = ? where id = ?", 3, billId);
resultMap.put("errmsg", errorMsg);
resultMap.put("flag", "false");
return resultMap;
List<Integer> platformIds;
platformIds = resumeJobDto.getPlatformList();
String errorMsg = "";
for (Integer platformId : platformIds) {
ResumeTaskResult result = client.releaseResumeJob(userId, jobId, platformId);
// 直接查看结果正在执行中会返回PENGING成功后会返回SUCCEED失败后会返回FAILED
TaskResult current = result.getResult();
baseBean.writeLog(current);
// 使用回调函数获取成功或者失败时的消息
result.onResult(() -> {
baseBean.writeLog("执行成功回调");
}, (reason) -> {
baseBean.writeLog("执行失败回调,原因:" + reason);
});
// 等待直到状态不再是PENDING
TaskResult taskResult = result.waitResult();
baseBean.writeLog(taskResult);
if (taskResult == TaskResult.SUCCEED) {
baseBean.writeLog("执行成功");
} else {
errorMsg = "执行失败,原因:" + result.getFailReason();
baseBean.writeLog(errorMsg);
break;
}
}
if (StringUtils.isNotBlank(errorMsg)) {
// 发布失败下架职位
client.closeResumeJob(userId, jobId);
// 更新状态为发布失败
rs.executeUpdate("update " + tableName + " set qdfbzt = ? where id = ?", 3, billId);
resultMap.put("errmsg", errorMsg);
resultMap.put("flag", "false");
return resultMap;
}
} else {
resultMap.put("errmsg", "未配置发布插件,第三方平台请至各招聘网站自行发布");
}
// 更新状态为已发布
rs.executeUpdate("update " + tableName + " set qdfbzt = ? where id = ?", 2, billId);

View File

@ -1,9 +1,9 @@
package weaver.formmode.recruit.modeexpand.position;
import com.alibaba.fastjson.JSON;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDto;
import com.weaver.rpa.sdk.clients.core.ERPASDKClients;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobV2Dto;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import weaver.conn.RecordSet;
@ -31,6 +31,10 @@ public class SyncPositionModeExpand extends AbstractModeExpandJavaCodeNew {
String tableName = "uf_jcl_zp_zpzw";
Map<String, String> resultMap = new HashMap<>(16);
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
if (!enableSdkClient) {
return resultMap;
}
BaseBean baseBean = new BaseBean();
try {
User user = (User) param.get("user");
@ -50,31 +54,32 @@ public class SyncPositionModeExpand extends AbstractModeExpandJavaCodeNew {
jobId = Long.parseLong(qllgwid);
}
}
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
Map<String, Object> map = new HashMap<>(16);
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
for (Property property : properties) {
map.put(property.getName(), property.getValue());
}
ResumeJobDto resumeJobDto = RecruitPositionUtil.convertMap2ResumeJobDto(map);
ResumeJobV2Dto resumeJobDto = RecruitPositionUtil.convertMap2ResumeJobV2Dto(user, map);
String userId = String.valueOf(user.getUID());
// 未创建职位则先创建职位
if (jobId == -1) {
baseBean.writeLog("【创建职位】,[id=" + billId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 创建千里聆职位
jobId = client.addResumeJob(userId, resumeJobDto);
jobId = client.addResumeJobV2(userId, resumeJobDto);
// 更新千里聆ID到建模表单
rs.executeUpdate("update " + tableName + " set qllgwid = ? where id = ?", jobId, billId);
} else {
baseBean.writeLog("【更新职位】,[id=" + billId + "],[qllgwid=" + jobId + "],resumeJobDto=" + JSON.toJSONString(resumeJobDto));
// 已发布的职位更新职位信息
client.editResumeJob(userId, jobId, jobDto -> {
client.editResumeJobV2(userId, jobId, jobDto -> {
new BaseBean().writeLog("职位更新前:" + JSON.toJSONString(jobDto));
BeanUtils.copyProperties(resumeJobDto, jobDto);
new BaseBean().writeLog("职位更新后:" + JSON.toJSONString(jobDto));
});
}
}
}
} catch (Exception e) {

View File

@ -3,18 +3,26 @@ package weaver.formmode.recruit.modeexpand.util;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.engine.recruit.conn.ApplicantCommonInfo;
import com.engine.recruit.conn.ModeBrowserCommonInfo;
import com.engine.recruit.entity.position.PositionSdkInstance;
import com.engine.recruit.entity.position.PositionSelectItem;
import com.engine.recruit.enums.PositionThirdChannelEnum;
import com.engine.recruit.exception.CustomizeRunTimeException;
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
import com.weaver.rpa.sdk.clients.application.resume.common.ResumePlatform;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDto;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField;
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobV2Dto;
import com.weaver.rpa.sdk.utils.HttpClientUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 招聘职位工具类
@ -26,27 +34,47 @@ import java.util.*;
public class RecruitPositionUtil {
/**
* 将Map转换成ResumeJobDto对象
* 将Map转换成ResumeJobV2Dto对象
*
* @param map 数据集合
* @return ResumeJobDto对象
* @return ResumeJobV2Dto
*/
public static ResumeJobDto convertMap2ResumeJobDto(Map<String, Object> map) {
String positionName = Convert.toStr(map.get("zpzwmc"));//职位名称
String positionDuty = Convert.toStr(map.get("gwzz"));//职位职责
String jobRequirements = Convert.toStr(map.get("rzyq"));//任职要求
String finishTime = Convert.toStr(map.get("zpjzrq"));//完成时间
String education = ApplicantCommonInfo.getRecruitCommonBrowserValue(Convert.toStr(map.get("zdxlyq")));//学历要求
String workYears = ApplicantCommonInfo.getRecruitCommonBrowserValue(Convert.toStr(map.get("gznx")));//工作年限
String positionNature = ApplicantCommonInfo.getRecruitCommonBrowserValue(Convert.toStr(map.get("zwxz")));//职位性质
Integer salaryMin = Convert.toInt(map.get("zdxzk"), 0);//最低薪酬
Integer salaryMax = Convert.toInt(map.get("zgxzk"), 0);// 最高薪酬
Integer xcyfs = Convert.toInt(map.get("xzyfs"), 12);// 薪酬月份数
Integer workingDays = Convert.toInt(map.get("sxmzdgts"), 1);// 实习每周到岗天数
Integer internshipDuration = Convert.toInt(map.get("sxscy"), 1);// 实习时长
String jobCategory = "不限";//职位类别
public static ResumeJobV2Dto convertMap2ResumeJobV2Dto(User user, Map<String, Object> map) {
// 职位名称
String positionName = Convert.toStr(map.get("zpzwmc"));
// 职位职责
String positionDuty = Convert.toStr(map.get("gwzz"));
// 任职要求
String jobRequirements = Convert.toStr(map.get("rzyq"));
// 完成时间
String finishTime = Convert.toStr(map.get("zpjzrq"));
// 学历要求
String education = ApplicantCommonInfo.getRecruitCommonBrowserValue(Convert.toStr(map.get("zdxlyq")));
// 工作年限
String workYears = ApplicantCommonInfo.getRecruitCommonBrowserValue(Convert.toStr(map.get("gznx")));
// 职位性质
String positionNature = ApplicantCommonInfo.getRecruitCommonBrowserValue(Convert.toStr(map.get("zwxz")));
// 最低薪酬
Integer salaryMin = Convert.toInt(map.get("zdxzk"), 0);
// 最高薪酬
Integer salaryMax = Convert.toInt(map.get("zgxzk"), 0);
// 薪酬月份数
Integer xcyfs = Convert.toInt(map.get("xzyfs"), 12);
// 实习每周到岗天数
Integer workingDays = Convert.toInt(map.get("sxmzdgts"), 1);
// 实习时长
Integer internshipDuration = Convert.toInt(map.get("sxscy"), 1);
// 招聘人数
Integer zprs = Convert.toInt(map.get("zprs"), 1);
// 职位类别
String jobCategory = Convert.toStr(map.get("zwlb"));
int experienceValue = -1;//不限
// 工作地点
String gzdd = Convert.toStr(map.get("gzdd"));
String workPlaceShowName = ModeBrowserCommonInfo.getWorkPlaceShowName(user, gzdd);
//不限
int experienceValue = -1;
if ("应届毕业生".equals(workYears)) {
experienceValue = 1;
} else if ("一年以内".equals(workYears)) {
@ -62,7 +90,8 @@ public class RecruitPositionUtil {
}
int educationValue = -1; //不限
//不限
int educationValue = -1;
if ("博士".equals(education)) {
educationValue = 8;
} else if ("MBA/EMBA".equals(education)) {
@ -81,7 +110,8 @@ public class RecruitPositionUtil {
educationValue = 1;
}
int resumeType = 1;// 兼职全职
// 社招全职兼职其他
int resumeType = 1;
if ("实习".equals(positionNature)) {
resumeType = 3;
} else if ("校招".equals(positionNature)) {
@ -90,52 +120,272 @@ public class RecruitPositionUtil {
// 招聘职位类型与特殊设置字段
ResumeJobDto resumeJobDto = new ResumeJobDto();
resumeJobDto.setResumeType(resumeType); // (必填,默认社招)招聘类型 1:社招 2:校招 3:实习
ResumeJobV2Dto resumeJobV2Dto = new ResumeJobV2Dto();
if (StringUtils.isNotBlank(workPlaceShowName)) {
resumeJobV2Dto.setJobArea(workPlaceShowName);
}
// (必填,默认社招)招聘类型 1:社招 2:校招 3:实习
resumeJobV2Dto.setResumeType(resumeType);
if (2 == resumeType && StringUtils.isBlank(finishTime)) {
throw new CustomizeRunTimeException("校招招聘截止时间必填");
}
resumeJobDto.setStopReumeTimeLong(stringTurnLong(finishTime));// (校招必填)仅校招: 招聘截止时间(时间戳)
resumeJobDto.setRequirementsTime(internshipDuration); // (实习必填,默认1个月)仅实习: 实习时长 1~12 单位:()
resumeJobDto.setWorkDate(workingDays); // (实习必填,默认1天)仅实习: 每周到岗天数 1~7 单位:()
// (校招必填)仅校招: 招聘截止时间(时间戳)
resumeJobV2Dto.setStopReumeTimeLong(stringTurnLong(finishTime));
// (实习必填,默认1个月)仅实习: 实习时长 1~12 单位:()
resumeJobV2Dto.setRequirementsTime(internshipDuration);
// (实习必填,默认1天)仅实习: 每周到岗天数 1~7 单位:()
resumeJobV2Dto.setWorkDate(workingDays);
// 招聘职位基本描述
resumeJobDto.setJobname(positionName); // 配置职位名称
// 配置职位名称
resumeJobV2Dto.setJobname(positionName);
String jobDescription = "";
if (StringUtils.isNotBlank(positionDuty)) {
jobDescription += "职位职责:\n" + positionDuty +"\n\n";
jobDescription += "职位职责:\n" + positionDuty + "\n\n";
}
if (StringUtils.isNotBlank(jobRequirements)) {
jobDescription += "任职要求:\n" + jobRequirements;
}
resumeJobDto.setJobdesc(jobDescription); // 配置职位描述
resumeJobDto.setJobType(jobCategory); // 配置职位类别
// 配置职位描述
resumeJobV2Dto.setJobdesc(jobDescription);
// 配置职位类别
List<ResumeJobDynamicField.Item> items = new ArrayList<>();
String[] typeSplit = jobCategory.split("\n");
for (String s : typeSplit) {
String[] split1 = s.split(":");
String platName = split1[0];
String typeStr = split1[1];
int platId = getPlatIdByName(platName);
if (0 != platId) {
ResumeJobDynamicField.Item item = new ResumeJobDynamicField.Item();
item.setLabel(String.valueOf(platId));
item.setValue(typeStr);
items.add(item);
}
}
resumeJobV2Dto.setJobType(items);
// 招聘职位条件
//resumeJobDto.setKeywordStr(Lists.newArrayList("java")); // 职位关键词
resumeJobDto.setExperience(experienceValue); // (必填,默认不限)经验要求(实习无此字段) -1:不限 1:一年以下 2:1~3年 3:3~5年 5:5~10年 6:10年以上
resumeJobDto.setEducation(educationValue); // (必填,默认不限)学历要求 -1:不限 1:初中及以下 2:高中 3:中专/中技 4:大专 5:本科 6:硕士 7:MBA/EMBA 8:博士
// (必填,默认不限)经验要求(实习无此字段) -1:不限 1:一年以下 2:1~3年 3:3~5年 5:5~10年 6:10年以上
resumeJobV2Dto.setExperience(experienceValue);
// (必填,默认不限)学历要求 -1:不限 1:初中及以下 2:高中 3:中专/中技 4:大专 5:本科 6:硕士 7:MBA/EMBA 8:博士
resumeJobV2Dto.setEducation(educationValue);
//薪资福利
resumeJobDto.setExpectSalaryStart(salaryMin); // (必填)薪资范围开始 单位:(社招/校招: 千元/ 实习:/)
resumeJobDto.setExpectSalaryStop(salaryMax); // (必填)薪资范围截止 单位:(社招/校招: 千元/ 实习:/)
resumeJobDto.setExpectSalaryMonth(xcyfs); // (必填,默认12个月)薪资月份数(实习无此字段) 1224
// (必填)薪资范围开始 单位:(社招/校招: 千元/ 实习:/)
resumeJobV2Dto.setExpectSalaryStart(salaryMin);
// (必填)薪资范围截止 单位:(社招/校招: 千元/ 实习:/)
resumeJobV2Dto.setExpectSalaryStop(salaryMax);
// (必填,默认12个月)薪资月份数(实习无此字段) 1224
resumeJobV2Dto.setExpectSalaryMonth(xcyfs);
// (必填)要发布的渠道平台Id
List<Integer> platformIds = matchPlatform(Convert.toStr(map.get("dsfqd")));
resumeJobDto.setPlatformIds(platformIds);
resumeJobV2Dto.setPlatformList(platformIds);
// 简历匹配度设置
resumeJobDto.setMappingageStart(-1); // (必填,默认不限)匹配年龄age开始 -1:不限
resumeJobDto.setMappingageStop(-1);// (必填,默认不限)匹配年龄age开始 -1:不限
resumeJobDto.setMappingSex(-1);// (必填,默认不限)匹配性别 -1:不限 0: 1:
resumeJobDto.setMappingeducationStr(Collections.singletonList(-1));// (必填,默认不限)匹配学历 -1:不限 1:初中及以下 2:高中 3:中专/中技 4:大专 5:本科 6:硕士 7:MBA/EMBA 8:博士
resumeJobDto.setMappingexperienceStr(Collections.singletonList(-1));// (必填,默认不限)匹配经验 -1:不限 1:1年内 2:1~3年 3:3~5年 4:5~10年 5:10年以上
// resumeJobDto.setMappingKeywordStr(Lists.newArrayList()); // 匹配关键词内容
resumeJobDto.setMappingStatus(1); // (必填,默认任一命中)匹配模式 1:任一命中 2:全部命中
// (必填,默认不限)匹配年龄age开始 -1:不限
resumeJobV2Dto.setMappingageStart(-1);
// (必填,默认不限)匹配年龄age开始 -1:不限
resumeJobV2Dto.setMappingageStop(-1);
// (必填,默认不限)匹配性别 -1:不限 0: 1:
resumeJobV2Dto.setMappingSex(-1);
// (必填,默认不限)匹配学历 -1:不限 1:初中及以下 2:高中 3:中专/中技 4:大专 5:本科 6:硕士 7:MBA/EMBA 8:博士
resumeJobV2Dto.setMappingeducationStr(Collections.singletonList(-1));
// (必填,默认不限)匹配经验 -1:不限 1:1年内 2:1~3年 3:3~5年 4:5~10年 5:10年以上
resumeJobV2Dto.setMappingexperienceStr(Collections.singletonList(-1));
String zwgjc = Util.null2String(map.get("zwgjc"));
List<String> zwgjcList = new ArrayList<>();
if (StringUtils.isNotBlank(zwgjc)) {
zwgjcList.addAll(Arrays.asList(zwgjc.split("")));
}
// 匹配关键词内容
resumeJobV2Dto.setMappingKeywordStr(zwgjcList);
// 职位关键词
resumeJobV2Dto.setKeywordStr(zwgjcList);
// (必填,默认任一命中)匹配模式 1:任一命中 2:全部命中
resumeJobV2Dto.setMappingStatus(1);
resumeJobV2Dto.setBizVersion(1);
// 海外经历 ["海外工作经历", "海外教育背景"]
List<String> hwjlList = new ArrayList<>();
String hwjl = Util.null2String(map.get("hwjl"));
if (StringUtils.isNotBlank(hwjl)) {
String[] split = hwjl.split(",");
List<String> strings = Arrays.asList(split);
if (strings.contains("0")) {
hwjlList.add("海外工作经历");
}
if (strings.contains("1")) {
hwjlList.add("海外教育背景");
}
}
resumeJobV2Dto.setHwjl(hwjlList);
/*
*BOSS直聘必填字段
*/
// 毕业时间-开始 boss校招必填
String bysjks = Util.null2String(map.get("bysjks"));
resumeJobV2Dto.setBysjStart(bysjks);
// 毕业时间-结束 boss校招必填
String bysjjs = Util.null2String(map.get("bysjjs"));
resumeJobV2Dto.setBysjEnd(bysjjs);
/*
* 前程无忧必填
*/
// 发布城市
String fbcs = Util.null2String(map.get("fbcs"));
if (StringUtils.isNotBlank(fbcs)) {
String[] split = fbcs.split(",");
resumeJobV2Dto.setFbcs(Arrays.asList(split));
}
// 所属行业
String sshy = Util.null2String(map.get("szhy"));
List<List<String>> sshyList = new ArrayList<>();
if (StringUtils.isNotBlank(sshy)) {
String[] split = sshy.split("\n");
for (String s : split) {
if (StringUtils.isNotBlank(s)) {
String[] strings = s.split("-");
if (strings.length == 2) {
List<String> strings1 = new ArrayList<>();
strings1.add(strings[0]);
strings1.add(strings[1]);
sshyList.add(strings1);
}
}
}
}
resumeJobV2Dto.setSshy(sshyList);
/*
* 猎聘必填 智联必填
*/
// 招聘人数
resumeJobV2Dto.setZprs(zprs);
/*
* 拉勾必填
*/
// 职位亮点
resumeJobV2Dto.setZwld(Util.null2String(map.get("zwld")));
// 行业领域
String hyly = Util.null2String(map.get("hyly"));
List<String> hylyList = new ArrayList<>();
if (StringUtils.isNotBlank(hyly)) {
hylyList.addAll(Arrays.asList(hyly.split("")));
}
resumeJobV2Dto.setHyly(hylyList);
// 人才加分项
String rcjfx = Util.null2String(map.get("rxjfx"));
resumeJobV2Dto.setRcjfx(rcjfx);
// 简历接收邮箱
String jljsyx = Util.null2String(map.get("jljsyx"));
resumeJobV2Dto.setJsyx(jljsyx);
// 语言要求
String yyyq = Util.null2String(map.get("yyyq"));
resumeJobV2Dto.setYyyq(yyyq);
// 语言要求程度
String yyyqcd = Util.null2String(map.get("yyyqcd"));
if (StringUtils.isNotBlank(yyyqcd)) {
switch (yyyqcd) {
case "0":
yyyqcd = "一般";
break;
case "1":
yyyqcd = "良好";
break;
case "2":
yyyqcd = "熟练";
break;
case "3":
yyyqcd = "精通";
break;
default:
break;
}
}
resumeJobV2Dto.setYyyq_level(yyyqcd);
// 职位福利
String zwfl = Util.null2String(map.get("zwfl"));
List<String> zwflList = new ArrayList<>();
if (StringUtils.isNotBlank(zwfl)) {
zwflList.addAll(Arrays.asList(zwfl.split("")));
}
resumeJobV2Dto.setZwfl(zwflList);
PositionSdkInstance positionSdkInstance = PositionSdkInstance.getPositionSdkInstance();
// 是否驻外
String sfzw = Util.null2String(map.get("sfzw"));
resumeJobV2Dto.setBossResident(PositionSelectItem.getItemByValue(positionSdkInstance.getBoss_resident(), sfzw));
if (!"3".equals(sfzw)) {
// 驻外国家或地区
String zwgjhdq = Util.null2String(map.get("zwgjhdq"));
resumeJobV2Dto.setBossResidentCountry(PositionSelectItem.getItemsByValues(positionSdkInstance.getBoss_resident_country(), zwgjhdq));
// 驻外语言要求
String zwyyyq = Util.null2String(map.get("zwyyyq"));
resumeJobV2Dto.setBossResidentLanguage(PositionSelectItem.getItemsByValues(positionSdkInstance.getBoss_resident_language(), zwyyyq));
// 驻外时长
String zwsc = Util.null2String(map.get("zwsc"));
if ("1".equals(sfzw)) {
resumeJobV2Dto.setBossResidentTime(PositionSelectItem.getItemByValue(positionSdkInstance.getBoss_resident_time(), zwsc));
} else {
resumeJobV2Dto.setBossResidentTime(PositionSelectItem.getItemByValue(positionSdkInstance.getBoss_resident_time_2(), zwsc));
}
}
String zpzwfzr = Util.null2String(map.get("zpzwfzr"));
String zpxzr = Util.null2String(map.get("zpxzr"));
List<String> userList = new ArrayList<>();
if (StringUtils.isNotBlank(zpzwfzr)) {
userList.addAll(Arrays.asList(zpzwfzr.split(",")));
}
if (StringUtils.isNotBlank(zpxzr)) {
userList.addAll(Arrays.asList(zpxzr.split(",")));
}
resumeJobV2Dto.setShareThirdUserList(userList);
return resumeJobV2Dto;
}
/**
* 必填字段校验
*
* @param resumeJobV2Dto
*/
public static void checkRequiredFields(ResumeJobV2Dto resumeJobV2Dto) {
List<Integer> platformList = resumeJobV2Dto.getPlatformList();
if (CollectionUtils.isNotEmpty(platformList)) {
List<ResumeJobDynamicField.Item> jobType = resumeJobV2Dto.getJobType();
if (CollectionUtils.isNotEmpty(jobType)) {
Map<String, String> map = jobType.stream().collect(Collectors.toMap(ResumeJobDynamicField.Item::getLabel, ResumeJobDynamicField.Item::getLabel));
for (Integer integer : platformList) {
String s = map.get(String.valueOf(integer));
if (StringUtils.isBlank(s)) {
PositionThirdChannelEnum enumByPlatformId = PositionThirdChannelEnum.getEnumByPlatformId(integer);
throw new CustomizeRunTimeException("职位类别字段校验失败,请选择[" + enumByPlatformId.getDesc() + "]对应的职位类别");
}
}
} else {
throw new CustomizeRunTimeException("请选择职位类别");
}
} else {
throw new CustomizeRunTimeException("请选择第三方发布渠道");
}
return resumeJobDto;
}
/**
@ -171,32 +421,40 @@ public class RecruitPositionUtil {
if (platformId == null) {
continue;
}
PositionThirdChannelEnum channelEnum = PositionThirdChannelEnum.getEnum(platformId);
switch (channelEnum) {
case BOSSZHIPIN:
platformIdList.add(ResumePlatform.BOSSZHIPIN);
break;
case LIEPIN:
platformIdList.add(ResumePlatform.LIEPIN);
break;
case LAGO:
platformIdList.add(ResumePlatform.LAGO);
break;
case QIANCHENGWUYOU:
platformIdList.add(ResumePlatform.QIANCHENGWUYOU);
break;
case ZHILIANZHAOPIN:
platformIdList.add(ResumePlatform.ZHILIANZHAOPIN);
break;
default:
break;
}
PositionThirdChannelEnum channelEnum = PositionThirdChannelEnum.getEnumByValue(platformId);
platformIdList.add(channelEnum.getResumePlatformId());
}
return platformIdList;
}
private static int getPlatIdByName(String platName) {
int platId = 0;
switch (platName) {
case "BOSS直聘":
platId = ResumePlatform.BOSSZHIPIN;
break;
case "智联":
case "智联招聘":
platId = ResumePlatform.ZHILIANZHAOPIN;
break;
case "前程无忧":
platId = ResumePlatform.QIANCHENGWUYOU;
break;
case "拉勾":
platId = ResumePlatform.LAGO;
break;
case "猎聘":
platId = ResumePlatform.LIEPIN;
break;
default:
break;
}
return platId;
}
public static boolean checkAvailable(ERPAResumeSDKClient client) {
HttpClientUtils.setTimeout(10000);//默认10秒
//默认10秒
HttpClientUtils.setTimeout(10000);
if (client == null || !client.available()) {
new BaseBean().writeLog("checkAvailableclient=" + JSON.toJSONString(client));
return false;