|
@@ -3,6 +3,7 @@ package com.kingdee.eas.custom.recuritment.task;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Maps;
|
|
|
+import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
|
|
|
import com.kingdee.bos.metadata.entity.*;
|
|
|
import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
import com.kingdee.eas.basedata.person.PersonInfo;
|
|
@@ -136,6 +137,9 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
sic.add("resumeBaseRec.*");
|
|
|
sic.add("resumeBaseRec.resumeState.*");
|
|
|
if (StringUtils.isNotBlank(billIds)) {
|
|
|
+ if (billIds.contains("'")) {
|
|
|
+ billIds = billIds.replace("'", "");
|
|
|
+ }
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
filterItems.add(new FilterItemInfo("id", billIds, CompareType.INCLUDE));
|
|
@@ -150,7 +154,7 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
preponeHours = 2;
|
|
|
}
|
|
|
Date now = new Date();
|
|
|
- Date before = DateTimeUtils.addHour(now, -preponeHours);
|
|
|
+ Date before = DateTimeUtils.addMinute(now, -preponeHours);
|
|
|
//查询最近12小时内更新的录用报批
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
@@ -189,10 +193,10 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
String beisenStatus = null;
|
|
|
//单据状态
|
|
|
HRBillStateEnum billState = recApprovalInfo.getBillState();
|
|
|
- if (hireApprovalBillStatusSet.contains(billState) && hireApprovalResumeStateSet.contains(resumeStateNumber)) {
|
|
|
+ if (hireApprovalResumeStateSet.contains(resumeStateNumber)) {
|
|
|
//单据状态为未提交/未审批/审批中,招聘需求状态为待报批/报批中 北森录用报批状态为待录用报批
|
|
|
beisenStatus = RECAPPROVAL1;
|
|
|
- } else if (HRBillStateEnum.AUDITEND.equals(billState) && hireTerminationResumeStateSet.contains(resumeStateNumber)) {
|
|
|
+ } else if (hireTerminationResumeStateSet.contains(resumeStateNumber)) {
|
|
|
//单据状态为审批不通过,招聘需求状态为终止报批/报批不通过 北森录用报批状态为录用终止
|
|
|
beisenStatus = RECAPPROVAL2;
|
|
|
} else if (HRBillStateEnum.AUDITED.equals(billState) && "0013".equals(resumeStateNumber)) {
|
|
@@ -205,14 +209,13 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
OfferInfo offerInfo = offerCollection.get(0);
|
|
|
sendState = offerInfo.getSendState();
|
|
|
}
|
|
|
- if (!StringUtils.isEmpty(sendState)) {
|
|
|
- //Offer发送状态不为空,忽略
|
|
|
- return;
|
|
|
+ if (StringUtils.isBlank(sendState) || "待发送".equals(sendState)) {
|
|
|
+ //发送状态为空或待确认,招聘需求状态为待入职 北森录用报批状态为待发Offer
|
|
|
+ beisenStatus = OFFER1;
|
|
|
}
|
|
|
} catch (BOSException e) {
|
|
|
throw new BOSException("获取offer状态报错: " + e.getMessage());
|
|
|
}
|
|
|
- beisenStatus = OFFER1;
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(beisenStatus)) {
|
|
|
if (recApprovalMap.containsKey(beisenStatus)) {
|
|
@@ -235,14 +238,14 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
* 同步offer状态到北森
|
|
|
*
|
|
|
* @param ctx
|
|
|
- * @param billId
|
|
|
+ * @param billIds
|
|
|
* @throws BOSException
|
|
|
* @throws EASBizException
|
|
|
*/
|
|
|
@Override
|
|
|
- protected void _syncOfferToBeisen(Context ctx, String billId, int preponeHours) throws BOSException, EASBizException {
|
|
|
+ protected void _syncOfferToBeisen(Context ctx, String billIds, int preponeHours) throws BOSException, EASBizException {
|
|
|
try {
|
|
|
- super._syncOfferToBeisen(ctx, billId, preponeHours);
|
|
|
+ super._syncOfferToBeisen(ctx, billIds, preponeHours);
|
|
|
IOffer iOffer = OfferFactory.getLocalInstance(ctx);
|
|
|
OfferCollection offerCollection = null;
|
|
|
SelectorItemCollection sic = new SelectorItemCollection();
|
|
@@ -250,14 +253,17 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
sic.add("resumeBaseRec.*");
|
|
|
sic.add("resumeBaseRec.resumeState.*");
|
|
|
sic.add("person.employeeType.isInCount");
|
|
|
- if (StringUtils.isNotBlank(billId)) {
|
|
|
+ if (StringUtils.isNotBlank(billIds)) {
|
|
|
+ if (billIds.contains("'")) {
|
|
|
+ billIds = billIds.replace("'", "");
|
|
|
+ }
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
- filterItems.add(new FilterItemInfo("id", billId));
|
|
|
+ filterItems.add(new FilterItemInfo("id", billIds));
|
|
|
EntityViewInfo viewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
offerCollection = iOffer.getOfferCollection(viewInfo);
|
|
|
if (offerCollection.isEmpty()) {
|
|
|
- logger.error("未匹配到offer单据,单据id: " + billId);
|
|
|
+ logger.error("未匹配到offer单据,单据id: " + billIds);
|
|
|
throw new BOSException("未匹配到offer单据");
|
|
|
}
|
|
|
} else {
|
|
@@ -265,7 +271,7 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
preponeHours = 2;
|
|
|
}
|
|
|
Date now = new Date();
|
|
|
- Date before = DateTimeUtils.addHour(now, -preponeHours);
|
|
|
+ Date before = DateTimeUtils.addMinute(now, -preponeHours);
|
|
|
//查询最近12小时内更新的录用报批
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
@@ -306,7 +312,7 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
//确认状态
|
|
|
OfferConfirmStateEnum confirmState = offerInfo.getConfirmState();
|
|
|
String beisenStatus = null;
|
|
|
- if ("0013".equals(resumeStateNumber) && StringUtils.isBlank(sendState) || "待发送".equals(sendState)) {
|
|
|
+ if ("0013".equals(resumeStateNumber) && (StringUtils.isBlank(sendState) || "待发送".equals(sendState))) {
|
|
|
//发送状态为空或待确认,招聘需求状态为待入职 北森录用报批状态为待发Offer
|
|
|
beisenStatus = OFFER1;
|
|
|
} else if ("0013".equals(resumeStateNumber) && "已发送".equals(sendState) && OfferConfirmStateEnum.TOBECONFIRM.equals(confirmState)) {
|
|
@@ -347,7 +353,6 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
}
|
|
|
}
|
|
|
handleBeisenTransferPhaseQuery(ctx, offerMap, applyIdOfferMap, "T_REC_Offer");
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
logger.error("offer同步北森状态转移报错: " + e.getMessage(), e);
|
|
|
}
|
|
@@ -367,8 +372,9 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
Map<String, JSONArray> recApprovalMap,
|
|
|
Map<String, String> applyIdStatusMap,
|
|
|
String tableName
|
|
|
- ) throws BOSException, IOException {
|
|
|
+ ) throws BOSException, IOException, EASBizException {
|
|
|
BeisenApiClient beisenApiClient = BeisenApiClient.getInstance();
|
|
|
+ IOffer iOffer = OfferFactory.getLocalInstance(ctx);
|
|
|
for (String statusName : recApprovalMap.keySet()) {
|
|
|
try {
|
|
|
//申请id
|
|
@@ -378,6 +384,7 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
params.put("applyIds", applyIds);
|
|
|
params.put("phaseId", phaseStatusInfo.getPhaseId());
|
|
|
params.put("statusId", phaseStatusInfo.getStatusId());
|
|
|
+ logger.error("同步北森状态statusName: " + statusName);
|
|
|
logger.error("同步北森状态url: " + BeisenParam.POST_TRANSFERPHASE_URL);
|
|
|
logger.error("同步北森状态参数: " + params.toJSONString());
|
|
|
JSONObject response = beisenApiClient.callApi(BeisenParam.POST_TRANSFERPHASE_URL, params);
|
|
@@ -396,15 +403,20 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
Set fids = new HashSet<>();
|
|
|
failApplyIds.forEach((applyid) -> {
|
|
|
fids.add(applyIdStatusMap.get(applyid));
|
|
|
+ //移除失败的申请id
|
|
|
+ applyIds.remove(applyid);
|
|
|
});
|
|
|
updateTable(ctx, tableName, errorMsg, "2", fids);
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ if (!applyIds.isEmpty()) {
|
|
|
+ //同步成功的数据,更新offer同步执行状态
|
|
|
Set fids = new HashSet<>();
|
|
|
- applyIdStatusMap.values().forEach((id) -> {
|
|
|
- fids.add(id);
|
|
|
- });
|
|
|
+ for (int i = 0; i < applyIds.size(); i++) {
|
|
|
+ String applyId = applyIds.get(i).toString();
|
|
|
+ fids.add(applyIdStatusMap.get(applyId));
|
|
|
+ }
|
|
|
updateTable(ctx, tableName, "成功", "1", fids);
|
|
|
}
|
|
|
} else {
|
|
@@ -414,6 +426,33 @@ public class BeisenTransferPhaseFacadeControllerBean extends AbstractBeisenTrans
|
|
|
});
|
|
|
updateTable(ctx, tableName, message, "2", fids);
|
|
|
}
|
|
|
+ //已入职
|
|
|
+ if (ENROLL1.equals(statusName) && !applyIds.isEmpty()) {
|
|
|
+ //入职成功需要调用北森招聘到岗接口同步
|
|
|
+ JSONObject entryhandleParams = new JSONObject();
|
|
|
+ for (int i = 0; i < applyIds.size(); i++) {
|
|
|
+ String applyId = applyIds.get(i).toString();
|
|
|
+ entryhandleParams.put("applyId", applyIds);
|
|
|
+ String offerId = applyIdStatusMap.get(applyId);
|
|
|
+ OfferInfo offerInfo = iOffer.getOfferInfo(new ObjectUuidPK(offerId));
|
|
|
+ //入职日期
|
|
|
+ Date entryDate = offerInfo.getEntryDate();
|
|
|
+ if (entryDate != null) {
|
|
|
+ String entryDateStr = DateTimeUtils.format(entryDate, "yyyy-MM-dd'T'HH:mm:ss");
|
|
|
+ entryhandleParams.put("entryDate", entryDateStr);
|
|
|
+ }
|
|
|
+ logger.error("北森招聘到岗url" + BeisenParam.POST_ENTRYHANDLE_URL);
|
|
|
+ logger.error("北森招聘到岗参数" + params.toJSONString());
|
|
|
+ JSONObject result = beisenApiClient.callApi(BeisenParam.POST_ENTRYHANDLE_URL, entryhandleParams);
|
|
|
+ logger.error("北森招聘到岗响应" + result.toJSONString());
|
|
|
+ if (result.getInteger("code") != 200) {
|
|
|
+ logger.error("北森招聘到岗响应报错: " + result.getString("message"));
|
|
|
+ updateTable(ctx, tableName, result.getString("message"), "2", AtsUtil.toSet(offerId));
|
|
|
+ } else {
|
|
|
+ updateTable(ctx, tableName, "成功", "1", AtsUtil.toSet(offerId));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
logger.error("同步北森状态转移报错: " + e.getMessage(), e);
|
|
|
throw e;
|