ADD-新建、编辑、删除,增加千里聆的交互

This commit is contained in:
dxfeng 2024-06-05 14:40:52 +08:00
parent 3abbd32ba5
commit 3fc8780e22
2 changed files with 152 additions and 0 deletions

View File

@ -0,0 +1,64 @@
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 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);
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 = ERPASDKClients.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;
}
}

View File

@ -0,0 +1,88 @@
package weaver.formmode.recruit.modeexpand.position;
import com.alibaba.fastjson.JSON;
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 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);
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 = 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);
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 -> {
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;
}
}