|
@@ -46,7 +46,7 @@ public class RecruitmentDemandService {
|
|
|
private static final int REQUIREMENT_STATUS_IN_PROGRESS = 40;
|
|
|
private static final int SHARE_TYPE_SUBORDINATE = 2;
|
|
|
private static final int REQUIREMENT_TYPE_NEW = 1;
|
|
|
- private static final int REQUIREMENT_TYPE_SUPPLY = 2;
|
|
|
+ private static final int REQUIREMENT_TYPE_SUPPLY = 4;
|
|
|
// 值映射关系
|
|
|
private static final Map<String, Integer> REQUIREMENT_TYPE_MAP = createRequirementTypeMap();
|
|
|
private static final Map<String, Integer> CATEGORY_MAP = createCategoryMap();
|
|
@@ -57,8 +57,8 @@ public class RecruitmentDemandService {
|
|
|
private static final Map<String, String> FORMAL_CUSTOM_FIELDS = createFormalCustomFields();
|
|
|
private static final Map<String, String> TEST_CUSTOM_FIELDS = createTestCustomFields();
|
|
|
//招聘类型
|
|
|
- private static final Map<String, String> RECRUITMENTTYPE_MAP = createRecruitmentType();
|
|
|
-
|
|
|
+ private static final Map<String, Integer> RECRUITMENTTYPE_MAP = createRecruitmentType();
|
|
|
+
|
|
|
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
|
|
// 缓存工号到用户ID的映射(避免重复查询)
|
|
|
private static final Map<String, Integer> jobNumberToUserIdCache = new ConcurrentHashMap<>();
|
|
@@ -140,23 +140,23 @@ public class RecruitmentDemandService {
|
|
|
map.put("twelve", "12月");
|
|
|
return Collections.unmodifiableMap(map);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//招聘类型
|
|
|
- private static Map<String, String> createRecruitmentType() {
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
+ private static Map<String, Integer> createRecruitmentType() {
|
|
|
+ Map<String, Integer> map = new HashMap<>();
|
|
|
// 初始化映射关系
|
|
|
- map.put("001", "001"); // 社会招聘
|
|
|
- map.put("002", "002"); // 校园招聘
|
|
|
- map.put("006", "006"); // 实习生招聘
|
|
|
- map.put("003", "003"); // 内部推荐
|
|
|
- map.put("004", "004"); // 内部竞聘
|
|
|
- map.put("005", "005"); // 猎头招聘
|
|
|
- map.put("007", "007"); // 外包(派遣)
|
|
|
- map.put("008", "008"); // 管培生
|
|
|
+ map.put("001", 1); // 社会招聘
|
|
|
+ map.put("002", 2); // 校园招聘
|
|
|
+ map.put("006", 3); // 实习生招聘
|
|
|
+ map.put("003", 4); // 内部推荐
|
|
|
+ map.put("004", 5); // 内部竞聘
|
|
|
+ map.put("005", 6); // 猎头招聘
|
|
|
+ map.put("007", 7); // 外包(派遣)
|
|
|
+ map.put("008", 8); // 管培生
|
|
|
return Collections.unmodifiableMap(map);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
private static Map<String, String> createFormalCustomFields() {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put("招聘职位", "extzhaopinzhiwei_614492_675953134");
|
|
@@ -174,7 +174,7 @@ public class RecruitmentDemandService {
|
|
|
map.put("转正考核标准", "extzhuanzhengkaohebiaozhun_614492_1527148155");
|
|
|
map.put("办公地点", "extbangongdidian_614492_920550595");
|
|
|
map.put("招聘类型", "extzhaopinqudao_614492_409009478");
|
|
|
-
|
|
|
+
|
|
|
return Collections.unmodifiableMap(map);
|
|
|
}
|
|
|
|
|
@@ -195,28 +195,28 @@ public class RecruitmentDemandService {
|
|
|
map.put("转正考核标准", "extzhuanzhengkaohebiaozhun_433899_1527148155");
|
|
|
map.put("办公地点", "extbangongdidian_433899_920550595");
|
|
|
map.put("招聘类型", "extzhaopinqudao_433899_409009478");
|
|
|
-
|
|
|
+
|
|
|
return Collections.unmodifiableMap(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 构建需求数据公共部分
|
|
|
- * @throws BOSException
|
|
|
- * @throws EASBizException
|
|
|
+ * @throws BOSException
|
|
|
+ * @throws EASBizException
|
|
|
*/
|
|
|
private JSONObject buildRequirementData(Context ctx, RecuritmentDemandInfo demandInfo) throws BOSException, EASBizException {
|
|
|
JSONObject params = new JSONObject();
|
|
|
-
|
|
|
+
|
|
|
// 需求类型映射
|
|
|
RecPersonType recPersonType = demandInfo.getRecPersonType();
|
|
|
if (recPersonType != null && StringUtils.isNotBlank(recPersonType.getValue())) {
|
|
|
Integer mappedType = REQUIREMENT_TYPE_MAP.get(recPersonType.getValue());
|
|
|
params.put("requirementType", mappedType != null ? mappedType : REQUIREMENT_TYPE_NEW);
|
|
|
-// //test
|
|
|
+// //test
|
|
|
// params.put("requirementType", 1);
|
|
|
}
|
|
|
|
|
@@ -225,7 +225,7 @@ public class RecruitmentDemandService {
|
|
|
params.put("requirementCount", demandInfo.getRecuritNumber());
|
|
|
params.put("jobDescription", demandInfo.getResponsibilities());
|
|
|
params.put("qualification", demandInfo.getQualification());
|
|
|
-
|
|
|
+
|
|
|
AdminOrgUnitInfo department = demandInfo.getDepartment();
|
|
|
if(null!= department) {
|
|
|
IAdminOrgUnit orgIns = AdminOrgUnitFactory.getLocalInstance(ctx);
|
|
@@ -235,13 +235,13 @@ public class RecruitmentDemandService {
|
|
|
// //test
|
|
|
// params.put("departmentId", 0);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 日期字段
|
|
|
Date applyDate = demandInfo.getApplyDate();
|
|
|
if (applyDate != null) {
|
|
|
params.put("createDate", DATE_FORMAT.format(applyDate));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Date arrivalDate = demandInfo.getArrivalDate();
|
|
|
if (arrivalDate != null) {
|
|
|
params.put("arivalTime", DATE_FORMAT.format(arrivalDate));
|
|
@@ -271,22 +271,22 @@ public class RecruitmentDemandService {
|
|
|
params.put("requirementStatus", rStatus);
|
|
|
// 处理自定义字段
|
|
|
addCustomFields( ctx, params, demandInfo);
|
|
|
-
|
|
|
+
|
|
|
return params;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加自定义字段
|
|
|
- * @throws BOSException
|
|
|
- * @throws EASBizException
|
|
|
+ * @throws BOSException
|
|
|
+ * @throws EASBizException
|
|
|
*/
|
|
|
private void addCustomFields(Context ctx, JSONObject params, RecuritmentDemandInfo demandInfo) throws BOSException, EASBizException {
|
|
|
// 招聘职位
|
|
|
addCustomField(params, "招聘职位", demandInfo.getRecuritPosition().getName());
|
|
|
-
|
|
|
+
|
|
|
// 招聘业务组织
|
|
|
addCustomField(params, "招聘业务组织", demandInfo.getHrOrgUnit().getName());
|
|
|
-
|
|
|
+
|
|
|
// 其他自定义字段
|
|
|
// 招聘申请类型 (headcountType -> 自定义字段)
|
|
|
String headcountType = Optional.ofNullable(demandInfo.get("headcountType"))
|
|
@@ -302,21 +302,21 @@ public class RecruitmentDemandService {
|
|
|
}
|
|
|
addCustomField(params, "福利待遇", getBenefits(demandInfo));
|
|
|
addCustomField(params, "备注", demandInfo.getRecRema());
|
|
|
-
|
|
|
+
|
|
|
// 培养周期特殊处理
|
|
|
String trainPeriod = Optional.ofNullable(getPropertyValue(demandInfo, "trainPeriod"))
|
|
|
.map(Object::toString)
|
|
|
.map(key -> TRAIN_PERIOD_MAP.getOrDefault(key, ""))
|
|
|
.orElse("");
|
|
|
addCustomField(params, "培养周期", trainPeriod);
|
|
|
-
|
|
|
+
|
|
|
// 其他字段
|
|
|
addCustomField(params, "是否需轮岗", mapYesNo(getPropertyValue(demandInfo, "needJobRotation")));
|
|
|
addCustomField(params, "轮岗岗位", getPropertyAsString(demandInfo, "rotationPosition"));
|
|
|
addCustomField(params, "定岗岗位", getPropertyAsString(demandInfo, "fixedPosition"));
|
|
|
addCustomField(params, "转正考核标准", getPropertyAsString(demandInfo, "regularizationStandard"));
|
|
|
addCustomField(params, "办公地点", getPropertyAsString(demandInfo, "workPlace"));
|
|
|
-
|
|
|
+
|
|
|
//
|
|
|
// if( null != demandInfo.get("demandCompType")) {
|
|
|
// DemandCompTypeInfo demandCompType = (DemandCompTypeInfo) demandInfo.get("demandCompType");
|
|
@@ -330,23 +330,23 @@ public class RecruitmentDemandService {
|
|
|
IRecType4BaseItem retTypeIns = RecType4BaseItemFactory.getLocalInstance(ctx);
|
|
|
recType = retTypeIns.getRecType4BaseItemInfo( new ObjectUuidPK(recType.getId().toString()));
|
|
|
String number = recType.getNumber();
|
|
|
- String string = RECRUITMENTTYPE_MAP.get(number);
|
|
|
- addCustomField(params, "招聘类型", string );
|
|
|
+ Integer val = RECRUITMENTTYPE_MAP.get(number);
|
|
|
+ addCustomField(params, "招聘类型", val );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 创建招聘需求
|
|
|
- * @throws BOSException
|
|
|
- * @throws EASBizException
|
|
|
+ * @throws BOSException
|
|
|
+ * @throws EASBizException
|
|
|
*/
|
|
|
public String createRequirement(Context ctx, RecuritmentDemandInfo demandInfo,JSONObject requirementData) throws IOException, EASBizException, BOSException {
|
|
|
JSONObject response = BeisenApiClient.getInstance().callApi(BeisenParam.CREATE_REQUIREMENT_URL, requirementData);
|
|
|
handleApiResponse(ctx,response,demandInfo , "");
|
|
|
return response.getString("data");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 推送招聘需求到北森系统
|
|
|
* @param demandInfo sHR系统的招聘需求数据
|
|
@@ -358,16 +358,16 @@ public class RecruitmentDemandService {
|
|
|
params.put("shareType", SHARE_TYPE_SUBORDINATE); // 共享方式固定为2(共享给下级)
|
|
|
return createRequirement( ctx, demandInfo,params);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
public void updateRequirement(Context ctx, String requirementId, RecuritmentDemandInfo demandInfo) throws BOSException, EASBizException {
|
|
|
JSONObject params = buildRequirementData( ctx, demandInfo);
|
|
|
params.put("requirementId", requirementId);
|
|
|
- params.put("requirementStatus", REQUIREMENT_STATUS_IN_PROGRESS); // 进行中
|
|
|
-
|
|
|
+// params.put("requirementStatus", REQUIREMENT_STATUS_IN_PROGRESS); // 进行中
|
|
|
+
|
|
|
try {
|
|
|
BeisenApiClient apiClient = BeisenApiClient.getInstance();
|
|
|
- JSONObject response = apiClient.callApi(BeisenParam.UPDATE_REQUIREMENT_URL, params);
|
|
|
+ JSONObject response = apiClient.callPutApi(BeisenParam.UPDATE_REQUIREMENT_URL, params);
|
|
|
// String msg = "更新_"+response.getString("message");
|
|
|
handleApiResponse(ctx,response,demandInfo , requirementId);
|
|
|
} catch (IOException e) {
|
|
@@ -377,8 +377,8 @@ public class RecruitmentDemandService {
|
|
|
|
|
|
/**
|
|
|
* 处理API响应
|
|
|
- * @throws BOSException
|
|
|
- * @throws EASBizException
|
|
|
+ * @throws BOSException
|
|
|
+ * @throws EASBizException
|
|
|
*/
|
|
|
private void handleApiResponse(Context ctx, JSONObject response, RecuritmentDemandInfo demandInfo ,String requirementId) throws BOSException, EASBizException {
|
|
|
int code = response.getIntValue("code");
|
|
@@ -411,7 +411,7 @@ public class RecruitmentDemandService {
|
|
|
private Object getPropertyValue(RecuritmentDemandInfo demandInfo, String property) {
|
|
|
return demandInfo.get(property);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取属性字符串值
|
|
|
*/
|
|
@@ -452,12 +452,12 @@ public class RecruitmentDemandService {
|
|
|
String sql = "SELECT BENEFITS.FName FROM T_REC_Benefits BENEFITS " +
|
|
|
"JOIN T_REC_RecDemandLinkBenefits LINK01 ON (BENEFITS.FID = LINK01.FBenefitsID) " +
|
|
|
"WHERE BENEFITS.FState = 1 AND LINK01.FDemandID = ?";
|
|
|
-
|
|
|
+
|
|
|
StringBuilder value = new StringBuilder();
|
|
|
try {
|
|
|
- List<Object[]> datas = RecDBUtils.getQueryData(SHRContext.getInstance().getContext(), sql,
|
|
|
+ List<Object[]> datas = RecDBUtils.getQueryData(SHRContext.getInstance().getContext(), sql,
|
|
|
new Object[]{demandInfo.getId().toString()});
|
|
|
-
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(datas)) {
|
|
|
for (Object[] objects : datas) {
|
|
|
if (objects.length > 0) {
|
|
@@ -482,6 +482,18 @@ public class RecruitmentDemandService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加自定义字段_integer
|
|
|
+ */
|
|
|
+ private void addCustomField(JSONObject params, String fieldName, Integer value) {
|
|
|
+ if (null != value) {
|
|
|
+ String fieldCode = getCustomFieldCode(fieldName);
|
|
|
+ if (fieldCode != null) {
|
|
|
+ params.put(fieldCode, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 获取自定义字段编码
|
|
@@ -495,8 +507,8 @@ public class RecruitmentDemandService {
|
|
|
* 映射招聘申请类型
|
|
|
*/
|
|
|
private String mapHeadcountType(String headcountType) {
|
|
|
- return StringUtils.isNotBlank(headcountType) ?
|
|
|
- HEADCOUNT_TYPE_MAP.getOrDefault(headcountType, headcountType) :
|
|
|
+ return StringUtils.isNotBlank(headcountType) ?
|
|
|
+ HEADCOUNT_TYPE_MAP.getOrDefault(headcountType, headcountType) :
|
|
|
null;
|
|
|
}
|
|
|
|
|
@@ -603,4 +615,4 @@ public class RecruitmentDemandService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|