|
|
@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
package weaver.formmode.mzg.modeexpand.offer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.mzg.conn.RecruitCommon;
|
|
|
|
|
|
|
|
import com.engine.mzg.enums.EmailTemplateEnum;
|
|
|
|
|
|
|
|
import com.engine.mzg.exception.CustomizeRunTimeException;
|
|
|
|
|
|
|
|
import com.engine.mzg.util.RecruitUtil;
|
|
|
|
|
|
|
|
import com.weaver.formmodel.data.model.Formfield;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
|
|
|
import weaver.formmode.IgnoreCaseHashMap;
|
|
|
|
|
|
|
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
|
|
|
|
|
|
|
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.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @author:dxfeng
|
|
|
|
|
|
|
|
* @createTime: 2024/09/20
|
|
|
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class SendOfferExpand extends AbstractModeExpandJavaCodeNew {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
int billId;
|
|
|
|
|
|
|
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
|
|
|
|
|
|
|
if (requestInfo != null) {
|
|
|
|
|
|
|
|
billId = Util.getIntValue(requestInfo.getRequestid());
|
|
|
|
|
|
|
|
IgnoreCaseHashMap<String, String> mainDataMap = new IgnoreCaseHashMap<>();
|
|
|
|
|
|
|
|
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
|
|
|
|
|
|
|
|
Property[] properties = mainTableInfo.getProperty();
|
|
|
|
|
|
|
|
for (Property property : properties) {
|
|
|
|
|
|
|
|
mainDataMap.put(property.getName(), property.getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String xm = Util.null2String(mainDataMap.get("xm"));
|
|
|
|
|
|
|
|
rs.executeQuery("select dzyx from uf_recruit_ms where id = ?", xm);
|
|
|
|
|
|
|
|
String sendTo = "";
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
sendTo = rs.getString("dzyx");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(sendTo)) {
|
|
|
|
|
|
|
|
throw new CustomizeRunTimeException("电子邮箱为空,邮件发送失败");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String emailTitle = "";
|
|
|
|
|
|
|
|
String emailContent = "";
|
|
|
|
|
|
|
|
rs.executeQuery("select yjzt ,yjnr from uf_recruit_email where mblx =? ", EmailTemplateEnum.OFFER.getValue());
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
emailTitle = rs.getString("yjzt");
|
|
|
|
|
|
|
|
emailContent = rs.getString("yjnr");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(emailTitle) || StringUtils.isBlank(emailContent)) {
|
|
|
|
|
|
|
|
throw new CustomizeRunTimeException("请检查邮件模板设置");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select modeuuid from uf_recruit_lytzs where id = ? ", billId);
|
|
|
|
|
|
|
|
String uuid = "";
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
uuid = rs.getString("modeuuid");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String confirmUrl = RecruitCommon.getSettingValue("OFFER_FEEDBACK_URL") + "?uuid=" + uuid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 发送邮件
|
|
|
|
|
|
|
|
List<Formfield> fieldList = RecruitUtil.getFieldList("uf_recruit_lytzs");
|
|
|
|
|
|
|
|
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getFieldname));
|
|
|
|
|
|
|
|
emailContent = RecruitUtil.getReplaceContent(emailContent, fieldMapList, mainDataMap);
|
|
|
|
|
|
|
|
// 拼接反馈信息
|
|
|
|
|
|
|
|
emailContent += "<div style=\"border:3px solid silver;width:635px;height:55px;line-height:55px;font-family:'microsoft Yahei';font-size:18px;font-weight:bold;color:#333;padding-left:10px\">请您答复是否接受此Offer? <a href=\"" + confirmUrl + "&status=1\" style=\"text-decoration:underline;color:#0000cc;margin-right:10px\">接受</a> <a href=\"" + confirmUrl + "&status=2\" style=\"text-decoration:underline;color:#0000cc;\">拒绝</a></div>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// offer附件
|
|
|
|
|
|
|
|
String offerAttach = RecruitUtil.getImageFileIdsByDocIds(Util.null2String(mainDataMap.get("fj")));
|
|
|
|
|
|
|
|
RecruitUtil.sendEmailWithFile(sendTo, emailTitle, emailContent, offerAttach);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rs.executeUpdate("update uf_recruit_lytzs set fkjg = 0 where id = ?", billId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
rs.writeLog(e);
|
|
|
|
|
|
|
|
result.put("errmsg", e.getMessage());
|
|
|
|
|
|
|
|
result.put("flag", "false");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|