|
@@ -14,6 +14,7 @@ import com.ruoyi.web.work.domain.Position;
|
|
|
import com.ruoyi.web.work.domain.Resume;
|
|
|
import com.ruoyi.web.work.domain.ResumeDeliver;
|
|
|
import com.ruoyi.web.work.domain.dto.ResumeDeliverDto;
|
|
|
+import com.ruoyi.web.work.domain.dto.ResumeInviteDto;
|
|
|
import com.ruoyi.web.work.domain.vo.ReceiveListVo;
|
|
|
import com.ruoyi.web.work.domain.vo.ReceiveVo;
|
|
|
import com.ruoyi.web.work.mapper.ResumeDeliverMapper;
|
|
@@ -22,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -58,14 +60,14 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
if (AppUtil.getUser().getIsAuthentication() != 1) {
|
|
|
return AjaxResult.error(7878, "您需要实名认证才能投递简历");
|
|
|
}
|
|
|
+ Resume resume = resumeService.getById(AppUtil.getUser().getId());
|
|
|
+ if (StringUtils.isEmpty(resume.getName())) {
|
|
|
+ return AjaxResult.error(7979, "请先完善简历再投递");
|
|
|
+ }
|
|
|
Position position = positionService.getById(id);
|
|
|
if (position == null || position.getState() != 0 || position.getAudit() != 1) {
|
|
|
return AjaxResult.error("该职位不存在或已下架");
|
|
|
}
|
|
|
- Resume resume = resumeService.getById(AppUtil.getUser().getId());
|
|
|
- if (StringUtils.isEmpty(resume.getName()) || StringUtils.isEmpty(resume.getAvatar())) {
|
|
|
- return AjaxResult.error(7979, "请先完善简历再投递");
|
|
|
- }
|
|
|
ResumeDeliver resumeDeliver = resumeDeliverMapper.check(position.getId(), AppUtil.getUser().getId());
|
|
|
if (resumeDeliver != null) {
|
|
|
return AjaxResult.error("请勿重复投递简历");
|
|
@@ -75,6 +77,7 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
resumeDeliver.setType(position.getType());
|
|
|
resumeDeliver.setPositionId(position.getId());
|
|
|
resumeDeliver.setEnterpriseId(position.getUserId());
|
|
|
+ resumeDeliver.setOpenId(AppUtil.getUser().getOpenId());
|
|
|
if (!save(resumeDeliver)) {
|
|
|
throw new ServiceException("投递简历失败");
|
|
|
}
|
|
@@ -95,8 +98,8 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult invite(Long id) {
|
|
|
- ResumeDeliver resumeDeliver = getById(id);
|
|
|
+ public AjaxResult invite(ResumeInviteDto dto) throws ParseException {
|
|
|
+ ResumeDeliver resumeDeliver = getById(dto.getId());
|
|
|
if (resumeDeliver == null || !resumeDeliver.getEnterpriseId().equals(AppUtil.getUser().getId())) {
|
|
|
return AjaxResult.error("简历不存在或非法操作");
|
|
|
}
|
|
@@ -110,10 +113,24 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
return AjaxResult.error("已发送邀请,等待求职者同意");
|
|
|
}
|
|
|
resumeDeliver.setState(1);
|
|
|
+ resumeDeliver.setInviteTime(dto.getInviteTime());
|
|
|
if (!updateById(resumeDeliver)) {
|
|
|
- throw new ServiceException("发生面试邀请失败");
|
|
|
+ throw new ServiceException("发送面试邀请失败");
|
|
|
}
|
|
|
+ sendMessage(resumeDeliver);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public AjaxResult complete(Long id) {
|
|
|
+ ResumeDeliver resumeDeliver = getById(id);
|
|
|
+ if (resumeDeliver == null || !resumeDeliver.getEnterpriseId().equals(AppUtil.getUser().getId())) {
|
|
|
+ return AjaxResult.error("简历不存在或非法操作");
|
|
|
+ }
|
|
|
+ resumeDeliver.setIsAccept(3);
|
|
|
+ if (!updateById(resumeDeliver)) {
|
|
|
+ throw new ServiceException("操作面试失败");
|
|
|
+ }
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
@@ -154,39 +171,26 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void sendMessage(ResumeDeliver resumeDeliver) {
|
|
|
+ public void sendMessage(ResumeDeliver resumeDeliver) throws ParseException {
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(HttpUtil.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + env.getProperty("wx.appid") + "&secret=" + env.getProperty("wx.appSecret")));
|
|
|
JSONObject body = new JSONObject();
|
|
|
body.set("touser", resumeDeliver.getOpenId());
|
|
|
- //面试邀请
|
|
|
+ body.set("appid", env.getProperty("wx.appid"));
|
|
|
+ JSONObject content = new JSONObject();
|
|
|
+ //面试邀请通知
|
|
|
if (resumeDeliver.getState() == 1 && resumeDeliver.getIsAccept() == 0) {
|
|
|
Position position = positionService.getById(resumeDeliver.getPositionId());
|
|
|
- Enterprise enterprise=enterpriseService.getById(resumeDeliver.getUserId());
|
|
|
- body.set("template_id", "Oh-CCL-nAh6kciX0fmIU2AfldccqOr88DYl0VMg97ZI");
|
|
|
- JSONObject content = new JSONObject();
|
|
|
- content.set("thing1", new JSONObject().set("value", position.getTitle()));
|
|
|
- content.set("thing2", new JSONObject().set("value", position.getAddress() + position.getMph()));
|
|
|
- content.set("time3", new JSONObject().set("value", DateUtils.datetoString(resumeDeliver.getInviteTime())));
|
|
|
- content.set("thing4", new JSONObject().set("value", enterprise.getName()));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-/* if (order.getState() == 3) {
|
|
|
- content.set("phrase2", new JSONObject().set("value", "完成交易"));
|
|
|
- content.set("time3", new JSONObject().set("value", DateUtils.dateToString(order.getOrderCompleteTime())));
|
|
|
- }
|
|
|
- if (order.getState() == -1) {
|
|
|
- content.set("phrase2", new JSONObject().set("value", "退款成功"));
|
|
|
- content.set("time3", new JSONObject().set("value", DateUtils.dateToString(order.getPayRefundTime())));
|
|
|
+ Enterprise enterprise = enterpriseService.getById(resumeDeliver.getUserId());
|
|
|
+ body.set("template_id", "ll-qdaEgbDN4rEod0nJpsjUuSqHT9e12EniZfRPiNqM");
|
|
|
+ body.set("page", "pages/user/resume/deliver/invite");
|
|
|
+ content.set("thing5", new JSONObject().set("value", enterprise.getName()));//公司名称
|
|
|
+ content.set("thing1", new JSONObject().set("value", position.getTitle()));//职位
|
|
|
+ content.set("time3", new JSONObject().set("value", DateUtils.formatDate(resumeDeliver.getInviteTime())));//面试时间
|
|
|
+ content.set("thing4", new JSONObject().set("value", StringUtils.truncateString(position.getAddress(), 15))); //面试地点
|
|
|
}
|
|
|
- content.set("character_string4", new JSONObject().set("value", order.getOrderNum()));
|
|
|
- content.set("amount5", new JSONObject().set("value", order.getTotalPrice()));
|
|
|
body.set("data", content);
|
|
|
String result = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + jsonObject.getStr("access_token"), body.toString());
|
|
|
- System.out.println("订单信息:" + content.toString());
|
|
|
- System.out.println("订单信息:" + order.toString());
|
|
|
+ System.out.println("body:" + body);
|
|
|
System.out.println("小程序订阅消息:" + result);
|
|
|
- return result;
|
|
|
- return false;*/
|
|
|
}
|
|
|
}
|