|
@@ -1,8 +1,15 @@
|
|
package com.management.platform.controller;
|
|
package com.management.platform.controller;
|
|
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.management.platform.entity.User;
|
|
|
|
+import com.management.platform.entity.WxCorpInfo;
|
|
|
|
+import com.management.platform.mapper.UserMapper;
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
import com.management.platform.service.WxCorpInfoService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
|
|
+import org.springframework.util.StringUtils;
|
|
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;
|
|
@@ -23,12 +30,34 @@ public class WxCorpInfoController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
WxCorpInfoService wxCorpInfoService;
|
|
WxCorpInfoService wxCorpInfoService;
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ UserMapper userMapper;
|
|
@RequestMapping("/testDownload")
|
|
@RequestMapping("/testDownload")
|
|
public HttpRespMsg testDownload() {
|
|
public HttpRespMsg testDownload() {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
msg.data = wxCorpInfoService.testDownloadFile();
|
|
msg.data = wxCorpInfoService.testDownloadFile();
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @RequestMapping("/testSendTemplateMsg")
|
|
|
|
+ public HttpRespMsg testSendTemplateMsg(String userId) {
|
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
|
+ int companyId=user.getCompanyId();
|
|
|
|
+ WxCorpInfo corpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
|
+
|
|
|
|
+ //推送到企业微信
|
|
|
|
+ String corpUid = user.getCorpwxUserid();
|
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
|
+ JSONObject jsonObj=new JSONObject();
|
|
|
|
+ jsonObj.put("key", "提醒");
|
|
|
|
+ jsonObj.put("value", "测试提醒消息");
|
|
|
|
+ dataJson.add(jsonObj);
|
|
|
|
+ json.put("template_id","tty9TkCAAAYoevY-40ciWD5lDncDfR5w");
|
|
|
|
+ json.put("url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://mobworktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
|
|
|
|
+ json.put("content_item",dataJson);
|
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(corpInfo, corpUid, json);
|
|
|
|
+ return new HttpRespMsg();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|