From 40660cc55bbc060efe8a3178bd1443b9426c38a6 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 19 Sep 2024 15:18:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=A2=E8=AF=95=E5=BD=92=E6=A1=A3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/mzg/conn/RecruitCommon.java | 20 +++ src/com/engine/mzg/conn/RecruitRecordSet.java | 4 +- .../interview/InterviewCompletedAction.java | 138 ++++++++++++++++++ 3 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 src/weaver/interfaces/mzg/action/interview/InterviewCompletedAction.java diff --git a/src/com/engine/mzg/conn/RecruitCommon.java b/src/com/engine/mzg/conn/RecruitCommon.java index 56b57f8..03335bd 100644 --- a/src/com/engine/mzg/conn/RecruitCommon.java +++ b/src/com/engine/mzg/conn/RecruitCommon.java @@ -80,4 +80,24 @@ public class RecruitCommon { } return formModeId; } + + /** + * 获取表单下拉框展示文本 + * + * @param formId 表单ID + * @param fieldName 字段明湖曾 + * @param value 下拉框值 + * @return + */ + public static String getSelectName(String formId, String fieldName, String value) { + String cancelReason = ""; + RecordSet rs = new RecordSet(); + rs.executeQuery("select selectname from workflow_selectitem where fieldid =( select id from workflow_billfield where billid = ? and fieldname = ? ) and selectvalue = ?", formId, fieldName, value); + if (rs.next()) { + cancelReason = rs.getString("selectname"); + } + return cancelReason; + } + + } diff --git a/src/com/engine/mzg/conn/RecruitRecordSet.java b/src/com/engine/mzg/conn/RecruitRecordSet.java index 40c28d1..223a100 100644 --- a/src/com/engine/mzg/conn/RecruitRecordSet.java +++ b/src/com/engine/mzg/conn/RecruitRecordSet.java @@ -26,8 +26,8 @@ public class RecruitRecordSet { * @param rs RecordSet * @return */ - public static Map getSingleRecordMap(RecordSet rs) { - Map dataMap = new IgnoreCaseHashMap<>(); + public static IgnoreCaseHashMap getSingleRecordMap(RecordSet rs) { + IgnoreCaseHashMap dataMap = new IgnoreCaseHashMap<>(); if (rs.next()) { String[] columnNames = rs.getColumnName(); for (String columnName : columnNames) { diff --git a/src/weaver/interfaces/mzg/action/interview/InterviewCompletedAction.java b/src/weaver/interfaces/mzg/action/interview/InterviewCompletedAction.java new file mode 100644 index 0000000..a1c8c62 --- /dev/null +++ b/src/weaver/interfaces/mzg/action/interview/InterviewCompletedAction.java @@ -0,0 +1,138 @@ +package weaver.interfaces.mzg.action.interview; + +import com.engine.mzg.conn.RecruitCommon; +import com.engine.mzg.conn.RecruitRecordSet; +import com.engine.mzg.exception.CustomizeRunTimeException; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.formmode.IgnoreCaseHashMap; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.MainTableInfo; +import weaver.soa.workflow.request.Property; +import weaver.soa.workflow.request.RequestInfo; + +import java.util.UUID; + +/** + * 1、如需要背调,生成背调台账数据 + *

+ * 2、不需要背调、生成offer台账数据 + * + * @author:dxfeng + * @createTime: 2024/09/14 + * @version: 1.0 + */ +public class InterviewCompletedAction implements Action { + @Override + public String execute(RequestInfo requestInfo) { + + RecordSet rs = new RecordSet(); + try { + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + int billId = requestInfo.getRequestManager().getBillid(); + String billTableName = requestInfo.getRequestManager().getBillTableName(); + int formId = requestInfo.getRequestManager().getFormid(); + User user = requestInfo.getRequestManager().getUser(); + int requestId = requestInfo.getRequestManager().getRequestid(); + + String msId = ""; + rs.executeQuery("select id from uf_recruit_ms where mslcid = ?", requestId); + if (rs.next()) { + msId = rs.getString("id"); + } + if (StringUtils.isBlank(msId)) { + throw new CustomizeRunTimeException("未获取到面试数据,请联系管理员"); + } + + IgnoreCaseHashMap mainDataMap = new IgnoreCaseHashMap<>(); + Property[] propertyArray = mainTableInfo.getProperty(); + for (Property property : propertyArray) { + mainDataMap.put(property.getName(), property.getValue()); + } + + String sfxybd = Util.null2String(mainDataMap.get("sfxybd")); + if ("0".equals(sfxybd)) { + // 创建背调 + String tableName = "uf_recruit_bd"; + IgnoreCaseHashMap dataMap = new IgnoreCaseHashMap<>(); + String uuid = UUID.randomUUID().toString(); + dataMap.put("modeuuid", uuid); + int formModeId = RecruitCommon.getModeIdByTableName(tableName); + dataMap.put("formmodeid", formModeId); + // 构建建模表基本数据 + RecruitRecordSet.buildModeInsertFields(dataMap, user.getUID()); + // 负责人 + dataMap.put("fzr", user.getUID()); + // 负责人岗位 + dataMap.put("fzrgw", user.getJobtitle()); + // 负责人部门 + dataMap.put("fzrbm", user.getUserDepartment()); + // 被背调人 + dataMap.put("bbdr", msId); + // 插入数据 + RecruitRecordSet.insertData(dataMap, tableName); + RecruitRecordSet.refreshRight(uuid, tableName, formModeId, user.getUID()); + } else { + String sqzw = Util.null2String(mainDataMap.get("sqzw")); + if (StringUtils.isBlank(sqzw)) { + throw new CustomizeRunTimeException("请检查面试流程中申请职位字段"); + } + rs.executeQuery("select * from uf_recruit_zpxqglb where id = ? ", sqzw); + IgnoreCaseHashMap recordMap = RecruitRecordSet.getSingleRecordMap(rs); + if (recordMap.isEmpty()) { + throw new CustomizeRunTimeException("未获取到招聘职位数据"); + } + String xqgw = Util.null2String(recordMap.get("xqgw")); + String gzdd = Util.null2String(recordMap.get("gzdd")); + String qtgzdd = Util.null2String(recordMap.get("qtgzdd")); + int zpxqFormId = RecruitCommon.getModeIdByTableName("uf_recruit_zpxqglb"); + String gzddStr = RecruitCommon.getSelectName(String.valueOf(zpxqFormId), "gzdd", gzdd); + if (StringUtils.isNotBlank(qtgzdd)) { + gzddStr = qtgzdd; + } + + + // 创建offer + String tableName = "uf_recruit_lytzs"; + IgnoreCaseHashMap dataMap = new IgnoreCaseHashMap<>(); + String uuid = UUID.randomUUID().toString(); + dataMap.put("modeuuid", uuid); + int formModeId = RecruitCommon.getModeIdByTableName(tableName); + dataMap.put("formmodeid", formModeId); + // 构建建模表基本数据 + RecruitRecordSet.buildModeInsertFields(dataMap, user.getUID()); + // 姓名 + dataMap.put("xm", msId); + // 岗位 + dataMap.put("gw", xqgw); + // 工作地点 + dataMap.put("gzdd", gzddStr); + //// 试用期税前 + //dataMap.put("syqsq", ""); + //// 转正税前 + //dataMap.put("zzsq", ""); + //// 年限 + //dataMap.put("nx", ""); + //// 试用期期限 + //dataMap.put("syqqx", ""); + //// 工作时间 + //dataMap.put("gzsj", ""); + //// 报道日期 + //dataMap.put("bdrq", ""); + + // 插入数据 + RecruitRecordSet.insertData(dataMap, tableName); + RecruitRecordSet.refreshRight(uuid, tableName, formModeId, user.getUID()); + + } + + return SUCCESS; + } catch (Exception e) { + rs.writeLog("InterviewCompletedAction error: ", e); + requestInfo.getRequestManager().setMessagecontent(e.getMessage()); + return FAILURE_AND_CONTINUE; + } + } +}