接受offer,数据插入待入职台账

美之高
dxfeng 8 months ago
parent 6302d7d9e0
commit dc2164c49a

@ -112,6 +112,7 @@ public class RecruitMobileServiceImpl extends Service implements RecruitMobileSe
buildDataMap.put("ypdjid", billId);
buildDataMap.put("mslx", "0");
buildDataMap.put("mszt", "0");
buildDataMap.put("msjg", "3");
RecruitRecordSet.buildModeInsertFields(buildDataMap, 1);
RecruitRecordSet.insertData(buildDataMap, targetTable);
msId = String.valueOf(RecruitRecordSet.refreshRight(uuid, targetTable, formModeId, 1));
@ -168,26 +169,42 @@ public class RecruitMobileServiceImpl extends Service implements RecruitMobileSe
}
RecordSet rs = new RecordSet();
rs.executeQuery("select fkjg from uf_recruit_lytzs where modeuuid = ? ", uuid);
rs.executeQuery("select id,fkjg from uf_recruit_lytzs where modeuuid = ? ", uuid);
String fkjg = "";
String id = "";
if (rs.next()) {
fkjg = rs.getString("fkjg");
id = rs.getString("id");
} else {
returnMap.put("description", "反馈失败offer信息有误请联系相应HR确认");
return returnMap;
}
// 查询是否存在待入职台账
rs.executeQuery("select id from uf_recruit_drz where offerid = ?", id);
String entryDataId = "";
if (rs.next()) {
entryDataId = rs.getString("id");
}
returnMap.put("entryDataId", entryDataId);
if (StringUtils.isNotBlank(fkjg) && !"0".equals(fkjg)) {
returnMap.put("description", "您已成功反馈,请勿重复反馈。");
returnMap.put("description", "您已成功反馈,无需重复反馈。");
returnMap.put("type", "info");
returnMap.put("message", "已反馈");
if (StringUtils.isNotBlank(entryDataId)) {
returnMap.put("description", "您已成功反馈,请勿重复反馈,请点击下方按钮完善入职信息");
}
return returnMap;
}
if ("1".equals(status)) {
returnMap.put("type", "success");
returnMap.put("message", "已接受offer");
returnMap.put("description", "您已接受offer期待您的加入请按期准备报道如有问题可以联系相应HR");
returnMap.put("description", "您已接受offer期待您的加入请按期准备报道如有问题可以联系相应HR,请点击下方按钮完善入职信息");
rs.executeUpdate("update uf_recruit_lytzs set fkjg = ? where modeuuid = ? ", status, uuid);
// 同步面试信息,创建待入职数据
entryDataId = createEntryData(params, id);
returnMap.put("entryDataId", entryDataId);
} else if ("2".equals(status)) {
returnMap.put("type", "info");
returnMap.put("message", "已拒绝offer");
@ -216,4 +233,85 @@ public class RecruitMobileServiceImpl extends Service implements RecruitMobileSe
}
return fields;
}
/**
*
*
* @param params
*/
private String createEntryData(Map<String, Object> params, String offerId) {
String mainId = "";
String targetTable = "uf_recruit_drz";
String sourceTable = "uf_recruit_ms";
if (StringUtils.isBlank(offerId)) {
throw new CustomizeRunTimeException("数据流转异常请联系HR确认");
}
RecordSet rs = new RecordSet();
rs.executeQuery("select xm from uf_recruit_lytzs where id = ?", offerId);
String msId = "";
if (rs.next()) {
msId = rs.getString("xm");
}
// 是否新增面试数据
rs.executeQuery("select * from uf_recruit_table where target_table = ? and source_table =? ", targetTable, sourceTable);
String mainTableId = "";
if (rs.next()) {
mainTableId = rs.getString("id");
}
if (StringUtils.isNotBlank(mainTableId)) {
// 查询配置的字段,更新或者插入数据
List<SyncTableField> fields = getSyncTableFields(mainTableId);
rs.executeQuery("select * from " + sourceTable + " where id = ? ", msId);
IgnoreCaseHashMap<String, String> buildDataMap = new IgnoreCaseHashMap<>();
if (rs.next()) {
for (SyncTableField field : fields) {
String value = RecruitUtil.parseBlankToNull(rs.getString(field.getSourceField()));
if (StringUtils.isNotBlank(value)) {
buildDataMap.put(field.getTargetField(), value);
}
}
// 新增
String uuid = UUID.randomUUID().toString();
buildDataMap.put("modeuuid", uuid);
int formModeId = RecruitCommon.getModeIdByTableName(targetTable);
buildDataMap.put("formmodeid", formModeId);
// 构建建模表基本数据
buildDataMap.put("offerid", offerId);
buildDataMap.put("msid", msId);
RecruitRecordSet.buildModeInsertFields(buildDataMap, 1);
RecruitRecordSet.insertData(buildDataMap, targetTable);
mainId = String.valueOf(RecruitRecordSet.refreshRight(uuid, targetTable, formModeId, 1));
}
// 更新明细表,明细表删除后重新插入数据
if (StringUtils.isNotBlank(mainId)) {
rs.executeQuery("select * from uf_recruit_table where source_table like '" + sourceTable + "_dt%' and target_table like '" + targetTable + "_dt%' ");
while (rs.next()) {
mainTableId = rs.getString("id");
String sourceDetailTable = rs.getString("source_table");
String targetDetailTable = rs.getString("target_table");
List<SyncTableField> syncTableFields = getSyncTableFields(mainTableId);
// 删除明细表数据
RecordSet recordSet = new RecordSet();
recordSet.executeUpdate(" delete from " + targetDetailTable + " where mainid = ?", mainId);
recordSet.executeQuery("select * from " + sourceDetailTable + " where mainid = ? ", msId);
while (recordSet.next()) {
buildDataMap = new IgnoreCaseHashMap<>();
buildDataMap.put("mainid", mainId);
for (SyncTableField field : syncTableFields) {
String value = RecruitUtil.parseBlankToNull(recordSet.getString(field.getSourceField()));
if (StringUtils.isNotBlank(value)) {
buildDataMap.put(field.getTargetField(), value);
}
}
RecruitRecordSet.insertData(buildDataMap, targetDetailTable);
}
}
}
}
return mainId;
}
}

Loading…
Cancel
Save