简历中心发送邮件、测评、应聘登记提交事件

美之高
dxfeng 8 months ago
parent 8c57c92434
commit f127eef41b

@ -0,0 +1,12 @@
package com.api.mzg.web;
import javax.ws.rs.Path;
/**
* @author:dxfeng
* @createTime: 2024/09/05
* @version: 1.0
*/
@Path("/jcl/mzg/mobile")
public class RecruitMobileController extends com.engine.mzg.web.RecruitMobileController{
}

@ -0,0 +1,59 @@
package com.engine.mzg.conn;
import weaver.conn.RecordSet;
/**
* @author:dxfeng
* @createTime: 2024/09/05
* @version: 1.0
*/
public class RecruitCommon {
/**
*
*
* @param key
* @return
*/
public static String getSettingValue(String key) {
RecordSet rs = new RecordSet();
rs.executeQuery("select pzz from uf_recruit_setting where pzx = ? ", key);
if (rs.next()) {
return rs.getString("pzz");
}
return "";
}
/**
* ID
*
* @param modeTable
* @return
*/
public static int getFormIdByTableName(String modeTable) {
int formId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select id from workflow_bill where tablename = ? ", modeTable);
if (rs.next()) {
formId = rs.getInt("id");
}
return formId;
}
/**
* ,ID
*
* @param modeTable
* @return
*/
public static int getModeIdByTableName(String modeTable) {
int formModeId = -1;
RecordSet rs = new RecordSet();
rs.executeQuery("select id from modeinfo where formid =( select id from workflow_bill where tablename = ? ) and isdelete = 0 order by id", modeTable);
if (rs.next()) {
formModeId = rs.getInt("id");
}
return formModeId;
}
}

@ -0,0 +1,168 @@
package com.engine.mzg.conn;
import com.engine.mzg.exception.CustomizeRunTimeException;
import com.engine.mzg.util.RecruitUtil;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.formmode.IgnoreCaseHashMap;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2023/10/19
* @version: 1.0
*/
public class RecruitRecordSet {
/**
*
*
* @param rs RecordSet
* @return
*/
public static Map<String, Object> getSingleRecordMap(RecordSet rs) {
Map<String, Object> dataMap = new IgnoreCaseHashMap<>();
if (rs.next()) {
String[] columnNames = rs.getColumnName();
for (String columnName : columnNames) {
dataMap.put(columnName, RecruitUtil.parseBlankToNull(rs.getString(columnName)));
}
}
return dataMap;
}
public static List<Map<String, Object>> getRecordMapList(RecordSet rs) {
List<Map<String, Object>> list = new ArrayList<>();
while (rs.next()) {
String[] columnNames = rs.getColumnName();
Map<String, Object> dataMap = new IgnoreCaseHashMap<>();
for (String columnName : columnNames) {
dataMap.put(columnName.toLowerCase(), RecruitUtil.parseBlankToNull(rs.getString(columnName)));
}
list.add(dataMap);
}
return list;
}
/**
*
*
* @param dataMap
* @param tableName
*/
public static void insertData(Map<String, Object> dataMap, String tableName) {
List<String> fieldList = new ArrayList<>();
List<String> dataList = new ArrayList<>();
List<String> paramList = new ArrayList<>();
dataMap.forEach((key, value) -> {
if (null != value) {
String valueStr = String.valueOf(value);
if (StringUtils.isNotBlank(valueStr)) {
fieldList.add(key);
dataList.add(valueStr);
paramList.add("?");
}
}
});
String insertSql = " insert into " + tableName + "(" + StringUtils.join(fieldList, ",") + ") values (" + StringUtils.join(paramList, ",") + ")";
RecordSet rs = new RecordSet();
rs.executeUpdate(insertSql, dataList);
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
throw new CustomizeRunTimeException(rs.getExceptionMsg());
}
}
/**
* ID
*
* @param dataMap
* @param tableName
*/
public static void updateDataById(Map<String, Object> dataMap, String tableName) {
List<String> fieldList = new ArrayList<>();
List<Object> dataList = new ArrayList<>();
String id = Util.null2String(dataMap.get("id"));
dataMap.remove("id");
dataMap.forEach((key, value) -> {
fieldList.add(key + " = ? ");
dataList.add(value);
});
dataList.add(id);
String updateSql = "update " + tableName + " set " + StringUtils.join(fieldList, ",") + " where id = ? ";
RecordSet rs = new RecordSet();
rs.executeUpdate(updateSql, dataList);
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
throw new CustomizeRunTimeException(rs.getExceptionMsg());
}
}
/**
*
*
* @param deleteSql
*/
public static void deleteData(String deleteSql) {
RecordSet rs = new RecordSet();
rs.executeUpdate(deleteSql);
if (StringUtils.isNotBlank(rs.getExceptionMsg())) {
throw new CustomizeRunTimeException(rs.getExceptionMsg());
}
}
/**
*
*
* @param mainDataMap
*/
public static void buildModeInsertFields(Map<String, Object> mainDataMap, int userId) {
String dateTime = DateUtil.getFullDate();
String[] dateSplit = dateTime.split(" ");
mainDataMap.put("modedatacreater", userId);
mainDataMap.put("modedatacreatedate", dateSplit[0]);
mainDataMap.put("modedatacreatetime", dateSplit[1]);
mainDataMap.put("modedatacreatertype", "0");
}
/**
*
*
* @param mainDataMap
*/
public static void buildModeUpdateFields(Map<String, Object> mainDataMap, int userId) {
String dateTime = DateUtil.getFullDate();
mainDataMap.put("modedatamodifier", userId);
mainDataMap.put("modedatamodifydatetime", dateTime);
}
/**
*
*
* @param uuid
* @param modeTable
* @param formModeId
*/
public static int refreshRight(String uuid, String modeTable, int formModeId, int creator) {
RecordSet rs = new RecordSet();
rs.executeQuery("select id from " + modeTable + " where modeuuid='" + uuid + "'");
if (rs.next()) {
//建模数据的id
int bid = Util.getIntValue(rs.getString("id"));
ModeRightInfo modeRightInfo = new ModeRightInfo();
modeRightInfo.setNewRight(true);
//新建的时候添加共享
modeRightInfo.editModeDataShare(creator, formModeId, bid);
return bid;
}
return -1;
}
}

@ -0,0 +1,54 @@
package com.engine.mzg.enums;
/**
*
*
* @author:dxfeng
* @createTime: 2023/09/13
* @version: 1.0
*/
public enum EmailTemplateEnum {
/**
*
*/
DISC(0, "性格测评"),
/**
*
*/
REGIST(1, "应聘登记"),
/**
*
*/
INTERVIEW(2, "面试"),
/**
* offer
*/
OFFER(3, "offer");
EmailTemplateEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
private Integer value;
private String desc;
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

@ -0,0 +1,19 @@
package com.engine.mzg.service;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/09/04
* @version: 1.0
*/
public interface RecruitMobileService {
/**
* DISC
*
* @param params
* @return
*/
Map<String, Object> submitDiscTest(Map<String, Object> params);
}

@ -0,0 +1,54 @@
package com.engine.mzg.service.impl;
import com.engine.core.impl.Service;
import com.engine.mzg.exception.CustomizeRunTimeException;
import com.engine.mzg.service.RecruitMobileService;
import weaver.conn.RecordSet;
import weaver.formmode.IgnoreCaseHashMap;
import weaver.formmode.mzg.modeexpand.disc.AddDiscExpand;
import weaver.general.Util;
import java.util.Map;
import java.util.regex.Matcher;
/**
* @author:dxfeng
* @createTime: 2024/09/04
* @version: 1.0
*/
public class RecruitMobileServiceImpl extends Service implements RecruitMobileService {
@Override
public Map<String, Object> submitDiscTest(Map<String, Object> params) {
String billId = Util.null2String(params.get("billId"));
// 更新DISC表中统计各项汇总
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_recruit_disc where id = ? ", billId);
if (rs.next()) {
int countD = 0;
int countI = 0;
int countS = 0;
int countC = 0;
Map<String, Object> dataMap = new IgnoreCaseHashMap<>();
String[] columnNames = rs.getColumnName();
for (String columnName : columnNames) {
Matcher matcher = AddDiscExpand.PATTERN.matcher(columnName);
if (matcher.matches()) {
String value = rs.getString(columnName);
if ("0".equals(value)) {
countD++;
} else if ("1".equals(value)) {
countI++;
} else if ("2".equals(value)) {
countS++;
} else if ("3".equals(value)) {
countC++;
}
}
}
rs.executeUpdate("update uf_recruit_disc set dxhj = ? ,ixhj = ?, sxhj = ?, cxhj = ? where id = ? ", countD, countI, countS, countC, billId);
} else {
throw new CustomizeRunTimeException("数据异常提交失败请联系HR");
}
return null;
}
}

@ -0,0 +1,320 @@
package com.engine.mzg.util;
import com.api.mobilemode.util.FieldHandler;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import com.engine.mzg.conn.RecruitCommon;
import com.weaver.formmodel.data.manager.FormInfoManager;
import com.weaver.formmodel.data.model.Formfield;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.IOUtils;
import weaver.common.MessageUtil;
import weaver.conn.RecordSet;
import weaver.docs.docs.*;
import weaver.email.EmailWorkRunnable;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.resource.ResourceComInfo;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author:dxfeng
* @createTime: 2023/09/26
* @version: 1.0
*/
public class RecruitUtil {
/**
*
*/
private static final Pattern EMAIL_PATTERN = Pattern.compile(Pattern.quote("{") + "(.*?)" + Pattern.quote("}"));
/**
*
*/
private static final Pattern MSG_PATTERN = Pattern.compile(Pattern.quote("$") + "(.*?)" + Pattern.quote("$"));
public static boolean sendEmail(String sendTo, String emailTitle, String emailContent) {
return MessageUtil.sendEmail(sendTo, emailTitle, emailContent);
}
/**
* @param sendTo
* @param emailTitle
* @param emailContent
* @param imageFileIds imageFileid
* @return
*/
public static boolean sendEmailWithFile(String sendTo, String emailTitle, String emailContent, String imageFileIds) {
EmailWorkRunnable emailWorkRunnable = new EmailWorkRunnable(sendTo, Util.toHtmlMode(emailTitle), Util.toHtmlMode(emailContent));
emailWorkRunnable.setImagefileids(imageFileIds);
return emailWorkRunnable.emailCommonRemind();
}
/**
*
*
* @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) {
messagePush(messageType, title, context, userIdList, creater, "", "");
}
/**
* @param messageType
* @param title
* @param context
* @param userIdList ID
* @param creater
* @param linkUrl
* @param linkMobileUrl
*/
public static void messagePush(String messageType, String title, String context, Set<String> userIdList, Integer creater, String linkUrl, String linkMobileUrl) {
MessageType message = MessageType.newInstance(Integer.parseInt(messageType));
try {
MessageBean messageBean = Util_Message.createMessage(message, userIdList, title, context, linkUrl, linkMobileUrl);
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);
}
}
/**
* null
*
* @param str
* @return
*/
public static Object parseBlankToNull(String str) {
return StringUtils.isBlank(str) ? null : str;
}
/**
* null
*
* @param obj
* @return
*/
public static String parseBlankToNull(Object obj) {
return Objects.isNull(obj) ? null : StringUtils.isBlank(obj.toString()) ? null : obj.toString();
}
/**
* ID
*
* @param inputStream
* @param filename
* @return
*/
public static int generateImageFileId(InputStream inputStream, String filename) {
int imageFileId;
try {
byte[] bytes = IOUtils.toByteArray(inputStream);
ImageFileManager ifm = new ImageFileManager();
ifm.setData(bytes);
ifm.setImagFileName(filename);
imageFileId = ifm.saveImageFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
return imageFileId;
}
public static List<Formfield> getFieldList(String tableName) {
int formId = RecruitCommon.getFormIdByTableName(tableName);
return FormInfoManager.getInstance().getAllField(formId);
}
public static String getFieldShowName(Formfield formfield, String fieldValue) {
User user = new User(1);
return FieldHandler.getFieldValue(fieldValue, formfield, true, user);
}
public static String getReplaceContent(String content, Map<String, List<Formfield>> fieldMapList, Map<String, Object> paramsData) {
Matcher matcher = EMAIL_PATTERN.matcher(content);
// 指定要匹配的字符串
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String replace = matcher.group(1);
List<Formfield> formFieldList = fieldMapList.get(replace);
if (CollectionUtils.isEmpty(formFieldList)) {
continue;
}
// 多个相同名称的字段,只取第一个
Formfield formfield = formFieldList.get(0);
String replaceValue = Util.null2String(paramsData.get(formfield.getFieldname().toLowerCase()));
String fieldShowName = RecruitUtil.getFieldShowName(formfield, replaceValue).replaceAll("<[^>]*>", "");
matcher.appendReplacement(sb, Util.null2String(fieldShowName));
}
matcher.appendTail(sb);
return sb.toString();
}
/**
*
*
* @param content
* @param fieldMap
* @param paramsData
* @return
*/
public static String getMsgReplaceStr(String content, Map<String, Formfield> fieldMap, Map<String, Object> paramsData) {
Matcher matcher = MSG_PATTERN.matcher(content);
// 指定要匹配的字符串
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
String replace = matcher.group(1);
Formfield formfield = fieldMap.get(replace);
String replaceValue = Util.null2String(paramsData.get(formfield.getFieldname().toLowerCase()));
String fieldShowName = RecruitUtil.getFieldShowName(formfield, replaceValue).replaceAll("<[^>]*>", "");
matcher.appendReplacement(sb, Util.null2String(fieldShowName));
}
matcher.appendTail(sb);
return sb.toString();
}
/**
* imageFieldIddocId
*
* @param secCategory
* @param imageFieldId
* @param user
* @return
* @throws Exception
*/
public static int createDocId(int secCategory, int imageFieldId, User user) throws Exception {
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(imageFieldId);
String filenameqc = manager.getImageFileName();
String filenamebc = filenameqc.substring(0, filenameqc.lastIndexOf("."));
RecordSet rs = new RecordSet();
DocManager dm = new DocManager();
DocImageManager imgManger = new DocImageManager();
imgManger.setDocfiletype("2");
int docId = dm.getNextDocId(rs);
imgManger.setDocid(docId);
imgManger.setImagefileid(imageFieldId);
imgManger.setImagefilename(filenameqc);
imgManger.setIsextfile("1");
imgManger.AddDocImageInfo();
String date = TimeUtil.getCurrentDateString();
String time = TimeUtil.getOnlyCurrentTimeString();
dm.setId(docId);
dm.setMaincategory(0);
dm.setSubcategory(0);
dm.setSeccategory(secCategory);
dm.setLanguageid(user.getLanguage());
dm.setDocstatus("1");
dm.setDocsubject(filenamebc);
dm.setDoccreaterid(user.getUID());
dm.setDocCreaterType(user.getLogintype());
dm.setUsertype(user.getLogintype());
dm.setOwnerid(user.getUID());
dm.setOwnerType(user.getLogintype());
dm.setDoclastmoduserid(user.getUID());
dm.setDocLastModUserType(user.getLogintype());
dm.setDoccreatedate(date);
dm.setDoclastmoddate(date);
dm.setDoccreatetime(time);
dm.setDoclastmodtime(time);
dm.setDoclangurage(user.getLanguage());
dm.setKeyword(filenameqc);
dm.setIsapprover("0");
dm.setIsreply("");
dm.setDocdepartmentid(user.getUserDepartment());
dm.setDocreplyable("1");
dm.setAccessorycount(1);
dm.setParentids("" + docId);
dm.setUserid(user.getUID());
DocCoder docCoder = new DocCoder();
dm.setDocCode(docCoder.getDocCoder("" + secCategory));
dm.setDocEditionId(dm.getNextEditionId(rs));
dm.setDocEdition(1);
dm.AddDocInfo();
dm.AddShareInfo();
DocViewer DocViewer = new DocViewer();
DocViewer.setDocShareByDoc("" + docId);
DocComInfo dc = new DocComInfo();
dc.addDocInfoCache("" + docId);
return docId;
}
public static String getImageFileIdsByDocIds(String docId) {
if (StringUtils.isBlank(docId)) {
return "";
}
List<String> imageFileIds = new ArrayList<>();
String[] split = docId.split(",");
try {
for (String s : split) {
if (StringUtils.isBlank(s)) {
continue;
}
DocImageManager imgManger = new DocImageManager();
imgManger.setDocid(Integer.parseInt(s));
imgManger.selectDocImageInfo();
imgManger.next();
imageFileIds.add(imgManger.getImagefileid());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return StringUtils.join(imageFileIds, ",");
}
/**
*
*
* @param id
*/
public static String getEmailTitle(String id) {
RecordSet recordSet = new RecordSet();
String emailTitle = "";
recordSet.executeQuery("select yjzt from uf_jcl_yjtzmb where id = ?", id);
if (recordSet.next()) {
emailTitle = recordSet.getString("yjzt");
}
return emailTitle;
}
}

@ -0,0 +1,40 @@
package com.engine.mzg.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.mzg.service.RecruitMobileService;
import com.engine.mzg.service.impl.RecruitMobileServiceImpl;
import com.engine.mzg.util.ResponseResult;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2024/09/05
* @version: 1.0
*/
public class RecruitMobileController {
public RecruitMobileService getService(User user) {
return ServiceUtil.getService(RecruitMobileServiceImpl.class, user);
}
@GET
@Path("/submitDiscTest")
@Produces(MediaType.APPLICATION_JSON)
public String submitDiscTest(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> params = ParamUtil.request2Map(request);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::submitDiscTest, params);
}
}

@ -0,0 +1,72 @@
package weaver.formmode.mzg.modeexpand.disc;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
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.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author:dxfeng
* @createTime: 2024/09/02
* @version: 1.0
*/
public class AddDiscExpand extends AbstractModeExpandJavaCodeNew {
public static final Pattern PATTERN = Pattern.compile("^q([1-9]|[1-3][0-9]|40)$");
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<>();
try {
int billId;
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) {
// 计算各个选项的值
int countD = 0;
int countI = 0;
int countS = 0;
int countC = 0;
RecordSet rs = new RecordSet();
MainTableInfo mainTableInfo = requestInfo.getMainTableInfo();
Property[] properties = mainTableInfo.getProperty();
for (Property property : properties) {
String name = property.getName();
Matcher matcher = PATTERN.matcher(name);
if (!matcher.matches()) {
continue;
}
if ("0".equals(property.getValue())) {
countD++;
} else if ("1".equals(property.getValue())) {
countI++;
} else if ("2".equals(property.getValue())) {
countS++;
} else if ("3".equals(property.getValue())) {
countC++;
}
}
// 更新各个选项的个数
rs.executeUpdate("update uf_recruit_disc set dxhj = ? ,ixhj = ?, sxhj = ?, cxhj = ? where id = ? ", countD, countI, countS, countC, billId);
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
result.put("errmsg", "DISC数据统计异常");
result.put("flag", "false");
}
return result;
}
}

@ -0,0 +1,118 @@
package weaver.formmode.mzg.modeexpand.resume;
import com.engine.mzg.conn.RecruitCommon;
import com.engine.mzg.conn.RecruitRecordSet;
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.BaseBean;
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.UUID;
import java.util.stream.Collectors;
/**
* DISC
*
* @author:dxfeng
* @createTime: 2024/09/05
* @version: 1.0
*/
public class SendDiscExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
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());
}
RecordSet rs = new RecordSet();
String mobileAppidDisc = RecruitCommon.getSettingValue("MOBILE_APPID_DISC");
String mobileUrlDisc = RecruitCommon.getSettingValue("MOBILE_URL_DISC");
String httpUrl = RecruitCommon.getSettingValue("HTTP_URL");
rs.executeQuery("select noLoginUser from mobileappbaseinfo where id = ?", mobileAppidDisc);
int creator = -1;
if (rs.next()) {
creator = rs.getInt("noLoginUser");
}
if (-1 == creator) {
throw new CustomizeRunTimeException("未配置免登陆访问用户,请检查移动建模应用配置");
}
String sendTo = Util.null2String(mainDataMap.get("dzyx"));
if (StringUtils.isBlank(sendTo)) {
throw new CustomizeRunTimeException("电子邮箱为空,邮件发送失败");
}
String emailTitle = "";
String emailContent = "";
rs.executeQuery("select yjzt ,yjnr from uf_recruit_email where mblx =? ", EmailTemplateEnum.DISC.getValue());
if (rs.next()) {
emailTitle = rs.getString("yjzt");
emailContent = rs.getString("yjnr");
}
if (StringUtils.isBlank(emailTitle) || StringUtils.isBlank(emailContent)) {
throw new CustomizeRunTimeException("请检查邮件模板设置");
}
// 插入DISC测评表数据
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
String uuid = UUID.randomUUID().toString();
dataMap.put("modeuuid", uuid);
int formModeId = RecruitCommon.getModeIdByTableName("uf_recruit_disc");
dataMap.put("formmodeid", formModeId);
// 构建建模表基本数据
RecruitRecordSet.buildModeInsertFields(dataMap, creator);
dataMap.put("xm", billId);
dataMap.put("sqzw", mainDataMap.get("sqzw"));
dataMap.put("lxfs", mainDataMap.get("lxfs"));
dataMap.put("modedatastatus", "0");
// 插入数据
RecruitRecordSet.insertData(dataMap, "uf_recruit_disc");
int id = RecruitRecordSet.refreshRight(uuid, "uf_recruit_disc", formModeId, creator);
// 测评ID反写简历中心表,更新状态
rs.executeUpdate("update uf_recruit_resume set cpzt = ? ,cpglid = ? where id = ? ", 1, id, billId);
// 发送邮件
// 查询字段信息
List<Formfield> fieldList = RecruitUtil.getFieldList("uf_recruit_resume");
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getFieldname));
String url = httpUrl + mobileUrlDisc + "&billid=" + id;
if (StringUtils.isNotBlank(url)) {
url = "<span><a href='" + url + "' target='_blank'>链接地址</a></span>";
}
emailContent = emailContent.replace("{链接地址}", url);
emailContent = RecruitUtil.getReplaceContent(emailContent, fieldMapList, mainDataMap);
RecruitUtil.sendEmail(sendTo, emailTitle, emailContent);
}
} catch (Exception e) {
new BaseBean().writeLog(e);
result.put("errmsg", e.getMessage());
result.put("flag", "false");
}
return result;
}
}

@ -0,0 +1,119 @@
package weaver.formmode.mzg.modeexpand.resume;
import com.engine.mzg.conn.RecruitCommon;
import com.engine.mzg.conn.RecruitRecordSet;
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.BaseBean;
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.UUID;
import java.util.stream.Collectors;
/**
*
*
* @author:dxfeng
* @createTime: 2024/09/05
* @version: 1.0
*/
public class SendRegistExpand extends AbstractModeExpandJavaCodeNew {
@Override
public Map<String, String> doModeExpand(Map<String, Object> param) {
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());
}
RecordSet rs = new RecordSet();
String mobileAppidRegist = RecruitCommon.getSettingValue("MOBILE_APPID_REGIST");
String mobileUrlRegist = RecruitCommon.getSettingValue("MOBILE_URL_REGIST");
String httpUrl = RecruitCommon.getSettingValue("HTTP_URL");
rs.executeQuery("select noLoginUser from mobileappbaseinfo where id = ?", mobileAppidRegist);
int creator = -1;
if (rs.next()) {
creator = rs.getInt("noLoginUser");
}
if (-1 == creator) {
throw new CustomizeRunTimeException("未配置免登陆访问用户,请检查移动建模应用配置");
}
String sendTo = Util.null2String(mainDataMap.get("dzyx"));
if (StringUtils.isBlank(sendTo)) {
throw new CustomizeRunTimeException("电子邮箱为空,邮件发送失败");
}
String emailTitle = "";
String emailContent = "";
rs.executeQuery("select yjzt ,yjnr from uf_recruit_email where mblx =? ", EmailTemplateEnum.REGIST.getValue());
if (rs.next()) {
emailTitle = rs.getString("yjzt");
emailContent = rs.getString("yjnr");
}
if (StringUtils.isBlank(emailTitle) || StringUtils.isBlank(emailContent)) {
throw new CustomizeRunTimeException("请检查邮件模板设置");
}
// 插入应聘登记数据
IgnoreCaseHashMap<String, Object> dataMap = new IgnoreCaseHashMap<>();
String uuid = UUID.randomUUID().toString();
dataMap.put("modeuuid", uuid);
int formModeId = RecruitCommon.getModeIdByTableName("uf_recruit_regist");
dataMap.put("formmodeid", formModeId);
// 构建建模表基本数据
RecruitRecordSet.buildModeInsertFields(dataMap, creator);
dataMap.put("xmzw", mainDataMap.get("xm"));
dataMap.put("sqzw", mainDataMap.get("sqzw"));
dataMap.put("lldh", mainDataMap.get("lxfs"));
//dataMap.put("modedatastatus", "0");
// 插入数据
RecruitRecordSet.insertData(dataMap, "uf_recruit_regist");
int id = RecruitRecordSet.refreshRight(uuid, "uf_recruit_regist", formModeId, creator);
// 测评ID反写简历中心表,更新状态
rs.executeUpdate("update uf_recruit_resume set xxcjzt = ? ,ypdjid = ? where id = ? ", 1, id, billId);
// 发送邮件
// 查询字段信息
List<Formfield> fieldList = RecruitUtil.getFieldList("uf_recruit_resume");
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getFieldname));
String url = httpUrl + mobileUrlRegist + "&billid=" + id;
if (StringUtils.isNotBlank(url)) {
url = "<span><a href='" + url + "' target='_blank'>链接地址</a></span>";
}
emailContent = emailContent.replace("{链接地址}", url);
emailContent = RecruitUtil.getReplaceContent(emailContent, fieldMapList, mainDataMap);
RecruitUtil.sendEmail(sendTo, emailTitle, emailContent);
}
} catch (Exception e) {
new BaseBean().writeLog(e);
result.put("errmsg", e.getMessage());
result.put("flag", "false");
}
return result;
}
}
Loading…
Cancel
Save