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 a10bdf9bed..a793a8501f 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 @@ private WxCpService wxCpService(WxCpConfigStorage wxCpConfigStorage, WxCpMultiPr 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 fcfa654a15..740f5a2a3b 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 c93a7e187f..63e730d1b4 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 2b1d8c13c5..70f620a58d 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-common/src/main/java/me/chanjar/weixin/common/util/DataUtils.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/DataUtils.java index 095363cf8d..2e9f5d4c7b 100644 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/DataUtils.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/DataUtils.java @@ -17,8 +17,10 @@ public class DataUtils { */ public static
@@ -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 69aea4bca7..16882669b7 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 07f300dd14..bfa2c1c938 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 1824196720..695534ba73 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 cc08d33bb1..6f2ade2e49 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 List list() throws WxErrorException {
}
@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 e3dc1cbe1c..73d11cc15d 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 d008e77083..0920c2b3e0 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 void create(WxMenu menu) throws WxErrorException {
}
@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 void delete() throws WxErrorException {
}
@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 WxMenu get() throws WxErrorException {
}
@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 6daea8ef2f..def73e4152 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 WxCpMessageSendStatistics getStatistics(int timeType) throws WxErrorExcep
@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 d04a051c0e..9b390b5ec8 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 WxCpOauth2UserInfo getUserInfo(String code) throws WxErrorException {
}
@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 8469451428..0cf0ab6665 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 void update(List userIds, String taskId, String replaceName) thro
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 5d61b3a199..8f96a729a0 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 4562d9b9b0..8ca7a6cb95 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 6370fc7c11..7fa00a3ada 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 7e777384eb..46784158f3 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 ca3fbceccb..c25b5208f1 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 a13205cd6b..04ec5b135b 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 e7c2267018..fa0c747c16 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 7f66f05094..0efe7dd606 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 df758ac3a2..61b3b4043b 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 448d2b62dd..dd9879a42a 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 AbstractWxCpInRedisConfigImpl(@NonNull WxRedisOps redisOps, String keyPre
* @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 b3d4834426..ac57fbeb7a 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 void setCorpId(String corpId) {
}
@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 void updateCorpAccessToken(String corpId, Integer agentId, String corpAcc
}
@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 WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId) {
}
@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 boolean isCorpAccessTokenExpired(String corpId, Integer agentId) {
}
@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 boolean autoRefreshToken() {
}
@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 1ef05ba8b3..d5b566a5e5 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 void setCorpId(String corpId) {
}
@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 WxAccessToken getCorpAccessTokenEntity(String corpId, Integer agentId) {
}
@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 boolean autoRefreshToken() {
}
@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 6435370150..484e0c4284 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 void setAesKey(String aesKey) {
}
@Override
- public Integer getAgentId() {
+ public Long getAgentId() {
return this.agentId;
}
@@ -329,10 +329,14 @@ public Integer getAgentId() {
*
* @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 85d136e01d..a013a9b930 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 void setCorpSecret(String corpSecret) {
}
@Override
- public Integer getAgentId() {
+ public Long getAgentId() {
return this.agentId;
}
@@ -321,7 +321,7 @@ public Integer getAgentId() {
*
* @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 f94c14a4f1..a8d0de682e 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 e4fe2a686a..5439849f2a 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 String getCorpAccessToken(String corpId, Integer agentId, Integer busines
}
@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 bdc85afcfc..115eafd182 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 WxCpConfigStorage getWxCpConfigStorage() {
return config;
}
};
- config.setAgentId(1);
+ config.setAgentId(1L);
service.setWxCpConfigStorage(config);
RequestExecutor