提交 | 用户 | age
|
f3ad4b
|
1 |
package com.hx.util.corp; |
C |
2 |
|
|
3 |
import com.alibaba.fastjson.JSONObject; |
|
4 |
import com.hx.exception.TipsException; |
|
5 |
import com.hx.util.HttpMethodUtil; |
|
6 |
import com.hx.util.StringUtils; |
|
7 |
import com.hx.util.corp.entity.WeiXinInfo; |
|
8 |
import org.slf4j.Logger; |
|
9 |
import org.slf4j.LoggerFactory; |
|
10 |
|
|
11 |
import java.util.HashMap; |
|
12 |
import java.util.Map; |
|
13 |
|
|
14 |
/** 企业微信工具类 |
|
15 |
* @author wangrenhuang |
|
16 |
* @Date 2021-10-19 |
|
17 |
*/ |
|
18 |
public class CorpMpUtil { |
|
19 |
|
|
20 |
//log4j日志 |
|
21 |
private static Logger logger = LoggerFactory.getLogger(CorpMpUtil.class.getName()); |
|
22 |
|
|
23 |
/**链接-获取应用accessToken*/ |
|
24 |
public static final String URL_GET_USER_INFO= "https://qyapi.weixin.qq.com/cgi-bin/user/get"; |
|
25 |
|
|
26 |
/** |
|
27 |
* 获取企业微信员工信息 |
|
28 |
* @param userId 用户id |
|
29 |
* @return 返回 |
|
30 |
*/ |
|
31 |
public static WeiXinInfo userInfo(String userId, String token) { |
|
32 |
Map<String,Object> map=new HashMap<>(); |
|
33 |
map.put("access_token",token); |
|
34 |
map.put("userid",userId); |
|
35 |
String datas = HttpMethodUtil.HttpURLUtilJson(URL_GET_USER_INFO, null, map, null, "GET"); |
|
36 |
WeiXinInfo weiXinInfo = JSONObject.parseObject(datas, WeiXinInfo.class); |
|
37 |
return weiXinInfo; |
|
38 |
} |
|
39 |
|
|
40 |
} |