Commit 58a9325d by 284718418@qq.com

招聘管理-发送面试通知

parent 8de82096
package cn.timer.api.bean.wechat;
/**
* 8小时企业管理
* 公众号模板消息
*
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022-04-18 15:14:40
*/
public class MessageTemplate {
/**
* 通知面试官
* 面试安排提醒
* {{first.DATA}}
* 面试职位:{{keyword1.DATA}}
* 面试时间:{{keyword2.DATA}}
* {{remark.DATA}}
*/
public static final String TEMPLATE_ID_TO_INTERVIEWER = "Uz6mVUYk9Tu7EO2V1pqiQ3x4EudDJTYWdaFtdf64h3M";
/**
* 通知面试者
* 面试提醒
* {{first.DATA}}
* 面试时间:{{keyword1.DATA}}
* 面试地点:{{keyword2.DATA}}
* {{remark.DATA}}
*/
public static final String TEMPLATE_ID_TO_INTERVIEWEE = "J5PkcWwJsti8ax0BBI9uhquPvV6NaqKrbHubavSvof0";
}
...@@ -345,5 +345,24 @@ public interface JxglEnumInterface { ...@@ -345,5 +345,24 @@ public interface JxglEnumInterface {
} }
} }
/**
* 招聘管理-面试流程:通知方式 1:全部 2:短信 3:邮件 4.微信公众号
*/
@Getter
enum NoticeWay implements JxglEnumInterface {
ALL(1, "全部"),
SHORT_MESSAGE(2, "短信"), EMAIL(3, "邮件"),
WECHAT_PUBLIC(4, "微信公众号");
private Integer type;
private String name;
NoticeWay(Integer type, String name) {
this.type = type;
this.name = name;
}
}
} }
package cn.timer.api.controller.verify; package cn.timer.api.controller.verify;
import cn.timer.api.utils.wxgzh.SignUtil;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
......
...@@ -514,7 +514,7 @@ public class ZpglController { ...@@ -514,7 +514,7 @@ public class ZpglController {
ZpglDtk zpglDtk = ZpglDtk.builder().build().selectOne(new QueryWrapper<ZpglDtk>().lambda().eq(ZpglDtk::getZpglRcxxId, zpglRcxxId)); ZpglDtk zpglDtk = ZpglDtk.builder().build().selectOne(new QueryWrapper<ZpglDtk>().lambda().eq(ZpglDtk::getZpglRcxxId, zpglRcxxId));
// offer // offer
ZpglRcxxOffer zpglRcxxOffer = ZpglRcxxOffer.builder().build().selectOne(new QueryWrapper<ZpglRcxxOffer>().lambda().eq(ZpglRcxxOffer::getZpglRcxxId, zpglRcxxId).eq(ZpglRcxxOffer::getDeleteFlag, 0)); ZpglRcxxOffer zpglRcxxOffer = ZpglRcxxOffer.builder().build().selectOne(new QueryWrapper<ZpglRcxxOffer>().lambda().eq(ZpglRcxxOffer::getZpglRcxxId, zpglRcxxId).eq(ZpglRcxxOffer::getDeleteFlag, 0).orderByDesc(ZpglRcxxOffer::getCreateTime));
Map<String, Object> map = new HashMap<>(7); Map<String, Object> map = new HashMap<>(7);
map.put("zpglRcxx", zpglRcxx); map.put("zpglRcxx", zpglRcxx);
......
...@@ -6,9 +6,8 @@ import cn.timer.api.bean.qyzx.QyzxEmpLogin; ...@@ -6,9 +6,8 @@ import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zpgl.ZpglRcxx; import cn.timer.api.bean.zpgl.ZpglRcxx;
import cn.timer.api.bean.zpgl.ZpglWxgzptEmpRcxx; import cn.timer.api.bean.zpgl.ZpglWxgzptEmpRcxx;
import cn.timer.api.controller.zpgl.sevice.ZpglWxgzptService; import cn.timer.api.controller.zpgl.sevice.ZpglWxgzptServiceImpl;
import cn.timer.api.dto.template.TemplateData; import cn.timer.api.dto.template.TemplateData;
import cn.timer.api.dto.template.TemplateMessage;
import cn.timer.api.dto.wxgzh.LoginDto; import cn.timer.api.dto.wxgzh.LoginDto;
import cn.timer.api.dto.wxgzh.MessageQueueDto; import cn.timer.api.dto.wxgzh.MessageQueueDto;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -19,7 +18,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -19,7 +18,6 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -31,9 +29,7 @@ import org.springframework.web.servlet.ModelAndView; ...@@ -31,9 +29,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import javax.transaction.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -58,7 +54,7 @@ public class ZpglWxgzptController { ...@@ -58,7 +54,7 @@ public class ZpglWxgzptController {
public static final String OAUTH_GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code"; public static final String OAUTH_GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
@Resource @Resource
private ZpglWxgzptService zpglWxgzptService; private ZpglWxgzptServiceImpl zpglWxgzptService;
@Resource @Resource
private RedisUtil redisUtil; private RedisUtil redisUtil;
......
...@@ -2,6 +2,7 @@ package cn.timer.api.controller.zpgl.sevice; ...@@ -2,6 +2,7 @@ package cn.timer.api.controller.zpgl.sevice;
import cn.timer.api.bean.clazz.SysRegion; import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.qyzx.QyzxEmpLogin; import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.wechat.MessageTemplate;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zpgl.*; import cn.timer.api.bean.zpgl.*;
import cn.timer.api.bean.zzgl.ZzglBmgwM; import cn.timer.api.bean.zzgl.ZzglBmgwM;
...@@ -11,6 +12,7 @@ import cn.timer.api.controller.kqgl.ClockInTool; ...@@ -11,6 +12,7 @@ import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.dto.baidu.*; import cn.timer.api.dto.baidu.*;
import cn.timer.api.bean.clazz.NationClass; import cn.timer.api.bean.clazz.NationClass;
import cn.timer.api.dto.email.SendMessageDto; import cn.timer.api.dto.email.SendMessageDto;
import cn.timer.api.dto.template.InterviewNotice;
import cn.timer.api.dto.zpgl.ImportCandidateDto; import cn.timer.api.dto.zpgl.ImportCandidateDto;
import cn.timer.api.dto.zpgl.ZpglRcxxDto; import cn.timer.api.dto.zpgl.ZpglRcxxDto;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -30,6 +32,7 @@ import org.springframework.stereotype.Service; ...@@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -57,6 +60,9 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -57,6 +60,9 @@ public class ZpglServiceImpl implements ZpglService {
@Autowired @Autowired
private ZpglMslcLogService zpglMslcLogService; private ZpglMslcLogService zpglMslcLogService;
@Autowired
private ZpglWxgzptServiceImpl zpglWxgzptService;
@Override @Override
public boolean updateZpglRcxx(UserBean userBean, ZpglRcxxDto zpglRcxxDto) { public boolean updateZpglRcxx(UserBean userBean, ZpglRcxxDto zpglRcxxDto) {
...@@ -204,6 +210,20 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -204,6 +210,20 @@ public class ZpglServiceImpl implements ZpglService {
zpglMslcLog.setDetail(detail); zpglMslcLog.setDetail(detail);
count = zpglRcxx.updateById(); count = zpglRcxx.updateById();
zpglMslcLogService.addZpglMslcLog(zpglMslcLog); zpglMslcLogService.addZpglMslcLog(zpglMslcLog);
// 发送面试通知
if(count && JxglEnumInterface.ResumeStatus.INTERVIEW.equals(zpglRcxxDto.getStatus()) && JxglEnumInterface.NoticeWay.WECHAT_PUBLIC.equals(zpglRcxxDto.getNoticeWay())){
InterviewNotice interviewNotice = new InterviewNotice();
interviewNotice.setName(zpglRcxxEntity.getName());
interviewNotice.setInterviewTime(zpglRcxxDto.getInterviewTime());
// 通知面试官
interviewNotice.setMobile("");
interviewNotice.setTemplateId(MessageTemplate.TEMPLATE_ID_TO_INTERVIEWER);
zpglWxgzptService.addInterviewMessageQueue(interviewNotice);
// 通知面试者
interviewNotice.setMobile(zpglRcxxEntity.getMobile());
interviewNotice.setTemplateId(MessageTemplate.TEMPLATE_ID_TO_INTERVIEWEE);
zpglWxgzptService.addInterviewMessageQueue(interviewNotice);
}
return count; return count;
} }
......
package cn.timer.api.controller.zpgl.sevice; package cn.timer.api.controller.zpgl.sevice;
import cn.hutool.http.HttpUtil;
import org.springframework.beans.factory.annotation.Value; import cn.timer.api.dto.template.InterviewNotice;
import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
...@@ -10,18 +9,20 @@ import java.util.Map; ...@@ -10,18 +9,20 @@ import java.util.Map;
* @author longys * @author longys
* @date 2022/3/25 18:08 * @date 2022/3/25 18:08
*/ */
@Service public interface ZpglWxgzptService {
public class ZpglWxgzptService {
@Value("${youling.serverUrl}")
private String serverUrl;
/** /**
* 添加消息队列 * 添加消息队列
* @param map * @param map
* @return * @return
*/ */
public String addMessageQueue(Map<String,Object> map){ String addMessageQueue(Map<String,Object> map);
return HttpUtil.post(serverUrl+"/wxgzh/addMessageQueue", map);
} /**
* 安排面试 通知面试官、面试者
* 添加消息队列
* @param interviewNotice
* @return
*/
String addInterviewMessageQueue(InterviewNotice interviewNotice);
} }
package cn.timer.api.controller.zpgl.sevice;
import cn.hutool.http.HttpUtil;
import cn.timer.api.bean.wechat.MessageTemplate;
import cn.timer.api.dto.template.InterviewNotice;
import cn.timer.api.dto.template.TemplateData;
import cn.timer.api.dto.wxgzh.MessageQueueDto;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author longys
* @date 2022/3/25 18:08
*/
@Slf4j
@Service
@Transactional(rollbackOn = Exception.class)
public class ZpglWxgzptServiceImpl implements ZpglWxgzptService {
@Value("${youling.serverUrl}")
private String serverUrl;
/**
* 添加消息队列
*
* @param map
* @return
*/
public String addMessageQueue(Map<String, Object> map) {
return HttpUtil.post(serverUrl + "/wxgzh/addMessageQueue", map);
}
/**
* 添加消息队列
*
* @param interviewNotice
* @return
*/
public String addInterviewMessageQueue(InterviewNotice interviewNotice) {
//消息队列对象
MessageQueueDto mqd = new MessageQueueDto();
BeanUtils.copyProperties(interviewNotice, mqd);
/** 模板消息内容 start */
List<TemplateData> templateData = new ArrayList<>();
if (MessageTemplate.TEMPLATE_ID_TO_INTERVIEWER.equals(interviewNotice.getTemplateId())) {
TemplateData key1 = new TemplateData("first", "您好," + interviewNotice.getZpglZwxxName() + interviewNotice.getName() + "已安排由您面试", "#000000");
templateData.add(key1);
} else if (MessageTemplate.TEMPLATE_ID_TO_INTERVIEWEE.equals(interviewNotice.getTemplateId())) {
TemplateData key1 = new TemplateData("first", "候选人" + interviewNotice.getName() + "你好!你所投递的" + interviewNotice.getZpglZwxxName() + "为你安排了面试", "#000000");
templateData.add(key1);
}
// 面试职位
TemplateData key2 = new TemplateData("keyword1", interviewNotice.getZpglZwxxName(), "#000000");
templateData.add(key2);
// 面试时间
TemplateData key3 = new TemplateData("keyword2", interviewNotice.getInterviewTime(), "#000000");
templateData.add(key3);
// 备注
TemplateData key4 = new TemplateData("remark", interviewNotice.getRemark(), "#000000");
templateData.add(key4);
//数据处理成固定好的json格式
String content = mqd.getContentJson(templateData);
mqd.setContent(content);
/** 模板消息内容 end */
/**
* //消息内容模板消息 json格式 普通消息字符串类型
* //手机号
* mqd.setMobile("18212310017");
* //类型(1 短信,2 邮件,3 微信模板消息)
* mqd.setType(2);
* //公众号类型 1:8小时企业管理 2:优领人才网
* mqd.setWxgzhType(1);
* //1 即时发送,2 定时发送
* mqd.setTiming(1);
* //模板id
* mqd.setTemplateId(interviewNotice.getTemplateId());
* //网页地址
* mqd.setUrl(null);
* //小程序页面地址
* mqd.setWxxcxPageId(null);
*/
Map map = JSON.parseObject(JSON.toJSONString(mqd), Map.class);
return HttpUtil.post(serverUrl + "/wxgzh/addMessageQueue", map);
}
}
package cn.timer.api.dto.template;
import cn.timer.api.dto.wxgzh.MessageQueueDto;
import cn.timer.api.utils.DateFormatUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InterviewNotice extends MessageQueueDto {
/**
* 面试者名字
*/
private String name;
/**
* 职位名称
*/
private String zpglZwxxName;
/**
* 面试时间
*/
private String interviewTime;
/**
* 备注
*/
private String remark;
public void setInterviewTime(Date interviewTime){
this.interviewTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(interviewTime);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment