|
@@ -65,30 +65,26 @@ public class WxCorpInfoController {
|
|
|
|
|
|
@RequestMapping("/testSendTemplateMsg")
|
|
|
public HttpRespMsg testSendTemplateMsg(String userId) {
|
|
|
- String corpwxuserIds = "";
|
|
|
- //多个用户
|
|
|
- String[] userIds = userId.split("\\|");
|
|
|
- List<String> ids = Arrays.asList(userIds);
|
|
|
- List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id",ids));
|
|
|
- corpwxuserIds = userList.stream().filter(u->!StringUtils.isEmpty(u.getCorpwxUserid())).map(User::getCorpwxUserid).collect(Collectors.joining("|"));
|
|
|
- if (corpwxuserIds.length() > 0) {
|
|
|
- int companyId=userList.get(0).getCompanyId();
|
|
|
- WxCorpInfo corpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
- System.out.println("发送给:"+corpwxuserIds);
|
|
|
- //推送到企业微信
|
|
|
+ int companyId=7;
|
|
|
+ WxCorpInfo corpInfo = wxCorpInfoService.getOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
+ String corpwxuserIds = "woy9TkCAAAPD6149u46N_Yi5ARSA4VFw";
|
|
|
+ System.out.println("发送给:"+corpwxuserIds);
|
|
|
+ //推送到企业微信
|
|
|
// String corpUid = user.getCorpwxUserid();
|
|
|
- JSONObject json=new JSONObject();
|
|
|
- JSONArray dataJson=new JSONArray();
|
|
|
- JSONObject jsonObj=new JSONObject();
|
|
|
- jsonObj.put("key", "提示");
|
|
|
- jsonObj.put("value", "测试提醒消息21:12");
|
|
|
- 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://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
|
|
|
- json.put("content_item",dataJson);
|
|
|
- wxCorpInfoService.sendWXCorpTemplateMsg(corpInfo, corpwxuserIds, json);
|
|
|
-
|
|
|
- }
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
+ JSONObject item=new JSONObject();
|
|
|
+ item.put("key","审核人");
|
|
|
+ item.put("value","$userName=woy9TkCAAAPD6149u46N_Yi5ARSA4VFw$");
|
|
|
+ dataJson.add(item);
|
|
|
+ json.put("template_id","tty9TkCAAANpvEtLrkPUGeOEd1-U7W2w");
|
|
|
+ JSONObject item2=new JSONObject();
|
|
|
+ item2.put("key","日期");
|
|
|
+ item2.put("value","2021-07-14");
|
|
|
+ dataJson.add(item2);
|
|
|
+ json.put("url","https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
|
|
|
+ json.put("content_item",dataJson);
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(corpInfo,corpwxuserIds,json);
|
|
|
return new HttpRespMsg();
|
|
|
}
|
|
|
|