generated from dxfeng/secondev-chapanda-feishu
千里聆职位发布、下架功能完善
This commit is contained in:
parent
0d43aaac44
commit
79321921fa
|
|
@ -4,6 +4,8 @@ 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.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;
|
||||
|
|
@ -23,8 +25,9 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||
String tableName = "uf_jcl_zp_zpzw";
|
||||
BaseBean baseBean = new BaseBean();
|
||||
|
||||
Map<String, String> result = new HashMap<>(16);
|
||||
Map<String, String> resultMap = new HashMap<>(16);
|
||||
try {
|
||||
User user = (User) param.get("user");
|
||||
int billId;
|
||||
|
|
@ -39,26 +42,53 @@ public class ClosePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
if (rs.next()) {
|
||||
String qllgwid = rs.getString("qllgwid");
|
||||
if (StringUtils.isBlank(qllgwid)) {
|
||||
new BaseBean().writeLog("billId=" + billId + ",当前职位暂未发布,无需进行下架操作");
|
||||
result.put("errmsg", "当前职位暂未发布,无需进行下架操作");
|
||||
result.put("flag", "false");
|
||||
return result;
|
||||
baseBean.writeLog("billId=" + billId + ",当前职位暂未发布,无需进行下架操作");
|
||||
resultMap.put("errmsg", "当前职位暂未发布,无需进行下架操作");
|
||||
resultMap.put("flag", "false");
|
||||
return resultMap;
|
||||
}
|
||||
long jobId = Long.parseLong(qllgwid);
|
||||
ERPAResumeSDKClient client = ERPASDKClients.getResumeSDKClient();
|
||||
client.start();
|
||||
String userId = String.valueOf(user.getUID());
|
||||
client.closeResumeJob(userId, jobId);
|
||||
rs.executeUpdate("update " + tableName + " set qdfbzt = ? where id = ?", 5, billId);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
result.put("errmsg", e.getMessage());
|
||||
result.put("flag", "false");
|
||||
baseBean.writeLog(e);
|
||||
resultMap.put("errmsg", e.getMessage());
|
||||
resultMap.put("flag", "false");
|
||||
}
|
||||
return result;
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
String tableName = "uf_jcl_zp_zpzw";
|
||||
|
||||
Map<String, String> resultMap = new HashMap<>(16);
|
||||
BaseBean baseBean = new BaseBean();
|
||||
try {
|
||||
User user = (User) param.get("user");
|
||||
int billId;
|
||||
|
|
@ -62,7 +63,7 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
ResumeJobDto resumeJobDto = RecruitPositionUtil.convertMap2ResumeJobDto(map);
|
||||
// 发布千里聆职位
|
||||
if (!RecruitPositionUtil.checkAvailable(client)) {
|
||||
new BaseBean().writeLog("千里聆未开通简历应用。");
|
||||
baseBean.writeLog("千里聆未开通简历应用。");
|
||||
resultMap.put("errmsg", "千里聆未开通简历应用。");
|
||||
resultMap.put("flag", "false");
|
||||
return resultMap;
|
||||
|
|
@ -70,16 +71,21 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
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 -> {
|
||||
// 处理获取到的简历信息
|
||||
new BaseBean().writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage));
|
||||
baseBean.writeLog("【简历接收回调】:" + JSON.toJSONString(resumeMqMessage));
|
||||
Thread thread = new Thread(new SdkResumeSavedThread(resumeMqMessage));
|
||||
thread.start();
|
||||
});
|
||||
|
|
@ -93,22 +99,22 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
ResumeTaskResult result = client.releaseResumeJob(userId, jobId, platformId);
|
||||
// 直接查看结果,正在执行中会返回PENGING,成功后会返回SUCCEED,失败后会返回FAILED
|
||||
TaskResult current = result.getResult();
|
||||
new BaseBean().writeLog(current);
|
||||
baseBean.writeLog(current);
|
||||
// 使用回调函数获取成功或者失败时的消息
|
||||
result.onResult(() -> {
|
||||
new BaseBean().writeLog("执行成功回调");
|
||||
baseBean.writeLog("执行成功回调");
|
||||
}, (reason) -> {
|
||||
new BaseBean().writeLog("执行失败回调,原因:" + reason);
|
||||
baseBean.writeLog("执行失败回调,原因:" + reason);
|
||||
});
|
||||
|
||||
// 等待直到状态不再是PENDING
|
||||
TaskResult taskResult = result.waitResult();
|
||||
new BaseBean().writeLog(taskResult);
|
||||
baseBean.writeLog(taskResult);
|
||||
if (taskResult == TaskResult.SUCCEED) {
|
||||
new BaseBean().writeLog("执行成功");
|
||||
baseBean.writeLog("执行成功");
|
||||
} else {
|
||||
errorMsg = "执行失败,原因:" + result.getFailReason();
|
||||
new BaseBean().writeLog(errorMsg);
|
||||
baseBean.writeLog(errorMsg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +133,7 @@ public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
new BaseBean().writeLog(e);
|
||||
baseBean.writeLog(e);
|
||||
resultMap.put("errmsg", e.getMessage());
|
||||
resultMap.put("flag", "false");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue