|
@@ -1,10 +1,15 @@
|
|
|
package com.ruoyi.web.work.service.impl;
|
|
|
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.web.work.api.util.AppUtil;
|
|
|
+import com.ruoyi.web.work.domain.Enterprise;
|
|
|
import com.ruoyi.web.work.domain.Position;
|
|
|
import com.ruoyi.web.work.domain.Resume;
|
|
|
import com.ruoyi.web.work.domain.ResumeDeliver;
|
|
@@ -12,10 +17,9 @@ import com.ruoyi.web.work.domain.dto.ResumeDeliverDto;
|
|
|
import com.ruoyi.web.work.domain.vo.ReceiveListVo;
|
|
|
import com.ruoyi.web.work.domain.vo.ReceiveVo;
|
|
|
import com.ruoyi.web.work.mapper.ResumeDeliverMapper;
|
|
|
-import com.ruoyi.web.work.service.IPositionService;
|
|
|
-import com.ruoyi.web.work.service.IResumeDeliverService;
|
|
|
-import com.ruoyi.web.work.service.IResumeService;
|
|
|
+import com.ruoyi.web.work.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -35,6 +39,15 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
@Autowired
|
|
|
private IResumeService resumeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IEnterpriseService enterpriseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Environment env;
|
|
|
+
|
|
|
@Override
|
|
|
public List<ResumeDeliver> selectList(ResumeDeliver resumeDeliver) {
|
|
|
return resumeDeliverMapper.selectList(resumeDeliver);
|
|
@@ -100,6 +113,7 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
if (!updateById(resumeDeliver)) {
|
|
|
throw new ServiceException("发生面试邀请失败");
|
|
|
}
|
|
|
+
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
@@ -138,4 +152,41 @@ public class ResumeDeliverServiceImpl extends ServiceImpl<ResumeDeliverMapper, R
|
|
|
public List<ReceiveListVo> receiveList(ResumeDeliver resumeDeliver) {
|
|
|
return resumeDeliverMapper.receiveList(resumeDeliver);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void sendMessage(ResumeDeliver resumeDeliver) {
|
|
|
+ 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());
|
|
|
+ //面试邀请
|
|
|
+ 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())));
|
|
|
+ }
|
|
|
+ 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("小程序订阅消息:" + result);
|
|
|
+ return result;
|
|
|
+ return false;*/
|
|
|
+ }
|
|
|
}
|