generated from dxfeng/secondev-chapanda-feishu
消息提醒-批量安排、取消面试
This commit is contained in:
parent
cb002def30
commit
3603341c8a
|
|
@ -0,0 +1,6 @@
|
||||||
|
#面试相关消息提醒,消息来源
|
||||||
|
INTERVIEW_MESSAGE_TYPE=85
|
||||||
|
#添加面试消息提醒表弟
|
||||||
|
INTERVIEW_ADD_MESSAGE_TITLE=面试安排提醒
|
||||||
|
#取消面试消息提醒表弟
|
||||||
|
INTERVIEW_CANCEL_MESSAGE_TITLE=取消面试提醒
|
||||||
|
|
@ -5,11 +5,13 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import weaver.common.DateUtil;
|
import weaver.common.DateUtil;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||||
import weaver.formmode.setup.ModeRightInfo;
|
import weaver.formmode.setup.ModeRightInfo;
|
||||||
import weaver.general.BaseBean;
|
import weaver.general.BaseBean;
|
||||||
import weaver.general.Util;
|
import weaver.general.Util;
|
||||||
import weaver.soa.workflow.request.*;
|
import weaver.soa.workflow.request.*;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,6 +25,22 @@ import java.util.*;
|
||||||
public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCodeNew {
|
public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||||
private static final String MODE_TABLE_NAME = "uf_jcl_ms";
|
private static final String MODE_TABLE_NAME = "uf_jcl_ms";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息来源ID
|
||||||
|
*/
|
||||||
|
private final String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息提醒标题
|
||||||
|
*/
|
||||||
|
private final String title;
|
||||||
|
|
||||||
|
public BatchAddInterviewResultModeExpand() throws UnsupportedEncodingException {
|
||||||
|
super();
|
||||||
|
messageType = RecruitModeUtil.getRecruitPropValue("INTERVIEW_MESSAGE_TYPE");
|
||||||
|
title = RecruitModeUtil.getRecruitPropValue("INTERVIEW_ADD_MESSAGE_TITLE");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
Map<String, String> result = new HashMap<>();
|
Map<String, String> result = new HashMap<>();
|
||||||
|
|
@ -30,8 +48,13 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod
|
||||||
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
if (requestInfo != null) {
|
if (requestInfo != null) {
|
||||||
int formModeId = -1;
|
int formModeId = -1;
|
||||||
|
int formId = -1;
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? )", MODE_TABLE_NAME);
|
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);
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
formModeId = rs.getInt("id");
|
formModeId = rs.getInt("id");
|
||||||
}
|
}
|
||||||
|
|
@ -67,19 +90,40 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod
|
||||||
detailMapList.add(detailDataMap);
|
detailMapList.add(detailDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
for (Map<String, Object> detailDataMap : detailMapList) {
|
for (Map<String, Object> detailDataMap : detailMapList) {
|
||||||
List<List<Object>> paramList = new ArrayList<>();
|
List<Object> paramList = buildParamList(detailDataMap);
|
||||||
buildParamList(detailDataMap, paramList);
|
|
||||||
if (CollectionUtils.isNotEmpty(paramList)) {
|
if (CollectionUtils.isNotEmpty(paramList)) {
|
||||||
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(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
String uuid = UUID.randomUUID().toString();
|
||||||
for (List<Object> objects : paramList) {
|
paramList.add(0, uuid);
|
||||||
String uuid = UUID.randomUUID().toString();
|
rs.executeUpdate(insertSql, paramList);
|
||||||
objects.add(0, uuid);
|
rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'");
|
||||||
rs.executeUpdate(insertSql, objects);
|
if (rs.next()) {
|
||||||
refreshRight(rs, uuid, formModeId);
|
// 权限重构
|
||||||
|
int bid = Util.getIntValue(rs.getString("id"));
|
||||||
|
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
||||||
|
modeRightInfo.setNewRight(true);
|
||||||
|
modeRightInfo.editModeDataShare(1, formModeId, bid);
|
||||||
|
getApplicantsInfo(msgBuilder, Util.null2String(detailDataMap.get("ypz")), Util.null2String(detailDataMap.get("tdzw")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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(",")));
|
||||||
|
RecruitModeUtil.messagePush(messageType, title, msgBuilder.toString(), userIdSet, Integer.parseInt(requestInfo.getCreatorid()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new BaseBean().writeLog(e);
|
new BaseBean().writeLog(e);
|
||||||
|
|
@ -93,10 +137,9 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod
|
||||||
/**
|
/**
|
||||||
* 构建批量插入数据集合
|
* 构建批量插入数据集合
|
||||||
*
|
*
|
||||||
* @param map 表单参数
|
* @param map 表单参数
|
||||||
* @param paramList 待插入数据集合
|
|
||||||
*/
|
*/
|
||||||
private void buildParamList(Map<String, Object> map, List<List<Object>> paramList) {
|
private List<Object> buildParamList(Map<String, Object> map) {
|
||||||
List<Object> param = new ArrayList<>();
|
List<Object> param = new ArrayList<>();
|
||||||
// 填充建模表相关字段
|
// 填充建模表相关字段
|
||||||
param.add(map.get("modedatacreatertype"));
|
param.add(map.get("modedatacreatertype"));
|
||||||
|
|
@ -139,26 +182,7 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod
|
||||||
// 面试状态,默认值:待面试
|
// 面试状态,默认值:待面试
|
||||||
param.add("0");
|
param.add("0");
|
||||||
|
|
||||||
paramList.add(param);
|
return param;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 权限重构
|
|
||||||
*
|
|
||||||
* @param rs RecordSet
|
|
||||||
* @param uuid UUID
|
|
||||||
* @param formModeId 建模ID
|
|
||||||
*/
|
|
||||||
private void refreshRight(RecordSet rs, String uuid, int formModeId) {
|
|
||||||
rs.executeQuery("select id from " + MODE_TABLE_NAME + " where modeuuid='" + uuid + "'");
|
|
||||||
if (rs.next()) {
|
|
||||||
//建模数据的id
|
|
||||||
int bid = Util.getIntValue(rs.getString("id"));
|
|
||||||
ModeRightInfo modeRightInfo = new ModeRightInfo();
|
|
||||||
modeRightInfo.setNewRight(true);
|
|
||||||
//新建的时候添加共享
|
|
||||||
modeRightInfo.editModeDataShare(1, formModeId, bid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -171,4 +195,28 @@ public class BatchAddInterviewResultModeExpand extends AbstractModeExpandJavaCod
|
||||||
private Object parseBlankToNull(String str) {
|
private Object parseBlankToNull(String str) {
|
||||||
return StringUtils.isBlank(str) ? null : str;
|
return StringUtils.isBlank(str) ? null : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应聘者信息
|
||||||
|
*
|
||||||
|
* @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/>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
package weaver.formmode.recruit.modeexpand.interview;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:dxfeng
|
||||||
|
* @createTime: 2023/09/26
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class CancelInterviewResultModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||||
|
private static final String MODE_TABLE_NAME = "uf_jcl_ms";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息来源ID
|
||||||
|
*/
|
||||||
|
private final String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息提醒标题
|
||||||
|
*/
|
||||||
|
private final String title;
|
||||||
|
|
||||||
|
public CancelInterviewResultModeExpand() {
|
||||||
|
super();
|
||||||
|
messageType = RecruitModeUtil.getRecruitPropValue("INTERVIEW_MESSAGE_TYPE");
|
||||||
|
title = RecruitModeUtil.getRecruitPropValue("INTERVIEW_CANCEL_MESSAGE_TITLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
String cancelInterview = Util.null2String(param.get("cancelInterview"));
|
||||||
|
if (!"true".equals(cancelInterview)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//数据id
|
||||||
|
int billId;
|
||||||
|
//模块id
|
||||||
|
int modeId;
|
||||||
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
|
if (requestInfo != null) {
|
||||||
|
billId = Util.getIntValue(requestInfo.getRequestid());
|
||||||
|
modeId = Util.getIntValue(requestInfo.getWorkflowid());
|
||||||
|
if (billId > 0 && modeId > 0) {
|
||||||
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
||||||
|
Property[] properties = mainTableInfo.getProperty();
|
||||||
|
Map<String, Object> mainDataMap = new HashMap<>();
|
||||||
|
for (Property property : properties) {
|
||||||
|
mainDataMap.put(property.getName(), property.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新面试状态为“已取消”
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeUpdate("update " + MODE_TABLE_NAME + " set zt = 4 where id = ?", billId);
|
||||||
|
|
||||||
|
// 发送消息
|
||||||
|
StringBuilder msgBuilder = new StringBuilder();
|
||||||
|
getApplicantsInfo(msgBuilder, Util.null2String(mainDataMap.get("ypz")), Util.null2String(mainDataMap.get("ypzw")));
|
||||||
|
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(msgBuilder)) {
|
||||||
|
String formId = Util.null2String(param.get("formId"));
|
||||||
|
msgBuilder.insert(0, RecruitModeUtil.getResourceNames(requestInfo.getCreatorid()) + "取消了面试,请知悉。取消原因:" + getCancelReason(formId, Util.null2String(mainDataMap.get("qxyy"))) + "<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(",")));
|
||||||
|
RecruitModeUtil.messagePush(messageType, title, msgBuilder.toString(), userIdSet, Integer.parseInt(requestInfo.getCreatorid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
result.put("errmsg", "自定义出错信息");
|
||||||
|
result.put("flag", "false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取应聘者信息
|
||||||
|
*
|
||||||
|
* @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/>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取取消理由
|
||||||
|
*
|
||||||
|
* @param formId 表单ID
|
||||||
|
* @param value 下拉框值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getCancelReason(String formId, 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 = 'qxyy' ) and selectvalue =?", formId, value);
|
||||||
|
if (rs.next()) {
|
||||||
|
cancelReason = rs.getString("selectname");
|
||||||
|
}
|
||||||
|
return cancelReason;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package weaver.formmode.recruit.modeexpand.util;
|
||||||
|
|
||||||
|
import com.cloudstore.dev.api.bean.MessageBean;
|
||||||
|
import com.cloudstore.dev.api.bean.MessageType;
|
||||||
|
import com.cloudstore.dev.api.util.Util_Message;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:dxfeng
|
||||||
|
* @createTime: 2023/09/26
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
public class RecruitModeUtil {
|
||||||
|
/**
|
||||||
|
* 消息推送
|
||||||
|
*
|
||||||
|
* @param messageType 消息来源
|
||||||
|
* @param title 消息标题
|
||||||
|
* @param context 消息内容
|
||||||
|
* @param userIdList 接收人ID集合
|
||||||
|
* @param creater 消息创建者
|
||||||
|
*/
|
||||||
|
public static void messagePush(String messageType, String title, String context, Set<String> userIdList, Integer creater) {
|
||||||
|
MessageType message = MessageType.newInstance(Integer.parseInt(messageType));
|
||||||
|
try {
|
||||||
|
MessageBean messageBean = Util_Message.createMessage(message, userIdList, title, context, "", "");
|
||||||
|
messageBean.setCreater(creater);
|
||||||
|
Util_Message.store(messageBean);
|
||||||
|
} catch (IOException e) {
|
||||||
|
new BaseBean().writeLog(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取人员姓名
|
||||||
|
*
|
||||||
|
* @param ids 人员ID
|
||||||
|
* @return 人员姓名
|
||||||
|
*/
|
||||||
|
public static String getResourceNames(String ids) {
|
||||||
|
try {
|
||||||
|
return new ResourceComInfo().getLastnames(ids);
|
||||||
|
} catch (Exception e) {
|
||||||
|
new BaseBean().writeLog(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取聚才林招聘相关配置文件
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getRecruitPropValue(String key) {
|
||||||
|
String value = new BaseBean().getPropValue("jclRecruit", key);
|
||||||
|
try {
|
||||||
|
value = new String(value.getBytes("ISO-8859-1"), "utf-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
new BaseBean().writeLog(e);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue