2023-09-25 16:57:28 +08:00
|
|
|
|
package weaver.formmode.recruit.modeexpand.interview;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
|
2023-10-27 16:50:24 +08:00
|
|
|
|
import com.engine.recruit.util.RecruitMessageUtils;
|
2023-11-09 14:57:02 +08:00
|
|
|
|
import com.weaver.formmodel.data.model.Formfield;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import weaver.common.DateUtil;
|
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
2023-09-26 15:21:22 +08:00
|
|
|
|
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
import weaver.formmode.setup.ModeRightInfo;
|
|
|
|
|
|
import weaver.general.BaseBean;
|
|
|
|
|
|
import weaver.general.Util;
|
2023-09-27 13:35:02 +08:00
|
|
|
|
import weaver.hrm.User;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
import weaver.soa.workflow.request.*;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
2023-11-09 14:57:02 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* <p>聚才林招聘</p>
|
2023-09-25 16:35:33 +08:00
|
|
|
|
* 批量面试推送面试评价
|
2023-09-22 17:06:12 +08:00
|
|
|
|
*
|
|
|
|
|
|
* @author:dxfeng
|
|
|
|
|
|
* @createTime: 2023/09/22
|
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCodeNew {
|
|
|
|
|
|
private static final String MODE_TABLE_NAME = "uf_jcl_ms";
|
|
|
|
|
|
|
2023-09-26 15:21:22 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 消息来源ID
|
|
|
|
|
|
*/
|
|
|
|
|
|
private final String messageType;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 消息提醒标题
|
|
|
|
|
|
*/
|
|
|
|
|
|
private final String title;
|
|
|
|
|
|
|
2023-10-20 15:52:26 +08:00
|
|
|
|
public BatchAddInterviewResultModeExpand() {
|
2023-09-26 15:21:22 +08:00
|
|
|
|
super();
|
2023-10-20 15:52:26 +08:00
|
|
|
|
messageType = RecruitModeUtil.getRecruitPropValue("INTERVIEW_MESSAGE_TYPE");
|
2023-09-26 15:21:22 +08:00
|
|
|
|
title = RecruitModeUtil.getRecruitPropValue("INTERVIEW_ADD_MESSAGE_TITLE");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-22 17:06:12 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
|
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
|
|
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
|
|
|
|
|
if (requestInfo != null) {
|
|
|
|
|
|
int formModeId = -1;
|
2023-09-26 15:21:22 +08:00
|
|
|
|
int formId = -1;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
RecordSet rs = new RecordSet();
|
2023-09-26 15:21:22 +08:00
|
|
|
|
rs.executeQuery("select id from workflow_bill where tablename = ?", MODE_TABLE_NAME);
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
formId = rs.getInt("id");
|
|
|
|
|
|
}
|
|
|
|
|
|
rs.executeQuery("select id from modeinfo where formid =?", formId);
|
2023-09-22 17:06:12 +08:00
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
formModeId = rs.getInt("id");
|
|
|
|
|
|
}
|
|
|
|
|
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
|
|
|
|
|
Property[] properties = mainTableInfo.getProperty();
|
|
|
|
|
|
Map<String, Object> mainDataMap = new HashMap<>();
|
|
|
|
|
|
for (Property property : properties) {
|
2023-09-26 18:50:30 +08:00
|
|
|
|
mainDataMap.put(property.getName(), RecruitModeUtil.parseBlankToNull(property.getValue()));
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
2023-09-27 13:35:02 +08:00
|
|
|
|
User user = (User) param.get("user");
|
2023-09-22 17:06:12 +08:00
|
|
|
|
// 填充建模数据基本信息
|
|
|
|
|
|
mainDataMap.put("formmodeid", formModeId);
|
2023-09-27 13:35:02 +08:00
|
|
|
|
mainDataMap.put("modedatacreater", user.getUID());
|
2023-09-22 17:06:12 +08:00
|
|
|
|
String dateTime = DateUtil.getFullDate();
|
|
|
|
|
|
String[] split = dateTime.split(" ");
|
|
|
|
|
|
mainDataMap.put("modedatacreatedate", split[0]);
|
|
|
|
|
|
mainDataMap.put("modedatacreatetime", split[1]);
|
2023-11-03 14:49:19 +08:00
|
|
|
|
mainDataMap.put("modedatamodifier", null);
|
|
|
|
|
|
mainDataMap.put("modedatamodifydatetime", null);
|
2023-09-22 17:06:12 +08:00
|
|
|
|
mainDataMap.put("modedatacreatertype", "0");
|
|
|
|
|
|
|
|
|
|
|
|
//mainDataMap.put("bsapid", requestInfo.getRequestid());
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> detailMapList = new ArrayList<>();
|
|
|
|
|
|
DetailTableInfo detailTableInfo = requestInfo.getDetailTableInfo();
|
|
|
|
|
|
DetailTable detailTable = detailTableInfo.getDetailTable(0);
|
|
|
|
|
|
Row[] rows = detailTable.getRow();
|
|
|
|
|
|
for (Row row : rows) {
|
|
|
|
|
|
Map<String, Object> detailDataMap = new HashMap<>(mainDataMap);
|
|
|
|
|
|
Cell[] cells = row.getCell();
|
|
|
|
|
|
for (Cell cell : cells) {
|
2023-09-26 18:50:30 +08:00
|
|
|
|
detailDataMap.put(cell.getName(), RecruitModeUtil.parseBlankToNull(cell.getValue()));
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
detailMapList.add(detailDataMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-09 14:57:02 +08:00
|
|
|
|
String tzypz = Util.null2String(mainDataMap.get("tzypz"));
|
|
|
|
|
|
String yjnr = Util.null2String(mainDataMap.get("yjnr"));
|
|
|
|
|
|
String yjtzmb = Util.null2String(mainDataMap.get("yjtzmb"));
|
|
|
|
|
|
List<String> sendTypeList = Arrays.asList(tzypz.split(","));
|
|
|
|
|
|
boolean sendEmail = sendTypeList.contains("0");
|
|
|
|
|
|
boolean sendSms = sendTypeList.contains("1");
|
|
|
|
|
|
String emailTitle = RecruitModeUtil.getEmailTitle(yjtzmb);
|
|
|
|
|
|
|
|
|
|
|
|
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_plapms");
|
|
|
|
|
|
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getLabelName));
|
2023-09-26 15:21:22 +08:00
|
|
|
|
String insertSql = "insert into " + MODE_TABLE_NAME + " (modeuuid, modedatacreatertype, formmodeid, modedatacreater, modedatacreatedate, modedatacreatetime, modedatamodifier, modedatamodifydatetime, pcid, ypz, ypzw, tdsj, sjhm, dzyx, tzypz, msfs, mshj, msc, msg, ptmsg, ptmsgsfcymspj, msrq, zt) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
|
|
|
StringBuilder msgBuilder = new StringBuilder();
|
2023-09-22 17:06:12 +08:00
|
|
|
|
for (Map<String, Object> detailDataMap : detailMapList) {
|
2023-09-26 15:21:22 +08:00
|
|
|
|
List<Object> paramList = buildParamList(detailDataMap);
|
2023-09-22 17:06:12 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(paramList)) {
|
2023-09-26 15:21:22 +08:00
|
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
|
|
|
paramList.add(0, uuid);
|
|
|
|
|
|
rs.executeUpdate(insertSql, paramList);
|
|
|
|
|
|
rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'");
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
// 权限重构
|
|
|
|
|
|
int bid = Util.getIntValue(rs.getString("id"));
|
|
|
|
|
|
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
|
|
|
|
|
modeRightInfo.setNewRight(true);
|
2023-11-03 14:47:34 +08:00
|
|
|
|
modeRightInfo.editModeDataShare(user.getUID(), formModeId, bid);
|
2023-09-26 18:50:30 +08:00
|
|
|
|
getApplicantsInfo(msgBuilder, Util.null2String(detailDataMap.get("ypz")), Util.null2String(detailDataMap.get("ypzw")));
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
2023-11-09 14:57:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 发送邮件
|
|
|
|
|
|
String msgContent = RecruitModeUtil.getReplaceContent(yjnr, fieldMapList, detailDataMap);
|
|
|
|
|
|
String yx = Util.null2String(detailDataMap.get("dzyx"));
|
|
|
|
|
|
String sjh = Util.null2String(detailDataMap.get("sjhm"));
|
|
|
|
|
|
if (sendEmail) {
|
|
|
|
|
|
RecruitMessageUtils.SendEmail(yx, emailTitle, msgContent);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (sendSms) {
|
|
|
|
|
|
RecruitMessageUtils.sendSMS(sjh, msgContent);
|
|
|
|
|
|
}
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
2023-11-09 14:57:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
2023-09-26 15:21:22 +08:00
|
|
|
|
if (StringUtils.isNotBlank(msgBuilder)) {
|
|
|
|
|
|
msgBuilder.insert(0, RecruitModeUtil.getResourceNames(requestInfo.getCreatorid()) + "安排了一场面试<br/>");
|
|
|
|
|
|
String msrq = Util.null2String(mainDataMap.get("msrq"));
|
|
|
|
|
|
String msg = Util.null2String(mainDataMap.get("msg"));
|
|
|
|
|
|
String ptmsg = Util.null2String(mainDataMap.get("ptmsg"));
|
|
|
|
|
|
String msdd = Util.null2String(mainDataMap.get("msdd"));
|
|
|
|
|
|
msgBuilder.append("面试时间:").append(msrq).append(";面试官:").append(RecruitModeUtil.getResourceNames(msg)).append(",").append(RecruitModeUtil.getResourceNames(ptmsg)).append("<br/>");
|
|
|
|
|
|
msgBuilder.append("面试地址:").append(msdd);
|
|
|
|
|
|
|
|
|
|
|
|
// 消息发送
|
|
|
|
|
|
Set<String> userIdSet = new HashSet<>();
|
|
|
|
|
|
userIdSet.addAll(Arrays.asList(msg.split(",")));
|
|
|
|
|
|
userIdSet.addAll(Arrays.asList(ptmsg.split(",")));
|
2023-09-27 13:35:02 +08:00
|
|
|
|
RecruitModeUtil.messagePush(messageType, title, msgBuilder.toString(), userIdSet, user.getUID());
|
2023-09-26 15:21:22 +08:00
|
|
|
|
}
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
new BaseBean().writeLog(e);
|
|
|
|
|
|
result.put("errmsg", "自定义出错信息");
|
|
|
|
|
|
result.put("flag", "false");
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 构建批量插入数据集合
|
|
|
|
|
|
*
|
2023-09-26 15:21:22 +08:00
|
|
|
|
* @param map 表单参数
|
2023-09-22 17:06:12 +08:00
|
|
|
|
*/
|
2023-09-26 15:21:22 +08:00
|
|
|
|
private List<Object> buildParamList(Map<String, Object> map) {
|
2023-09-22 17:06:12 +08:00
|
|
|
|
List<Object> param = new ArrayList<>();
|
|
|
|
|
|
// 填充建模表相关字段
|
|
|
|
|
|
param.add(map.get("modedatacreatertype"));
|
|
|
|
|
|
param.add(map.get("formmodeid"));
|
|
|
|
|
|
param.add(map.get("modedatacreater"));
|
|
|
|
|
|
param.add(map.get("modedatacreatedate"));
|
|
|
|
|
|
param.add(map.get("modedatacreatetime"));
|
|
|
|
|
|
param.add(map.get("modedatamodifier"));
|
|
|
|
|
|
param.add(map.get("modedatamodifydatetime"));
|
|
|
|
|
|
|
|
|
|
|
|
// 表单字段
|
|
|
|
|
|
// 批次ID
|
|
|
|
|
|
param.add(map.get("pcid"));
|
|
|
|
|
|
// 应聘者
|
|
|
|
|
|
param.add(map.get("ypz"));
|
|
|
|
|
|
// 投递职位
|
2023-09-26 18:50:30 +08:00
|
|
|
|
param.add(map.get("ypzw"));
|
|
|
|
|
|
// 投递时间
|
2023-09-22 17:06:12 +08:00
|
|
|
|
param.add(map.get("tdsj"));
|
|
|
|
|
|
// 手机号码
|
|
|
|
|
|
param.add(map.get("sjhm"));
|
|
|
|
|
|
// 电子邮箱
|
|
|
|
|
|
param.add(map.get("dzyx"));
|
|
|
|
|
|
// 通知应聘者
|
|
|
|
|
|
param.add(map.get("tzypz"));
|
|
|
|
|
|
// 面试方式
|
|
|
|
|
|
param.add(map.get("msfs"));
|
|
|
|
|
|
// 面试环节
|
|
|
|
|
|
param.add(map.get("mshj"));
|
|
|
|
|
|
// 面试轮次
|
|
|
|
|
|
param.add(map.get("msc"));
|
|
|
|
|
|
// 面试官
|
|
|
|
|
|
param.add(map.get("msg"));
|
|
|
|
|
|
// 陪同面试官
|
|
|
|
|
|
param.add(map.get("ptmsg"));
|
|
|
|
|
|
// 陪同面试官是否参与面试评价
|
|
|
|
|
|
param.add(map.get("ptmsgsfcymspj"));
|
|
|
|
|
|
// 面试日期
|
|
|
|
|
|
param.add(map.get("msrq"));
|
2023-09-25 16:35:33 +08:00
|
|
|
|
// 面试状态,默认值:待面试
|
|
|
|
|
|
param.add("0");
|
2023-09-22 17:06:12 +08:00
|
|
|
|
|
2023-09-26 15:21:22 +08:00
|
|
|
|
return param;
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-26 15:21:22 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取应聘者信息
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param msgBuilder 消息内容
|
|
|
|
|
|
* @param applicantId 应聘者ID
|
|
|
|
|
|
* @param positionId 应聘职位ID
|
|
|
|
|
|
*/
|
|
|
|
|
|
private void getApplicantsInfo(StringBuilder msgBuilder, String applicantId, String positionId) {
|
|
|
|
|
|
if (StringUtils.isAnyBlank(applicantId, positionId)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
rs.executeQuery("select xm from uf_jcl_yppc where id = ?", applicantId);
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
msgBuilder.append("应聘者:").append(rs.getString("xm"));
|
|
|
|
|
|
}
|
|
|
|
|
|
rs.executeQuery("select zpzwmc from uf_jcl_zp_zpzw where id = ?", positionId);
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
msgBuilder.append(";应聘职位:").append(rs.getString("zpzwmc"));
|
|
|
|
|
|
}
|
|
|
|
|
|
msgBuilder.append("<br/>");
|
|
|
|
|
|
}
|
2023-09-22 17:06:12 +08:00
|
|
|
|
}
|