package com.ruoyi.system.util;
|
|
import org.apache.http.HttpResponse;
|
import org.apache.http.util.EntityUtils;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* @ClassName QiYeUtils
|
* @Description TODO
|
* @Author jqs
|
* @Date 2023/7/18 19:07
|
* @Version 1.0
|
*/
|
public class QiYeUtils {
|
|
private final static String ACCESS_TOKEN_HOST = "https://qyapi.weixin.qq.com/cgi-bin/";
|
|
|
|
public static String getAccessTokenByQY() throws Exception {
|
String host = ACCESS_TOKEN_HOST + "gettoken?corpid=ww11400938eb1b91bc&corpsecret=-wuQ2EBxNT9BJa40LdpFqyxI_8RqrZTCUNiabzBasi8";
|
Map<String, String> headers = new HashMap<>(8);
|
HttpResponse response = HttpUtils.doGet(host, "", "GET", headers, null);
|
return EntityUtils.toString(response.getEntity());
|
}
|
|
public static String getDepartmentList(String accessToken) throws Exception {
|
String host = ACCESS_TOKEN_HOST + "department/list?access_token="+accessToken;
|
Map<String, String> headers = new HashMap<>(8);
|
HttpResponse response = HttpUtils.doGet(host, "", "GET", headers, null);
|
return EntityUtils.toString(response.getEntity());
|
}
|
|
}
|