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