weaver-hrm-recruit/src/weaver/formmode/recruit/modeexpand/position/DeletePositionModeExpand.java

69 lines
2.6 KiB
Java

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;
}
}