2023-10-23 15:31:54 +08:00
|
|
|
|
package weaver.formmode.recruit.modeexpand.offer;
|
|
|
|
|
|
|
2023-11-08 09:37:13 +08:00
|
|
|
|
import com.engine.recruit.enums.RecordOperateEnum;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
import com.engine.recruit.util.RecruitMessageUtils;
|
2023-11-09 16:34:47 +08:00
|
|
|
|
import com.weaver.formmodel.data.model.Formfield;
|
|
|
|
|
|
import weaver.common.DateUtil;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
2023-11-08 09:37:13 +08:00
|
|
|
|
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
import weaver.hrm.User;
|
2023-10-27 18:01:07 +08:00
|
|
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
import weaver.soa.workflow.request.MainTableInfo;
|
|
|
|
|
|
import weaver.soa.workflow.request.Property;
|
|
|
|
|
|
import weaver.soa.workflow.request.RequestInfo;
|
|
|
|
|
|
|
2023-11-09 16:34:47 +08:00
|
|
|
|
import java.util.Arrays;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
import java.util.HashMap;
|
2023-11-09 16:34:47 +08:00
|
|
|
|
import java.util.List;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
import java.util.Map;
|
2023-11-09 16:34:47 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2023-10-23 15:31:54 +08:00
|
|
|
|
|
|
|
|
|
|
public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, String> doModeExpand(Map<String, Object> params) {
|
|
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
try {
|
|
|
|
|
|
//数据id
|
|
|
|
|
|
int billId;
|
|
|
|
|
|
//模块id
|
|
|
|
|
|
int modeId;
|
|
|
|
|
|
RequestInfo requestInfo = (RequestInfo) params.get("RequestInfo");
|
|
|
|
|
|
User user = (User) params.get("user");
|
2023-11-08 09:37:13 +08:00
|
|
|
|
String recordType = Util.null2String(params.get("recordType"));
|
|
|
|
|
|
if (!RecordOperateEnum.SEND_OFFER.getOperateType().equals(recordType)) {
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2023-10-23 15:31:54 +08:00
|
|
|
|
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<>(16);
|
|
|
|
|
|
for (Property property : properties) {
|
|
|
|
|
|
mainDataMap.put(property.getName(), property.getValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
// 发送信息
|
2023-11-09 16:34:47 +08:00
|
|
|
|
String tzypz = Util.null2String(mainDataMap.get("tzypz"));
|
|
|
|
|
|
String tznr = Util.null2String(mainDataMap.get("tznr"));
|
|
|
|
|
|
String yjtzmb = Util.null2String(mainDataMap.get("yjtzmb"));
|
|
|
|
|
|
String yx = Util.null2String(mainDataMap.get("dzyx"));
|
|
|
|
|
|
String sjh = Util.null2String(mainDataMap.get("sjhm"));
|
|
|
|
|
|
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_offer");
|
|
|
|
|
|
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getLabelName));
|
|
|
|
|
|
// 发送邮件
|
|
|
|
|
|
String offerMobileUrl = RecruitModeUtil.getRecruitPropValue("OFFER_MOBILE_URL");
|
|
|
|
|
|
offerMobileUrl += "&billid=" + billId + "&dzyx=" + yx;
|
|
|
|
|
|
String mobileLink = "<span color='red'><a href='" + offerMobileUrl + "' target='_blank'>录用通知函</a></span>";
|
|
|
|
|
|
tznr = tznr.replace("{录用通知函}", mobileLink);
|
|
|
|
|
|
String msgContent = RecruitModeUtil.getReplaceContent(tznr, fieldMapList, mainDataMap);
|
|
|
|
|
|
|
|
|
|
|
|
if (sendEmail) {
|
|
|
|
|
|
String offerAttach = RecruitModeUtil.getImageFileIdsByDocIds(Util.null2String(mainDataMap.get("offerfj")));
|
|
|
|
|
|
RecruitMessageUtils.SendEmailWithFile(yx, emailTitle, msgContent, offerAttach);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (sendSms) {
|
|
|
|
|
|
String name = Util.null2String(mainDataMap.get("xm"));
|
|
|
|
|
|
String positionName = Util.null2String(mainDataMap.get("zpzwmc"));
|
|
|
|
|
|
String endDate = Util.null2String(mainDataMap.get("sxrq"));
|
|
|
|
|
|
String companyId = Util.null2String(mainDataMap.get("rzgs"));
|
|
|
|
|
|
//if (StringUtils.isAnyBlank(name, positionName, endDate, companyId)) {
|
|
|
|
|
|
// result.put("errmsg", "offer短信发送失败,应聘者信息获取失败");
|
|
|
|
|
|
// result.put("flag", "false");
|
|
|
|
|
|
//}
|
|
|
|
|
|
String mobileContent = name + "你好,恭喜你成功通过" + new SubCompanyComInfo().getSubCompanyname(companyId) + "的" + positionName + "面试,聘用通知已发送至你的邮箱,请注意查收邮件,并于" + endDate + "前确认,逾期将失效。";
|
|
|
|
|
|
|
|
|
|
|
|
RecruitMessageUtils.sendSMS(sjh, mobileContent);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 更新状态为已发送,更新通知内容,更新发送人、发送时间
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
2023-11-16 10:01:27 +08:00
|
|
|
|
rs.executeUpdate("update uf_jcl_offer set zt = 1,tznr = ?,fsr=?,fssj=? where id = ? ", tznr, user.getUID(), DateUtil.getDateTime(), billId);
|
2023-10-23 15:31:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
result.put("errmsg", "自定义出错信息");
|
|
|
|
|
|
result.put("flag", "false");
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|