From f2798f8c1f2cc55c4a9a89529f524b0a04da96b7 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 18 Sep 2024 16:00:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=81=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E9=9D=A2=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/mzg/enums/EmailTemplateEnum.java | 4 +- .../AdjustmentInterviewFlowExpand.java | 91 ++++++++++++++++++- .../interview/CancelInterviewFlowExpand.java | 67 +++++++++++++- .../interview/SubmitInterviewAction.java | 11 ++- 4 files changed, 167 insertions(+), 6 deletions(-) diff --git a/src/com/engine/mzg/enums/EmailTemplateEnum.java b/src/com/engine/mzg/enums/EmailTemplateEnum.java index fe2d214..b45426a 100644 --- a/src/com/engine/mzg/enums/EmailTemplateEnum.java +++ b/src/com/engine/mzg/enums/EmailTemplateEnum.java @@ -25,7 +25,9 @@ public enum EmailTemplateEnum { /** * offer */ - OFFER(5, "offer"); + OFFER(5, "offer"), + INTERVIEW_ADJUST(6, "面试调整"), + INTERVIEW_CANCEL(7, "面试取消"); EmailTemplateEnum(Integer value, String desc) { this.value = value; diff --git a/src/weaver/formmode/mzg/modeexpand/interview/AdjustmentInterviewFlowExpand.java b/src/weaver/formmode/mzg/modeexpand/interview/AdjustmentInterviewFlowExpand.java index 96ab9cb..b944e8e 100644 --- a/src/weaver/formmode/mzg/modeexpand/interview/AdjustmentInterviewFlowExpand.java +++ b/src/weaver/formmode/mzg/modeexpand/interview/AdjustmentInterviewFlowExpand.java @@ -1,8 +1,24 @@ package weaver.formmode.mzg.modeexpand.interview; +import com.engine.mzg.conn.RecruitCommon; +import com.engine.mzg.enums.EmailTemplateEnum; +import com.engine.mzg.exception.CustomizeRunTimeException; +import com.engine.mzg.util.RecruitUtil; +import com.weaver.formmodel.data.model.Formfield; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.formmode.IgnoreCaseHashMap; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.soa.workflow.request.MainTableInfo; +import weaver.soa.workflow.request.Property; +import weaver.soa.workflow.request.RequestInfo; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @author:dxfeng @@ -11,7 +27,78 @@ import java.util.Map; */ public class AdjustmentInterviewFlowExpand extends AbstractModeExpandJavaCodeNew { @Override - public Map doModeExpand(Map map) { - return null; + public Map doModeExpand(Map param) { + // 取消面试 + Map result = new HashMap<>(); + try { + String billId; + String recruitType = Util.null2String(param.get("recruitType")); + if (!"adjustmentInterview".equals(recruitType)) { + return result; + } + RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo"); + if (requestInfo != null) { + billId = requestInfo.getRequestid(); + RecordSet rs = new RecordSet(); + IgnoreCaseHashMap mainDataMap = new IgnoreCaseHashMap<>(); + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + Property[] properties = mainTableInfo.getProperty(); + for (Property property : properties) { + mainDataMap.put(property.getName(), property.getValue()); + } + String mslx = Util.null2String(mainDataMap.get("mslx")); + String mslc = ""; + String msrq = ""; + String msfs = ""; + String msdz = ""; + Integer emailTemplateId; + if ("0".equals(mslx)) { + mslc = "dyl"; + emailTemplateId = EmailTemplateEnum.INTERVIEW_FIRST.getValue(); + } else if ("1".equals(mslx)) { + mslc = "del"; + emailTemplateId = EmailTemplateEnum.INTERVIEW_SECOND.getValue(); + } else if ("2".equals(mslx)) { + mslc = "dsl"; + emailTemplateId = EmailTemplateEnum.INTERVIEW_THIRD.getValue(); + } else { + result.put("errmsg", "面试类型匹配异常"); + result.put("flag", "false"); + return result; + } + msrq = Util.null2String(mainDataMap.get(mslc + "msrq")); + msfs = Util.null2String(mainDataMap.get(mslc + "msfs")); + msdz = Util.null2String(mainDataMap.get(mslc + "msdz")); + + // 更新流程中的字段 + String flowTableInterview = RecruitCommon.getSettingValue("FLOW_TABLE_INTERVIEW"); + String requestId = Util.null2String(mainDataMap.get("mslcid")); + String sql = "update " + flowTableInterview + " set " + mslc + "msrq = ?," + mslc + "msfs=?," + mslc + "msdz=? where requestId = ? "; + rs.executeUpdate(sql, msrq, msfs, msdz, requestId); + + // 发送调整面试邮件 + String emailTitle = ""; + String emailContent = ""; + rs.executeQuery("select yjzt ,yjnr from uf_recruit_email where mblx =? ", emailTemplateId); + if (rs.next()) { + emailTitle = rs.getString("yjzt"); + emailContent = rs.getString("yjnr"); + } + + if (StringUtils.isBlank(emailTitle) || StringUtils.isBlank(emailContent)) { + throw new CustomizeRunTimeException("请检查邮件模板设置"); + } + List fieldList = RecruitUtil.getFieldList("uf_recruit_ms"); + Map> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getFieldname)); + emailContent = RecruitUtil.getReplaceContent(emailContent, fieldMapList, mainDataMap); + String sendTo = Util.null2String(mainDataMap.get("dzyx")); + RecruitUtil.sendEmail(sendTo, emailTitle, emailContent); + } + } catch (Exception e) { + new BaseBean().writeLog(e); + result.put("errmsg", e.getMessage()); + result.put("flag", "false"); + } + return result; } } diff --git a/src/weaver/formmode/mzg/modeexpand/interview/CancelInterviewFlowExpand.java b/src/weaver/formmode/mzg/modeexpand/interview/CancelInterviewFlowExpand.java index 020024d..1f1b99d 100644 --- a/src/weaver/formmode/mzg/modeexpand/interview/CancelInterviewFlowExpand.java +++ b/src/weaver/formmode/mzg/modeexpand/interview/CancelInterviewFlowExpand.java @@ -1,8 +1,24 @@ package weaver.formmode.mzg.modeexpand.interview; +import com.engine.mzg.conn.RecruitCommon; +import com.engine.mzg.enums.EmailTemplateEnum; +import com.engine.mzg.exception.CustomizeRunTimeException; +import com.engine.mzg.util.RecruitUtil; +import com.weaver.formmodel.data.model.Formfield; +import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; +import weaver.formmode.IgnoreCaseHashMap; import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.soa.workflow.request.MainTableInfo; +import weaver.soa.workflow.request.Property; +import weaver.soa.workflow.request.RequestInfo; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @author:dxfeng @@ -11,7 +27,54 @@ import java.util.Map; */ public class CancelInterviewFlowExpand extends AbstractModeExpandJavaCodeNew { @Override - public Map doModeExpand(Map map) { - return null; + public Map doModeExpand(Map param) { + + // 取消面试 + Map result = new HashMap<>(); + try { + String billId; + RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo"); + if (requestInfo != null) { + billId = requestInfo.getRequestid(); + RecordSet rs = new RecordSet(); + IgnoreCaseHashMap mainDataMap = new IgnoreCaseHashMap<>(); + MainTableInfo mainTableInfo = requestInfo.getMainTableInfo(); + Property[] properties = mainTableInfo.getProperty(); + for (Property property : properties) { + mainDataMap.put(property.getName(), property.getValue()); + } + // 发送取消面试邮件 + String emailTitle = ""; + String emailContent = ""; + rs.executeQuery("select yjzt ,yjnr from uf_recruit_email where mblx =? ", EmailTemplateEnum.INTERVIEW_CANCEL.getValue()); + if (rs.next()) { + emailTitle = rs.getString("yjzt"); + emailContent = rs.getString("yjnr"); + } + + if (StringUtils.isBlank(emailTitle) || StringUtils.isBlank(emailContent)) { + throw new CustomizeRunTimeException("请检查邮件模板设置"); + } + List fieldList = RecruitUtil.getFieldList("uf_recruit_ms"); + Map> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getFieldname)); + emailContent = RecruitUtil.getReplaceContent(emailContent, fieldMapList, mainDataMap); + String sendTo = Util.null2String(mainDataMap.get("dzyx")); + RecruitUtil.sendEmail(sendTo, emailTitle, emailContent); + + // 更新流程、建模状态 + rs.executeUpdate("update uf_recruit_ms set mszt = ? where id = ?", "2", billId); + // 获取流程表名 + String flowTableInterview = RecruitCommon.getSettingValue("FLOW_TABLE_INTERVIEW"); + String requestId = Util.null2String(mainDataMap.get("mslcid")); + rs.executeUpdate("update " + flowTableInterview + " set mszt = ? where requestId = ? ", "2", requestId); + + } + } catch (Exception e) { + new BaseBean().writeLog(e); + result.put("errmsg", e.getMessage()); + result.put("flag", "false"); + } + return result; + } } diff --git a/src/weaver/interfaces/mzg/action/interview/SubmitInterviewAction.java b/src/weaver/interfaces/mzg/action/interview/SubmitInterviewAction.java index 1d457b8..26b896a 100644 --- a/src/weaver/interfaces/mzg/action/interview/SubmitInterviewAction.java +++ b/src/weaver/interfaces/mzg/action/interview/SubmitInterviewAction.java @@ -52,6 +52,14 @@ public class SubmitInterviewAction implements Action { User user = requestInfo.getRequestManager().getUser(); int requestId = requestInfo.getRequestManager().getRequestid(); int nodeId = requestInfo.getRequestManager().getNodeid(); + rs.executeQuery("select mszt from " + billTableName + " where id = ?", billId); + if (rs.next()) { + String mszt = rs.getString("mszt"); + if ("2".equals(mszt)) { + requestInfo.getRequestManager().setMessagecontent("该面试已取消"); + return FAILURE_AND_CONTINUE; + } + } Set userIdSet = new HashSet<>(); @@ -86,6 +94,7 @@ public class SubmitInterviewAction implements Action { for (Property property : propertyArray) { mainDataMap.put(property.getName(), property.getValue()); } + Optional userIdOptional = userIdSet.stream().findFirst(); String msg = null; if (userIdOptional.isPresent()) { @@ -115,7 +124,7 @@ public class SubmitInterviewAction implements Action { } else { return SUCCESS; } - mainDataMap.put(msgField,msg); + mainDataMap.put(msgField, msg); // 更新表单字段 rs.executeUpdate("update " + billTableName + " set " + msgField + " = ? where id = ?", msg, billId);