generated from dxfeng/secondev-chapanda-feishu
ADD-新建、编辑、删除,增加千里聆的交互
This commit is contained in:
parent
fc2666a5b1
commit
81a29c58d2
|
|
@ -94,6 +94,22 @@ public class PositionSdkInstance {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断千里聆SDK是否可用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean enableSdkClient() {
|
||||
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
|
||||
if (client == null || !client.available()) {
|
||||
new BaseBean().writeLog("checkAvailable failed!client=" + JSON.toJSONString(client));
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ERPAResumeSDKClient getResumeSDKClient() {
|
||||
return resumeSDKClient;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
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();
|
||||
|
||||
// 获取职位类别表单
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ public class RpaJclServiceImpl extends Service implements RpaJclService {
|
|||
@Override
|
||||
public Map<String, Object> setEmailSetting(Map<String, Object> param) {
|
||||
try {
|
||||
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
|
||||
if (!enableSdkClient) {
|
||||
throw new CustomizeRunTimeException("千里聆SDK校验失败,无法执行邮箱操作,请检查千里聆非标配置");
|
||||
}
|
||||
String billId = Util.null2String(param.get("billId"));
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.executeQuery("select * from uf_jcl_qllyxpz where id = ? ", billId);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
if (billId > 0 && modeId > 0) {
|
||||
RecordSet rs = new RecordSet();
|
||||
// 判断是否配置千里聆,若未配置千里聆信息,则不执行下架职位操作,只更新状态
|
||||
if (checkUseQll()) {
|
||||
boolean enableSdkClient = PositionSdkInstance.enableSdkClient();
|
||||
if (enableSdkClient) {
|
||||
rs.executeQuery("select qllgwid,qdfbzt from " + tableName + " where id = ?", billId);
|
||||
if (rs.next()) {
|
||||
String qllgwid = rs.getString("qllgwid");
|
||||
|
|
@ -57,14 +58,6 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
long jobId = Long.parseLong(qllgwid);
|
||||
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
|
||||
|
||||
//// 在启动监听前需要配置好简历接收回调
|
||||
//client.addResumeSavedListener(resumeMqMessage -> {
|
||||
// // 处理获取到的简历信息
|
||||
// baseBean.writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage));
|
||||
// Thread thread = new Thread(new SdkResumeSavedThread(resumeMqMessage));
|
||||
// thread.start();
|
||||
//});
|
||||
//client.start();
|
||||
String userId = String.valueOf(user.getUID());
|
||||
ResumeTaskResult result = client.closeResumeJob(userId, jobId);
|
||||
String errorMsg = "";
|
||||
|
|
@ -97,6 +90,8 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
resultMap.put("errmsg", "未配置下架插件,第三方平台请至各招聘网站自行下架");
|
||||
}
|
||||
// 更新招聘状态为招聘结束
|
||||
rs.executeUpdate("update " + tableName + " set zpzt = ? where id = ?", 1, billId);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
package weaver.formmode.recruit.modeexpand.position;
|
||||
|
||||
import com.engine.recruit.entity.position.PositionSdkInstance;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/05/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class DeletePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
@Override
|
||||
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");
|
||||
int billId;
|
||||
int modeId;
|
||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||
if (requestInfo != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
String userId = String.valueOf(user.getUID());
|
||||
// 未创建职位,则先创建职位
|
||||
if (jobId != -1) {
|
||||
ERPAResumeSDKClient client = PositionSdkInstance.getPositionSdkInstance().getResumeSDKClient();
|
||||
baseBean.writeLog("【删除职位】,[id=" + billId + "],[qllgwid=" + jobId + "]");
|
||||
client.delResumeJob(userId, jobId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog(e);
|
||||
resultMap.put("errmsg", "招聘职位同步千里聆失败!" + e.getMessage());
|
||||
resultMap.put("flag", "false");
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -44,83 +44,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 = 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);
|
||||
// 发布千里聆职位
|
||||
//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.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.editResumeJobV2(userId, jobId, jobDto -> {
|
||||
new BaseBean().writeLog("职位更新前:" + JSON.toJSONString(jobDto));
|
||||
BeanUtils.copyProperties(resumeJobDto,jobDto);
|
||||
new BaseBean().writeLog("职位更新后:" + JSON.toJSONString(jobDto));
|
||||
});
|
||||
}
|
||||
|
||||
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("执行成功");
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
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.ResumeJobV2Dto;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitPositionUtil;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.MainTableInfo;
|
||||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/05/29
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class SyncPositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||
|
||||
@Override
|
||||
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");
|
||||
int billId;
|
||||
int modeId;
|
||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||
if (requestInfo != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
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 {
|
||||
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));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog(e);
|
||||
resultMap.put("errmsg", "招聘职位同步千里聆失败!" + e.getMessage());
|
||||
resultMap.put("flag", "false");
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue