From 065aef33bbe54d3c145d742d1f9a1a28456ef423 Mon Sep 17 00:00:00 2001 From: chenyan <522581280@qq.com> Date: Wed, 18 Oct 2023 23:52:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E5=BA=94=E7=94=A8=E5=88=97=E8=A1=A8=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java | 2 +- .../weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java index ae4db4582a..be754f229b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java @@ -39,7 +39,7 @@ public List listAppShareInfo(Integer agentId, Integer busines JsonObject tmpJson = GsonParser.parse(responseContent); return WxCpGsonBuilder.create().fromJson(tmpJson.get("corp_list"), - new TypeToken>() { + new TypeToken>() { }.getType() ); } diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java index b972b69f32..e78ce5c008 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java @@ -1,5 +1,6 @@ package me.chanjar.weixin.cp.api.impl; +import com.google.gson.JsonObject; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.cp.api.ApiTestModule; @@ -23,7 +24,7 @@ public class WxCpCorpGroupServiceImplTest { @Test public void testListAppShareInfo() throws WxErrorException { Integer agentId = wxService.getWxCpConfigStorage().getAgentId(); - Integer businessType = 0; + Integer businessType = 1; String corpId = null; Integer limit = null; String cursor = null; From 38f36681c1e2b20b98ad98ab7430456948c5a7fd Mon Sep 17 00:00:00 2001 From: chenyan <522581280@qq.com> Date: Fri, 20 Oct 2023 13:59:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1-?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81=EF=BC=9A?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=B8=B8=20-=20=E5=9F=BA=E7=A1=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20-=20=E8=8E=B7=E5=8F=96=E4=B8=8B=E7=BA=A7/=E4=B8=8B?= =?UTF-8?q?=E6=B8=B8=E4=BC=81=E4=B8=9A=E7=9A=84access=5Ftoken.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/cp/api/WxCpCorpGroupService.java | 14 ++++++++++++++ .../cp/api/impl/WxCpCorpGroupServiceImpl.java | 14 ++++++++++++++ .../api/impl/WxCpCorpGroupServiceImplTest.java | 16 ++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java index 4da13d3fde..4c6d7e11c2 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java @@ -24,4 +24,18 @@ public interface WxCpCorpGroupService { * @throws WxErrorException the wx error exception */ List listAppShareInfo(Integer agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException; + + /** + *
+   * 上下游 - 基础接口 - 获取下级/下游企业的access_token.
+   * 详情请见: ...
+   * 
+ * + * @param corpId 已授权的下级/下游企业corpid + * @param agentId 已授权的下级/下游企业应用ID + * @param businessType 填0则为企业互联/局校互联,填1则表示上下游企业 + * @return 获取到的下级/下游企业调用凭证,最长为512字节 + * @throws WxErrorException + */ + String getToken(String corpId, Integer agentId, Integer businessType) throws WxErrorException; } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java index be754f229b..30b4e79322 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java @@ -9,6 +9,7 @@ import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorp; import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorpListAppShareInfoResp; +import me.chanjar.weixin.cp.constant.WxCpApiPathConsts; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import java.util.List; @@ -43,4 +44,17 @@ public List listAppShareInfo(Integer agentId, Integer busines }.getType() ); } + + @Override + public String getToken(String corpId, Integer agentId, Integer businessType) throws WxErrorException { + final String url = this.cpService.getWxCpConfigStorage().getApiUrl(WxCpApiPathConsts.CorpGroup.CORP_GET_TOKEN); + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty("corpid", corpId); + jsonObject.addProperty("business_type", businessType); + jsonObject.addProperty("agentid", agentId); + String responseContent = this.cpService.post(url, jsonObject); + JsonObject tmpJson = GsonParser.parse(responseContent); + + return tmpJson.get("access_token").getAsString(); + } } diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java index e78ce5c008..613c76bd7b 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java @@ -31,4 +31,20 @@ public void testListAppShareInfo() throws WxErrorException { List resp = wxService.getCorpGroupService().listAppShareInfo(agentId, businessType, corpId, limit, cursor); assertNotNull(resp); } + + /** + *
+   * 上下游 - 基础接口 - 获取下级/下游企业的access_token.
+   * 详情请见: ...
+   * 
+ * @throws WxErrorException + */ + @Test + public void testGetToken() throws WxErrorException { + Integer agentId = 1000016; + Integer businessType = 1; + String corpId = "subCorpId"; + String accessToken = wxService.getCorpGroupService().getToken(corpId, agentId, businessType); + assertNotNull(accessToken); + } } From 3013b7bdec0d3778c2f5cdce5c24ec57104bc32a Mon Sep 17 00:00:00 2001 From: chenyan <522581280@qq.com> Date: Fri, 20 Oct 2023 17:18:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Revert=20"=E4=BC=81=E4=B8=9A=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1-=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3=E6=94=AF?= =?UTF-8?q?=E6=8C=81=EF=BC=9A=E4=B8=8A=E4=B8=8B=E6=B8=B8=20-=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=8E=A5=E5=8F=A3=20-=20=E8=8E=B7=E5=8F=96=E4=B8=8B?= =?UTF-8?q?=E7=BA=A7/=E4=B8=8B=E6=B8=B8=E4=BC=81=E4=B8=9A=E7=9A=84access?= =?UTF-8?q?=5Ftoken."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 38f36681c1e2b20b98ad98ab7430456948c5a7fd. --- .../weixin/cp/api/WxCpCorpGroupService.java | 14 -------------- .../cp/api/impl/WxCpCorpGroupServiceImpl.java | 14 -------------- .../api/impl/WxCpCorpGroupServiceImplTest.java | 16 ---------------- 3 files changed, 44 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java index 4c6d7e11c2..4da13d3fde 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpCorpGroupService.java @@ -24,18 +24,4 @@ public interface WxCpCorpGroupService { * @throws WxErrorException the wx error exception */ List listAppShareInfo(Integer agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException; - - /** - *
-   * 上下游 - 基础接口 - 获取下级/下游企业的access_token.
-   * 详情请见: ...
-   * 
- * - * @param corpId 已授权的下级/下游企业corpid - * @param agentId 已授权的下级/下游企业应用ID - * @param businessType 填0则为企业互联/局校互联,填1则表示上下游企业 - * @return 获取到的下级/下游企业调用凭证,最长为512字节 - * @throws WxErrorException - */ - String getToken(String corpId, Integer agentId, Integer businessType) throws WxErrorException; } diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java index 30b4e79322..be754f229b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImpl.java @@ -9,7 +9,6 @@ import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorp; import me.chanjar.weixin.cp.bean.corpgroup.WxCpCorpGroupCorpListAppShareInfoResp; -import me.chanjar.weixin.cp.constant.WxCpApiPathConsts; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import java.util.List; @@ -44,17 +43,4 @@ public List listAppShareInfo(Integer agentId, Integer busines }.getType() ); } - - @Override - public String getToken(String corpId, Integer agentId, Integer businessType) throws WxErrorException { - final String url = this.cpService.getWxCpConfigStorage().getApiUrl(WxCpApiPathConsts.CorpGroup.CORP_GET_TOKEN); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("corpid", corpId); - jsonObject.addProperty("business_type", businessType); - jsonObject.addProperty("agentid", agentId); - String responseContent = this.cpService.post(url, jsonObject); - JsonObject tmpJson = GsonParser.parse(responseContent); - - return tmpJson.get("access_token").getAsString(); - } } diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java index 613c76bd7b..e78ce5c008 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpCorpGroupServiceImplTest.java @@ -31,20 +31,4 @@ public void testListAppShareInfo() throws WxErrorException { List resp = wxService.getCorpGroupService().listAppShareInfo(agentId, businessType, corpId, limit, cursor); assertNotNull(resp); } - - /** - *
-   * 上下游 - 基础接口 - 获取下级/下游企业的access_token.
-   * 详情请见: ...
-   * 
- * @throws WxErrorException - */ - @Test - public void testGetToken() throws WxErrorException { - Integer agentId = 1000016; - Integer businessType = 1; - String corpId = "subCorpId"; - String accessToken = wxService.getCorpGroupService().getToken(corpId, agentId, businessType); - assertNotNull(accessToken); - } }