调整、取消面试

美之高
dxfeng 9 months ago
parent 76712bfe64
commit f2798f8c1f

@ -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;

@ -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<String, String> doModeExpand(Map<String, Object> map) {
return null;
public Map<String, String> doModeExpand(Map<String, Object> param) {
// 取消面试
Map<String, String> 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<String, String> 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<Formfield> fieldList = RecruitUtil.getFieldList("uf_recruit_ms");
Map<String, List<Formfield>> 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;
}
}

@ -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<String, String> doModeExpand(Map<String, Object> map) {
return null;
public Map<String, String> doModeExpand(Map<String, Object> param) {
// 取消面试
Map<String, String> result = new HashMap<>();
try {
String billId;
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
if (requestInfo != null) {
billId = requestInfo.getRequestid();
RecordSet rs = new RecordSet();
IgnoreCaseHashMap<String, String> 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<Formfield> fieldList = RecruitUtil.getFieldList("uf_recruit_ms");
Map<String, List<Formfield>> 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;
}
}

@ -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<String> userIdSet = new HashSet<>();
@ -86,6 +94,7 @@ public class SubmitInterviewAction implements Action {
for (Property property : propertyArray) {
mainDataMap.put(property.getName(), property.getValue());
}
Optional<String> 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);

Loading…
Cancel
Save