应聘登记,创建面试台账

美之高
dxfeng 7 months ago
parent f9ca65f925
commit 641587f8db

@ -1,19 +1,23 @@
package com.engine.mzg.service.impl;
import com.engine.core.impl.Service;
import com.engine.mzg.conn.RecruitCommon;
import com.engine.mzg.conn.RecruitRecordSet;
import com.engine.mzg.entity.SyncTableField;
import com.engine.mzg.exception.CustomizeRunTimeException;
import com.engine.mzg.service.RecruitMobileService;
import com.engine.mzg.util.RecruitUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.IgnoreCaseHashMap;
import weaver.formmode.mzg.modeexpand.disc.AddDiscExpand;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.regex.Matcher;
/**
@ -51,7 +55,7 @@ public class RecruitMobileServiceImpl extends Service implements RecruitMobileSe
}
rs.executeUpdate("update uf_recruit_disc set dxhj = ? ,ixhj = ?, sxhj = ?, cxhj = ? where id = ? ", countD, countI, countS, countC, billId);
} else {
throw new CustomizeRunTimeException("数据异常,提交失败,请联系HR");
throw new CustomizeRunTimeException("数据流转异常请联系HR确认");
}
return null;
}
@ -62,6 +66,9 @@ public class RecruitMobileServiceImpl extends Service implements RecruitMobileSe
String billId = Util.null2String(params.get("billId"));
String targetTable = Util.null2String(params.get("targetTable"));
String sourceTable = Util.null2String(params.get("sourceTable"));
if (StringUtils.isBlank(billId)) {
throw new CustomizeRunTimeException("数据流转异常请联系HR确认");
}
RecordSet rs = new RecordSet();
rs.executeQuery("select id,mslcid from uf_recruit_ms where ypdjid = ? ", billId);
String msId = "";
@ -76,30 +83,88 @@ public class RecruitMobileServiceImpl extends Service implements RecruitMobileSe
throw new CustomizeRunTimeException("当前数据已登记结束,无法重复提交");
}
rs.executeQuery("select * from uf_recruit_table where target_table = ? and source_table =? ", targetTable, sourceTable);
String mainId = "";
String mainTableId = "";
if (rs.next()) {
mainId = rs.getString("id");
mainTableId = rs.getString("id");
}
if (StringUtils.isNotBlank(mainId)) {
if (StringUtils.isNotBlank(mainTableId)) {
// 查询配置的字段,更新或者插入数据
rs.executeQuery("select * from uf_recruit_table_dt1 where mainid = ? ", mainId);
List<SyncTableField> fields = new ArrayList<>();
while (rs.next()) {
fields.add(SyncTableField.builder().sourceField(rs.getString("source_field")).targetField(rs.getString("target_field")).build());
}
if (CollectionUtils.isNotEmpty(fields)) {
throw new CustomizeRunTimeException("数据同步配置异常,请检查配置");
}
List<SyncTableField> fields = getSyncTableFields(mainTableId);
rs.executeQuery("select * from " + sourceTable + " where id = ? ", billId);
Map<String, String> buildDataMap = new HashMap<>();
IgnoreCaseHashMap<String, String> buildDataMap = new IgnoreCaseHashMap<>();
if (rs.next()) {
for (SyncTableField field : fields) {
buildDataMap.put(field.getTargetField(), rs.getString(field.getSourceField()));
String value = RecruitUtil.parseBlankToNull(rs.getString(field.getSourceField()));
if (StringUtils.isNotBlank(value)) {
buildDataMap.put(field.getTargetField(), value);
}
}
if (isAdd) {
// 新增
String uuid = UUID.randomUUID().toString();
buildDataMap.put("modeuuid", uuid);
int formModeId = RecruitCommon.getModeIdByTableName(targetTable);
buildDataMap.put("formmodeid", formModeId);
// 构建建模表基本数据
buildDataMap.put("ypdjid",billId);
RecruitRecordSet.buildModeInsertFields(buildDataMap, 1);
RecruitRecordSet.insertData(buildDataMap, targetTable);
msId = String.valueOf(RecruitRecordSet.refreshRight(uuid, targetTable, formModeId,1));
} else {
// 更新
buildDataMap.put("id", msId);
RecruitRecordSet.updateDataById(buildDataMap, targetTable);
}
}
// 更新明细表,明细表删除后重新插入数据
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 = ?", msId);
recordSet.executeQuery("select * from " + sourceDetailTable + " where mainid = ? ", billId);
while (recordSet.next()) {
buildDataMap = new IgnoreCaseHashMap<>();
buildDataMap.put("mainid", msId);
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 null;
}
/**
*
*
* @param mainTableId
* @return
*/
private static List<SyncTableField> getSyncTableFields(String mainTableId) {
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_recruit_table_dt1 where mainid = ? ", mainTableId);
List<SyncTableField> fields = new ArrayList<>();
while (rs.next()) {
fields.add(SyncTableField.builder().sourceField(rs.getString("source_field")).targetField(rs.getString("target_field")).build());
}
if (CollectionUtils.isEmpty(fields)) {
throw new CustomizeRunTimeException("数据同步配置异常,请检查配置");
}
return fields;
}
}

@ -120,7 +120,7 @@ public class RecruitUtil {
* @param str
* @return
*/
public static Object parseBlankToNull(String str) {
public static String parseBlankToNull(String str) {
return StringUtils.isBlank(str) ? null : str;
}

@ -37,4 +37,13 @@ public class RecruitMobileController {
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::submitDiscTest, params);
}
@GET
@Path("/submitRegist")
@Produces(MediaType.APPLICATION_JSON)
public String submitRegist(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::submitRegist, params);
}
}

Loading…
Cancel
Save