generated from dxfeng/secondev-chapanda-feishu
ADD-职位分渠道发布、下架、刷新
This commit is contained in:
parent
2c7a894148
commit
b00e707f81
|
|
@ -54,6 +54,15 @@ public class RecruitPositionController {
|
|||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::releaseResumeJob, param);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/saveAndReleaseResumeJob")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String saveAndReleaseResumeJob(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> param = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitPositionWrapper(user)::saveAndReleaseResumeJob, param);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/closeResumeJob")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ public interface RecruitPositionService {
|
|||
*/
|
||||
Map<String, Object> releaseResumeJob(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 保存并发布职位
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> saveAndReleaseResumeJob(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 下架职位
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.recruit.service.impl;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||||
import com.engine.recruit.conn.RecruitRecordSet;
|
||||
|
|
@ -12,6 +13,7 @@ import com.engine.recruit.enums.PositionReleaseStatusEnum;
|
|||
import com.engine.recruit.enums.PositionThirdChannelEnum;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.recruit.service.RecruitPositionService;
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.ERPAResumeSDKClient;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.common.ResumeJobStatus;
|
||||
import com.weaver.rpa.sdk.clients.application.resume.entity.ResumeJobDynamicField;
|
||||
|
|
@ -21,10 +23,13 @@ import org.springframework.beans.BeanUtils;
|
|||
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.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitPositionUtil;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -101,7 +106,6 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
@Override
|
||||
public Map<String, Object> releaseResumeJob(Map<String, Object> param) {
|
||||
try {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
String billId = Util.null2String(param.get("billId"));
|
||||
String platformIds = Util.null2String(param.get("platformIds"));
|
||||
if (StringUtils.isBlank(platformIds)) {
|
||||
|
|
@ -138,8 +142,6 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
}
|
||||
|
||||
String errorMsg = "";
|
||||
int succ = 0;
|
||||
int fail = 0;
|
||||
String[] split = platformIds.split(",");
|
||||
for (String platformId : split) {
|
||||
PositionThirdChannelEnum positionThirdChannelEnum = PositionThirdChannelEnum.getEnumByValue(platformId);
|
||||
|
|
@ -161,27 +163,21 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
Integer status;
|
||||
if (taskResult == TaskResult.SUCCEED) {
|
||||
rs.writeLog("执行成功");
|
||||
succ++;
|
||||
status = PositionReleaseStatusEnum.PUBLISHED.getValue();
|
||||
} else {
|
||||
errorMsg = "执行失败,原因:" + result.getFailReason();
|
||||
rs.writeLog(errorMsg);
|
||||
fail++;
|
||||
status = PositionReleaseStatusEnum.PUBLISHING_FAILED.getValue();
|
||||
}
|
||||
recordPublishingStatus(billId, platformId, status, errorMsg);
|
||||
}
|
||||
resultMap.put("msg", "成功发布" + succ + "个,失败" + fail + "个");
|
||||
} else {
|
||||
String msg = "未配置发布插件,第三方平台请至各招聘网站自行发布";
|
||||
resultMap.put("errmsg", msg);
|
||||
String[] splits = platformIds.split(",");
|
||||
for (String platformId : splits) {
|
||||
recordPublishingStatus(billId, platformId, PositionReleaseStatusEnum.PUBLISHED.getValue(), msg);
|
||||
}
|
||||
}
|
||||
// 更新状态为已发布
|
||||
//rs.executeUpdate("update uf_jcl_zp_zpzw set qdfbzt = ? where id = ?", 2, billId);
|
||||
return getReportList(param);
|
||||
} catch (InterruptedException e) {
|
||||
throw new CustomizeRunTimeException(e);
|
||||
|
|
@ -233,19 +229,19 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
|
||||
// 使用回调函数获取成功或者失败时的消息
|
||||
result.onResult(() -> {
|
||||
rs.writeLog("执行成功回调");
|
||||
rs.writeLog("下架成功回调");
|
||||
}, (reason) -> {
|
||||
rs.writeLog("执行失败回调,原因:" + reason);
|
||||
rs.writeLog("下架失败回调,原因:" + reason);
|
||||
});
|
||||
|
||||
// 等待直到状态不再是PENDING
|
||||
TaskResult taskResult = result.waitResult();
|
||||
rs.writeLog(taskResult);
|
||||
if (taskResult == TaskResult.SUCCEED) {
|
||||
rs.writeLog("执行成功");
|
||||
rs.writeLog("下架成功");
|
||||
syncResumePlatformStatus(billId, jobId, client);
|
||||
} else {
|
||||
errorMsg = "执行失败,原因:" + result.getFailReason();
|
||||
errorMsg = "下架失败,原因:" + result.getFailReason();
|
||||
throw new CustomizeRunTimeException(errorMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -257,9 +253,6 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
recordPublishingStatus(billId, platformId, PositionReleaseStatusEnum.PUBLISHED.getValue(), msg);
|
||||
}
|
||||
}
|
||||
//
|
||||
// 更新招聘状态为招聘结束
|
||||
//rs.executeUpdate("update uf_jcl_zp_zpzw set zpzt = ? where id = ?", 1, billId);
|
||||
|
||||
return getReportList(param);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
@ -270,10 +263,6 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
@Override
|
||||
public Map<String, Object> refreshResumeJob(Map<String, Object> param) {
|
||||
String billId = Util.null2String(param.get("billId"));
|
||||
String platformIds = Util.null2String(param.get("platformIds"));
|
||||
if (StringUtils.isBlank(platformIds)) {
|
||||
throw new CustomizeRunTimeException("请选择要刷新的平台");
|
||||
}
|
||||
RecordSet rs = new RecordSet();
|
||||
try {
|
||||
long jobId = -1;
|
||||
|
|
@ -335,12 +324,49 @@ public class RecruitPositionServiceImpl extends Service implements RecruitPositi
|
|||
positionRelease.setTips(tips);
|
||||
}
|
||||
list.add(positionRelease);
|
||||
//returnMap.put(rs.getInt("inner_channel"), releaseStatusEnum.getLabel());
|
||||
}
|
||||
returnMap.put("list", list);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> saveAndReleaseResumeJob(Map<String, Object> param) {
|
||||
String billId = Util.null2String(param.get("billId"));
|
||||
String submitDataStr = Util.null2String(param.get("submitData"));
|
||||
if (StringUtils.isAnyBlank(billId, submitDataStr)) {
|
||||
throw new CustomizeRunTimeException("职位发布失败,接口传参有误");
|
||||
}
|
||||
JSONObject submitData = JSONObject.parseObject(submitDataStr);
|
||||
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_zp_zpzw");
|
||||
Map<String, Formfield> fieldIdMap = fieldList.stream().collect(Collectors.toMap(item -> "field" + item.getId()
|
||||
, item -> item, (k1, k2) -> k1));
|
||||
Map<String, Object> mainDataMap = new HashMap<>();
|
||||
Map<String, Object> innerMap = submitData.getInnerMap();
|
||||
BaseBean baseBean = new BaseBean();
|
||||
for (Map.Entry<String, Object> entry : innerMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = Util.null2String(entry.getValue());
|
||||
Formfield formfield = fieldIdMap.get(key);
|
||||
if (null != formfield) {
|
||||
String fieldName = formfield.getFieldname();
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
mainDataMap.put(fieldName, value);
|
||||
} else {
|
||||
mainDataMap.put(fieldName, null);
|
||||
if("text".equals(formfield.getFielddbtype())){
|
||||
mainDataMap.put(fieldName, "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
baseBean.writeLog("未匹配到对应字段,key==" + key);
|
||||
}
|
||||
}
|
||||
mainDataMap.put("id", billId);
|
||||
|
||||
RecruitRecordSet.updateDataById(mainDataMap, "uf_jcl_zp_zpzw");
|
||||
return releaseResumeJob(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职位类别
|
||||
*
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ public class RecruitPositionWrapper extends Service {
|
|||
return getRecruitPositionService(user).releaseResumeJob(param);
|
||||
}
|
||||
|
||||
public Map<String, Object> saveAndReleaseResumeJob(Map<String, Object> param) {
|
||||
return getRecruitPositionService(user).saveAndReleaseResumeJob(param);
|
||||
}
|
||||
|
||||
public Map<String, Object> closeResumeJob(Map<String, Object> param) {
|
||||
return getRecruitPositionService(user).closeResumeJob(param);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue