generated from dxfeng/secondev-chapanda-feishu
ADD-offer邮件预览功能
This commit is contained in:
parent
a2a1fe9676
commit
2b053ff154
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.recruit.controller;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/05/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/jcl/recruit/offer")
|
||||
public class RecruitOfferController extends com.engine.recruit.controller.RecruitOfferController{
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.engine.recruit.controller;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.recruit.util.ResponseResult;
|
||||
import com.engine.recruit.wrapper.RecruitOfferWrapper;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.POST;
|
||||
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/05/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitOfferController {
|
||||
public RecruitOfferWrapper getRecruitOfferWrapper(User user) {
|
||||
return ServiceUtil.getService(RecruitOfferWrapper.class, user);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/updatePreContent")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String updatePreContent(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> param = ParamUtil.request2Map(request);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getRecruitOfferWrapper(user)::updatePreContent, param);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.engine.recruit.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/05/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface RecruitOfferService {
|
||||
|
||||
/**
|
||||
* 更新offer邮件预览内容
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> updatePreContent(Map<String, Object> param);
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.engine.recruit.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.exception.CustomizeRunTimeException;
|
||||
import com.engine.recruit.service.RecruitOfferService;
|
||||
import com.weaver.formmodel.data.model.Formfield;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.recruit.modeexpand.offer.CreateOfferModeExpand;
|
||||
import weaver.formmode.recruit.modeexpand.util.RecruitModeUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/05/20
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitOfferServiceImpl extends Service implements RecruitOfferService {
|
||||
@Override
|
||||
public Map<String, Object> updatePreContent(Map<String, Object> param) {
|
||||
String urlInfoStr = Util.null2String(param.get("urlInfo"));
|
||||
String submitDataStr = Util.null2String(param.get("submitData"));
|
||||
JSONObject urlInfo = JSONObject.parseObject(urlInfoStr);
|
||||
JSONObject submitData = JSONObject.parseObject(submitDataStr);
|
||||
String billId = Util.null2String(urlInfo.get("billid"));
|
||||
List<Formfield> fieldList = RecruitModeUtil.getFieldList("uf_jcl_offer");
|
||||
Map<String, String> fieldIdMap = fieldList.stream().collect(Collectors.toMap(item -> "field" + item.getId()
|
||||
, Formfield::getFieldname));
|
||||
Map<String, Object> mainDataMap = new HashMap<>();
|
||||
Map<String,Object> innerMap = submitData.getInnerMap();
|
||||
for (Map.Entry<String,Object> entry : innerMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = Util.null2String(entry.getValue());
|
||||
mainDataMap.put(fieldIdMap.get(key), value);
|
||||
}
|
||||
String tznr = Util.null2String(mainDataMap.get("tznr"));
|
||||
String yx = Util.null2String(mainDataMap.get("dzyx"));
|
||||
String msgContent = CreateOfferModeExpand.getOfferMsgContent(billId, fieldList, mainDataMap, tznr, yx);
|
||||
|
||||
RecordSet rs = new RecordSet();
|
||||
// 更新
|
||||
rs.executeUpdate("update uf_jcl_offer set ylnr = ? where id = ? ", msgContent, billId);
|
||||
String exceptionMsg = rs.getExceptionMsg();
|
||||
if (StringUtils.isNotBlank(exceptionMsg)) {
|
||||
throw new CustomizeRunTimeException(exceptionMsg);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.engine.recruit.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.recruit.service.RecruitOfferService;
|
||||
import com.engine.recruit.service.impl.RecruitOfferServiceImpl;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2024/05/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class RecruitOfferWrapper extends Service {
|
||||
private RecruitOfferService getRecruitOfferService(User user) {
|
||||
return ServiceUtil.getService(RecruitOfferServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> updatePreContent(Map<String, Object> param) {
|
||||
return getRecruitOfferService(user).updatePreContent(param);
|
||||
}
|
||||
}
|
||||
|
|
@ -59,12 +59,7 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
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 = RecruitConstant.OFFER_MOBILE_URL + "&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);
|
||||
String msgContent = getOfferMsgContent(String.valueOf(billId), fieldList, mainDataMap, tznr, yx);
|
||||
|
||||
if (sendEmail) {
|
||||
String offerAttach = RecruitModeUtil.getImageFileIdsByDocIds(Util.null2String(mainDataMap.get("offerfj")));
|
||||
|
|
@ -95,4 +90,23 @@ public class CreateOfferModeExpand extends AbstractModeExpandJavaCodeNew {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取offer邮件通知内容
|
||||
*
|
||||
* @param billId
|
||||
* @param fieldList
|
||||
* @param mainDataMap
|
||||
* @param tznr
|
||||
* @param yx
|
||||
* @return
|
||||
*/
|
||||
public static String getOfferMsgContent(String billId, List<Formfield> fieldList, Map<String, Object> mainDataMap, String tznr, String yx) {
|
||||
Map<String, List<Formfield>> fieldMapList = fieldList.stream().collect(Collectors.groupingBy(Formfield::getLabelName));
|
||||
// 发送邮件
|
||||
String offerMobileUrl = RecruitConstant.OFFER_MOBILE_URL + "&billid=" + billId + "&dzyx=" + yx;
|
||||
String mobileLink = "<span color='red'><a href='" + offerMobileUrl + "' target='_blank'>录用通知函</a></span>";
|
||||
tznr = tznr.replace("{录用通知函}", mobileLink);
|
||||
return RecruitModeUtil.getReplaceContent(tznr, fieldMapList, mainDataMap);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue