generated from dxfeng/secondev-chapanda-feishu
90 lines
3.9 KiB
Java
90 lines
3.9 KiB
Java
|
|
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;
|
||
|
|
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";
|
||
|
|
|
||
|
|
Map<String, String> result = new HashMap<>(16);
|
||
|
|
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()) {
|
||
|
|
jobId = Long.parseLong(rs.getString("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);
|
||
|
|
// 发布千里聆职位
|
||
|
|
if (!RecruitPositionUtil.checkAvailable(client)) {
|
||
|
|
new BaseBean().writeLog("千里聆未开通简历应用。");
|
||
|
|
result.put("errmsg", "千里聆未开通简历应用。");
|
||
|
|
result.put("flag", "false");
|
||
|
|
}
|
||
|
|
String userId = String.valueOf(user.getUID());
|
||
|
|
// TODO 测试数据 userId = "26";
|
||
|
|
// 未创建职位,则先创建职位
|
||
|
|
if (jobId == -1) {
|
||
|
|
// 创建千里聆职位
|
||
|
|
jobId = client.addResumeJob(userId, resumeJobDto);
|
||
|
|
// 更新千里聆ID到建模表单
|
||
|
|
rs.executeUpdate("update " + tableName + " set qllgwid = ? where id = ?", jobId, billId);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 发布职位
|
||
|
|
client.setRobotAuthority(userId,userId,false);
|
||
|
|
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);
|
||
|
|
result.put("errmsg", e.getMessage());
|
||
|
|
result.put("flag", "false");
|
||
|
|
}
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|