package com.hx.util.corp; import com.alibaba.fastjson.JSONObject; import com.hx.util.HttpMethodUtil; import com.hx.util.corp.entity.WeiXinInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; /** 企业微信工具类 * @author wangrenhuang * @Date 2021-10-19 */ public class CorpMpUtil { //log4j日志 private static Logger logger = LoggerFactory.getLogger(CorpMpUtil.class.getName()); /**链接-获取应用accessToken*/ public static final String URL_GET_USER_INFO= "https://qyapi.weixin.qq.com/cgi-bin/user/get"; /** * 获取企业微信员工信息 * @param userId 用户id * @return 返回 */ public static WeiXinInfo userInfo(String userId, String token) { Map map=new HashMap<>(); map.put("access_token",token); map.put("userid",userId); String datas = HttpMethodUtil.HttpURLUtilJson(URL_GET_USER_INFO, null, map, null, "GET"); WeiXinInfo weiXinInfo = JSONObject.parseObject(datas, WeiXinInfo.class); return weiXinInfo; } }