|
@@ -1,5 +1,8 @@
|
|
|
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.annotation.DataScope;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
@@ -11,7 +14,9 @@ import com.ruoyi.web.work.domain.dto.VisitDto;
|
|
|
import com.ruoyi.web.work.domain.vo.VisitVoList;
|
|
|
import com.ruoyi.web.work.mapper.FollowRecordMapper;
|
|
|
import com.ruoyi.web.work.service.IFollowRecordService;
|
|
|
+import com.ruoyi.web.work.service.IUserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -26,6 +31,12 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol
|
|
|
@Autowired
|
|
|
private FollowRecordMapper followRecordMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IUserService userService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Environment env;
|
|
|
+
|
|
|
@DataScope(deptAlias = "k")
|
|
|
@Override
|
|
|
public List<FollowRecord> selectList(FollowRecord followRecord) {
|
|
@@ -85,4 +96,36 @@ public class FollowRecordServiceImpl extends ServiceImpl<FollowRecordMapper, Fol
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public void sendMessage(FollowRecord record) {
|
|
|
+ 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("appid", env.getProperty("wx.appid"));
|
|
|
+ JSONObject content = new JSONObject();
|
|
|
+ //复诊提醒
|
|
|
+ if (record.getType()==0) {
|
|
|
+ /* User user = userService.getById(record.getPatientId);
|
|
|
+ body.set("touser", user.getOpenId());
|
|
|
+ body.set("template_id", "PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg");
|
|
|
+ body.set("page", "pages/user/money/index");
|
|
|
+ content.set("amount3", new JSONObject().set("value", pay.getMoney() + "元"));//提现金额
|
|
|
+ content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
|
|
|
+ content.set("time2", new JSONObject().set("value", DateUtils.getTime())); //提现时间*/
|
|
|
+ }
|
|
|
+ //随访提醒
|
|
|
+ if (record.getType()==1) {
|
|
|
+ /* User user = userService.getById(pay.getUserId());
|
|
|
+ body.set("touser", user.getOpenId());
|
|
|
+ body.set("template_id", "NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo");
|
|
|
+ body.set("page", "pages/user/money/index");
|
|
|
+ content.set("amount3", new JSONObject().set("value", pay.getMoney() + "元"));//提现金额
|
|
|
+ content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
|
|
|
+ content.set("thing5", new JSONObject().set("value", pay.getMsg())); //失败原因
|
|
|
+ content.set("time2", new JSONObject().set("value", DateUtils.getTime())); //提现时间*/
|
|
|
+ }
|
|
|
+ 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("body:" + body);
|
|
|
+ System.out.println("小程序订阅消息:" + result);
|
|
|
+ }
|
|
|
}
|