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

94 lines
4.1 KiB
Java
Raw Normal View History

2023-10-09 10:31:12 +08:00
package weaver.formmode.recruit.modeexpand.position;
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;
2023-10-10 09:28:13 +08:00
import org.apache.commons.lang3.StringUtils;
2023-10-09 10:31:12 +08:00
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.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/10/07
* @version: 1.0
*/
public class ReleasePositionModeExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
String tableName = "uf_jcl_zp_zpzw";
2023-10-10 09:28:13 +08:00
Map<String, String> resultMap = new HashMap<>(16);
2023-10-09 10:31:12 +08:00
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()) {
2023-10-10 09:28:13 +08:00
String qllgwid = rs.getString("qllgwid");
if (StringUtils.isNotBlank(qllgwid)) {
jobId = Long.parseLong(qllgwid);
}
2023-10-09 10:31:12 +08:00
}
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)) {
new BaseBean().writeLog("千里聆未开通简历应用。");
2023-10-10 09:28:13 +08:00
resultMap.put("errmsg", "千里聆未开通简历应用。");
resultMap.put("flag", "false");
return resultMap;
2023-10-09 10:31:12 +08:00
}
String userId = String.valueOf(user.getUID());
// 未创建职位,则先创建职位
if (jobId == -1) {
// 创建千里聆职位
jobId = client.addResumeJob(userId, resumeJobDto);
// 更新千里聆ID到建模表单
rs.executeUpdate("update " + tableName + " set qllgwid = ? where id = ?", jobId, billId);
}
// 发布职位
2023-10-10 09:28:13 +08:00
client.setRobotAuthority(userId, userId, false);
2023-10-09 10:31:12 +08:00
client.start();
List<Integer> platformIds = resumeJobDto.getPlatformIds();
for (Integer platformId : platformIds) {
client.releaseResumeJob(userId, jobId, platformId);
}
// 更新状态为已发布
rs.executeUpdate("update " + tableName + " set qdfbzt = ? where id = ?", 2, billId);
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
2023-10-10 09:28:13 +08:00
resultMap.put("errmsg", e.getMessage());
resultMap.put("flag", "false");
2023-10-09 10:31:12 +08:00
}
2023-10-10 09:28:13 +08:00
return resultMap;
2023-10-09 10:31:12 +08:00
}
}