generated from dxfeng/secondev-chapanda-feishu
offer通知发送调整
This commit is contained in:
parent
7269c12807
commit
9bf9055c57
|
|
@ -1,9 +1,9 @@
|
|||
package weaver.formmode.recruit.modeexpand.offer;
|
||||
|
||||
import com.engine.recruit.enums.RecordOperateEnum;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.recruit.util.RecruitMessageUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import weaver.common.DateUtil;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
|
|
@ -14,8 +14,11 @@ import weaver.soa.workflow.request.MainTableInfo;
|
|||
import weaver.soa.workflow.request.Property;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
||||
/**
|
||||
|
|
@ -28,7 +31,6 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
*/
|
||||
private String title;
|
||||
|
||||
private final RecordSet recordSet = new RecordSet();
|
||||
|
||||
@Override
|
||||
public Map<String, String> doModeExpand(Map<String, Object> params) {
|
||||
|
|
@ -55,82 +57,51 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
mainDataMap.put(property.getName(), property.getValue());
|
||||
}
|
||||
// 发送信息
|
||||
sendMessage(billId);
|
||||
// 更新状态为已发送
|
||||
recordSet.executeUpdate("update uf_jcl_offer set zt = 1 where id = ? ", billId);
|
||||
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();
|
||||
rs.executeUpdate("update uf_jcl_offer set zt = 1,tznr = ?,fsr=?,fssj=? where id = ? ", billId, tznr, user.getUID(), DateUtil.getDateTime());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("errmsg", "自定义出错信息");
|
||||
result.put("flag", "false");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void sendMessage(int billId) {
|
||||
String querySql = "select sjhm,dzyx,yjtzmb,tznr,tzypz,offerfj from uf_jcl_offer where id = ?";
|
||||
recordSet.executeQuery(querySql, billId);
|
||||
String sjhm = "";
|
||||
String dzyx = "";
|
||||
String yjtzmb = "";
|
||||
String tznr = "";
|
||||
String tzypz = "";
|
||||
String offerfj = "";
|
||||
while (recordSet.next()) {
|
||||
sjhm = Util.null2String(recordSet.getString("sjhm"));
|
||||
dzyx = Util.null2String(recordSet.getString("dzyx"));
|
||||
yjtzmb = Util.null2String(recordSet.getString("yjtzmb"));
|
||||
tznr = Util.null2String(recordSet.getString("tznr"));
|
||||
tzypz = Util.null2String(recordSet.getString("tzypz"));
|
||||
offerfj = Util.null2String(recordSet.getString("offerfj"));
|
||||
}
|
||||
offerfj = RecruitModeUtil.getImageFileIdsByDocIds(offerfj);
|
||||
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
String[] ways = tzypz.split(",");
|
||||
for (String way : ways) {
|
||||
switch (way) {
|
||||
case "0":
|
||||
// 邮件附件,对应表单上传的附件
|
||||
RecruitMessageUtils.SendEmailWithFile(dzyx, getEmailTitle(yjtzmb), tznr, offerfj);
|
||||
break;
|
||||
case "1":
|
||||
// 短信
|
||||
recordSet.executeQuery("select b.xm , c.zpzwmc , a.sxrq , a.rzgs from uf_jcl_offer a inner join uf_jcl_yppc b on a.xm = b.id inner join uf_jcl_zp_zpzw c on a.ypzw = c.id where a.id = ?", billId);
|
||||
if (recordSet.next()) {
|
||||
String name = recordSet.getString("xm");
|
||||
String positionName = recordSet.getString("zpzwmc");
|
||||
String endDate = recordSet.getString("sxrq");
|
||||
String companyId = recordSet.getString("rzgs");
|
||||
if (StringUtils.isAnyBlank(name, positionName, endDate, companyId)) {
|
||||
throw new CustomizeRunTimeException("offer短信发送失败,应聘者信息获取失败");
|
||||
}
|
||||
String msgContent = name + "你好,恭喜你成功通过" + new SubCompanyComInfo().getSubCompanyname(companyId) + "的" + positionName + "面试,聘用通知已发送至你的邮箱,请注意查收邮件,并于" + endDate + "前确认,逾期将失效。";
|
||||
params.put("receiver", sjhm);
|
||||
params.put("content", msgContent);
|
||||
RecruitMessageUtils.sendSMS(params);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取邮件模板主题
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private String getEmailTitle(String id) {
|
||||
String emailTitle = "";
|
||||
recordSet.executeQuery("select yjzt from uf_jcl_yjtzmb where id = ?", id);
|
||||
if (recordSet.next()) {
|
||||
emailTitle = recordSet.getString("yjzt");
|
||||
}
|
||||
return emailTitle;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue