generated from dxfeng/secondev-chapanda-feishu
169 lines
7.6 KiB
Java
169 lines
7.6 KiB
Java
package com.engine.recruit.service.impl;
|
||
|
||
import com.engine.core.impl.Service;
|
||
import com.engine.recruit.conn.ApplicantCommonInfo;
|
||
import com.engine.recruit.conn.RecruitRecordSet;
|
||
import com.engine.recruit.constant.RecruitConstant;
|
||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||
import com.engine.recruit.service.RecruitInterviewService;
|
||
import com.weaver.formmodel.data.model.Formfield;
|
||
import org.apache.commons.lang3.StringUtils;
|
||
import weaver.conn.RecordSet;
|
||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||
import weaver.general.Util;
|
||
import weaver.hrm.resource.ResourceComInfo;
|
||
|
||
import java.util.*;
|
||
import java.util.stream.Collectors;
|
||
|
||
/**
|
||
* @author:dxfeng
|
||
* @createTime: 2023/11/28
|
||
* @version: 1.0
|
||
*/
|
||
public class RecruitInterviewServiceImpl extends Service implements RecruitInterviewService {
|
||
@Override
|
||
public Map<String, Object> updateInterviewStatus(Map<String, Object> param) {
|
||
Map<String, Object> returnMap = new HashMap<>(3);
|
||
String status = Util.null2String(param.get("status"));
|
||
String uuid = Util.null2String(param.get("uuid"));
|
||
returnMap.put("type", "error");
|
||
returnMap.put("message", "反馈失败");
|
||
|
||
if (StringUtils.isBlank(status) || StringUtils.isBlank(uuid)) {
|
||
returnMap.put("description", "反馈失败,请直接点击邮件/短信中的链接地址访问,请勿修改链接内容。");
|
||
return returnMap;
|
||
}
|
||
|
||
RecordSet rs = new RecordSet();
|
||
rs.executeQuery("select * from uf_jcl_ms where modeuuid = ? ", uuid);
|
||
Map<String, Object> mainDataMap = RecruitRecordSet.getSingleRecordMap(rs);
|
||
String sfcj = "";
|
||
String id = "";
|
||
String sjhm = "";
|
||
if (!mainDataMap.isEmpty()) {
|
||
sfcj = Util.null2String(mainDataMap.get("sfcj"));
|
||
id = Util.null2String(mainDataMap.get("id"));
|
||
sjhm = Util.null2String(mainDataMap.get("sjhm"));
|
||
} else {
|
||
returnMap.put("description", "反馈失败,面试信息有误,请联系相应HR确认");
|
||
return returnMap;
|
||
}
|
||
|
||
|
||
if (StringUtils.isNotBlank(sfcj)) {
|
||
returnMap.put("description", "您已成功反馈面试,请勿重复反馈。");
|
||
return returnMap;
|
||
}
|
||
|
||
int formId = ApplicantCommonInfo.getFormIdByTableName("uf_jcl_ms");
|
||
int modeId = ApplicantCommonInfo.getModeIdByTableName("uf_jcl_ms");
|
||
|
||
List<Formfield> fieldList = RecruitModeUtil.getFieldList(formId);
|
||
Map<String, Formfield> fieldMap = fieldList.stream().collect(Collectors.toMap(Formfield::getFieldname, item -> item, (k1, k2) -> k1));
|
||
// 参加
|
||
if ("0".equals(status)) {
|
||
returnMap.put("type", "success");
|
||
returnMap.put("message", "已确认参加面试");
|
||
// returnMap.put("description", "您已接受面试,感谢您的应聘,请按期准备面试,如有问题可以联系相应HR");
|
||
String href = RecruitConstant.INTERVIEW_REGISTRATION_MOBILE_URL;
|
||
if (StringUtils.isNotEmpty(sjhm)) {
|
||
rs.executeQuery("select id from uf_jcl_yppc where sjhm = ? ", sjhm);
|
||
if (rs.next()) {
|
||
String ypId = rs.getString("id");
|
||
href = href + "&ypId=" + ypId;
|
||
}
|
||
}
|
||
String description = "<p> 您已接受面试,感谢您的应聘,请在面试前点击下方链接填写面试登记表信息,如有问题可以联系相应HR<br />\n" +
|
||
" 面试登记表链接:<b><a href= '" + href + "' target='_blank'>面试登记表链接</a></b></p>";
|
||
returnMap.put("description", description);
|
||
|
||
rs.executeUpdate("update uf_jcl_ms set sfcj = ? , zt = 0 where modeuuid = ? ", 0, uuid);
|
||
|
||
|
||
String msgContent = "应聘者:$ypz$,确认参加面试,请知悉。<br/>" +
|
||
"面试时间:$msrq$;面试官:$msg$";
|
||
sendMsg(rs, mainDataMap, id, formId, modeId, fieldMap, msgContent);
|
||
} else if ("1".equals(status)) {
|
||
returnMap.put("type", "info");
|
||
returnMap.put("message", "已取消参加面试");
|
||
returnMap.put("description", "您已取消参加面试,感谢您的应聘。希望您能够找到真正适合自己的工作。");
|
||
|
||
rs.executeUpdate("update uf_jcl_ms set sfcj = ? , qxyy = 2 , zt = 4 where modeuuid = ? ", 1, uuid);
|
||
|
||
|
||
String msgContent = "应聘者:$ypz$,反馈不参加面试,面试已取消,请知悉。<br/>" +
|
||
"面试时间:$msrq$;面试官:$msg$";
|
||
sendMsg(rs, mainDataMap, id, formId, modeId, fieldMap, msgContent);
|
||
}
|
||
|
||
return returnMap;
|
||
}
|
||
|
||
@Override
|
||
public String getInterviewEvaluateStatus(Map<String, Object> param) {
|
||
try {
|
||
String id = Util.null2String(param.get("id"));
|
||
String msg = Util.null2String(param.get("msg"));
|
||
if (StringUtils.isBlank(msg)) {
|
||
return "";
|
||
}
|
||
RecordSet rs = new RecordSet();
|
||
int formId = ApplicantCommonInfo.getFormIdByTableName("uf_jcl_mspjfk");
|
||
String[] split = msg.split(",");
|
||
List<String> spanList = new ArrayList<>();
|
||
ResourceComInfo resourceComInfo = new ResourceComInfo();
|
||
for (String s : split) {
|
||
rs.executeQuery("select jg,zt from uf_jcl_mspjfk where msid = ? and msg = ?", id, s);
|
||
String jg = "";
|
||
String zt = "";
|
||
if (rs.next()) {
|
||
jg = Util.null2String(rs.getString("jg"));
|
||
zt = Util.null2String(rs.getString("zt"));
|
||
}
|
||
|
||
if (StringUtils.isNotBlank(jg)) {
|
||
jg = ApplicantCommonInfo.getSelectName(String.valueOf(formId), "jg", jg);
|
||
spanList.add("<a href=javaScript:openhrm(" + s + ") onclick=pointerXY(event)>" + resourceComInfo.getLastname(s) + "(" + jg + ")</a>");
|
||
} else {
|
||
String span = "<a href=javaScript:openhrm(" + s + ") onclick=pointerXY(event)>" + resourceComInfo.getLastname(s);
|
||
if (StringUtils.isNotBlank(zt)) {
|
||
zt = ApplicantCommonInfo.getSelectName(String.valueOf(formId), "zt", zt);
|
||
span += "(" + zt + ")";
|
||
}
|
||
span += "</a>";
|
||
spanList.add(span);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
return StringUtils.join(spanList, "<br/>");
|
||
} catch (Exception e) {
|
||
throw new CustomizeRunTimeException(e);
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 发送消息提醒
|
||
* @param rs
|
||
* @param mainDataMap
|
||
* @param id
|
||
* @param formId
|
||
* @param modeId
|
||
* @param fieldMap
|
||
* @param msgContent
|
||
*/
|
||
private void sendMsg(RecordSet rs, Map<String, Object> mainDataMap, String id, int formId, int modeId, Map<String, Formfield> fieldMap, String msgContent) {
|
||
msgContent = RecruitModeUtil.getMsgReplaceStr(msgContent, fieldMap, mainDataMap);
|
||
String msg = Util.null2String(mainDataMap.get("msg"));
|
||
Set<String> userIdSet = new HashSet<>();
|
||
userIdSet.add(Util.null2String(mainDataMap.get("modedatacreater")));
|
||
userIdSet.addAll(Arrays.asList(msg.split(",")));
|
||
String showCardLink = RecruitModeUtil.getShowCardLink(String.valueOf(modeId), String.valueOf(formId), id);
|
||
rs.writeLog("showCardLink=="+showCardLink);
|
||
RecruitModeUtil.messagePush(RecruitConstant.INTERVIEW_MESSAGE_TYPE, "面试反馈通知", msgContent, userIdSet, 1, showCardLink, "");
|
||
}
|
||
}
|