From fc87fa55b2abdd496afb693d56b9588629b20986 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Tue, 24 Sep 2024 09:31:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E6=8E=92=E3=80=81=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E3=80=81=E5=8F=96=E6=B6=88=E9=9D=A2=E8=AF=95=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=EF=BC=9B=20=E5=A4=84=E7=90=86=E9=9D=A2=E8=AF=95=E8=AF=84?= =?UTF-8?q?=E4=BB=B7=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/recruit/conn/RecruitRecordSet.java | 22 +++ .../BatchAddInterviewResultModeExpand.java | 4 +- .../interview/CreateInterviewModeExpand.java | 8 +- .../interview/InterviewEvaluate.java | 163 ++++++++++++++++++ .../interview/UpdateInterviewModeExpand.java | 5 + 5 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 src/weaver/formmode/recruit/modeexpand/interview/InterviewEvaluate.java diff --git a/src/com/engine/recruit/conn/RecruitRecordSet.java b/src/com/engine/recruit/conn/RecruitRecordSet.java index 354f9c3..920c995 100644 --- a/src/com/engine/recruit/conn/RecruitRecordSet.java +++ b/src/com/engine/recruit/conn/RecruitRecordSet.java @@ -103,6 +103,28 @@ public class RecruitRecordSet { } } + /** + * 更新数据 + * + * @param dataMap + * @param tableName + * @param whereSql + */ + public static void updateData(Map dataMap, String tableName, String whereSql) { + List fieldList = new ArrayList<>(); + List dataList = new ArrayList<>(); + dataMap.forEach((key, value) -> { + fieldList.add(key + " = ? "); + dataList.add(value); + }); + String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + whereSql; + RecordSet rs = new RecordSet(); + rs.executeUpdate(updateSql, dataList); + if (StringUtils.isNotBlank(rs.getExceptionMsg())) { + throw new CustomizeRunTimeException(rs.getExceptionMsg()); + } + } + /** * 删除数据 * diff --git a/src/weaver/formmode/recruit/modeexpand/interview/BatchAddInterviewResultModeExpand.java b/src/weaver/formmode/recruit/modeexpand/interview/BatchAddInterviewResultModeExpand.java index f5e9fbf..dcc5610 100644 --- a/src/weaver/formmode/recruit/modeexpand/interview/BatchAddInterviewResultModeExpand.java +++ b/src/weaver/formmode/recruit/modeexpand/interview/BatchAddInterviewResultModeExpand.java @@ -103,6 +103,8 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod modeRightInfo.editModeDataShare(user.getUID(), formModeId, bid); getApplicantsInfo(msgBuilder, Util.null2String(detailDataMap.get("ypz")), Util.null2String(detailDataMap.get("ypzw"))); } + // 创建面试评价反馈数据 + InterviewEvaluate.createEvaluate(detailDataMap, formModeId, user); // 发送邮件 String msgContent = RecruitModeUtil.getReplaceContent(yjnr, fieldMapList, detailDataMap); @@ -145,7 +147,7 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod } } catch (Exception e) { new BaseBean().writeLog(e); - result.put("errmsg", "自定义出错信息"); + result.put("errmsg", e.getMessage()); result.put("flag", "false"); } return result; diff --git a/src/weaver/formmode/recruit/modeexpand/interview/CreateInterviewModeExpand.java b/src/weaver/formmode/recruit/modeexpand/interview/CreateInterviewModeExpand.java index f161c26..d0dc80b 100644 --- a/src/weaver/formmode/recruit/modeexpand/interview/CreateInterviewModeExpand.java +++ b/src/weaver/formmode/recruit/modeexpand/interview/CreateInterviewModeExpand.java @@ -35,6 +35,8 @@ public class CreateInterviewModeExpand extends AbstractModeExpandJavaCodeNew { */ private String title; + private final BaseBean baseBean = new BaseBean(); + @Override public Map doModeExpand(Map params) { Map result = new HashMap<>(); @@ -63,6 +65,8 @@ public class CreateInterviewModeExpand extends AbstractModeExpandJavaCodeNew { } InterviewOperateTypeEnum operateTypeEnum = InterviewOperateTypeEnum.getOperateType(operateType); if (operateTypeEnum == InterviewOperateTypeEnum.ARRANGE) { + // 创建面试评价反馈数据 + InterviewEvaluate.createEvaluate(mainDataMap, billId, user); messageType = RecruitConstant.INTERVIEW_MESSAGE_TYPE; title = RecruitConstant.INTERVIEW_ADD_MESSAGE_TITLE; // 消息提醒 @@ -76,8 +80,8 @@ public class CreateInterviewModeExpand extends AbstractModeExpandJavaCodeNew { } } } catch (Exception e) { - new BaseBean().writeLog(e); - result.put("errmsg", "自定义出错信息"); + baseBean.writeLog(e); + result.put("errmsg", e.getMessage()); result.put("flag", "false"); } diff --git a/src/weaver/formmode/recruit/modeexpand/interview/InterviewEvaluate.java b/src/weaver/formmode/recruit/modeexpand/interview/InterviewEvaluate.java new file mode 100644 index 0000000..3b7d5f2 --- /dev/null +++ b/src/weaver/formmode/recruit/modeexpand/interview/InterviewEvaluate.java @@ -0,0 +1,163 @@ +package weaver.formmode.recruit.modeexpand.interview; + +import com.engine.recruit.conn.ApplicantCommonInfo; +import com.engine.recruit.conn.RecruitDataMap; +import com.engine.recruit.conn.RecruitRecordSet; +import com.engine.recruit.exception.CustomizeRunTimeException; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; + +import java.util.Map; +import java.util.UUID; + +/** + * @author:dxfeng + * @createTime: 2024/09/23 + * @version: 1.0 + */ +public class InterviewEvaluate { + private static final String TABLE_NAME = "uf_jcl_mspjfk"; + + /** + * 创建面试,针对面试官创建面试反馈记录,同步批次ID,面试ID + * + * @param mainDataMap + * @param msId + * @param user + */ + public static void createEvaluate(Map mainDataMap, int msId, User user) { + int formModeId = ApplicantCommonInfo.getModeIdByTableName(TABLE_NAME); + if (formModeId < 0) { + new BaseBean().writeLog("uf_jcl_mspjfk,未查询到对应模板"); + } + String msg = Util.null2String(mainDataMap.get("msg")); + if (StringUtils.isBlank(msg)) { + throw new CustomizeRunTimeException("面试官为空,请检查面试官设置"); + } + String[] split = msg.split(","); + for (String msgId : split) { + insertData(mainDataMap, msId, user, TABLE_NAME, formModeId, msgId); + } + } + + + /** + * 调整面试,同步调整面试反馈记录,若删除面试官则删除对应的面试反馈记录,若增加面试官,则创建增加面试的面试反馈记录 + * + * @param mainDataMap + * @param msId + * @param user + */ + public static void updateEvaluate(Map mainDataMap, int msId, User user) { + RecordSet rs = new RecordSet(); + int formModeId = ApplicantCommonInfo.getModeIdByTableName(TABLE_NAME); + if (formModeId < 0) { + rs.writeLog("uf_jcl_mspjfk,未查询到对应模板"); + } + String msg = Util.null2String(mainDataMap.get("msg")); + if (StringUtils.isBlank(msg)) { + throw new CustomizeRunTimeException("面试官为空,请检查面试官设置"); + } + + // 删除非面试官数据 + rs.executeUpdate("delete from " + TABLE_NAME + " where msid=" + msId + " and msg not in (" + msg + ")"); + + String[] split = msg.split(","); + String selectSql = "select id from " + TABLE_NAME + " where msid = ? and msg = ?"; + for (String msgId : split) { + String billId = ""; + rs.executeQuery(selectSql, msId, msgId); + if (rs.next()) { + billId = rs.getString("id"); + } + + if (StringUtils.isBlank(billId)) { + // 新增数据 + insertData(mainDataMap, msId, user, TABLE_NAME, formModeId, msgId); + } else { + // 更新数据 + RecruitDataMap dataMap = new RecruitDataMap<>(); + // id + dataMap.put("id", billId); + // 应聘者 + dataMap.put("ypz", mainDataMap.get("ypz")); + // 应聘职位 + dataMap.put("ypzw", mainDataMap.get("ypzw")); + // 面试方式 + dataMap.put("msfs", mainDataMap.get("msfs")); + // 面试环节 + dataMap.put("mshj", mainDataMap.get("mshj")); + // 面试轮次 + dataMap.put("msc", mainDataMap.get("msc")); + // 面试日期 + dataMap.put("msrq", mainDataMap.get("msrq")); + // 面试地址 + dataMap.put("msdd", mainDataMap.get("msdd")); + + // 更新数据 + RecruitRecordSet.updateDataById(dataMap, TABLE_NAME); + } + } + } + + + /** + * 取消面试,同步取消对应的面试反馈记录的面试状态为已取消 + * + * @param msId + */ + public static void cancelEvaluate(int msId) { + RecordSet rs = new RecordSet(); + rs.executeUpdate("update " + TABLE_NAME + " set fkzt = 3 where msid=" + msId); + } + + + /** + * 插入面试评价数据 + * + * @param mainDataMap + * @param msId + * @param user + * @param tableName + * @param formModeId + * @param msgId + */ + private static void insertData(Map mainDataMap, int msId, User user, String tableName, int formModeId, String msgId) { + RecruitDataMap dataMap = new RecruitDataMap<>(); + String uuid = UUID.randomUUID().toString(); + dataMap.put("modeuuid", uuid); + dataMap.put("formmodeid", formModeId); + RecruitRecordSet.buildModeInsertFields(dataMap, user.getUID()); + // 反馈状态(设置为待反馈) + dataMap.put("fkzt", "0"); + // 批次ID + dataMap.put("pcid", mainDataMap.get("pcid")); + // 面试ID + dataMap.put("msid", msId); + // 应聘者 + dataMap.put("ypz", mainDataMap.get("ypz")); + // 应聘职位 + dataMap.put("ypzw", mainDataMap.get("ypzw")); + // 面试方式 + dataMap.put("msfs", mainDataMap.get("msfs")); + // 面试环节 + dataMap.put("mshj", mainDataMap.get("mshj")); + // 面试轮次 + dataMap.put("msc", mainDataMap.get("msc")); + // 面试日期 + dataMap.put("msrq", mainDataMap.get("msrq")); + // 面试地址 + dataMap.put("msdd", mainDataMap.get("msdd")); + // 面试官 + dataMap.put("msg", msgId); + + // 创建数据 + RecruitRecordSet.insertData(dataMap, tableName); + // 刷新权限 + RecruitRecordSet.refreshRight(uuid, tableName, formModeId, user.getUID()); + } + +} diff --git a/src/weaver/formmode/recruit/modeexpand/interview/UpdateInterviewModeExpand.java b/src/weaver/formmode/recruit/modeexpand/interview/UpdateInterviewModeExpand.java index 9334d6b..6ba00a6 100644 --- a/src/weaver/formmode/recruit/modeexpand/interview/UpdateInterviewModeExpand.java +++ b/src/weaver/formmode/recruit/modeexpand/interview/UpdateInterviewModeExpand.java @@ -76,10 +76,15 @@ public class UpdateInterviewModeExpand extends AbstractModeExpandJavaCodeNew { messageType = RecruitConstant.INTERVIEW_MESSAGE_TYPE; title = RecruitConstant.INTERVIEW_CANCEL_MESSAGE_TITLE; cancelInterView(params, requestInfo, billId, mainDataMap); + // 更新面试评价状态为已取消 + InterviewEvaluate.cancelEvaluate(billId); // 发送邮件 InterviewMsgUtil.sendEmailAndMsg(mainDataMap, billId, false); break; case ADJUSTMENT: + // 更新面试评价 + InterviewEvaluate.updateEvaluate(mainDataMap, billId, user); + messageType = RecruitConstant.INTERVIEW_MESSAGE_TYPE; title = RecruitConstant.INTERVIEW_ADJUSTMENT_MESSAGE_TITLE; // 发送消息提醒