lsw 11 hónapja
szülő
commit
a2017bbe67

+ 31 - 26
app/pages/job/detail.vue

@@ -78,34 +78,39 @@ export default {
 		},
 		//投递简历
 		send() {
-			this.http.request({
-				url: '/app/deliver/send/' + this.item.id,
-				success: (res) => {
-					//实名认证跳转
-					if (res.data.code == 7878) {
-						uni.showModal({
-							title: '提示',
-							content: res.data.msg,
-							showCancel: false,
-							success: (res) => {
-								uni.navigateTo({ url:'/pages/user/auth'});
+			uni.requestSubscribeMessage({
+				tmplIds: ['Oh-CCL-nAh6kciX0fmIU2AfldccqOr88DYl0VMg97ZI', 'Au3K-5T2Uc0P2km_Jl0QaMgdNRyjtJpBgHpeol9zRHo'],
+				complete: (c) => {
+					this.http.request({
+						url: '/app/deliver/send/' + this.item.id,
+						success: (res) => {
+							//实名认证跳转
+							if (res.data.code == 7878) {
+								uni.showModal({
+									title: '提示',
+									content: res.data.msg,
+									showCancel: false,
+									success: (res) => {
+										uni.navigateTo({ url: '/pages/user/auth' });
+									}
+								});
+								return;
 							}
-						});
-						return;
-					}
-					//完善简历跳转
-					if (res.data.code == 7979) {
-						uni.showModal({
-							title: '提示',
-							content: res.data.msg,
-							showCancel: false,
-							success: (res) => {
-								uni.navigateTo({ url: '/pages/user/resume/index' });
+							//完善简历跳转
+							if (res.data.code == 7979) {
+								uni.showModal({
+									title: '提示',
+									content: res.data.msg,
+									showCancel: false,
+									success: (res) => {
+										uni.navigateTo({ url: '/pages/user/resume/index' });
+									}
+								});
+								return;
 							}
-						});
-					} else {
-						uni.showModal({ content: '投递成功,等待企业回应', showCancel: false });
-					}
+							uni.showModal({ content: '投递成功,等待企业回应', showCancel: false });
+						}
+					});
 				}
 			});
 		},

+ 7 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/ResumeDeliver.java

@@ -28,6 +28,9 @@ public class ResumeDeliver{
     @ApiModelProperty(value = "关联账号")
     private Long userId;
 
+    @ApiModelProperty(value = "微信id")
+    private String openId;
+
     @ApiModelProperty(value = "企业id")
     private Long enterpriseId;
 
@@ -46,6 +49,10 @@ public class ResumeDeliver{
     @ApiModelProperty(value = "是否签订合同:0=未发送,1=已发送,2=已签订")
     private Integer isContract;
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    @ApiModelProperty(value = "面试时间")
+    private Date inviteTime;
+
     @TableField(fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IResumeDeliverService.java

@@ -52,6 +52,7 @@ public interface IResumeDeliverService extends IService<ResumeDeliver> {
 
     /**
      * 删除投递
+     *
      * @param id
      * @return
      */
@@ -59,6 +60,7 @@ public interface IResumeDeliverService extends IService<ResumeDeliver> {
 
     /**
      * 职位收到简历统计概要
+     *
      * @param userId
      * @return
      */
@@ -66,8 +68,16 @@ public interface IResumeDeliverService extends IService<ResumeDeliver> {
 
     /**
      * 职位收到的简历列表
+     *
      * @param resumeDeliver
      * @return
      */
     List<ReceiveListVo> receiveList(ResumeDeliver resumeDeliver);
+
+    /**
+     * 发送模板消息
+     *
+     * @param resumeDeliver
+     */
+    public void sendMessage(ResumeDeliver resumeDeliver);
 }

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/PositionServiceImpl.java

@@ -41,7 +41,7 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
     private IEnterpriseService enterpriseService;
 
     @Autowired
-    IUserService userService;
+    private IUserService userService;
 
     @Override
     public List<Position> selectList(Position position) {

+ 54 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/ResumeDeliverServiceImpl.java

@@ -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;*/
+    }
 }

+ 3 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -158,6 +158,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
         return Date.from(zdt.toInstant());
     }
+    public static final String datetoString(final Date date) {
+        return parseDateToStr("yyyy-MM-dd HH:mm", date);
+    }
     public static boolean isToday(Date date) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);