From 6014c833bce5a4ea8437f43aeaf6fdd55ebd6586 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Fri, 31 Jul 2026 00:21:52 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#4079=20=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E6=94=AF=E6=8C=81=E9=95=BF=E6=95=B4?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E5=BA=94?= =?UTF-8?q?=E7=94=A8ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/AbstractWxCpConfiguration.java | 2 +- .../cp/properties/WxCpSingleProperties.java | 2 +- .../wxjava/cp/properties/WxCpProperties.java | 2 +- ...bstractWxCpConfigStorageConfiguration.java | 2 +- .../weixin/cp/api/WxCpAgentService.java | 4 ++-- .../weixin/cp/api/WxCpCorpGroupService.java | 2 +- .../weixin/cp/api/WxCpMenuService.java | 6 +++--- .../weixin/cp/api/WxCpOAuth2Service.java | 2 +- .../cp/api/impl/WxCpAgentServiceImpl.java | 4 ++-- .../cp/api/impl/WxCpCorpGroupServiceImpl.java | 2 +- .../cp/api/impl/WxCpMenuServiceImpl.java | 6 +++--- .../cp/api/impl/WxCpMessageServiceImpl.java | 4 ++-- .../cp/api/impl/WxCpOAuth2ServiceImpl.java | 2 +- .../cp/api/impl/WxCpTaskCardServiceImpl.java | 4 ++-- .../me/chanjar/weixin/cp/bean/WxCpAgent.java | 2 +- .../cp/bean/WxCpAgentJsapiSignature.java | 2 +- .../WxCpCorpGroupCorpGetTokenReq.java | 2 +- .../bean/message/WxCpLinkedCorpMessage.java | 10 +++++++++- .../weixin/cp/bean/message/WxCpMessage.java | 10 +++++++++- .../message/WxCpSchoolContactMessage.java | 10 +++++++++- .../cp/bean/messagebuilder/BaseBuilder.java | 8 ++++++-- .../weixin/cp/config/WxCpConfigStorage.java | 2 +- .../cp/config/WxCpCorpGroupConfigStorage.java | 16 +++++++-------- .../impl/AbstractWxCpInRedisConfigImpl.java | 2 +- .../impl/WxCpCorpGroupDefaultConfigImpl.java | 20 +++++++++---------- .../impl/WxCpCorpGroupRedissonConfigImpl.java | 20 +++++++++---------- .../cp/config/impl/WxCpDefaultConfigImpl.java | 10 +++++++--- .../cp/config/impl/WxCpRedisConfigImpl.java | 6 +++--- .../cp/corpgroup/service/WxCpCgService.java | 14 ++++++------- .../service/impl/BaseWxCpCgServiceImpl.java | 14 ++++++------- .../cp/api/impl/BaseWxCpServiceImplTest.java | 2 +- .../cp/api/impl/WxCpAgentServiceImplTest.java | 10 +++++----- .../impl/WxCpCorpGroupServiceImplTest.java | 2 +- .../message/WxCpLinkedCorpMessageTest.java | 16 +++++++-------- .../cp/bean/message/WxCpMessageTest.java | 10 +++++----- .../message/WxCpSchoolContactMessageTest.java | 18 ++++++++--------- .../AbstractWxCpInRedisConfigImplTest.java | 2 +- .../cp/config/impl/DemoToStringFix.java | 2 +- .../impl/WxCpDefaultConfigImplTest.java | 17 ++++++++++++++++ ...WxCpCgServiceApacheHttpClientImplTest.java | 2 +- .../impl/WxCpTpMessageServiceImplTest.java | 2 +- 41 files changed, 162 insertions(+), 113 deletions(-) create mode 100644 weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImplTest.java diff --git a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/AbstractWxCpConfiguration.java b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/AbstractWxCpConfiguration.java index a10bdf9be..a793a8501 100644 --- a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/AbstractWxCpConfiguration.java +++ b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/AbstractWxCpConfiguration.java @@ -125,7 +125,7 @@ public abstract class AbstractWxCpConfiguration { private void configCorp(WxCpDefaultConfigImpl config, WxCpSingleProperties wxCpSingleProperties) { String corpId = wxCpSingleProperties.getCorpId(); String corpSecret = wxCpSingleProperties.getCorpSecret(); - Integer agentId = wxCpSingleProperties.getAgentId(); + Long agentId = wxCpSingleProperties.getAgentId(); String token = wxCpSingleProperties.getToken(); String aesKey = wxCpSingleProperties.getAesKey(); // 企业微信,私钥,会话存档路径 diff --git a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpSingleProperties.java b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpSingleProperties.java index fcfa654a1..740f5a2a3 100644 --- a/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpSingleProperties.java +++ b/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpSingleProperties.java @@ -52,7 +52,7 @@ public class WxCpSingleProperties implements Serializable { *

使用自建应用 Secret 时,需要填写对应应用的 AgentId。

*

使用通讯录同步 Secret 时,无需填写此字段。

*/ - private Integer agentId; + private Long agentId; /** * 微信企业号应用 EncodingAESKey */ diff --git a/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpProperties.java b/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpProperties.java index c93a7e187..63e730d1b 100644 --- a/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpProperties.java +++ b/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpProperties.java @@ -34,7 +34,7 @@ public class WxCpProperties { /** * 微信企业号应用 ID */ - private Integer agentId; + private Long agentId; /** * 微信企业号应用 EncodingAESKey */ diff --git a/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/AbstractWxCpConfigStorageConfiguration.java b/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/AbstractWxCpConfigStorageConfiguration.java index 2b1d8c13c..70f620a58 100644 --- a/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/AbstractWxCpConfigStorageConfiguration.java +++ b/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/AbstractWxCpConfigStorageConfiguration.java @@ -15,7 +15,7 @@ public abstract class AbstractWxCpConfigStorageConfiguration { protected WxCpDefaultConfigImpl config(WxCpDefaultConfigImpl config, WxCpProperties properties) { String corpId = properties.getCorpId(); String corpSecret = properties.getCorpSecret(); - Integer agentId = properties.getAgentId(); + Long agentId = properties.getAgentId(); String token = properties.getToken(); String aesKey = properties.getAesKey(); // 企业微信,私钥,会话存档路径 diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentService.java index 05f06f1da..7302a88f0 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentService.java @@ -27,7 +27,7 @@ public interface WxCpAgentService { * @return wx cp agent * @throws WxErrorException the wx error exception */ - WxCpAgent get(Integer agentId) throws WxErrorException; + WxCpAgent get(Long agentId) throws WxErrorException; /** *
@@ -65,6 +65,6 @@ public interface WxCpAgentService {
    * @return admin list
    * @throws WxErrorException the wx error exception
    */
-  WxCpTpAdmin getAdminList(Integer agentId) throws WxErrorException;
+  WxCpTpAdmin getAdminList(Long agentId) throws WxErrorException;
 
 }
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 69aea4bca..16882669b 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
@@ -23,5 +23,5 @@ public interface WxCpCorpGroupService {
    * @return the list
    * @throws WxErrorException the wx error exception
    */
-  List listAppShareInfo(Integer agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException;
+  List listAppShareInfo(Long agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException;
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMenuService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMenuService.java
index 07f300dd1..bfa2c1c93 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMenuService.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMenuService.java
@@ -40,7 +40,7 @@ public interface WxCpMenuService {
    * @throws WxErrorException the wx error exception
    * @see #create(me.chanjar.weixin.common.bean.menu.WxMenu) #create(me.chanjar.weixin.common.bean.menu.WxMenu)
    */
-  void create(Integer agentId, WxMenu menu) throws WxErrorException;
+  void create(Long agentId, WxMenu menu) throws WxErrorException;
 
   /**
    * 
@@ -67,7 +67,7 @@ public interface WxCpMenuService {
    * @throws WxErrorException the wx error exception
    * @see #delete() #delete()
    */
-  void delete(Integer agentId) throws WxErrorException;
+  void delete(Long agentId) throws WxErrorException;
 
   /**
    * 
@@ -96,5 +96,5 @@ public interface WxCpMenuService {
    * @throws WxErrorException the wx error exception
    * @see #get() #get()
    */
-  WxMenu get(Integer agentId) throws WxErrorException;
+  WxMenu get(Long agentId) throws WxErrorException;
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOAuth2Service.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOAuth2Service.java
index 182419672..695534ba7 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOAuth2Service.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOAuth2Service.java
@@ -85,7 +85,7 @@ public interface WxCpOAuth2Service {
    * @throws WxErrorException 异常
    * @see #getUserInfo(String) #getUserInfo(String)
    */
-  WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErrorException;
+  WxCpOauth2UserInfo getUserInfo(Long agentId, String code) throws WxErrorException;
 
   /**
    * 获取家校访问用户身份
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImpl.java
index cc08d33bb..6f2ade2e4 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImpl.java
@@ -34,7 +34,7 @@ public class WxCpAgentServiceImpl implements WxCpAgentService {
   private final WxCpService mainService;
 
   @Override
-  public WxCpAgent get(Integer agentId) throws WxErrorException {
+  public WxCpAgent get(Long agentId) throws WxErrorException {
     if (agentId == null) {
       throw new IllegalArgumentException("缺少agentid参数");
     }
@@ -67,7 +67,7 @@ public class WxCpAgentServiceImpl implements WxCpAgentService {
   }
 
   @Override
-  public WxCpTpAdmin getAdminList(Integer agentId) throws WxErrorException {
+  public WxCpTpAdmin getAdminList(Long agentId) throws WxErrorException {
     if (agentId == null) {
       throw new IllegalArgumentException("缺少agentid参数");
     }
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 e3dc1cbe1..73d11cc15 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
@@ -25,7 +25,7 @@ public class WxCpCorpGroupServiceImpl implements WxCpCorpGroupService {
   private final WxCpService cpService;
 
   @Override
-  public List listAppShareInfo(Integer agentId, Integer businessType, String corpId,
+  public List listAppShareInfo(Long agentId, Integer businessType, String corpId,
                                                   Integer limit, String cursor) throws WxErrorException {
     final String url = this.cpService.getWxCpConfigStorage().getApiUrl(LIST_SHARE_APP_INFO);
     JsonObject jsonObject = new JsonObject();
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMenuServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMenuServiceImpl.java
index d008e7708..0920c2b3e 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMenuServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMenuServiceImpl.java
@@ -27,7 +27,7 @@ public class WxCpMenuServiceImpl implements WxCpMenuService {
   }
 
   @Override
-  public void create(Integer agentId, WxMenu menu) throws WxErrorException {
+  public void create(Long agentId, WxMenu menu) throws WxErrorException {
     String url = String.format(this.mainService.getWxCpConfigStorage().getApiUrl(MENU_CREATE), agentId);
     this.mainService.post(url, menu.toJson());
   }
@@ -38,7 +38,7 @@ public class WxCpMenuServiceImpl implements WxCpMenuService {
   }
 
   @Override
-  public void delete(Integer agentId) throws WxErrorException {
+  public void delete(Long agentId) throws WxErrorException {
     String url = String.format(this.mainService.getWxCpConfigStorage().getApiUrl(MENU_DELETE), agentId);
     this.mainService.get(url, null);
   }
@@ -49,7 +49,7 @@ public class WxCpMenuServiceImpl implements WxCpMenuService {
   }
 
   @Override
-  public WxMenu get(Integer agentId) throws WxErrorException {
+  public WxMenu get(Long agentId) throws WxErrorException {
     String url = String.format(this.mainService.getWxCpConfigStorage().getApiUrl(MENU_GET), agentId);
     try {
       String resultContent = this.mainService.get(url, null);
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java
index 6daea8ef2..def73e415 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java
@@ -21,7 +21,7 @@ public class WxCpMessageServiceImpl implements WxCpMessageService {
 
   @Override
   public WxCpMessageSendResult send(WxCpMessage message) throws WxErrorException {
-    Integer agentId = message.getAgentId();
+    Long agentId = message.getAgentId();
     if (null == agentId) {
       message.setAgentId(this.cpService.getWxCpConfigStorage().getAgentId());
     }
@@ -38,7 +38,7 @@ public class WxCpMessageServiceImpl implements WxCpMessageService {
 
   @Override
   public WxCpLinkedCorpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException {
-    Integer agentId = message.getAgentId();
+    Long agentId = message.getAgentId();
     if (null == agentId) {
       message.setAgentId(this.cpService.getWxCpConfigStorage().getAgentId());
     }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java
index d04a051c0..9b390b5ec 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java
@@ -69,7 +69,7 @@ public class WxCpOAuth2ServiceImpl implements WxCpOAuth2Service {
   }
 
   @Override
-  public WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErrorException {
+  public WxCpOauth2UserInfo getUserInfo(Long agentId, String code) throws WxErrorException {
     String responseText =
       this.mainService.get(String.format(this.mainService.getWxCpConfigStorage().getApiUrl(GET_USER_INFO), code,
         agentId), null);
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpTaskCardServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpTaskCardServiceImpl.java
index 846945142..0cf0ab666 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpTaskCardServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpTaskCardServiceImpl.java
@@ -28,7 +28,7 @@ public class WxCpTaskCardServiceImpl implements WxCpTaskCardService {
 
   @Override
   public void update(List userIds, String taskId, String replaceName) throws WxErrorException {
-    Integer agentId = this.mainService.getWxCpConfigStorage().getAgentId();
+    Long agentId = this.mainService.getWxCpConfigStorage().getAgentId();
 
     Map data = new HashMap<>(4);
     data.put("userids", userIds);
@@ -45,7 +45,7 @@ public class WxCpTaskCardServiceImpl implements WxCpTaskCardService {
   public void updateTemplateCardButton(List userIds, List partyIds,
                                        List tagIds, Integer atAll,
                                        String responseCode, String replaceName) throws WxErrorException {
-    Integer agentId = this.mainService.getWxCpConfigStorage().getAgentId();
+    Long agentId = this.mainService.getWxCpConfigStorage().getAgentId();
     Map data = new HashMap<>(7);
     data.put("userids", userIds);
     data.put("partyids", partyIds);
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgent.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgent.java
index 5d61b3a19..8f96a729a 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgent.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgent.java
@@ -32,7 +32,7 @@ public class WxCpAgent implements Serializable {
   private String errMsg;
 
   @SerializedName("agentid")
-  private Integer agentId;
+  private Long agentId;
 
   @SerializedName("name")
   private String name;
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentJsapiSignature.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentJsapiSignature.java
index 4562d9b9b..8ca7a6cb9 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentJsapiSignature.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpAgentJsapiSignature.java
@@ -21,7 +21,7 @@ public class WxCpAgentJsapiSignature implements Serializable {
 
   private String corpid;
 
-  private Integer agentid;
+  private Long agentid;
 
   private long timestamp;
 
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/corpgroup/WxCpCorpGroupCorpGetTokenReq.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/corpgroup/WxCpCorpGroupCorpGetTokenReq.java
index 6370fc7c1..7fa00a3ad 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/corpgroup/WxCpCorpGroupCorpGetTokenReq.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/corpgroup/WxCpCorpGroupCorpGetTokenReq.java
@@ -17,5 +17,5 @@ public class WxCpCorpGroupCorpGetTokenReq implements Serializable {
   @SerializedName("business_type")
   private int businessType;
   @SerializedName("agentid")
-  private int agentId;
+  private long agentId;
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessage.java
index 7e777384e..46784158f 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessage.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessage.java
@@ -55,7 +55,15 @@ public class WxCpLinkedCorpMessage implements Serializable {
   /**
    * 企业应用的id,整型。可在应用的设置页面查看
    */
-  private Integer agentId;
+  private Long agentId;
+
+  public void setAgentId(long agentId) {
+    this.agentId = Long.valueOf(agentId);
+  }
+
+  public void setAgentId(Long agentId) {
+    this.agentId = agentId;
+  }
   private String msgType;
   /**
    * 消息内容,最长不超过2048个字节
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpMessage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpMessage.java
index ca3fbcecc..c25b5208f 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpMessage.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpMessage.java
@@ -45,7 +45,15 @@ public class WxCpMessage implements Serializable {
   /**
    * 企业应用的id,整型。企业内部开发,可在应用的设置页面查看;第三方服务商,可通过接口 获取企业授权信息 获取该参数值
    */
-  private Integer agentId;
+  private Long agentId;
+
+  public void setAgentId(long agentId) {
+    this.agentId = Long.valueOf(agentId);
+  }
+
+  public void setAgentId(Long agentId) {
+    this.agentId = agentId;
+  }
   /**
    * 消息类型
    * 文本消息: text
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessage.java
index a13205cd6..04ec5b135 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessage.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessage.java
@@ -74,7 +74,15 @@ public class WxCpSchoolContactMessage implements Serializable {
    * 企业应用的id,整型。可在应用的设置页面查看
    */
   @SerializedName("agentid")
-  private Integer agentId;
+  private Long agentId;
+
+  public void setAgentId(long agentId) {
+    this.agentId = Long.valueOf(agentId);
+  }
+
+  public void setAgentId(Long agentId) {
+    this.agentId = agentId;
+  }
 
   /**
    * 消息内容,最长不超过2048个字节(支持id转译)
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/messagebuilder/BaseBuilder.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/messagebuilder/BaseBuilder.java
index e7c226701..fa0c747c1 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/messagebuilder/BaseBuilder.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/messagebuilder/BaseBuilder.java
@@ -15,7 +15,7 @@ public abstract class BaseBuilder {
   /**
    * The Agent id.
    */
-  protected Integer agentId;
+  protected Long agentId;
   /**
    * The To user.
    */
@@ -39,11 +39,15 @@ public abstract class BaseBuilder {
    * @param agentId the agent id
    * @return the t
    */
-  public T agentId(Integer agentId) {
+  public T agentId(Long agentId) {
     this.agentId = agentId;
     return (T) this;
   }
 
+  public T agentId(long agentId) {
+    return this.agentId(Long.valueOf(agentId));
+  }
+
   /**
    * To user t.
    *
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpConfigStorage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpConfigStorage.java
index 7f66f0509..0efe7dd60 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpConfigStorage.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpConfigStorage.java
@@ -158,7 +158,7 @@ public interface WxCpConfigStorage {
    *
    * @return the agent id
    */
-  Integer getAgentId();
+  Long getAgentId();
 
   /**
    * Gets token.
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpCorpGroupConfigStorage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpCorpGroupConfigStorage.java
index df758ac3a..61b3b4043 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpCorpGroupConfigStorage.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/WxCpCorpGroupConfigStorage.java
@@ -36,7 +36,7 @@ public interface WxCpCorpGroupConfigStorage {
    * @param corpAccessToken  the corp access token
    * @param expiresInSeconds the expires in seconds
    */
-  void updateCorpAccessToken(String corpId, Integer agentId, String corpAccessToken, int expiresInSeconds);
+  void updateCorpAccessToken(String corpId, Long agentId, String corpAccessToken, int expiresInSeconds);
 
   /**
    * 授权企业的access token相关
@@ -45,7 +45,7 @@ public interface WxCpCorpGroupConfigStorage {
    * @param agentId 应用ID
    * @return the access token
    */
-  String getCorpAccessToken(String corpId, Integer agentId);
+  String getCorpAccessToken(String corpId, Long agentId);
 
   /**
    * Gets access token entity.
@@ -54,7 +54,7 @@ public interface WxCpCorpGroupConfigStorage {
    * @param agentId 应用ID
    * @return the access token entity
    */
-  WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId);
+  WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId);
 
   /**
    * Is access token expired boolean.
@@ -63,7 +63,7 @@ public interface WxCpCorpGroupConfigStorage {
    * @param agentId 应用ID
    * @return the boolean
    */
-  boolean isCorpAccessTokenExpired(String corpId, Integer agentId);
+  boolean isCorpAccessTokenExpired(String corpId, Long agentId);
 
   /**
    * Expire access token.
@@ -71,7 +71,7 @@ public interface WxCpCorpGroupConfigStorage {
    * @param corpId  企业ID
    * @param agentId 应用ID
    */
-  void expireCorpAccessToken(String corpId, Integer agentId);
+  void expireCorpAccessToken(String corpId, Long agentId);
 
   /**
    * 网络代理相关
@@ -122,11 +122,11 @@ public interface WxCpCorpGroupConfigStorage {
    * @param agentId 应用ID
    * @return the access token lock
    */
-  Lock getCorpAccessTokenLock(String corpId, Integer agentId);
+  Lock getCorpAccessTokenLock(String corpId, Long agentId);
 
   void setCorpId(String corpId);
 
-  void setAgentId(Integer agentId);
+  void setAgentId(Long agentId);
 
   /**
    * Gets corp id.
@@ -140,5 +140,5 @@ public interface WxCpCorpGroupConfigStorage {
    *
    * @return the agent id
    */
-  Integer getAgentId();
+  Long getAgentId();
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImpl.java
index 448d2b62d..dd9879a42 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImpl.java
@@ -74,7 +74,7 @@ public abstract class AbstractWxCpInRedisConfigImpl extends WxCpDefaultConfigImp
    * @param agentId 应用 agentId
    */
   @Override
-  public void setAgentId(Integer agentId) {
+  public void setAgentId(Long agentId) {
     super.setAgentId(agentId);
     String ukey;
     if (agentId != null) {
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupDefaultConfigImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupDefaultConfigImpl.java
index b3d483442..ac57fbeb7 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupDefaultConfigImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupDefaultConfigImpl.java
@@ -39,7 +39,7 @@ public class WxCpCorpGroupDefaultConfigImpl implements WxCpCorpGroupConfigStorag
   /**
    * 微信企业号应用 ID
    */
-  private volatile Integer agentId;
+  private volatile Long agentId;
 
   @Override
   public void setBaseApiUrl(String baseUrl) {
@@ -65,17 +65,17 @@ public class WxCpCorpGroupDefaultConfigImpl implements WxCpCorpGroupConfigStorag
   }
 
   @Override
-  public Integer getAgentId() {
+  public Long getAgentId() {
     return agentId;
   }
 
   @Override
-  public void setAgentId(Integer agentId) {
+  public void setAgentId(Long agentId) {
     this.agentId = agentId;
   }
 
   @Override
-  public void updateCorpAccessToken(String corpId, Integer agentId, String corpAccessToken, int expiresInSeconds) {
+  public void updateCorpAccessToken(String corpId, Long agentId, String corpAccessToken, int expiresInSeconds) {
     String key = generateAccessTokenKey(corpId, agentId);
     corpAccessTokenMap.put(key, corpAccessToken);
     //预留200秒的时间
@@ -83,12 +83,12 @@ public class WxCpCorpGroupDefaultConfigImpl implements WxCpCorpGroupConfigStorag
   }
 
   @Override
-  public String getCorpAccessToken(String corpId, Integer agentId) {
+  public String getCorpAccessToken(String corpId, Long agentId) {
     return this.corpAccessTokenMap.get(generateAccessTokenKey(corpId, agentId));
   }
 
   @Override
-  public WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId) {
+  public WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId) {
     String key = generateAccessTokenKey(corpId, agentId);
     String accessToken = corpAccessTokenMap.getOrDefault(key, StringUtils.EMPTY);
     Long expire = corpAccessTokenExpireTimeMap.getOrDefault(key, 0L);
@@ -99,7 +99,7 @@ public class WxCpCorpGroupDefaultConfigImpl implements WxCpCorpGroupConfigStorag
   }
 
   @Override
-  public boolean isCorpAccessTokenExpired(String corpId, Integer agentId) {
+  public boolean isCorpAccessTokenExpired(String corpId, Long agentId) {
     //不存在或者过期
     String key = generateAccessTokenKey(corpId, agentId);
     return corpAccessTokenExpireTimeMap.get(key) == null
@@ -107,7 +107,7 @@ public class WxCpCorpGroupDefaultConfigImpl implements WxCpCorpGroupConfigStorag
   }
 
   @Override
-  public void expireCorpAccessToken(String corpId, Integer agentId) {
+  public void expireCorpAccessToken(String corpId, Long agentId) {
     String key = generateAccessTokenKey(corpId, agentId);
     corpAccessTokenMap.remove(key);
     corpAccessTokenExpireTimeMap.remove(key);
@@ -189,12 +189,12 @@ public class WxCpCorpGroupDefaultConfigImpl implements WxCpCorpGroupConfigStorag
   }
 
   @Override
-  public Lock getCorpAccessTokenLock(String corpId, Integer agentId) {
+  public Lock getCorpAccessTokenLock(String corpId, Long agentId) {
     return this.corpAccessTokenLocker
       .computeIfAbsent(generateAccessTokenKey(corpId, agentId), key -> new ReentrantLock());
   }
 
-  private String generateAccessTokenKey(String corpId, Integer agentId) {
+  private String generateAccessTokenKey(String corpId, Long agentId) {
     return String.join(":", this.corpId, String.valueOf(this.agentId), corpId, String.valueOf(agentId));
   }
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupRedissonConfigImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupRedissonConfigImpl.java
index 1ef05ba8b..d5b566a5e 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupRedissonConfigImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpCorpGroupRedissonConfigImpl.java
@@ -60,7 +60,7 @@ public class WxCpCorpGroupRedissonConfigImpl implements WxCpCorpGroupConfigStora
   /**
    * 微信企业号应用 ID
    */
-  private volatile Integer agentId;
+  private volatile Long agentId;
 
   @Override
   public void setBaseApiUrl(String baseUrl) {
@@ -86,27 +86,27 @@ public class WxCpCorpGroupRedissonConfigImpl implements WxCpCorpGroupConfigStora
   }
 
   @Override
-  public Integer getAgentId() {
+  public Long getAgentId() {
     return agentId;
   }
 
   @Override
-  public void setAgentId(Integer agentId) {
+  public void setAgentId(Long agentId) {
     this.agentId = agentId;
   }
 
   @Override
-  public void updateCorpAccessToken(String corpId, Integer agentId, String corpAccessToken, int expiresInSeconds) {
+  public void updateCorpAccessToken(String corpId, Long agentId, String corpAccessToken, int expiresInSeconds) {
     wxRedisOps.setValue(generateAccessTokenKey(corpId, agentId), corpAccessToken, expiresInSeconds, TimeUnit.SECONDS);
   }
 
   @Override
-  public String getCorpAccessToken(String corpId, Integer agentId) {
+  public String getCorpAccessToken(String corpId, Long agentId) {
     return wxRedisOps.getValue(generateAccessTokenKey(corpId, agentId));
   }
 
   @Override
-  public WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId) {
+  public WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId) {
     String key = generateAccessTokenKey(corpId, agentId);
     String accessToken = wxRedisOps.getValue(key);
     Long expire = wxRedisOps.getExpire(key);
@@ -120,13 +120,13 @@ public class WxCpCorpGroupRedissonConfigImpl implements WxCpCorpGroupConfigStora
   }
 
   @Override
-  public boolean isCorpAccessTokenExpired(String corpId, Integer agentId) {
+  public boolean isCorpAccessTokenExpired(String corpId, Long agentId) {
     String key = generateAccessTokenKey(corpId, agentId);
     return wxRedisOps.getExpire(key) == 0L || wxRedisOps.getExpire(key) == -2;
   }
 
   @Override
-  public void expireCorpAccessToken(String corpId, Integer agentId) {
+  public void expireCorpAccessToken(String corpId, Long agentId) {
     wxRedisOps.expire(generateAccessTokenKey(corpId, agentId), 0, TimeUnit.SECONDS);
   }
 
@@ -206,11 +206,11 @@ public class WxCpCorpGroupRedissonConfigImpl implements WxCpCorpGroupConfigStora
   }
 
   @Override
-  public Lock getCorpAccessTokenLock(String corpId, Integer agentId) {
+  public Lock getCorpAccessTokenLock(String corpId, Long agentId) {
     return this.getLockByKey(String.join(":", corpId, String.valueOf(agentId), LOCKER_CORP_ACCESS_TOKEN));
   }
 
-  private String generateAccessTokenKey(String corpId, Integer agentId) {
+  private String generateAccessTokenKey(String corpId, Long agentId) {
     return String.join(":", keyPrefix, CG_ACCESS_TOKEN_KEY, corpId, String.valueOf(agentId));
   }
 
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImpl.java
index 643537015..484e0c428 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImpl.java
@@ -30,7 +30,7 @@ public class WxCpDefaultConfigImpl implements WxCpConfigStorage, Serializable {
   /**
    * The Agent id.
    */
-  protected volatile Integer agentId;
+  protected volatile Long agentId;
   /**
    * The Jsapi ticket lock.
    */
@@ -320,7 +320,7 @@ public class WxCpDefaultConfigImpl implements WxCpConfigStorage, Serializable {
   }
 
   @Override
-  public Integer getAgentId() {
+  public Long getAgentId() {
     return this.agentId;
   }
 
@@ -329,10 +329,14 @@ public class WxCpDefaultConfigImpl implements WxCpConfigStorage, Serializable {
    *
    * @param agentId the agent id
    */
-  public void setAgentId(Integer agentId) {
+  public void setAgentId(Long agentId) {
     this.agentId = agentId;
   }
 
+  public void setAgentId(long agentId) {
+    this.setAgentId(Long.valueOf(agentId));
+  }
+
   /**
    * 设置企微会话存档路径.
    *
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java
index 85d136e01..a013a9b93 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/config/impl/WxCpRedisConfigImpl.java
@@ -40,7 +40,7 @@ public class WxCpRedisConfigImpl implements WxCpConfigStorage {
   private volatile String corpSecret;
   private volatile String token;
   private volatile String aesKey;
-  private volatile Integer agentId;
+  private volatile Long agentId;
   private volatile String msgAuditPriKey;
   private volatile String msgAuditLibPath;
   private volatile String oauth2redirectUri;
@@ -312,7 +312,7 @@ public class WxCpRedisConfigImpl implements WxCpConfigStorage {
   }
 
   @Override
-  public Integer getAgentId() {
+  public Long getAgentId() {
     return this.agentId;
   }
 
@@ -321,7 +321,7 @@ public class WxCpRedisConfigImpl implements WxCpConfigStorage {
    *
    * @param agentId the agent id
    */
-  public void setAgentId(Integer agentId) {
+  public void setAgentId(Long agentId) {
     this.agentId = agentId;
   }
 
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/WxCpCgService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/WxCpCgService.java
index f94c14a4f..a8d0de682 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/WxCpCgService.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/WxCpCgService.java
@@ -24,11 +24,11 @@ public interface WxCpCgService {
    * @param corpAccessToken  the corp access token
    * @param expiresInSeconds the expires in seconds
    */
-  void updateCorpAccessToken(String corpId, Integer agentId, String corpAccessToken, int expiresInSeconds);
+  void updateCorpAccessToken(String corpId, Long agentId, String corpAccessToken, int expiresInSeconds);
 
-  String getCorpAccessToken(String corpId, Integer agentId, Integer businessType) throws WxErrorException;
+  String getCorpAccessToken(String corpId, Long agentId, Integer businessType) throws WxErrorException;
 
-  String getCorpAccessToken(String corpId, Integer agentId, Integer businessType, boolean forceRefresh) throws WxErrorException;
+  String getCorpAccessToken(String corpId, Long agentId, Integer businessType, boolean forceRefresh) throws WxErrorException;
 
   /**
    * 授权企业的access token相关
@@ -39,7 +39,7 @@ public interface WxCpCgService {
    * @return the access token
    * @throws WxErrorException 微信错误异常
    */
-  WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId, Integer businessType) throws WxErrorException;
+  WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId, Integer businessType) throws WxErrorException;
 
   /**
    * Gets access token entity.
@@ -51,7 +51,7 @@ public interface WxCpCgService {
    * @return the access token entity
    * @throws WxErrorException 微信错误异常
    */
-  WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId, Integer businessType, boolean forceRefresh) throws WxErrorException;
+  WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId, Integer businessType, boolean forceRefresh) throws WxErrorException;
 
   /**
    * Is access token expired boolean.
@@ -60,7 +60,7 @@ public interface WxCpCgService {
    * @param agentId 应用ID
    * @return the boolean
    */
-  boolean isCorpAccessTokenExpired(String corpId, Integer agentId);
+  boolean isCorpAccessTokenExpired(String corpId, Long agentId);
 
   /**
    * Expire access token.
@@ -68,7 +68,7 @@ public interface WxCpCgService {
    * @param corpId  企业ID
    * @param agentId 应用ID
    */
-  void expireCorpAccessToken(String corpId, Integer agentId);
+  void expireCorpAccessToken(String corpId, Long agentId);
 
   /**
    * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求.
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/impl/BaseWxCpCgServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/impl/BaseWxCpCgServiceImpl.java
index e4fe2a686..5439849f2 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/impl/BaseWxCpCgServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/corpgroup/service/impl/BaseWxCpCgServiceImpl.java
@@ -43,17 +43,17 @@ public abstract class BaseWxCpCgServiceImpl implements WxCpCgService, Requ
   private final WxCpLinkedCorpService linkedCorpService = new WxCpLinkedCorpServiceImpl(this);
 
   @Override
-  public void updateCorpAccessToken(String corpId, Integer agentId, String corpAccessToken, int expiresInSeconds) {
+  public void updateCorpAccessToken(String corpId, Long agentId, String corpAccessToken, int expiresInSeconds) {
 
   }
 
   @Override
-  public String getCorpAccessToken(String corpId, Integer agentId, Integer businessType) throws WxErrorException {
+  public String getCorpAccessToken(String corpId, Long agentId, Integer businessType) throws WxErrorException {
     return getCorpAccessToken(corpId, agentId, businessType, false);
   }
 
   @Override
-  public String getCorpAccessToken(String corpId, Integer agentId, Integer businessType, boolean forceRefresh) throws WxErrorException {
+  public String getCorpAccessToken(String corpId, Long agentId, Integer businessType, boolean forceRefresh) throws WxErrorException {
     if (!this.configStorage.isCorpAccessTokenExpired(corpId, agentId) && !forceRefresh) {
       return this.configStorage.getCorpAccessToken(corpId, agentId);
     }
@@ -71,23 +71,23 @@ public abstract class BaseWxCpCgServiceImpl implements WxCpCgService, Requ
   }
 
   @Override
-  public WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId, Integer businessType) throws WxErrorException {
+  public WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId, Integer businessType) throws WxErrorException {
     return this.getCorpAccessTokenEntity(corpId, agentId, businessType, false);
   }
 
 
   @Override
-  public WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId, Integer businessType, boolean forceRefresh) throws WxErrorException {
+  public WxAccessToken getCorpAccessTokenEntity(String corpId, Long agentId, Integer businessType, boolean forceRefresh) throws WxErrorException {
     return this.configStorage.getCorpAccessTokenEntity(corpId, agentId);
   }
 
   @Override
-  public boolean isCorpAccessTokenExpired(String corpId, Integer agentId) {
+  public boolean isCorpAccessTokenExpired(String corpId, Long agentId) {
     return this.configStorage.isCorpAccessTokenExpired(corpId, agentId);
   }
 
   @Override
-  public void expireCorpAccessToken(String corpId, Integer agentId) {
+  public void expireCorpAccessToken(String corpId, Long agentId) {
     this.configStorage.expireCorpAccessToken(corpId, agentId);
   }
 
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java
index bdc85afcf..115eafd18 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java
@@ -121,7 +121,7 @@ public class BaseWxCpServiceImplTest {
         return config;
       }
     };
-    config.setAgentId(1);
+    config.setAgentId(1L);
     service.setWxCpConfigStorage(config);
     RequestExecutor re = mock(RequestExecutor.class);
 
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImplTest.java
index cbd947b92..e9004c6cf 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImplTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImplTest.java
@@ -43,7 +43,7 @@ public class WxCpAgentServiceImplTest {
    */
   @Test
   public void testGet() throws Exception {
-    final Integer agentId = this.wxCpService.getWxCpConfigStorage().getAgentId();
+    final Long agentId = this.wxCpService.getWxCpConfigStorage().getAgentId();
     WxCpAgent wxCpAgent = this.wxCpService.getAgentService().get(agentId);
 
     assertThat(wxCpAgent.getAgentId()).isEqualTo(agentId);
@@ -60,7 +60,7 @@ public class WxCpAgentServiceImplTest {
    */
   @Test
   public void testSet() throws WxErrorException {
-    final Integer agentId = this.wxCpService.getWxCpConfigStorage().getAgentId();
+    final Long agentId = this.wxCpService.getWxCpConfigStorage().getAgentId();
 
     this.wxCpService.getAgentService().set(WxCpAgent.builder()
       .description("abcddd")
@@ -92,7 +92,7 @@ public class WxCpAgentServiceImplTest {
    */
   @Test
   public void testGetAdminList() throws WxErrorException {
-    final Integer agentId = this.wxCpService.getWxCpConfigStorage().getAgentId();
+    final Long agentId = this.wxCpService.getWxCpConfigStorage().getAgentId();
     WxCpTpAdmin adminList = this.wxCpService.getAgentService().getAdminList(agentId);
 
     assertThat(adminList).isNotNull();
@@ -124,7 +124,7 @@ public class WxCpAgentServiceImplTest {
       when(wxService.getAgentService()).thenReturn(new WxCpAgentServiceImpl(wxService));
 
       WxCpAgentService wxAgentService = this.wxService.getAgentService();
-      WxCpAgent wxCpAgent = wxAgentService.get(9);
+      WxCpAgent wxCpAgent = wxAgentService.get(9L);
 
       assertEquals(9, wxCpAgent.getAgentId().intValue());
 
@@ -171,7 +171,7 @@ public class WxCpAgentServiceImplTest {
       when(wxService.getAgentService()).thenReturn(new WxCpAgentServiceImpl(wxService));
 
       WxCpAgentService wxAgentService = this.wxService.getAgentService();
-      WxCpTpAdmin adminList = wxAgentService.getAdminList(9);
+      WxCpTpAdmin adminList = wxAgentService.getAdminList(9L);
 
       assertEquals(0, adminList.getErrcode().intValue());
       assertEquals(2, adminList.getAdmin().size());
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 e78ce5c00..44928e3e7 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
@@ -23,7 +23,7 @@ public class WxCpCorpGroupServiceImplTest {
 
   @Test
   public void testListAppShareInfo() throws WxErrorException {
-    Integer agentId = wxService.getWxCpConfigStorage().getAgentId();
+    Long agentId = wxService.getWxCpConfigStorage().getAgentId();
     Integer businessType = 1;
     String corpId = null;
     Integer limit = null;
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageTest.java
index cab57e151..e008e4772 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageTest.java
@@ -27,7 +27,7 @@ public class WxCpLinkedCorpMessageTest {
       .toUsers(new String[]{"userid1", "userid2", "CorpId1/userid1", "CorpId2/userid2"})
       .toParties(new String[]{"partyid1", "partyid2", "LinkedId1/partyid1", "LinkedId2/partyid2"})
       .toTags(new String[]{"tagid1", "tagid2"})
-      .agentId(1)
+      .agentId(1L)
       .isToAll(false)
       .isSafe(false)
       .content("你的快递已到,请携带工卡前往邮件中心领取。\n出发前可查看邮件中心视频实况,聪明避开排队。")
@@ -61,7 +61,7 @@ public class WxCpLinkedCorpMessageTest {
       .toUsers(new String[]{"userid1", "userid2", "CorpId1/userid1", "CorpId2/userid2"})
       .toParties(new String[]{"partyid1", "partyid2", "LinkedId1/partyid1", "LinkedId2/partyid2"})
       .toTags(new String[]{"tagid1", "tagid2"})
-      .agentId(1)
+      .agentId(1L)
       .isToAll(false)
       .isSafe(false)
       .mediaId("MEDIA_ID")
@@ -94,7 +94,7 @@ public class WxCpLinkedCorpMessageTest {
       .toUsers(new String[]{"userid1", "userid2", "CorpId1/userid1", "CorpId2/userid2"})
       .toParties(new String[]{"partyid1", "partyid2", "LinkedId1/partyid1", "LinkedId2/partyid2"})
       .toTags(new String[]{"tagid1", "tagid2"})
-      .agentId(1)
+      .agentId(1L)
       .isToAll(false)
       .isSafe(false)
       .mediaId("MEDIA_ID")
@@ -131,7 +131,7 @@ public class WxCpLinkedCorpMessageTest {
       .toUsers(new String[]{"userid1", "userid2", "CorpId1/userid1", "CorpId2/userid2"})
       .toParties(new String[]{"partyid1", "partyid2", "LinkedId1/partyid1", "LinkedId2/partyid2"})
       .toTags(new String[]{"tagid1", "tagid2"})
-      .agentId(1)
+      .agentId(1L)
       .isToAll(false)
       .isSafe(false)
       .mediaId("1Yv-zXfHjSjU-7LH-GwtYqDGS-zz6w22KmWAT5COgP7o")
@@ -164,7 +164,7 @@ public class WxCpLinkedCorpMessageTest {
       .toUsers(new String[]{"userid1", "userid2", "CorpId1/userid1", "CorpId2/userid2"})
       .toParties(new String[]{"partyid1", "partyid2", "LinkedId1/partyid1", "LinkedId2/partyid2"})
       .toTags(new String[]{"tagid1", "tagid2"})
-      .agentId(1)
+      .agentId(1L)
       .isToAll(false)
       .title("领奖通知")
       .description("
2016年9月26日
恭喜你抽中iPhone 7一台,领奖码:xxxx
**事项详情**\n" + diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpMessageTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpMessageTest.java index 9d6210b46..04f22a3d8 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpMessageTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpMessageTest.java @@ -238,7 +238,7 @@ public class WxCpMessageTest { WxCpMessage reply = WxCpMessage.TEMPLATECARD().toUser("OPENID") .toParty("PartyID1 | PartyID2") .toTag("TagID1 | TagID2") - .agentId(1000002) + .agentId(1000002L) .cardType(WxConsts.TemplateCardType.TEXT_NOTICE) .taskId("task_id") .sourceIconUrl("图片的url") @@ -328,7 +328,7 @@ public class WxCpMessageTest { .build(); WxCpMessage reply = WxCpMessage.TEMPLATECARD().toUser("OPENID") - .agentId(1000002) + .agentId(1000002L) .cardType(WxConsts.TemplateCardType.NEWS_NOTICE) .sourceIconUrl("图片的url") .sourceDesc("企业微信") @@ -395,7 +395,7 @@ public class WxCpMessageTest { .build(); WxCpMessage reply = WxCpMessage.TEMPLATECARD().toUser("OPENID") - .agentId(1000002) + .agentId(1000002L) .cardType(WxConsts.TemplateCardType.BUTTON_INTERACTION) .sourceIconUrl("图片的url") .sourceDesc("企业微信") @@ -444,7 +444,7 @@ public class WxCpMessageTest { .build(); WxCpMessage reply = WxCpMessage.TEMPLATECARD().toUser("OPENID") - .agentId(1000002) + .agentId(1000002L) .cardType(WxConsts.TemplateCardType.VOTE_INTERACTION) .sourceIconUrl("图片的url") .sourceDesc("企业微信") @@ -510,7 +510,7 @@ public class WxCpMessageTest { WxCpMessage reply = WxCpMessage.TEMPLATECARD().toUser("OPENID") - .agentId(1000002) + .agentId(1000002L) .cardType(WxConsts.TemplateCardType.MULTIPLE_INTERACTION) .sourceIconUrl("图片的url") .sourceDesc("企业微信") diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessageTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessageTest.java index f26182705..8fd627ec9 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessageTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpSchoolContactMessageTest.java @@ -109,7 +109,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .content("你的快递已到,请携带工卡前往邮件中心领取。\n出发前可查看邮件中心视频实况,聪明避开排队。") .enableIdTrans(false) .enableDuplicateCheck(false) @@ -123,7 +123,7 @@ public class WxCpSchoolContactMessageTest { schoolContactMessage1.setToStudentUserId(new String[]{"student_userid1", "student_userid2"}); schoolContactMessage1.setToParty(new String[]{"partyid1", "partyid2"}); schoolContactMessage1.setToAll(false); - schoolContactMessage1.setAgentId(1); + schoolContactMessage1.setAgentId(1L); schoolContactMessage1.setContent("你的快递已到,请携带工卡前往邮件中心领取"); schoolContactMessage1.setEnableIdTrans(false); schoolContactMessage1.setEnableDuplicateCheck(false); @@ -163,7 +163,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .mediaId("MEDIA_ID") .build(); @@ -198,7 +198,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .mediaId("MEDIA_ID") .build(); @@ -233,7 +233,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .mediaId("MEDIA_ID") .title("Title") .description("Description") @@ -272,7 +272,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .mediaId("1Yv-zXfHjSjU-7LH-GwtYqDGS-zz6w22KmWAT5COgP7o") .build(); @@ -307,7 +307,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .articles(Lists.newArrayList(NewArticle.builder() .title("中秋节礼品领取") .description("今年中秋节公司有豪礼相送") @@ -357,7 +357,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .mpNewsArticles(Lists.newArrayList(MpnewsArticle.newBuilder() .title("Title") .thumbMediaId("MEDIA_ID") @@ -409,7 +409,7 @@ public class WxCpSchoolContactMessageTest { .toStudentUserId(new String[]{"student_userid1", "student_userid2"}) .toParty(new String[]{"partyid1", "partyid2"}) .toAll(false) - .agentId(1) + .agentId(1L) .appId("APPID") .title("欢迎报名夏令营") .thumbMediaId("MEDIA_ID") diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImplTest.java index 201286943..3f96797a8 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/AbstractWxCpInRedisConfigImplTest.java @@ -29,7 +29,7 @@ public class AbstractWxCpInRedisConfigImplTest { // 使用匿名类提供具体实现用于测试 }; config.setCorpId("testCorpId"); - config.setAgentId(1); + config.setAgentId(1L); } /** diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/DemoToStringFix.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/DemoToStringFix.java index 48fe9a663..1edbe6b4c 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/DemoToStringFix.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/DemoToStringFix.java @@ -30,7 +30,7 @@ public class DemoToStringFix { }; config.setCorpId("demoCorpId"); - config.setAgentId(1001); + config.setAgentId(1001L); System.out.println("Testing toString() method:"); try { diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImplTest.java new file mode 100644 index 000000000..06807137e --- /dev/null +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/config/impl/WxCpDefaultConfigImplTest.java @@ -0,0 +1,17 @@ +package me.chanjar.weixin.cp.config.impl; + +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; + +public class WxCpDefaultConfigImplTest { + + @Test + public void shouldStoreAgentIdBeyondIntegerRange() { + WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl(); + + config.setAgentId(1013699173317L); + + assertEquals(config.getAgentId(), Long.valueOf(1013699173317L)); + } +} diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/corpgroup/service/impl/WxCpCgServiceApacheHttpClientImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/corpgroup/service/impl/WxCpCgServiceApacheHttpClientImplTest.java index 4c99dbf5e..7fcd0b91e 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/corpgroup/service/impl/WxCpCgServiceApacheHttpClientImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/corpgroup/service/impl/WxCpCgServiceApacheHttpClientImplTest.java @@ -38,7 +38,7 @@ public class WxCpCgServiceApacheHttpClientImplTest { //下游企业的corpId String corpId = ""; //下游企业的agentId - int agentId = 0; + Long agentId = 0L; int businessType = 0; String userId = ""; WxCpCorpGroupCorpGetTokenReq wxCpCorpGroupCorpGetTokenReq; diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpMessageServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpMessageServiceImplTest.java index ff0a143b7..48ee6bb80 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpMessageServiceImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpMessageServiceImplTest.java @@ -77,7 +77,7 @@ public class WxCpTpMessageServiceImplTest { + "?access_token=" + accessToken; when(wxCpTpService.post(eq(expectedUrl), anyString(), eq(true))).thenReturn(mockResponse); - WxCpMessage message = WxCpMessage.TEXT().toUser("zhangsan").content("hello").agentId(1).build(); + WxCpMessage message = WxCpMessage.TEXT().toUser("zhangsan").content("hello").agentId(1L).build(); WxCpMessageSendResult result = wxCpTpMessageService.send(message, corpId); assertNotNull(result);