🎨 #4079 【企业微信】支持长整型的企业微信应用ID
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ public interface WxCpCorpGroupService {
|
||||
* @return the list
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
List<WxCpCorpGroupCorp> listAppShareInfo(Integer agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException;
|
||||
List<WxCpCorpGroupCorp> listAppShareInfo(Long agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 获取家校访问用户身份
|
||||
|
||||
@@ -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参数");
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class WxCpCorpGroupServiceImpl implements WxCpCorpGroupService {
|
||||
private final WxCpService cpService;
|
||||
|
||||
@Override
|
||||
public List<WxCpCorpGroupCorp> listAppShareInfo(Integer agentId, Integer businessType, String corpId,
|
||||
public List<WxCpCorpGroupCorp> 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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class WxCpTaskCardServiceImpl implements WxCpTaskCardService {
|
||||
|
||||
@Override
|
||||
public void update(List<String> userIds, String taskId, String replaceName) throws WxErrorException {
|
||||
Integer agentId = this.mainService.getWxCpConfigStorage().getAgentId();
|
||||
Long agentId = this.mainService.getWxCpConfigStorage().getAgentId();
|
||||
|
||||
Map<String, Object> data = new HashMap<>(4);
|
||||
data.put("userids", userIds);
|
||||
@@ -45,7 +45,7 @@ public class WxCpTaskCardServiceImpl implements WxCpTaskCardService {
|
||||
public void updateTemplateCardButton(List<String> userIds, List<Integer> partyIds,
|
||||
List<Integer> tagIds, Integer atAll,
|
||||
String responseCode, String replaceName) throws WxErrorException {
|
||||
Integer agentId = this.mainService.getWxCpConfigStorage().getAgentId();
|
||||
Long agentId = this.mainService.getWxCpConfigStorage().getAgentId();
|
||||
Map<String, Object> data = new HashMap<>(7);
|
||||
data.put("userids", userIds);
|
||||
data.put("partyids", partyIds);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class WxCpAgentJsapiSignature implements Serializable {
|
||||
|
||||
private String corpid;
|
||||
|
||||
private Integer agentid;
|
||||
private Long agentid;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
|
||||
@@ -17,5 +17,5 @@ public class WxCpCorpGroupCorpGetTokenReq implements Serializable {
|
||||
@SerializedName("business_type")
|
||||
private int businessType;
|
||||
@SerializedName("agentid")
|
||||
private int agentId;
|
||||
private long agentId;
|
||||
}
|
||||
|
||||
@@ -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个字节
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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转译)
|
||||
|
||||
@@ -15,7 +15,7 @@ public abstract class BaseBuilder<T> {
|
||||
/**
|
||||
* The Agent id.
|
||||
*/
|
||||
protected Integer agentId;
|
||||
protected Long agentId;
|
||||
/**
|
||||
* The To user.
|
||||
*/
|
||||
@@ -39,11 +39,15 @@ public abstract class BaseBuilder<T> {
|
||||
* @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.
|
||||
*
|
||||
|
||||
@@ -158,7 +158,7 @@ public interface WxCpConfigStorage {
|
||||
*
|
||||
* @return the agent id
|
||||
*/
|
||||
Integer getAgentId();
|
||||
Long getAgentId();
|
||||
|
||||
/**
|
||||
* Gets token.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置企微会话存档路径.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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请求.
|
||||
|
||||
@@ -43,17 +43,17 @@ public abstract class BaseWxCpCgServiceImpl<H, P> 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<H, P> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public class BaseWxCpServiceImplTest {
|
||||
return config;
|
||||
}
|
||||
};
|
||||
config.setAgentId(1);
|
||||
config.setAgentId(1L);
|
||||
service.setWxCpConfigStorage(config);
|
||||
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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出发前可查看<a href=\"http://work.weixin.qq.com\">邮件中心视频实况</a>,聪明避开排队。")
|
||||
@@ -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("<div class=\"gray\">2016年9月26日</div> <div class=\"normal\">恭喜你抽中iPhone 7一台,领奖码:xxxx</div><div " +
|
||||
@@ -203,7 +203,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)
|
||||
.articles(Lists.newArrayList(NewArticle.builder()
|
||||
.title("中秋节礼品领取")
|
||||
@@ -250,7 +250,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)
|
||||
.mpNewsArticles(Lists.newArrayList(MpnewsArticle.newBuilder()
|
||||
@@ -299,7 +299,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)
|
||||
.content("您的会议室已经预定,稍后会同步到`邮箱`\n" +
|
||||
" >**事项详情**\n" +
|
||||
|
||||
@@ -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("企业微信")
|
||||
|
||||
@@ -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出发前可查看<a href=\"http://work.weixin.qq.com\">邮件中心视频实况</a>,聪明避开排队。")
|
||||
.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")
|
||||
|
||||
@@ -29,7 +29,7 @@ public class AbstractWxCpInRedisConfigImplTest {
|
||||
// 使用匿名类提供具体实现用于测试
|
||||
};
|
||||
config.setCorpId("testCorpId");
|
||||
config.setAgentId(1);
|
||||
config.setAgentId(1L);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ public class DemoToStringFix {
|
||||
};
|
||||
|
||||
config.setCorpId("demoCorpId");
|
||||
config.setAgentId(1001);
|
||||
config.setAgentId(1001L);
|
||||
|
||||
System.out.println("Testing toString() method:");
|
||||
try {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class WxCpCgServiceApacheHttpClientImplTest {
|
||||
//下游企业的corpId
|
||||
String corpId = "";
|
||||
//下游企业的agentId
|
||||
int agentId = 0;
|
||||
Long agentId = 0L;
|
||||
int businessType = 0;
|
||||
String userId = "";
|
||||
WxCpCorpGroupCorpGetTokenReq wxCpCorpGroupCorpGetTokenReq;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user