From a538020ae3d1af171816187a16ebb0072ea68892 Mon Sep 17 00:00:00 2001
From: Andru <769883346@qq.com>
Date: 星期五, 03 十一月 2023 18:31:11 +0800
Subject: [PATCH] 添加企业微信发送邮件方法

---
 src/main/java/com/hx/mp/util/CorpMpClientUtil.java |  410 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 332 insertions(+), 78 deletions(-)

diff --git a/src/main/java/com/hx/mp/util/CorpMpClientUtil.java b/src/main/java/com/hx/mp/util/CorpMpClientUtil.java
index 41d7cf7..5e89e85 100644
--- a/src/main/java/com/hx/mp/util/CorpMpClientUtil.java
+++ b/src/main/java/com/hx/mp/util/CorpMpClientUtil.java
@@ -1,5 +1,8 @@
 package com.hx.mp.util;
 
+import com.hx.util.StringUtils;
+import com.hz.util.http.HttpHzUtil;
+import com.hz.util.http.dto.HttpHzResponse;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONException;
 import net.sf.json.JSONObject;
@@ -8,121 +11,222 @@
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.text.MessageFormat;
+import java.util.List;
 
 /**
  * 浼佷笟寰俊瀹㈡埛宸ュ叿
  */
 public class CorpMpClientUtil {
 
-   /**鐢熸垚鑱旂郴鎴戞寜閽弬鏁扮殑閾炬帴锛堢敓鎴恈onfig_id锛�*/
-   public static final String CREATE_CONTACT_ID_URL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_contact_way?access_token=";
-   /**鑾峰彇浼佷笟瀹㈡埛璇︽儏閾炬帴*/
-   public static final String GET_CLIENT_DETAIL_URL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get";
-   /**娣诲姞瀹㈡埛鑱旂郴浜烘爣绛�*/
-   public static final String ADD_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_corp_tag?access_token=";
-   /**鍒犻櫎瀹㈡埛鑱旂郴浜烘爣绛�*/
-   public static final String DEL_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_corp_tag?access_token=";
-   /**瀹㈡埛鍏宠仈浼佷笟寰俊鐨勬爣绛緐rl*/
-   public static final String RELATION_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/mark_tag?access_token=";
-
-
-    /**鐢熸垚浼佷笟鎴愬憳鑱旂郴鎴戠殑id-鍗曚汉
-     * @param accessToken 浼佷笟鐨刟ccessToken
-     * @param userId 浼佷笟鎴愬憳鐨剈serId
-     * @param state 浼佷笟鑷畾涔夌殑state鍙傛暟锛岀敤浜庡尯鍒嗕笉鍚岀殑娣诲姞娓犻亾锛屽湪璋冪敤鈥滆幏鍙栧閮ㄨ仈绯讳汉璇︽儏鈥濇椂浼氳繑鍥炶鍙傛暟鍊硷紝涓嶈秴杩�30涓瓧绗�
-     * @param remark 鑱旂郴鏂瑰紡鐨勫娉ㄤ俊鎭紝鐢ㄤ簬鍔╄锛屼笉瓒呰繃30涓瓧绗�
-     * @return
+    /**
+     * 鐢熸垚鑱旂郴鎴戞寜閽弬鏁扮殑閾炬帴锛堢敓鎴恈onfig_id锛�
      */
-   public static JSONObject createContactId(String accessToken,String userId,String state,String remark){
+    public static final String CREATE_CONTACT_ID_URL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_contact_way?access_token=";
+    /**
+     * 鑾峰彇浼佷笟瀹㈡埛璇︽儏閾炬帴
+     */
+    public static final String GET_CLIENT_DETAIL_URL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get";
+    /**
+     * 鑾峰彇鑾峰彇浼佷笟鏍囩搴撻摼鎺�
+     */
+    public static final String GET_CORP_TAG_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_corp_tag_list?access_token=";
+    /**
+     * 娣诲姞瀹㈡埛鑱旂郴浜烘爣绛�
+     */
+    public static final String ADD_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/add_corp_tag?access_token=";
+    /**
+     * 缂栬緫浼佷笟瀹㈡埛鏍囩
+     */
+    public static final String EDIT_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/edit_corp_tag?access_token=";
+    /**
+     * 鍒犻櫎瀹㈡埛鑱旂郴浜烘爣绛�
+     */
+    public static final String DEL_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_corp_tag?access_token=";
+    /**
+     * 瀹㈡埛鍏宠仈浼佷笟寰俊鐨勬爣绛緐rl
+     */
+    public static final String RELATION_TAG = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/mark_tag?access_token=";
 
-       String configId = null;
-       JSONObject data = new JSONObject();
-       data.put("type",1);
-       data.put("scene",1);
-       data.put("state",state);
-       data.put("remark",remark);
-       JSONArray userIds = new JSONArray();
-       userIds.add(userId);
-       data.put("user",userIds);
+    /**
+     * 鑾峰彇鍛樺伐瀹㈡埛鍒楄〃url
+     */
+    public static final String EXTERNAL_CONTACT_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list";
 
-       //璇锋眰锛岃繑鍥炴牸寮�
+    /**
+     * 鍒涘缓鑾峰閾炬帴url
+     */
+    public static final String CUSTOMER_ACQUISITION_CREATE_LINK = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/create_link?access_token=";
+
+    /**
+     * 鑾峰彇鑾峰瀹㈡埛鍒楄〃
+     */
+    public static final String CUSTOMER_ACQUISITION_CUSTOMER_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/customer_acquisition/customer?access_token=";
+
+    /**
+     * 鑾峰彇閰嶇疆杩囧鎴风兢绠$悊鐨勫鎴风兢鍒楄〃
+     */
+    public static final String GROUP_CHAT_LIST = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/list?access_token=";
+
+
+    /**
+     * 閫氳繃瀹㈡埛缇D锛岃幏鍙栬鎯呫�傚寘鎷兢鍚嶃�佺兢鎴愬憳鍒楄〃銆佺兢鎴愬憳鍏ョ兢鏃堕棿銆佸叆缇ゆ柟寮忋�傦紙瀹㈡埛缇ゆ槸鐢卞叿鏈夊鎴风兢浣跨敤鏉冮檺鐨勬垚鍛樺垱寤虹殑澶栭儴缇わ級
+     */
+    public static final String GROUP_CHAT_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token=";
+
+    /**
+     * 浼佷笟寰俊鍙戦�佹櫘閫氶偖浠�
+     */
+    public static final String GROUP_SENT_EMAIL = "https://qyapi.weixin.qq.com/cgi-bin/exmail/app/compose_send?access_token=";
+
+
+
+    /**
+     * 鐢熸垚浼佷笟鎴愬憳鑱旂郴鎴戠殑id-鍗曚汉
+     *
+     * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param userId      浼佷笟鎴愬憳鐨剈serId
+     * @param state       浼佷笟鑷畾涔夌殑state鍙傛暟锛岀敤浜庡尯鍒嗕笉鍚岀殑娣诲姞娓犻亾锛屽湪璋冪敤鈥滆幏鍙栧閮ㄨ仈绯讳汉璇︽儏鈥濇椂浼氳繑鍥炶鍙傛暟鍊硷紝涓嶈秴杩�30涓瓧绗�
+     * @param remark      鑱旂郴鏂瑰紡鐨勫娉ㄤ俊鎭紝鐢ㄤ簬鍔╄锛屼笉瓒呰繃30涓瓧绗�
+     * @return 杩斿洖
+     */
+    public static JSONObject createContactId(String accessToken, String userId, String state, String remark) {
+
+        String configId = null;
+        JSONObject data = new JSONObject();
+        data.put("type", 1);
+        data.put("scene", 1);
+        data.put("state", state);
+        data.put("remark", remark);
+        JSONArray userIds = new JSONArray();
+        userIds.add(userId);
+        data.put("user", userIds);
+
+        //璇锋眰锛岃繑鍥炴牸寮�
        /*{
            "errcode": 0,
                "errmsg": "ok",
                "config_id":"42b34949e138eb6e027c123cba77fAAA"銆�銆�
        }*/
 
-       return HttpURLUtil(CREATE_CONTACT_ID_URL+accessToken,data.toString());
-   }
+        return HttpURLUtil(CREATE_CONTACT_ID_URL + accessToken, data.toString());
+    }
 
-    /**鑾峰彇浼佷笟瀹㈡埛璇︽儏淇℃伅
+    /**
+     * 鑾峰彇瀹㈡埛鍒楄〃
      * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param userId 浼佷笟鎴愬憳鐨剈serId
+     * @return 杩斿洖
+     */
+    public static JSONObject getExternalContactList(String accessToken, String userId) {
+        return HttpURLUtil(EXTERNAL_CONTACT_LIST + "?access_token=" + accessToken + "&userid=" + userId, null);
+    }
+
+    /**
+     * 鑾峰彇浼佷笟瀹㈡埛璇︽儏淇℃伅
+     *
+     * @param accessToken    浼佷笟鐨刟ccessToken
      * @param externalUserId 澶栭儴浜哄憳鐨剈serId
-     * @return
+     * @return 杩斿洖
      */
-   public static JSONObject getClientData(String accessToken,String externalUserId){
+    public static JSONObject getClientData(String accessToken, String externalUserId) {
+        return HttpURLUtil(GET_CLIENT_DETAIL_URL + "?access_token=" + accessToken + "&external_userid=" + externalUserId, null);
+    }
 
-       return HttpURLUtil(GET_CLIENT_DETAIL_URL+"?access_token="+accessToken+"&external_userid="+externalUserId,null);
-   }
-
-    /** 娣诲姞瀹㈡埛鑱旂郴浜烘爣绛撅紝
-     *濡傛灉瑕佸悜鎸囧畾鐨勬爣绛剧粍涓嬫坊鍔犳爣绛撅紝闇�瑕佸~鍐檊roup_id鍙傛暟锛涘鏋滆鍒涘缓涓�涓叏鏂扮殑鏍囩缁勪互鍙婃爣绛撅紝
-     *鍒欓渶瑕侀�氳繃group_name鍙傛暟鎸囧畾鏂版爣绛剧粍鍚嶇О锛屽鏋滃~鍐欑殑groupname宸茬粡瀛樺湪锛屽垯浼氬湪姝ゆ爣绛剧粍涓嬫柊寤烘爣绛�
+    /**
+     * 浼佷笟鍙�氳繃姝ゆ帴鍙h幏鍙栦紒涓氬鎴锋爣绛捐鎯�
+     *
      * @param accessToken 浼佷笟鐨刟ccessToken
-     * @param groupId 缁刬d锛堢粍鍚嶇О鍜岀粍id蹇呭~涓�涓級
-     * @param groupName 缁勫悕绉� 缁勫悕绉板拰缁刬d蹇呭~涓�涓級
-     * @param groupOrder 缁勬帓搴忥紝涓嶅~榛樿浼佷笟寰俊鐢熸垚瑙勫垯
-     * @param tagArray 鏁扮粍锛屾牸寮忥細[{ "name": "TAG_NAME_1", "order": 1 }]
-     * @return
+     * @param tagId  鏍囩id
+     * @param groupId 鏍囩缁刬d
+     * @return 杩斿洖
      */
-   public static JSONObject addTable(String accessToken,String groupId,String groupName,String groupOrder,JSONArray tagArray){
-       JSONObject data = new JSONObject();
-       data.put("group_id",groupId);
-       data.put("group_name",groupName);
-       data.put("order",groupOrder);
-       data.put("tag",tagArray);
-       return HttpURLUtil(ADD_TAG+accessToken,data.toString());
-   }
+    public static JSONObject getCorpTagList(String accessToken, JSONArray tagId, JSONArray groupId) {
+        JSONObject data = new JSONObject();
+        data.put("tag_id", tagId);
+        data.put("group_id", groupId);
+        return HttpURLUtil(GET_CORP_TAG_LIST + accessToken, data.toString());
+    }
 
-    /**鍒犻櫎瀹㈡埛鑱旂郴浜烘爣绛�
+    /**
+     * 娣诲姞瀹㈡埛鑱旂郴浜烘爣绛撅紝
+     * 濡傛灉瑕佸悜鎸囧畾鐨勬爣绛剧粍涓嬫坊鍔犳爣绛撅紝闇�瑕佸~鍐檊roup_id鍙傛暟锛涘鏋滆鍒涘缓涓�涓叏鏂扮殑鏍囩缁勪互鍙婃爣绛撅紝
+     * 鍒欓渶瑕侀�氳繃group_name鍙傛暟鎸囧畾鏂版爣绛剧粍鍚嶇О锛屽鏋滃~鍐欑殑groupname宸茬粡瀛樺湪锛屽垯浼氬湪姝ゆ爣绛剧粍涓嬫柊寤烘爣绛�
+     *
+     * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param groupId     缁刬d锛堢粍鍚嶇О鍜岀粍id蹇呭~涓�涓級
+     * @param groupName   缁勫悕绉� 缁勫悕绉板拰缁刬d蹇呭~涓�涓級
+     * @param groupOrder  缁勬帓搴忥紝涓嶅~榛樿浼佷笟寰俊鐢熸垚瑙勫垯
+     * @param tagArray    鏁扮粍锛屾牸寮忥細[{ "name": "TAG_NAME_1", "order": 1 }]
+     * @return 杩斿洖
+     */
+    public static JSONObject addTable(String accessToken, String groupId, String groupName, String groupOrder, JSONArray tagArray) {
+        JSONObject data = new JSONObject();
+        data.put("group_id", groupId);
+        data.put("group_name", groupName);
+        data.put("order", groupOrder);
+        data.put("tag", tagArray);
+        return HttpURLUtil(ADD_TAG + accessToken, data.toString());
+    }
+
+    /**
+     * 缂栬緫浼佷笟瀹㈡埛鏍囩锛�
+     * 娉ㄦ剰:淇敼鍚庣殑鏍囩缁勪笉鑳藉拰宸叉湁鐨勬爣绛剧粍閲嶅悕锛屾爣绛句篃涓嶈兘鍜屽悓涓�鏍囩缁勪笅鐨勫叾浠栨爣绛鹃噸鍚嶃��
+     *
+     * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param id     鏍囩鎴栨爣绛剧粍鐨刬d
+     * @param name   鏂扮殑鏍囩鎴栨爣绛剧粍鍚嶇О锛屾渶闀夸负30涓瓧绗�
+     * @param order  鏍囩/鏍囩缁勭殑娆″簭鍊笺�俹rder鍊煎ぇ鐨勬帓搴忛潬鍓嶃�傛湁鏁堢殑鍊艰寖鍥存槸[0, 2^32)
+     * @return 杩斿洖
+     */
+    public static JSONObject editTable(String accessToken, String id, String name, String order) {
+        JSONObject data = new JSONObject();
+        data.put("id", id);
+        data.put("name", name);
+        data.put("order", order);
+        return HttpURLUtil(EDIT_TAG + accessToken, data.toString());
+    }
+
+    /**
+     * 鍒犻櫎瀹㈡埛鑱旂郴浜烘爣绛�
      * groupArr鍜宼agArr涓嶅彲鍚屾椂涓虹┖銆�
      * 濡傛灉涓�涓爣绛剧粍涓嬫墍鏈夌殑鏍囩鍧囪鍒犻櫎锛屽垯鏍囩缁勪細琚嚜鍔ㄥ垹闄ゃ��
+     *
      * @param accessToken 浼佷笟鐨刟ccessToken
-     * @param groupArr 缁刬d鏁扮粍
-     * @param tagArr 鏍囩id鏁扮粍
-     * @return
+     * @param groupArr    缁刬d鏁扮粍
+     * @param tagArr      鏍囩id鏁扮粍
+     * @return 杩斿洖
      */
-   public static JSONObject delTable(String accessToken,JSONArray groupArr,String tagArr){
-       JSONObject data = new JSONObject();
-       data.put("tag_id",tagArr);
-       data.put("group_id",groupArr);
-       return HttpURLUtil(DEL_TAG+accessToken,data.toString());
-   }
+    public static JSONObject delTable(String accessToken, JSONArray groupArr, JSONArray tagArr) {
+        JSONObject data = new JSONObject();
+        data.put("tag_id", tagArr);
+        data.put("group_id", groupArr);
+        return HttpURLUtil(DEL_TAG + accessToken, data.toString());
+    }
 
     /**
      * 瀹㈡埛鍏宠仈浼佷笟寰俊鐨勬爣绛�
      * 娉ㄦ剰锛氳纭繚external_userid鏄痷serid鐨勫閮ㄨ仈绯讳汉銆�
      * add_tag鍜宺emove_tag涓嶅彲鍚屾椂涓虹┖銆�
-     * @param accessToken 浼佷笟鐨刟ccessToken
-     * @param userId 浼佷笟鎴愬憳鐨剈serid
+     *
+     * @param accessToken    浼佷笟鐨刟ccessToken
+     * @param userId         浼佷笟鎴愬憳鐨剈serid
      * @param externalUserId 澶栭儴鑱旂郴浜虹殑id
-     * @param addTag 鏂板鐨勬爣绛緄d锛堜紒涓氭爣绛剧殑id锛夋暟缁�
-     * @param removeTag 鍒犻櫎鐨勬爣绛緄d锛堜紒涓氭爣绛剧殑id锛夋暟缁�
-     * @return
+     * @param addTag         鏂板鐨勬爣绛緄d锛堜紒涓氭爣绛剧殑id锛夋暟缁�
+     * @param removeTag      鍒犻櫎鐨勬爣绛緄d锛堜紒涓氭爣绛剧殑id锛夋暟缁�
+     * @return 杩斿洖
      */
-    public static JSONObject relationTag(String accessToken,String userId,String externalUserId
-            ,JSONArray addTag,JSONArray removeTag){
+    public static JSONObject relationTag(String accessToken, String userId, String externalUserId, JSONArray addTag, JSONArray removeTag) {
         JSONObject data = new JSONObject();
-        data.put("userid",userId);
-        data.put("external_userid",externalUserId);
-        data.put("add_tag",addTag);
-        data.put("remove_tag",removeTag);
-        return HttpURLUtil(RELATION_TAG+accessToken,data.toString());
+        data.put("userid", userId);
+        data.put("external_userid", externalUserId);
+        data.put("add_tag", addTag);
+        data.put("remove_tag", removeTag);
+        return HttpURLUtil(RELATION_TAG + accessToken, data.toString());
     }
 
-
-    /** 璇锋眰http鍗忚 鑾峰彇淇℃伅宸ュ叿 **/
+    /**
+     * 璇锋眰http鍗忚 鑾峰彇淇℃伅宸ュ叿
+     **/
     public static JSONObject HttpURLUtil(String url, String data) {
         HttpURLConnection con = null;
         URL u = null;
@@ -166,4 +270,154 @@
         }
         return obj;
     }
+
+    /**鐢熸垚浼佷笟鎴愬憳鑱旂郴鎴戠殑id-鍗曚汉
+     * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param userId 浼佷笟鎴愬憳鐨剈serId
+     * @param scene 鍦烘櫙锛�1-鍦ㄥ皬绋嬪簭涓仈绯伙紝2-閫氳繃浜岀淮鐮佽仈绯�
+     * @param state 浼佷笟鑷畾涔夌殑state鍙傛暟锛岀敤浜庡尯鍒嗕笉鍚岀殑娣诲姞娓犻亾锛屽湪璋冪敤鈥滆幏鍙栧閮ㄨ仈绯讳汉璇︽儏鈥濇椂浼氳繑鍥炶鍙傛暟鍊硷紝涓嶈秴杩�30涓瓧绗�
+     * @param remark 鑱旂郴鏂瑰紡鐨勫娉ㄤ俊鎭紝鐢ㄤ簬鍔╄锛屼笉瓒呰繃30涓瓧绗�
+     * @return 杩斿洖
+     */
+    public static JSONObject createContactId(String accessToken,String userId,int scene,String state,String remark){
+        String configId = null;
+        JSONObject data = new JSONObject();
+        data.put("type",1);
+        data.put("scene",scene);
+        data.put("state",state);
+        data.put("remark",remark);
+        JSONArray userIds = new JSONArray();
+        userIds.add(userId);
+        data.put("user",userIds);
+
+        //璇锋眰锛岃繑鍥炴牸寮�
+       /*{
+           "errcode": 0,
+               "errmsg": "ok",
+               "config_id":"42b34949e138eb6e027c123cba77fAAA"銆�銆�
+       }*/
+
+        return HttpURLUtil(CREATE_CONTACT_ID_URL+accessToken,data.toString());
+    }
+
+    /**
+     * 鍒涘缓鑾峰閾炬帴
+     *
+     * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param linkName  閾炬帴鍚嶇О
+     * @param userList 鍛樺伐鐢ㄦ埛userId
+     * @return 杩斿洖
+     */
+    public static JSONObject createCustomerAcquisitionLink(String accessToken, String linkName, JSONArray userList) {
+        JSONObject data = new JSONObject();
+        data.put("link_name", linkName);
+        JSONObject subData = new JSONObject();
+        subData.accumulate("user_list", userList);
+        data.put("range", subData);
+        /** 杩斿洖鏁版嵁
+         * {
+         *    "link_id":"LINK_ID",
+         *    "link_name":"鑾峰閾炬帴1鍙�",
+         *    "range":
+         *    {
+         *    		"user_list":["zhangsan","lisi"],
+         * 		"department_list":[2,3]
+         *    },
+         *    "skip_verify":true
+         * }
+         */
+        return HttpURLUtil(CUSTOMER_ACQUISITION_CREATE_LINK + accessToken, data.toString());
+    }
+
+    /**
+     * 鑾峰彇鑾峰瀹㈡埛鍒楄〃
+     *
+     * @param accessToken 浼佷笟鐨刟ccessToken
+     * @param linkId  閾炬帴id
+     * @param cursor  鍒嗛〉娓告爣
+     * @return 杩斿洖
+     */
+    public static JSONObject getCustomerAcquisitionCustomerList(String accessToken, String linkId, String cursor) {
+        JSONObject data = new JSONObject();
+        data.put("link_id", linkId);
+        data.put("limit", 1000);
+        // 鍒嗛〉娓告爣
+        if (!StringUtils.isEmpty(cursor)) {
+            data.put("cursor", cursor);
+        }
+        /** 杩斿洖鏁版嵁
+         * {
+         *     "errcode": 0,
+         *     "errmsg": "ok",
+         * 	"customer_list":
+         * 	[
+         *                {
+         * 			"external_userid":"woAJ2GCAAAXtWyujaWJHDDGi0mACAAA",
+         * 			"userid":"zhangsan",
+         * 			"chat_status":0,
+         * 			"state":"CHANNEL_A"
+         *        }
+         * 	],
+         * 	"next_cursor":"CURSOR"
+         * }
+         */
+        return HttpURLUtil(CUSTOMER_ACQUISITION_CUSTOMER_LIST + accessToken, data.toString());
+    }
+
+
+    /**
+     * 璇ユ帴鍙g敤浜庤幏鍙栭厤缃繃瀹㈡埛缇ょ鐞嗙殑瀹㈡埛缇ゅ垪琛ㄣ��
+     *
+     * @param accessToken  浼佷笟鐨刟ccessToken
+     * @param statusFilter 瀹㈡埛缇よ窡杩涚姸鎬佽繃婊ゃ��0 - 鎵�鏈夊垪琛�(鍗充笉杩囨护) 1 - 绂昏亴寰呯户鎵� 2 - 绂昏亴缁ф壙涓� 3 - 绂昏亴缁ф壙瀹屾垚
+     * @param userIdList   缇や富杩囨护 濡傛灉涓嶅~锛岃〃绀鸿幏鍙栧簲鐢ㄥ彲瑙佽寖鍥村唴鍏ㄩ儴缇や富鐨勬暟鎹彲瑙佽寖鍥翠汉鏁拌秴杩�1000浜猴紝涓轰簡闃叉鏁版嵁鍖呰繃澶э紝浼氭姤閿� 81017 鐢ㄦ埛ID鍒楄〃銆傛渶澶�100涓�
+     * @param cursor       鍒嗛〉涓嬫爣
+     * @param limit        鍒楄〃
+     * @return 杩斿洖
+     */
+    public static HttpHzResponse getGroupChatList(String accessToken, Integer statusFilter, List<String> userIdList, String cursor, Integer limit) {
+        JSONObject bodyData = new JSONObject();
+        bodyData.put("status_filter", statusFilter);
+        //鍒嗛〉涓嬫爣
+        if (StringUtils.noNull(cursor)) {
+            bodyData.put("cursor", cursor);
+        }
+        //榛樿100鏉�
+        if (limit == null) {
+            limit = 100;
+        }
+        bodyData.put("limit", limit);
+        //杩囨护
+        if (userIdList != null && userIdList.size() > 0) {
+            JSONObject filter = new JSONObject();
+            filter.put("userid_list", userIdList);
+            bodyData.put("owner_filter", filter);
+        }
+        return HttpHzUtil.HttpURLUtilJson(GROUP_CHAT_LIST + accessToken, bodyData.toString(), null, null, "GET", null);
+    }
+
+    /**
+     * 閫氳繃瀹㈡埛缇D锛岃幏鍙栬鎯呫�傚寘鎷兢鍚嶃�佺兢鎴愬憳鍒楄〃銆佺兢鎴愬憳鍏ョ兢鏃堕棿銆佸叆缇ゆ柟寮忋�傦紙瀹㈡埛缇ゆ槸鐢卞叿鏈夊鎴风兢浣跨敤鏉冮檺鐨勬垚鍛樺垱寤虹殑澶栭儴缇わ級
+     *
+     * @param chatId   瀹㈡埛缇D
+     * @param needName 鏄惁闇�瑕佽繑鍥炵兢鎴愬憳鐨勫悕瀛�0-涓嶈繑鍥烇紱1-杩斿洖
+     */
+    public static HttpHzResponse getGroupChatDetail(String accessToken, String chatId, Integer needName) {
+        JSONObject bodyData = new JSONObject();
+        bodyData.put("chat_id", chatId);
+        if (needName == null) {
+            needName = 0;
+        }
+        bodyData.put("need_name", needName);
+        return HttpHzUtil.HttpURLUtilJson(GROUP_CHAT_DETAIL + accessToken, bodyData.toString(), null, null, "GET", null);
+    }
+
+    /**
+     * 浼佷笟寰俊鍙戦�佹櫘閫氶偖浠�
+     * 鎺ュ彛鍦板潃: https://developer.work.weixin.qq.com/document/path/97445
+     * @param bodyData  鍙傛暟
+     */
+    public static JSONObject sentEmail(String accessToken, JSONObject bodyData) {
+        return HttpURLUtil(GROUP_SENT_EMAIL + accessToken, bodyData.toString());
+    }
 }

--
Gitblit v1.8.0