| @@ -4,8 +4,8 @@ | |||
| ### 声明:本项目Fork自chanjarster/weixin-java-tools,但由于原项目已停止维护,故单独维护和发布,且发布到maven上的groupId也会不同,详细信息见下文。 | |||
| ### 最新更新:2.0.0版发布!!! on 2016-07-31 | |||
| #### 由于本次更新涉及接口调整比较大,主要是公众号的调整,企业号无过多调整,主要是为了解决主接口类过于庞大不方便管理的问题,将接口实现代码按模块进行拆分。因此版本号直接从1.X.X直接升级到2.0.0,所以如果习惯于1.X.X版本的同学不想做过多更改的话,请慎重考虑升级到最新版本。 | |||
| ### 最新更新:2.1.0版发布!!! on 2016-08-31 | |||
| #### 自2.0.0版本以来,接口调整比较大,主要是公众号的调整,企业号无过多调整,主要是为了解决主接口类过于庞大不方便管理的问题,将接口实现代码按模块进行拆分。所以如果习惯于1.X.X版本的同学不想做过多更改的话,请慎重考虑升级到2.X.X版本。 | |||
| --- | |||
| ### 详细开发文档请看 [wiki](https://github.com/chanjarster/weixin-java-tools/wiki)。 | |||
| @@ -32,12 +32,12 @@ | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-mp</artifactId> | |||
| <version>2.0.0</version> | |||
| <version>2.1.0</version> | |||
| </dependency> | |||
| ``` | |||
| ```groovy | |||
| compile 'com.github.binarywang:weixin-java-mp:2.0.0' | |||
| compile 'com.github.binarywang:weixin-java-mp:2.1.0' | |||
| ``` | |||
| * 企业号: | |||
| @@ -45,12 +45,12 @@ compile 'com.github.binarywang:weixin-java-mp:2.0.0' | |||
| <dependency> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-cp</artifactId> | |||
| <version>2.0.0</version> | |||
| <version>2.1.0</version> | |||
| </dependency> | |||
| ``` | |||
| ```groovy | |||
| compile 'com.github.binarywang:weixin-java-cp:2.0.0' | |||
| compile 'com.github.binarywang:weixin-java-cp:2.1.0' | |||
| ``` | |||
| #### 本项目主要存放在github上,地址为 : | |||
| @@ -5,7 +5,7 @@ | |||
| <modelVersion>4.0.0</modelVersion> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.1.0-SNAPSHOT</version> | |||
| <version>2.1.0</version> | |||
| <packaging>pom</packaging> | |||
| <name>WeiXin Java Tools - Parent</name> | |||
| <description>微信公众号、企业号上级POM</description> | |||
| @@ -6,7 +6,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.1.0-SNAPSHOT</version> | |||
| <version>2.1.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-common</artifactId> | |||
| @@ -61,7 +61,7 @@ public class WxConsts { | |||
| /** | |||
| * 群发反馈消息代码所对应的文字描述 | |||
| */ | |||
| public static final Map<String, String> MASS_ST_2_DESC = new HashMap<String, String>(); | |||
| public static final Map<String, String> MASS_ST_2_DESC = new HashMap<>(); | |||
| /////////////////////// | |||
| // 微信端推送过来的事件类型 | |||
| /////////////////////// | |||
| @@ -25,7 +25,7 @@ public class WxMessageInMemoryDuplicateChecker implements WxMessageDuplicateChec | |||
| /** | |||
| * 消息id->消息时间戳的map | |||
| */ | |||
| private final ConcurrentHashMap<String, Long> msgId2Timestamp = new ConcurrentHashMap<String, Long>(); | |||
| private final ConcurrentHashMap<String, Long> msgId2Timestamp = new ConcurrentHashMap<>(); | |||
| /** | |||
| * 后台清理线程是否已经开启 | |||
| @@ -56,7 +56,7 @@ public class WxMessageInMemoryDuplicateChecker implements WxMessageDuplicateChec | |||
| } | |||
| protected void checkBackgroundProcessStarted() { | |||
| if (backgroundProcessStarted.getAndSet(true)) { | |||
| if (this.backgroundProcessStarted.getAndSet(true)) { | |||
| return; | |||
| } | |||
| Thread t = new Thread(new Runnable() { | |||
| @@ -64,11 +64,11 @@ public class WxMessageInMemoryDuplicateChecker implements WxMessageDuplicateChec | |||
| public void run() { | |||
| try { | |||
| while (true) { | |||
| Thread.sleep(clearPeriod); | |||
| Thread.sleep(WxMessageInMemoryDuplicateChecker.this.clearPeriod); | |||
| Long now = System.currentTimeMillis(); | |||
| for (Map.Entry<String, Long> entry : msgId2Timestamp.entrySet()) { | |||
| if (now - entry.getValue() > timeToLive) { | |||
| msgId2Timestamp.entrySet().remove(entry); | |||
| for (Map.Entry<String, Long> entry : WxMessageInMemoryDuplicateChecker.this.msgId2Timestamp.entrySet()) { | |||
| if (now - entry.getValue() > WxMessageInMemoryDuplicateChecker.this.timeToLive) { | |||
| WxMessageInMemoryDuplicateChecker.this.msgId2Timestamp.entrySet().remove(entry); | |||
| } | |||
| } | |||
| } | |||
| @@ -87,7 +87,7 @@ public class WxMessageInMemoryDuplicateChecker implements WxMessageDuplicateChec | |||
| return false; | |||
| } | |||
| checkBackgroundProcessStarted(); | |||
| Long timestamp = msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis()); | |||
| Long timestamp = this.msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis()); | |||
| return timestamp != null; | |||
| } | |||
| @@ -16,7 +16,7 @@ public class WxAccessToken implements Serializable { | |||
| } | |||
| public String getAccessToken() { | |||
| return accessToken; | |||
| return this.accessToken; | |||
| } | |||
| public void setAccessToken(String accessToken) { | |||
| @@ -24,7 +24,7 @@ public class WxAccessToken implements Serializable { | |||
| } | |||
| public int getExpiresIn() { | |||
| return expiresIn; | |||
| return this.expiresIn; | |||
| } | |||
| public void setExpiresIn(int expiresIn) { | |||
| @@ -39,7 +39,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getAppId() { | |||
| return appId; | |||
| return this.appId; | |||
| } | |||
| public void setAppId(String appId) { | |||
| @@ -47,7 +47,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getCardId() { | |||
| return cardId; | |||
| return this.cardId; | |||
| } | |||
| public void setCardId(String cardId) { | |||
| @@ -55,7 +55,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getCardType() { | |||
| return cardType; | |||
| return this.cardType; | |||
| } | |||
| public void setCardType(String cardType) { | |||
| @@ -63,7 +63,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getLocationId() { | |||
| return locationId; | |||
| return this.locationId; | |||
| } | |||
| public void setLocationId(String locationId) { | |||
| @@ -71,7 +71,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getCode() { | |||
| return code; | |||
| return this.code; | |||
| } | |||
| public void setCode(String code) { | |||
| @@ -79,7 +79,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getOpenId() { | |||
| return openId; | |||
| return this.openId; | |||
| } | |||
| public void setOpenId(String openId) { | |||
| @@ -87,7 +87,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public Long getTimestamp() { | |||
| return timestamp; | |||
| return this.timestamp; | |||
| } | |||
| public void setTimestamp(Long timestamp) { | |||
| @@ -95,7 +95,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getNonceStr() { | |||
| return nonceStr; | |||
| return this.nonceStr; | |||
| } | |||
| public void setNonceStr(String nonceStr) { | |||
| @@ -103,7 +103,7 @@ public class WxCardApiSignature implements Serializable { | |||
| } | |||
| public String getSignature() { | |||
| return signature; | |||
| return this.signature; | |||
| } | |||
| public void setSignature(String signature) { | |||
| @@ -19,7 +19,7 @@ public class WxJsapiSignature implements Serializable { | |||
| private String signature; | |||
| public String getSignature() { | |||
| return signature; | |||
| return this.signature; | |||
| } | |||
| public void setSignature(String signature) { | |||
| @@ -27,7 +27,7 @@ public class WxJsapiSignature implements Serializable { | |||
| } | |||
| public String getNoncestr() { | |||
| return noncestr; | |||
| return this.noncestr; | |||
| } | |||
| public void setNoncestr(String noncestr) { | |||
| @@ -35,7 +35,7 @@ public class WxJsapiSignature implements Serializable { | |||
| } | |||
| public long getTimestamp() { | |||
| return timestamp; | |||
| return this.timestamp; | |||
| } | |||
| public void setTimestamp(long timestamp) { | |||
| @@ -43,7 +43,7 @@ public class WxJsapiSignature implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -51,7 +51,7 @@ public class WxJsapiSignature implements Serializable { | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| return this.appid; | |||
| } | |||
| public void setAppid(String appid) { | |||
| @@ -19,7 +19,7 @@ public class WxMenu implements Serializable { | |||
| private static final long serialVersionUID = -7083914585539687746L; | |||
| private List<WxMenuButton> buttons = new ArrayList<WxMenuButton>(); | |||
| private List<WxMenuButton> buttons = new ArrayList<>(); | |||
| private WxMenuRule matchRule; | |||
| @@ -40,7 +40,7 @@ public class WxMenu implements Serializable { | |||
| } | |||
| public List<WxMenuButton> getButtons() { | |||
| return buttons; | |||
| return this.buttons; | |||
| } | |||
| public void setButtons(List<WxMenuButton> buttons) { | |||
| @@ -48,7 +48,7 @@ public class WxMenu implements Serializable { | |||
| } | |||
| public WxMenuRule getMatchRule() { | |||
| return matchRule; | |||
| return this.matchRule; | |||
| } | |||
| public void setMatchRule(WxMenuRule matchRule) { | |||
| @@ -62,7 +62,7 @@ public class WxMenu implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMenu{" + | |||
| "buttons=" + buttons + | |||
| "buttons=" + this.buttons + | |||
| '}'; | |||
| } | |||
| @@ -14,7 +14,7 @@ public class WxMenuButton { | |||
| private String url; | |||
| private String mediaId; | |||
| private List<WxMenuButton> subButtons = new ArrayList<WxMenuButton>(); | |||
| private List<WxMenuButton> subButtons = new ArrayList<>(); | |||
| @Override | |||
| public String toString() { | |||
| @@ -23,7 +23,7 @@ public class WxMenuButton { | |||
| } | |||
| public String getType() { | |||
| return type; | |||
| return this.type; | |||
| } | |||
| public void setType(String type) { | |||
| @@ -31,7 +31,7 @@ public class WxMenuButton { | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| return this.name; | |||
| } | |||
| public void setName(String name) { | |||
| @@ -39,7 +39,7 @@ public class WxMenuButton { | |||
| } | |||
| public String getKey() { | |||
| return key; | |||
| return this.key; | |||
| } | |||
| public void setKey(String key) { | |||
| @@ -47,7 +47,7 @@ public class WxMenuButton { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -55,7 +55,7 @@ public class WxMenuButton { | |||
| } | |||
| public List<WxMenuButton> getSubButtons() { | |||
| return subButtons; | |||
| return this.subButtons; | |||
| } | |||
| public void setSubButtons(List<WxMenuButton> subButtons) { | |||
| @@ -63,7 +63,7 @@ public class WxMenuButton { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -13,7 +13,7 @@ public class WxMenuRule { | |||
| private String language; | |||
| public String getTagId() { | |||
| return tagId; | |||
| return this.tagId; | |||
| } | |||
| public void setTagId(String tagId) { | |||
| @@ -21,7 +21,7 @@ public class WxMenuRule { | |||
| } | |||
| public String getSex() { | |||
| return sex; | |||
| return this.sex; | |||
| } | |||
| public void setSex(String sex) { | |||
| @@ -29,7 +29,7 @@ public class WxMenuRule { | |||
| } | |||
| public String getCountry() { | |||
| return country; | |||
| return this.country; | |||
| } | |||
| public void setCountry(String country) { | |||
| @@ -37,7 +37,7 @@ public class WxMenuRule { | |||
| } | |||
| public String getProvince() { | |||
| return province; | |||
| return this.province; | |||
| } | |||
| public void setProvince(String province) { | |||
| @@ -45,7 +45,7 @@ public class WxMenuRule { | |||
| } | |||
| public String getCity() { | |||
| return city; | |||
| return this.city; | |||
| } | |||
| public void setCity(String city) { | |||
| @@ -53,7 +53,7 @@ public class WxMenuRule { | |||
| } | |||
| public String getClientPlatformType() { | |||
| return clientPlatformType; | |||
| return this.clientPlatformType; | |||
| } | |||
| public void setClientPlatformType(String clientPlatformType) { | |||
| @@ -61,7 +61,7 @@ public class WxMenuRule { | |||
| } | |||
| public String getLanguage() { | |||
| return language; | |||
| return this.language; | |||
| } | |||
| public void setLanguage(String language) { | |||
| @@ -29,7 +29,7 @@ public class WxError implements Serializable { | |||
| } | |||
| public int getErrorCode() { | |||
| return errorCode; | |||
| return this.errorCode; | |||
| } | |||
| public void setErrorCode(int errorCode) { | |||
| @@ -37,7 +37,7 @@ public class WxError implements Serializable { | |||
| } | |||
| public String getErrorMsg() { | |||
| return errorMsg; | |||
| return this.errorMsg; | |||
| } | |||
| public void setErrorMsg(String errorMsg) { | |||
| @@ -45,7 +45,7 @@ public class WxError implements Serializable { | |||
| } | |||
| public String getJson() { | |||
| return json; | |||
| return this.json; | |||
| } | |||
| public void setJson(String json) { | |||
| @@ -54,10 +54,10 @@ public class WxError implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| if (json != null) { | |||
| return json; | |||
| if (this.json != null) { | |||
| return this.json; | |||
| } | |||
| return "错误: Code=" + errorCode + ", Msg=" + errorMsg; | |||
| return "错误: Code=" + this.errorCode + ", Msg=" + this.errorMsg; | |||
| } | |||
| public static class Builder { | |||
| @@ -17,7 +17,7 @@ public class WxMediaUploadResult implements Serializable { | |||
| } | |||
| public String getType() { | |||
| return type; | |||
| return this.type; | |||
| } | |||
| public void setType(String type) { | |||
| @@ -25,7 +25,7 @@ public class WxMediaUploadResult implements Serializable { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -33,7 +33,7 @@ public class WxMediaUploadResult implements Serializable { | |||
| } | |||
| public long getCreatedAt() { | |||
| return createdAt; | |||
| return this.createdAt; | |||
| } | |||
| public void setCreatedAt(long createdAt) { | |||
| @@ -41,7 +41,7 @@ public class WxMediaUploadResult implements Serializable { | |||
| } | |||
| public String getThumbMediaId() { | |||
| return thumbMediaId; | |||
| return this.thumbMediaId; | |||
| } | |||
| public void setThumbMediaId(String thumbMediaId) { | |||
| @@ -50,8 +50,8 @@ public class WxMediaUploadResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxUploadResult [type=" + type + ", media_id=" + mediaId + ", thumb_media_id=" + thumbMediaId | |||
| + ", created_at=" + createdAt + "]"; | |||
| return "WxUploadResult [type=" + this.type + ", media_id=" + this.mediaId + ", thumb_media_id=" + this.thumbMediaId | |||
| + ", created_at=" + this.createdAt + "]"; | |||
| } | |||
| } | |||
| @@ -14,7 +14,7 @@ public class WxErrorException extends Exception { | |||
| } | |||
| public WxError getError() { | |||
| return error; | |||
| return this.error; | |||
| } | |||
| @@ -18,7 +18,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| */ | |||
| protected static final String EMPTY_ARRAY[] = new String[0]; | |||
| // ------------------------------ WxSession | |||
| protected Map<String, Object> attributes = new ConcurrentHashMap<String, Object>(); | |||
| protected Map<String, Object> attributes = new ConcurrentHashMap<>(); | |||
| /** | |||
| * The session identifier of this Session. | |||
| */ | |||
| @@ -47,7 +47,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| /** | |||
| * The current accessed time for this session. | |||
| */ | |||
| protected volatile long thisAccessedTime = creationTime; | |||
| protected volatile long thisAccessedTime = this.creationTime; | |||
| /** | |||
| * The default maximum inactive interval for Sessions created by | |||
| * this Manager. | |||
| @@ -77,7 +77,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| if (name == null) return null; | |||
| return (attributes.get(name)); | |||
| return (this.attributes.get(name)); | |||
| } | |||
| @Override | |||
| @@ -86,8 +86,8 @@ public class StandardSession implements WxSession, InternalSession { | |||
| throw new IllegalStateException | |||
| (sm.getString("sessionImpl.getAttributeNames.ise")); | |||
| Set<String> names = new HashSet<String>(); | |||
| names.addAll(attributes.keySet()); | |||
| Set<String> names = new HashSet<>(); | |||
| names.addAll(this.attributes.keySet()); | |||
| return Collections.enumeration(names); | |||
| } | |||
| @@ -109,7 +109,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| throw new IllegalStateException(sm.getString( | |||
| "sessionImpl.setAttribute.ise", getIdInternal())); | |||
| attributes.put(name, value); | |||
| this.attributes.put(name, value); | |||
| } | |||
| @@ -132,10 +132,10 @@ public class StandardSession implements WxSession, InternalSession { | |||
| @Override | |||
| public WxSession getSession() { | |||
| if (facade == null) { | |||
| facade = new StandardSessionFacade(this); | |||
| if (this.facade == null) { | |||
| this.facade = new StandardSessionFacade(this); | |||
| } | |||
| return (facade); | |||
| return (this.facade); | |||
| } | |||
| @@ -157,15 +157,15 @@ public class StandardSession implements WxSession, InternalSession { | |||
| return true; | |||
| } | |||
| if (accessCount.get() > 0) { | |||
| if (this.accessCount.get() > 0) { | |||
| return true; | |||
| } | |||
| if (maxInactiveInterval > 0) { | |||
| if (this.maxInactiveInterval > 0) { | |||
| long timeNow = System.currentTimeMillis(); | |||
| int timeIdle; | |||
| timeIdle = (int) ((timeNow - thisAccessedTime) / 1000L); | |||
| if (timeIdle >= maxInactiveInterval) { | |||
| timeIdle = (int) ((timeNow - this.thisAccessedTime) / 1000L); | |||
| if (timeIdle >= this.maxInactiveInterval) { | |||
| expire(); | |||
| } | |||
| } | |||
| @@ -193,7 +193,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| if (name == null) return; | |||
| // Remove this attribute from our collection | |||
| attributes.remove(name); | |||
| this.attributes.remove(name); | |||
| } | |||
| @@ -202,7 +202,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| // Check to see if session has already been invalidated. | |||
| // Do not check expiring at this point as expire should not return until | |||
| // isValid is false | |||
| if (!isValid) | |||
| if (!this.isValid) | |||
| return; | |||
| synchronized (this) { | |||
| @@ -210,24 +210,24 @@ public class StandardSession implements WxSession, InternalSession { | |||
| // Double check locking - isValid needs to be volatile | |||
| // The check of expiring is to ensure that an infinite loop is not | |||
| // entered as per bug 56339 | |||
| if (expiring || !isValid) | |||
| if (this.expiring || !this.isValid) | |||
| return; | |||
| if (manager == null) | |||
| if (this.manager == null) | |||
| return; | |||
| // Mark this session as "being expired" | |||
| expiring = true; | |||
| this.expiring = true; | |||
| accessCount.set(0); | |||
| this.accessCount.set(0); | |||
| // Remove this session from our manager's active sessions | |||
| manager.remove(this, true); | |||
| this.manager.remove(this, true); | |||
| // We have completed expire of this session | |||
| setValid(false); | |||
| expiring = false; | |||
| this.expiring = false; | |||
| // Unbind any objects associated with this session | |||
| String keys[] = keys(); | |||
| @@ -244,7 +244,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| public void access() { | |||
| this.thisAccessedTime = System.currentTimeMillis(); | |||
| accessCount.incrementAndGet(); | |||
| this.accessCount.incrementAndGet(); | |||
| } | |||
| @@ -253,7 +253,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| public void endAccess() { | |||
| this.thisAccessedTime = System.currentTimeMillis(); | |||
| accessCount.decrementAndGet(); | |||
| this.accessCount.decrementAndGet(); | |||
| } | |||
| @@ -273,13 +273,13 @@ public class StandardSession implements WxSession, InternalSession { | |||
| @Override | |||
| public void setId(String id) { | |||
| if ((this.id != null) && (manager != null)) | |||
| manager.remove(this); | |||
| if ((this.id != null) && (this.manager != null)) | |||
| this.manager.remove(this); | |||
| this.id = id; | |||
| if (manager != null) | |||
| manager.add(this); | |||
| if (this.manager != null) | |||
| this.manager.add(this); | |||
| } | |||
| /** | |||
| @@ -289,7 +289,7 @@ public class StandardSession implements WxSession, InternalSession { | |||
| */ | |||
| protected String[] keys() { | |||
| return attributes.keySet().toArray(EMPTY_ARRAY); | |||
| return this.attributes.keySet().toArray(EMPTY_ARRAY); | |||
| } | |||
| @@ -300,31 +300,31 @@ public class StandardSession implements WxSession, InternalSession { | |||
| StandardSession session = (StandardSession) o; | |||
| if (creationTime != session.creationTime) return false; | |||
| if (expiring != session.expiring) return false; | |||
| if (isValid != session.isValid) return false; | |||
| if (maxInactiveInterval != session.maxInactiveInterval) return false; | |||
| if (thisAccessedTime != session.thisAccessedTime) return false; | |||
| if (!accessCount.equals(session.accessCount)) return false; | |||
| if (!attributes.equals(session.attributes)) return false; | |||
| if (!facade.equals(session.facade)) return false; | |||
| if (!id.equals(session.id)) return false; | |||
| return manager.equals(session.manager); | |||
| if (this.creationTime != session.creationTime) return false; | |||
| if (this.expiring != session.expiring) return false; | |||
| if (this.isValid != session.isValid) return false; | |||
| if (this.maxInactiveInterval != session.maxInactiveInterval) return false; | |||
| if (this.thisAccessedTime != session.thisAccessedTime) return false; | |||
| if (!this.accessCount.equals(session.accessCount)) return false; | |||
| if (!this.attributes.equals(session.attributes)) return false; | |||
| if (!this.facade.equals(session.facade)) return false; | |||
| if (!this.id.equals(session.id)) return false; | |||
| return this.manager.equals(session.manager); | |||
| } | |||
| @Override | |||
| public int hashCode() { | |||
| int result = attributes.hashCode(); | |||
| result = 31 * result + id.hashCode(); | |||
| result = 31 * result + (isValid ? 1 : 0); | |||
| result = 31 * result + (expiring ? 1 : 0); | |||
| result = 31 * result + manager.hashCode(); | |||
| result = 31 * result + (int) (creationTime ^ (creationTime >>> 32)); | |||
| result = 31 * result + (int) (thisAccessedTime ^ (thisAccessedTime >>> 32)); | |||
| result = 31 * result + maxInactiveInterval; | |||
| result = 31 * result + facade.hashCode(); | |||
| result = 31 * result + accessCount.hashCode(); | |||
| int result = this.attributes.hashCode(); | |||
| result = 31 * result + this.id.hashCode(); | |||
| result = 31 * result + (this.isValid ? 1 : 0); | |||
| result = 31 * result + (this.expiring ? 1 : 0); | |||
| result = 31 * result + this.manager.hashCode(); | |||
| result = 31 * result + (int) (this.creationTime ^ (this.creationTime >>> 32)); | |||
| result = 31 * result + (int) (this.thisAccessedTime ^ (this.thisAccessedTime >>> 32)); | |||
| result = 31 * result + this.maxInactiveInterval; | |||
| result = 31 * result + this.facade.hashCode(); | |||
| result = 31 * result + this.accessCount.hashCode(); | |||
| return result; | |||
| } | |||
| @@ -14,32 +14,32 @@ public class StandardSessionFacade implements WxSession { | |||
| } | |||
| public InternalSession getInternalSession() { | |||
| return (InternalSession) session; | |||
| return (InternalSession) this.session; | |||
| } | |||
| @Override | |||
| public Object getAttribute(String name) { | |||
| return session.getAttribute(name); | |||
| return this.session.getAttribute(name); | |||
| } | |||
| @Override | |||
| public Enumeration<String> getAttributeNames() { | |||
| return session.getAttributeNames(); | |||
| return this.session.getAttributeNames(); | |||
| } | |||
| @Override | |||
| public void setAttribute(String name, Object value) { | |||
| session.setAttribute(name, value); | |||
| this.session.setAttribute(name, value); | |||
| } | |||
| @Override | |||
| public void removeAttribute(String name) { | |||
| session.removeAttribute(name); | |||
| this.session.removeAttribute(name); | |||
| } | |||
| @Override | |||
| public void invalidate() { | |||
| session.invalidate(); | |||
| this.session.invalidate(); | |||
| } | |||
| } | |||
| @@ -32,7 +32,7 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| * The set of currently active Sessions for this Manager, keyed by | |||
| * session identifier. | |||
| */ | |||
| protected Map<String, InternalSession> sessions = new ConcurrentHashMap<String, InternalSession>(); | |||
| protected Map<String, InternalSession> sessions = new ConcurrentHashMap<>(); | |||
| /** | |||
| * The maximum number of active Sessions allowed, or -1 for no limit. | |||
| */ | |||
| @@ -117,7 +117,7 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| @Override | |||
| public void remove(InternalSession session, boolean update) { | |||
| if (session.getIdInternal() != null) { | |||
| sessions.remove(session.getIdInternal()); | |||
| this.sessions.remove(session.getIdInternal()); | |||
| } | |||
| } | |||
| @@ -127,7 +127,7 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| if (id == null) | |||
| return (null); | |||
| return sessions.get(id); | |||
| return this.sessions.get(id); | |||
| } | |||
| @@ -138,12 +138,12 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| (sm.getString("sessionManagerImpl.createSession.ise")); | |||
| } | |||
| if ((maxActiveSessions >= 0) && | |||
| (getActiveSessions() >= maxActiveSessions)) { | |||
| rejectedSessions++; | |||
| if ((this.maxActiveSessions >= 0) && | |||
| (getActiveSessions() >= this.maxActiveSessions)) { | |||
| this.rejectedSessions++; | |||
| throw new TooManyActiveSessionsException( | |||
| sm.getString("sessionManagerImpl.createSession.tmase"), | |||
| maxActiveSessions); | |||
| this.maxActiveSessions); | |||
| } | |||
| // Recycle or create a Session instance | |||
| @@ -155,7 +155,7 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| session.setMaxInactiveInterval(this.maxInactiveInterval); | |||
| String id = sessionId; | |||
| session.setId(id); | |||
| sessionCounter++; | |||
| this.sessionCounter++; | |||
| return (session); | |||
| @@ -164,7 +164,7 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| @Override | |||
| public int getActiveSessions() { | |||
| return sessions.size(); | |||
| return this.sessions.size(); | |||
| } | |||
| @@ -185,17 +185,17 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| public void add(InternalSession session) { | |||
| // 当第一次有session创建的时候,开启session清理线程 | |||
| if (!backgroundProcessStarted.getAndSet(true)) { | |||
| if (!this.backgroundProcessStarted.getAndSet(true)) { | |||
| Thread t = new Thread(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| while (true) { | |||
| try { | |||
| // 每秒清理一次 | |||
| Thread.sleep(backgroundProcessorDelay * 1000l); | |||
| Thread.sleep(StandardSessionManager.this.backgroundProcessorDelay * 1000l); | |||
| backgroundProcess(); | |||
| } catch (InterruptedException e) { | |||
| log.error("SessionManagerImpl.backgroundProcess error", e); | |||
| StandardSessionManager.this.log.error("SessionManagerImpl.backgroundProcess error", e); | |||
| } | |||
| } | |||
| } | |||
| @@ -204,12 +204,12 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| t.start(); | |||
| } | |||
| sessions.put(session.getIdInternal(), session); | |||
| this.sessions.put(session.getIdInternal(), session); | |||
| int size = getActiveSessions(); | |||
| if (size > maxActive) { | |||
| synchronized (maxActiveUpdateLock) { | |||
| if (size > maxActive) { | |||
| maxActive = size; | |||
| if (size > this.maxActive) { | |||
| synchronized (this.maxActiveUpdateLock) { | |||
| if (size > this.maxActive) { | |||
| this.maxActive = size; | |||
| } | |||
| } | |||
| } | |||
| @@ -223,14 +223,14 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| @Override | |||
| public InternalSession[] findSessions() { | |||
| return sessions.values().toArray(new InternalSession[0]); | |||
| return this.sessions.values().toArray(new InternalSession[0]); | |||
| } | |||
| @Override | |||
| public void backgroundProcess() { | |||
| count = (count + 1) % processExpiresFrequency; | |||
| if (count == 0) | |||
| this.count = (this.count + 1) % this.processExpiresFrequency; | |||
| if (this.count == 0) | |||
| processExpires(); | |||
| } | |||
| @@ -243,17 +243,17 @@ public class StandardSessionManager implements WxSessionManager, InternalSession | |||
| InternalSession sessions[] = findSessions(); | |||
| int expireHere = 0; | |||
| if (log.isDebugEnabled()) | |||
| log.debug("Start expire sessions {} at {} sessioncount {}", getName(), timeNow, sessions.length); | |||
| if (this.log.isDebugEnabled()) | |||
| this.log.debug("Start expire sessions {} at {} sessioncount {}", getName(), timeNow, sessions.length); | |||
| for (int i = 0; i < sessions.length; i++) { | |||
| if (sessions[i] != null && !sessions[i].isValid()) { | |||
| expireHere++; | |||
| } | |||
| } | |||
| long timeEnd = System.currentTimeMillis(); | |||
| if (log.isDebugEnabled()) | |||
| log.debug("End expire sessions {} processingTime {} expired sessions: {}", getName(), timeEnd - timeNow, expireHere); | |||
| processingTime += (timeEnd - timeNow); | |||
| if (this.log.isDebugEnabled()) | |||
| this.log.debug("End expire sessions {} processingTime {} expired sessions: {}", getName(), timeEnd - timeNow, expireHere); | |||
| this.processingTime += (timeEnd - timeNow); | |||
| } | |||
| @@ -40,7 +40,7 @@ public class TooManyActiveSessionsException | |||
| int maxActive) { | |||
| super(message); | |||
| maxActiveSessions = maxActive; | |||
| this.maxActiveSessions = maxActive; | |||
| } | |||
| /** | |||
| @@ -49,6 +49,6 @@ public class TooManyActiveSessionsException | |||
| * @return The maximum number of sessions allowed by the session manager. | |||
| */ | |||
| public int getMaxActiveSessions() { | |||
| return maxActiveSessions; | |||
| return this.maxActiveSessions; | |||
| } | |||
| } | |||
| @@ -13,7 +13,7 @@ public class LogExceptionHandler implements WxErrorExceptionHandler { | |||
| @Override | |||
| public void handle(WxErrorException e) { | |||
| log.error("Error happens", e); | |||
| this.log.error("Error happens", e); | |||
| } | |||
| @@ -3,24 +3,24 @@ package me.chanjar.weixin.common.util.crypto; | |||
| import java.util.ArrayList; | |||
| public class ByteGroup { | |||
| ArrayList<Byte> byteContainer = new ArrayList<Byte>(); | |||
| ArrayList<Byte> byteContainer = new ArrayList<>(); | |||
| public byte[] toBytes() { | |||
| byte[] bytes = new byte[byteContainer.size()]; | |||
| for (int i = 0; i < byteContainer.size(); i++) { | |||
| bytes[i] = byteContainer.get(i); | |||
| byte[] bytes = new byte[this.byteContainer.size()]; | |||
| for (int i = 0; i < this.byteContainer.size(); i++) { | |||
| bytes[i] = this.byteContainer.get(i); | |||
| } | |||
| return bytes; | |||
| } | |||
| public ByteGroup addBytes(byte[] bytes) { | |||
| for (byte b : bytes) { | |||
| byteContainer.add(b); | |||
| this.byteContainer.add(b); | |||
| } | |||
| return this; | |||
| } | |||
| public int size() { | |||
| return byteContainer.size(); | |||
| return this.byteContainer.size(); | |||
| } | |||
| } | |||
| @@ -47,7 +47,7 @@ public class PKCS7Encoder { | |||
| * @return 删除补位字符后的明文 | |||
| */ | |||
| public static byte[] decode(byte[] decrypted) { | |||
| int pad = (int) decrypted[decrypted.length - 1]; | |||
| int pad = decrypted[decrypted.length - 1]; | |||
| if (pad < 1 || pad > 32) { | |||
| pad = 0; | |||
| } | |||
| @@ -80,10 +80,10 @@ public class WxCryptUtil { | |||
| */ | |||
| public static String createSign(Map<String, String> packageParams, | |||
| String signKey) { | |||
| SortedMap<String, String> sortedMap = new TreeMap<String, String>(); | |||
| SortedMap<String, String> sortedMap = new TreeMap<>(); | |||
| sortedMap.putAll(packageParams); | |||
| List<String> keys = new ArrayList<String>(packageParams.keySet()); | |||
| List<String> keys = new ArrayList<>(packageParams.keySet()); | |||
| Collections.sort(keys); | |||
| StringBuffer toSign = new StringBuffer(); | |||
| @@ -131,7 +131,7 @@ public class WxCryptUtil { | |||
| String nonce = genRandomStr(); | |||
| try { | |||
| String signature = SHA1.gen(token, timeStamp, nonce, encryptedXml); | |||
| String signature = SHA1.gen(this.token, timeStamp, nonce, encryptedXml); | |||
| String result = generateXml(encryptedXml, signature, timeStamp, nonce); | |||
| return result; | |||
| } catch (NoSuchAlgorithmException e) { | |||
| @@ -151,7 +151,7 @@ public class WxCryptUtil { | |||
| byte[] plainTextBytes = plainText.getBytes(CHARSET); | |||
| byte[] bytesOfSizeInNetworkOrder = number2BytesInNetworkOrder( | |||
| plainTextBytes.length); | |||
| byte[] appIdBytes = appidOrCorpid.getBytes(CHARSET); | |||
| byte[] appIdBytes = this.appidOrCorpid.getBytes(CHARSET); | |||
| // randomStr + networkBytesOrder + text + appid | |||
| byteCollector.addBytes(randomStringBytes); | |||
| @@ -169,8 +169,8 @@ public class WxCryptUtil { | |||
| try { | |||
| // 设置加密模式为AES的CBC模式 | |||
| Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); | |||
| SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES"); | |||
| IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16); | |||
| SecretKeySpec keySpec = new SecretKeySpec(this.aesKey, "AES"); | |||
| IvParameterSpec iv = new IvParameterSpec(this.aesKey, 0, 16); | |||
| cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv); | |||
| // 加密 | |||
| @@ -207,7 +207,7 @@ public class WxCryptUtil { | |||
| try { | |||
| // 验证安全签名 | |||
| String signature = SHA1.gen(token, timeStamp, nonce, cipherText); | |||
| String signature = SHA1.gen(this.token, timeStamp, nonce, cipherText); | |||
| if (!signature.equals(msgSignature)) { | |||
| throw new RuntimeException("加密消息签名校验失败"); | |||
| } | |||
| @@ -231,9 +231,9 @@ public class WxCryptUtil { | |||
| try { | |||
| // 设置解密模式为AES的CBC模式 | |||
| Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); | |||
| SecretKeySpec key_spec = new SecretKeySpec(aesKey, "AES"); | |||
| SecretKeySpec key_spec = new SecretKeySpec(this.aesKey, "AES"); | |||
| IvParameterSpec iv = new IvParameterSpec( | |||
| Arrays.copyOfRange(aesKey, 0, 16)); | |||
| Arrays.copyOfRange(this.aesKey, 0, 16)); | |||
| cipher.init(Cipher.DECRYPT_MODE, key_spec, iv); | |||
| // 使用BASE64对密文进行解码 | |||
| @@ -264,7 +264,7 @@ public class WxCryptUtil { | |||
| } | |||
| // appid不相同的情况 | |||
| if (!from_appid.equals(appidOrCorpid)) { | |||
| if (!from_appid.equals(this.appidOrCorpid)) { | |||
| throw new RuntimeException("AppID不正确"); | |||
| } | |||
| @@ -14,6 +14,7 @@ public class InputStreamResponseHandler implements ResponseHandler<InputStream> | |||
| public static final ResponseHandler<InputStream> INSTANCE = new InputStreamResponseHandler(); | |||
| @Override | |||
| public InputStream handleResponse(final HttpResponse response) throws IOException { | |||
| final StatusLine statusLine = response.getStatusLine(); | |||
| final HttpEntity entity = response.getEntity(); | |||
| @@ -70,7 +70,7 @@ public class MediaDownloadRequestExecutor implements RequestExecutor<File, Strin | |||
| return null; | |||
| } | |||
| String[] name_ext = fileName.split("\\."); | |||
| File localFile = FileUtils.createTmpFile(inputStream, name_ext[0], name_ext[1], tmpDirFile); | |||
| File localFile = FileUtils.createTmpFile(inputStream, name_ext[0], name_ext[1], this.tmpDirFile); | |||
| return localFile; | |||
| } finally { | |||
| @@ -35,7 +35,7 @@ public class URIUtil { | |||
| private static String getHex(byte buf[]) { | |||
| StringBuilder o = new StringBuilder(buf.length * 3); | |||
| for (int i = 0; i < buf.length; i++) { | |||
| int n = (int) buf[i] & 0xff; | |||
| int n = buf[i] & 0xff; | |||
| o.append("%"); | |||
| if (n < 0x10) { | |||
| o.append("0"); | |||
| @@ -19,6 +19,7 @@ public class Utf8ResponseHandler implements ResponseHandler<String> { | |||
| public static final ResponseHandler<String> INSTANCE = new Utf8ResponseHandler(); | |||
| @Override | |||
| public String handleResponse(final HttpResponse response) throws IOException { | |||
| final StatusLine statusLine = response.getStatusLine(); | |||
| final HttpEntity entity = response.getEntity(); | |||
| @@ -18,6 +18,7 @@ import java.lang.reflect.Type; | |||
| */ | |||
| public class WxAccessTokenAdapter implements JsonDeserializer<WxAccessToken> { | |||
| @Override | |||
| public WxAccessToken deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |||
| WxAccessToken accessToken = new WxAccessToken(); | |||
| JsonObject accessTokenJsonObject = json.getAsJsonObject(); | |||
| @@ -18,6 +18,7 @@ import java.lang.reflect.Type; | |||
| */ | |||
| public class WxErrorAdapter implements JsonDeserializer<WxError> { | |||
| @Override | |||
| public WxError deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |||
| WxError wxError = new WxError(); | |||
| JsonObject wxErrorJsonObject = json.getAsJsonObject(); | |||
| @@ -18,6 +18,7 @@ import java.lang.reflect.Type; | |||
| */ | |||
| public class WxMediaUploadResultAdapter implements JsonDeserializer<WxMediaUploadResult> { | |||
| @Override | |||
| public WxMediaUploadResult deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |||
| WxMediaUploadResult uploadResult = new WxMediaUploadResult(); | |||
| JsonObject uploadResultJsonObject = json.getAsJsonObject(); | |||
| @@ -29,6 +29,7 @@ import me.chanjar.weixin.common.bean.menu.WxMenuRule; | |||
| */ | |||
| public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializer<WxMenu> { | |||
| @Override | |||
| public JsonElement serialize(WxMenu menu, Type typeOfSrc, JsonSerializationContext context) { | |||
| JsonObject json = new JsonObject(); | |||
| @@ -75,6 +76,7 @@ public class WxMenuGsonAdapter implements JsonSerializer<WxMenu>, JsonDeserializ | |||
| return matchRule; | |||
| } | |||
| @Override | |||
| public WxMenu deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |||
| /* | |||
| * 操蛋的微信 | |||
| @@ -47,7 +47,7 @@ import java.util.*; | |||
| public class StringManager { | |||
| private static final Map<String, Map<Locale, StringManager>> managers = | |||
| new Hashtable<String, Map<Locale, StringManager>>(); | |||
| new Hashtable<>(); | |||
| private static int LOCALE_CACHE_SIZE = 10; | |||
| /** | |||
| * The ResourceBundle for this StringManager. | |||
| @@ -81,10 +81,10 @@ public class StringManager { | |||
| } | |||
| } | |||
| } | |||
| bundle = bnd; | |||
| this.bundle = bnd; | |||
| // Get the actual locale, which may be different from the requested one | |||
| if (bundle != null) { | |||
| Locale bundleLocale = bundle.getLocale(); | |||
| if (this.bundle != null) { | |||
| Locale bundleLocale = this.bundle.getLocale(); | |||
| if (bundleLocale.equals(Locale.ROOT)) { | |||
| this.locale = Locale.ENGLISH; | |||
| } else { | |||
| @@ -192,8 +192,8 @@ public class StringManager { | |||
| try { | |||
| // Avoid NPE if bundle is null and treat it like an MRE | |||
| if (bundle != null) { | |||
| str = bundle.getString(key); | |||
| if (this.bundle != null) { | |||
| str = this.bundle.getString(key); | |||
| } | |||
| } catch (MissingResourceException mre) { | |||
| //bad: shouldn't mask an exception the following way: | |||
| @@ -227,7 +227,7 @@ public class StringManager { | |||
| } | |||
| MessageFormat mf = new MessageFormat(value); | |||
| mf.setLocale(locale); | |||
| mf.setLocale(this.locale); | |||
| return mf.format(args, new StringBuffer(), null).toString(); | |||
| } | |||
| @@ -235,6 +235,6 @@ public class StringManager { | |||
| * Identify the Locale this StringManager is associated with | |||
| */ | |||
| public Locale getLocale() { | |||
| return locale; | |||
| return this.locale; | |||
| } | |||
| } | |||
| @@ -25,9 +25,9 @@ public class XStreamInitializer { | |||
| @Override | |||
| protected void writeText(QuickWriter writer, String text) { | |||
| if (text.startsWith(PREFIX_CDATA) && text.endsWith(SUFFIX_CDATA)) { | |||
| if (text.startsWith(this.PREFIX_CDATA) && text.endsWith(this.SUFFIX_CDATA)) { | |||
| writer.write(text); | |||
| } else if (text.startsWith(PREFIX_MEDIA_ID) && text.endsWith(SUFFIX_MEDIA_ID)) { | |||
| } else if (text.startsWith(this.PREFIX_MEDIA_ID) && text.endsWith(this.SUFFIX_MEDIA_ID)) { | |||
| writer.write(text); | |||
| } else { | |||
| super.writeText(writer, text); | |||
| @@ -34,8 +34,8 @@ public class WxCryptUtilTest { | |||
| String afterAesEncrypt2 = "jn1L23DB+6ELqJ+6bruv23M2GmYfkv0xBh2h+XTBOKVKcgDFHle6gqcZ1cZrk3e1qjPQ1F4RsLWzQRG9udbKWesxlkupqcEcW7ZQweImX9+wLMa0GaUzpkycA8+IamDBxn5loLgZpnS7fVAbExOkK5DYHBmv5tptA9tklE/fTIILHR8HLXa5nQvFb3tYPKAlHF3rtTeayNf0QuM+UW/wM9enGIDIJHF7CLHiDNAYxr+r+OrJCmPQyTy8cVWlu9iSvOHPT/77bZqJucQHQ04sq7KZI27OcqpQNSto2OdHCoTccjggX5Z9Mma0nMJBU+jLKJ38YB1fBIz+vBzsYjrTmFQ44YfeEuZ+xRTQwr92vhA9OxchWVINGC50qE/6lmkwWTwGX9wtQpsJKhP+oS7rvTY8+VdzETdfakjkwQ5/Xka042OlUb1/slTwo4RscuQ+RdxSGvDahxAJ6+EAjLt9d8igHngxIbf6YyqqROxuxqIeIch3CssH/LqRs+iAcILvApYZckqmA7FNERspKA5f8GoJ9sv8xmGvZ9Yrf57cExWtnX8aCMMaBropU/1k+hKP5LVdzbWCG0hGwx/dQudYR/eXp3P0XxjlFiy+9DMlaFExWUZQDajPkdPrEeOwofJb"; | |||
| public void testNormal() throws ParserConfigurationException, SAXException, IOException { | |||
| WxCryptUtil pc = new WxCryptUtil(token, encodingAesKey, appId); | |||
| String encryptedXml = pc.encrypt(replyMsg); | |||
| WxCryptUtil pc = new WxCryptUtil(this.token, this.encodingAesKey, this.appId); | |||
| String encryptedXml = pc.encrypt(this.replyMsg); | |||
| System.out.println(encryptedXml); | |||
| @@ -56,31 +56,31 @@ public class WxCryptUtilTest { | |||
| String nonce = root.getElementsByTagName("Nonce").item(0).getTextContent(); | |||
| System.out.println(nonce); | |||
| String messageText = String.format(xmlFormat, cipherText); | |||
| String messageText = String.format(this.xmlFormat, cipherText); | |||
| System.out.println(messageText); | |||
| // 第三方收到企业号平台发送的消息 | |||
| String plainMessage = pc.decrypt(cipherText); | |||
| System.out.println(plainMessage); | |||
| assertEquals(plainMessage, replyMsg); | |||
| assertEquals(plainMessage, this.replyMsg); | |||
| } | |||
| public void testAesEncrypt() { | |||
| WxCryptUtil pc = new WxCryptUtil(token, encodingAesKey, appId); | |||
| assertEquals(pc.encrypt(randomStr, replyMsg), afterAesEncrypt); | |||
| WxCryptUtil pc = new WxCryptUtil(this.token, this.encodingAesKey, this.appId); | |||
| assertEquals(pc.encrypt(this.randomStr, this.replyMsg), this.afterAesEncrypt); | |||
| } | |||
| public void testAesEncrypt2() { | |||
| WxCryptUtil pc = new WxCryptUtil(token, encodingAesKey, appId); | |||
| assertEquals(pc.encrypt(randomStr, replyMsg2), afterAesEncrypt2); | |||
| WxCryptUtil pc = new WxCryptUtil(this.token, this.encodingAesKey, this.appId); | |||
| assertEquals(pc.encrypt(this.randomStr, this.replyMsg2), this.afterAesEncrypt2); | |||
| } | |||
| public void testValidateSignatureError() throws ParserConfigurationException, SAXException, | |||
| IOException { | |||
| try { | |||
| WxCryptUtil pc = new WxCryptUtil(token, encodingAesKey, appId); | |||
| String afterEncrpt = pc.encrypt(replyMsg); | |||
| WxCryptUtil pc = new WxCryptUtil(this.token, this.encodingAesKey, this.appId); | |||
| String afterEncrpt = pc.encrypt(this.replyMsg); | |||
| DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | |||
| DocumentBuilder db = dbf.newDocumentBuilder(); | |||
| StringReader sr = new StringReader(afterEncrpt); | |||
| @@ -91,8 +91,8 @@ public class WxCryptUtilTest { | |||
| NodeList nodelist1 = root.getElementsByTagName("Encrypt"); | |||
| String encrypt = nodelist1.item(0).getTextContent(); | |||
| String fromXML = String.format(xmlFormat, encrypt); | |||
| pc.decrypt("12345", timestamp, nonce, fromXML); // 这里签名错误 | |||
| String fromXML = String.format(this.xmlFormat, encrypt); | |||
| pc.decrypt("12345", this.timestamp, this.nonce, fromXML); // 这里签名错误 | |||
| } catch (RuntimeException e) { | |||
| assertEquals(e.getMessage(), "加密消息签名校验失败"); | |||
| return; | |||
| @@ -6,7 +6,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.1.0-SNAPSHOT</version> | |||
| <version>2.1.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-cp</artifactId> | |||
| @@ -6,7 +6,7 @@ | |||
| <parent> | |||
| <groupId>com.github.binarywang</groupId> | |||
| <artifactId>weixin-java-parent</artifactId> | |||
| <version>2.1.0-SNAPSHOT</version> | |||
| <version>2.1.0</version> | |||
| </parent> | |||
| <artifactId>weixin-java-mp</artifactId> | |||
| <name>WeiXin Java Tools - MP</name> | |||
| @@ -191,6 +191,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||
| this.oauth2redirectUri = oauth2redirectUri; | |||
| } | |||
| @Override | |||
| public String getHttpProxyHost() { | |||
| return this.httpProxyHost; | |||
| } | |||
| @@ -199,6 +200,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||
| this.httpProxyHost = httpProxyHost; | |||
| } | |||
| @Override | |||
| public int getHttpProxyPort() { | |||
| return this.httpProxyPort; | |||
| } | |||
| @@ -207,6 +209,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||
| this.httpProxyPort = httpProxyPort; | |||
| } | |||
| @Override | |||
| public String getHttpProxyUsername() { | |||
| return this.httpProxyUsername; | |||
| } | |||
| @@ -215,6 +218,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||
| this.httpProxyUsername = httpProxyUsername; | |||
| } | |||
| @Override | |||
| public String getHttpProxyPassword() { | |||
| return this.httpProxyPassword; | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxMpMessageRouter { | |||
| private static final int DEFAULT_THREAD_POOL_SIZE = 100; | |||
| private final List<WxMpMessageRouterRule> rules = new ArrayList<WxMpMessageRouterRule>(); | |||
| private final List<WxMpMessageRouterRule> rules = new ArrayList<>(); | |||
| private final WxMpService wxMpService; | |||
| @@ -139,9 +139,9 @@ public class WxMpMessageRouter { | |||
| return null; | |||
| } | |||
| final List<WxMpMessageRouterRule> matchRules = new ArrayList<WxMpMessageRouterRule>(); | |||
| final List<WxMpMessageRouterRule> matchRules = new ArrayList<>(); | |||
| // 收集匹配的规则 | |||
| for (final WxMpMessageRouterRule rule : rules) { | |||
| for (final WxMpMessageRouterRule rule : this.rules) { | |||
| if (rule.test(wxMessage)) { | |||
| matchRules.add(rule); | |||
| if(!rule.isReEnter()) { | |||
| @@ -155,39 +155,40 @@ public class WxMpMessageRouter { | |||
| } | |||
| WxMpXmlOutMessage res = null; | |||
| final List<Future> futures = new ArrayList<Future>(); | |||
| final List<Future> futures = new ArrayList<>(); | |||
| for (final WxMpMessageRouterRule rule : matchRules) { | |||
| // 返回最后一个非异步的rule的执行结果 | |||
| if(rule.isAsync()) { | |||
| futures.add( | |||
| executorService.submit(new Runnable() { | |||
| this.executorService.submit(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| rule.service(wxMessage, wxMpService, sessionManager, exceptionHandler); | |||
| rule.service(wxMessage, WxMpMessageRouter.this.wxMpService, WxMpMessageRouter.this.sessionManager, WxMpMessageRouter.this.exceptionHandler); | |||
| } | |||
| }) | |||
| ); | |||
| } else { | |||
| res = rule.service(wxMessage, wxMpService, sessionManager, exceptionHandler); | |||
| res = rule.service(wxMessage, this.wxMpService, this.sessionManager, this.exceptionHandler); | |||
| // 在同步操作结束,session访问结束 | |||
| log.debug("End session access: async=false, sessionId={}", wxMessage.getFromUserName()); | |||
| this.log.debug("End session access: async=false, sessionId={}", wxMessage.getFromUserName()); | |||
| sessionEndAccess(wxMessage); | |||
| } | |||
| } | |||
| if (futures.size() > 0) { | |||
| executorService.submit(new Runnable() { | |||
| this.executorService.submit(new Runnable() { | |||
| @Override | |||
| public void run() { | |||
| for (Future future : futures) { | |||
| try { | |||
| future.get(); | |||
| log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName()); | |||
| WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName()); | |||
| // 异步操作结束,session访问结束 | |||
| sessionEndAccess(wxMessage); | |||
| } catch (InterruptedException e) { | |||
| log.error("Error happened when wait task finish", e); | |||
| WxMpMessageRouter.this.log.error("Error happened when wait task finish", e); | |||
| } catch (ExecutionException e) { | |||
| log.error("Error happened when wait task finish", e); | |||
| WxMpMessageRouter.this.log.error("Error happened when wait task finish", e); | |||
| } | |||
| } | |||
| } | |||
| @@ -209,7 +210,7 @@ public class WxMpMessageRouter { | |||
| messageId.append(wxMessage.getMsgId()); | |||
| } | |||
| return messageDuplicateChecker.isDuplicate(messageId.toString()); | |||
| return this.messageDuplicateChecker.isDuplicate(messageId.toString()); | |||
| } | |||
| @@ -219,7 +220,7 @@ public class WxMpMessageRouter { | |||
| */ | |||
| protected void sessionEndAccess(WxMpXmlMessage wxMessage) { | |||
| InternalSession session = ((InternalSessionManager)sessionManager).findSession(wxMessage.getFromUserName()); | |||
| InternalSession session = ((InternalSessionManager)this.sessionManager).findSession(wxMessage.getFromUserName()); | |||
| if (session != null) { | |||
| session.endAccess(); | |||
| } | |||
| @@ -1,12 +1,12 @@ | |||
| package me.chanjar.weixin.mp.api; | |||
| import java.util.List; | |||
| import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.mp.bean.WxMpUserQuery; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpUserList; | |||
| import java.util.List; | |||
| /** | |||
| * 用户管理和统计相关操作接口 | |||
| * | |||
| @@ -42,7 +42,7 @@ public interface WxMpUserService { | |||
| * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息 | |||
| * </pre> | |||
| * | |||
| * @param openid 用户openid, lang 使用默认(zh_CN 简体) | |||
| * @param openidList 用户openid列表 | |||
| */ | |||
| List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException; | |||
| @@ -13,7 +13,7 @@ public class Industry implements Serializable { | |||
| private String secondClass; | |||
| public String getId() { | |||
| return id; | |||
| return this.id; | |||
| } | |||
| public void setId(String id) { | |||
| @@ -21,7 +21,7 @@ public class Industry implements Serializable { | |||
| } | |||
| public String getFirstClass() { | |||
| return firstClass; | |||
| return this.firstClass; | |||
| } | |||
| public void setFirstClass(String firstClass) { | |||
| @@ -29,7 +29,7 @@ public class Industry implements Serializable { | |||
| } | |||
| public String getSecondClass() { | |||
| return secondClass; | |||
| return this.secondClass; | |||
| } | |||
| public void setSecondClass(String secondClass) { | |||
| @@ -20,7 +20,7 @@ public class WxMpCard { | |||
| private Boolean canConsume; | |||
| public String getCardId() { | |||
| return cardId; | |||
| return this.cardId; | |||
| } | |||
| public void setCardId(String cardId) { | |||
| @@ -28,7 +28,7 @@ public class WxMpCard { | |||
| } | |||
| public Long getBeginTime() { | |||
| return beginTime; | |||
| return this.beginTime; | |||
| } | |||
| public void setBeginTime(Long beginTime) { | |||
| @@ -36,7 +36,7 @@ public class WxMpCard { | |||
| } | |||
| public Long getEndTime() { | |||
| return endTime; | |||
| return this.endTime; | |||
| } | |||
| public void setEndTime(Long endTime) { | |||
| @@ -44,7 +44,7 @@ public class WxMpCard { | |||
| } | |||
| public String getUserCardStatus() { | |||
| return userCardStatus; | |||
| return this.userCardStatus; | |||
| } | |||
| public void setUserCardStatus(String userCardStatus) { | |||
| @@ -52,7 +52,7 @@ public class WxMpCard { | |||
| } | |||
| public Boolean getCanConsume() { | |||
| return canConsume; | |||
| return this.canConsume; | |||
| } | |||
| public void setCanConsume(Boolean canConsume) { | |||
| @@ -62,11 +62,11 @@ public class WxMpCard { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpCard{" + | |||
| "cardId='" + cardId + '\'' + | |||
| ", beginTime=" + beginTime + | |||
| ", endTime=" + endTime + | |||
| ", userCardStatus='" + userCardStatus + '\'' + | |||
| ", canConsume=" + canConsume + | |||
| "cardId='" + this.cardId + '\'' + | |||
| ", beginTime=" + this.beginTime + | |||
| ", endTime=" + this.endTime + | |||
| ", userCardStatus='" + this.userCardStatus + '\'' + | |||
| ", canConsume=" + this.canConsume + | |||
| '}'; | |||
| } | |||
| } | |||
| @@ -182,7 +182,7 @@ public class WxMpCustomMessage implements Serializable { | |||
| } | |||
| public String getKfAccount() { | |||
| return kfAccount; | |||
| return this.kfAccount; | |||
| } | |||
| public void setKfAccount(String kfAccount) { | |||
| @@ -11,23 +11,27 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpGroup implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 1554709708638735270L; | |||
| private long id = -1; | |||
| private String name; | |||
| private long count; | |||
| public long getId() { | |||
| return id; | |||
| return this.id; | |||
| } | |||
| public void setId(long id) { | |||
| this.id = id; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| return this.name; | |||
| } | |||
| public void setName(String name) { | |||
| this.name = name; | |||
| } | |||
| public long getCount() { | |||
| return count; | |||
| return this.count; | |||
| } | |||
| public void setCount(long count) { | |||
| this.count = count; | |||
| @@ -42,7 +46,7 @@ public class WxMpGroup implements Serializable { | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpGroup [id=" + id + ", name=" + name + ", count=" + count + "]"; | |||
| return "WxMpGroup [id=" + this.id + ", name=" + this.name + ", count=" + this.count + "]"; | |||
| } | |||
| } | |||
| @@ -22,7 +22,7 @@ public class WxMpIndustry implements Serializable { | |||
| } | |||
| public Industry getPrimaryIndustry() { | |||
| return primaryIndustry; | |||
| return this.primaryIndustry; | |||
| } | |||
| public void setPrimaryIndustry(Industry primaryIndustry) { | |||
| @@ -30,7 +30,7 @@ public class WxMpIndustry implements Serializable { | |||
| } | |||
| public Industry getSecondIndustry() { | |||
| return secondIndustry; | |||
| return this.secondIndustry; | |||
| } | |||
| public void setSecondIndustry(Industry secondIndustry) { | |||
| @@ -11,6 +11,10 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpMassGroupMessage implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -6625914040986749286L; | |||
| private Long groupId; | |||
| private String msgtype; | |||
| private String content; | |||
| @@ -21,7 +25,7 @@ public class WxMpMassGroupMessage implements Serializable { | |||
| } | |||
| public String getMsgtype() { | |||
| return msgtype; | |||
| return this.msgtype; | |||
| } | |||
| /** | |||
| @@ -41,7 +45,7 @@ public class WxMpMassGroupMessage implements Serializable { | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| return this.content; | |||
| } | |||
| public void setContent(String content) { | |||
| @@ -49,7 +53,7 @@ public class WxMpMassGroupMessage implements Serializable { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -61,7 +65,7 @@ public class WxMpMassGroupMessage implements Serializable { | |||
| } | |||
| public Long getGroupId() { | |||
| return groupId; | |||
| return this.groupId; | |||
| } | |||
| /** | |||
| @@ -13,10 +13,14 @@ import java.util.List; | |||
| */ | |||
| public class WxMpMassNews implements Serializable { | |||
| private List<WxMpMassNewsArticle> articles = new ArrayList<WxMpMassNewsArticle>(); | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 565937155013581016L; | |||
| private List<WxMpMassNewsArticle> articles = new ArrayList<>(); | |||
| public List<WxMpMassNewsArticle> getArticles() { | |||
| return articles; | |||
| return this.articles; | |||
| } | |||
| public void addArticle(WxMpMassNewsArticle article) { | |||
| @@ -28,7 +32,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public boolean isEmpty() { | |||
| return articles == null || articles.isEmpty(); | |||
| return this.articles == null || this.articles.isEmpty(); | |||
| } | |||
| /** | |||
| @@ -76,7 +80,7 @@ public class WxMpMassNews implements Serializable { | |||
| private boolean showCoverPic; | |||
| public String getThumbMediaId() { | |||
| return thumbMediaId; | |||
| return this.thumbMediaId; | |||
| } | |||
| public void setThumbMediaId(String thumbMediaId) { | |||
| @@ -84,7 +88,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public String getAuthor() { | |||
| return author; | |||
| return this.author; | |||
| } | |||
| public void setAuthor(String author) { | |||
| @@ -92,7 +96,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| return this.title; | |||
| } | |||
| public void setTitle(String title) { | |||
| @@ -100,7 +104,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public String getContentSourceUrl() { | |||
| return contentSourceUrl; | |||
| return this.contentSourceUrl; | |||
| } | |||
| public void setContentSourceUrl(String contentSourceUrl) { | |||
| @@ -108,7 +112,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| return this.content; | |||
| } | |||
| public void setContent(String content) { | |||
| @@ -116,7 +120,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public String getDigest() { | |||
| return digest; | |||
| return this.digest; | |||
| } | |||
| public void setDigest(String digest) { | |||
| @@ -124,7 +128,7 @@ public class WxMpMassNews implements Serializable { | |||
| } | |||
| public boolean isShowCoverPic() { | |||
| return showCoverPic; | |||
| return this.showCoverPic; | |||
| } | |||
| public void setShowCoverPic(boolean showCoverPic) { | |||
| @@ -133,14 +137,14 @@ public class WxMpMassNews implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + ", author=" + author + ", title=" + title + | |||
| ", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest + | |||
| ", showCoverPic=" + showCoverPic + "]"; | |||
| return "WxMpMassNewsArticle [" + "thumbMediaId=" + this.thumbMediaId + ", author=" + this.author + ", title=" + this.title + | |||
| ", contentSourceUrl=" + this.contentSourceUrl + ", content=" + this.content + ", digest=" + this.digest + | |||
| ", showCoverPic=" + this.showCoverPic + "]"; | |||
| } | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMassNews [" + "articles=" + articles + "]"; | |||
| return "WxMpMassNews [" + "articles=" + this.articles + "]"; | |||
| } | |||
| } | |||
| @@ -8,6 +8,10 @@ import java.io.Serializable; | |||
| * @author miller | |||
| */ | |||
| public class WxMpMassPreviewMessage implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 9095211638358424020L; | |||
| private String toWxUsername; | |||
| private String msgType; | |||
| private String content; | |||
| @@ -18,7 +22,7 @@ public class WxMpMassPreviewMessage implements Serializable { | |||
| } | |||
| public String getToWxUsername() { | |||
| return toWxUsername; | |||
| return this.toWxUsername; | |||
| } | |||
| public void setToWxUsername(String toWxUsername) { | |||
| @@ -26,7 +30,7 @@ public class WxMpMassPreviewMessage implements Serializable { | |||
| } | |||
| public String getMsgType() { | |||
| return msgType; | |||
| return this.msgType; | |||
| } | |||
| /** | |||
| @@ -47,7 +51,7 @@ public class WxMpMassPreviewMessage implements Serializable { | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| return this.content; | |||
| } | |||
| public void setContent(String content) { | |||
| @@ -55,7 +59,7 @@ public class WxMpMassPreviewMessage implements Serializable { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -11,12 +11,16 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpMassVideo implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 9153925016061915637L; | |||
| private String mediaId; | |||
| private String title; | |||
| private String description; | |||
| public String getTitle() { | |||
| return title; | |||
| return this.title; | |||
| } | |||
| public void setTitle(String title) { | |||
| @@ -24,7 +28,7 @@ public class WxMpMassVideo implements Serializable { | |||
| } | |||
| public String getDescription() { | |||
| return description; | |||
| return this.description; | |||
| } | |||
| public void setDescription(String description) { | |||
| @@ -32,7 +36,7 @@ public class WxMpMassVideo implements Serializable { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -22,14 +22,14 @@ public class WxMpMaterial { | |||
| } | |||
| public Map<String, String> getForm() { | |||
| Map<String, String> form = new HashMap<String, String>(); | |||
| form.put("title", videoTitle); | |||
| form.put("introduction", videoIntroduction); | |||
| Map<String, String> form = new HashMap<>(); | |||
| form.put("title", this.videoTitle); | |||
| form.put("introduction", this.videoIntroduction); | |||
| return form; | |||
| } | |||
| public String getVideoTitle() { | |||
| return videoTitle; | |||
| return this.videoTitle; | |||
| } | |||
| public void setVideoTitle(String videoTitle) { | |||
| @@ -37,7 +37,7 @@ public class WxMpMaterial { | |||
| } | |||
| public String getVideoIntroduction() { | |||
| return videoIntroduction; | |||
| return this.videoIntroduction; | |||
| } | |||
| public void setVideoIntroduction(String videoIntroduction) { | |||
| @@ -45,7 +45,7 @@ public class WxMpMaterial { | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| return this.name; | |||
| } | |||
| public void setName(String name) { | |||
| @@ -53,7 +53,7 @@ public class WxMpMaterial { | |||
| } | |||
| public File getFile() { | |||
| return file; | |||
| return this.file; | |||
| } | |||
| public void setFile(File file) { | |||
| @@ -62,6 +62,6 @@ public class WxMpMaterial { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterial [" + "name=" + name + ", file=" + file + ", videoTitle=" + videoTitle + ", videoIntroduction=" + videoIntroduction + "]"; | |||
| return "WxMpMaterial [" + "name=" + this.name + ", file=" + this.file + ", videoTitle=" + this.videoTitle + ", videoIntroduction=" + this.videoIntroduction + "]"; | |||
| } | |||
| } | |||
| @@ -6,12 +6,16 @@ import java.io.Serializable; | |||
| public class WxMpMaterialArticleUpdate implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -7611963949517780270L; | |||
| private String mediaId; | |||
| private int index; | |||
| private WxMpMaterialNews.WxMpMaterialNewsArticle articles; | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -19,7 +23,7 @@ public class WxMpMaterialArticleUpdate implements Serializable { | |||
| } | |||
| public int getIndex() { | |||
| return index; | |||
| return this.index; | |||
| } | |||
| public void setIndex(int index) { | |||
| @@ -27,7 +31,7 @@ public class WxMpMaterialArticleUpdate implements Serializable { | |||
| } | |||
| public WxMpMaterialNews.WxMpMaterialNewsArticle getArticles() { | |||
| return articles; | |||
| return this.articles; | |||
| } | |||
| public void setArticles(WxMpMaterialNews.WxMpMaterialNewsArticle articles) { | |||
| @@ -40,6 +44,6 @@ public class WxMpMaterialArticleUpdate implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialArticleUpdate [" + "mediaId=" + mediaId + ", index=" + index + ", articles=" + articles + "]"; | |||
| return "WxMpMaterialArticleUpdate [" + "mediaId=" + this.mediaId + ", index=" + this.index + ", articles=" + this.articles + "]"; | |||
| } | |||
| } | |||
| @@ -8,10 +8,14 @@ import java.util.List; | |||
| public class WxMpMaterialNews implements Serializable { | |||
| private List<WxMpMaterialNewsArticle> articles = new ArrayList<WxMpMaterialNewsArticle>(); | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -3283203652013494976L; | |||
| private List<WxMpMaterialNewsArticle> articles = new ArrayList<>(); | |||
| public List<WxMpMaterialNewsArticle> getArticles() { | |||
| return articles; | |||
| return this.articles; | |||
| } | |||
| public void addArticle(WxMpMaterialNewsArticle article) { | |||
| @@ -23,7 +27,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public boolean isEmpty() { | |||
| return articles == null || articles.isEmpty(); | |||
| return this.articles == null || this.articles.isEmpty(); | |||
| } | |||
| /** | |||
| @@ -82,7 +86,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| private String url; | |||
| public String getThumbMediaId() { | |||
| return thumbMediaId; | |||
| return this.thumbMediaId; | |||
| } | |||
| public void setThumbMediaId(String thumbMediaId) { | |||
| @@ -90,7 +94,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getAuthor() { | |||
| return author; | |||
| return this.author; | |||
| } | |||
| public void setAuthor(String author) { | |||
| @@ -98,7 +102,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| return this.title; | |||
| } | |||
| public void setTitle(String title) { | |||
| @@ -106,7 +110,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getContentSourceUrl() { | |||
| return contentSourceUrl; | |||
| return this.contentSourceUrl; | |||
| } | |||
| public void setContentSourceUrl(String contentSourceUrl) { | |||
| @@ -114,7 +118,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| return this.content; | |||
| } | |||
| public void setContent(String content) { | |||
| @@ -122,7 +126,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getDigest() { | |||
| return digest; | |||
| return this.digest; | |||
| } | |||
| public void setDigest(String digest) { | |||
| @@ -130,7 +134,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public boolean isShowCoverPic() { | |||
| return showCoverPic; | |||
| return this.showCoverPic; | |||
| } | |||
| public void setShowCoverPic(boolean showCoverPic) { | |||
| @@ -138,7 +142,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -146,7 +150,7 @@ public class WxMpMaterialNews implements Serializable { | |||
| } | |||
| public String getThumbUrl() { | |||
| return thumbUrl; | |||
| return this.thumbUrl; | |||
| } | |||
| public void setThumbUrl(String thumbUrl) { | |||
| @@ -155,14 +159,14 @@ public class WxMpMaterialNews implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMassNewsArticle [" + "thumbMediaId=" + thumbMediaId + "thumbUrl=" + thumbUrl + ", author=" + author + ", title=" + title + | |||
| ", contentSourceUrl=" + contentSourceUrl + ", content=" + content + ", digest=" + digest + | |||
| ", showCoverPic=" + showCoverPic +", url=" + url + "]"; | |||
| return "WxMpMassNewsArticle [" + "thumbMediaId=" + this.thumbMediaId + "thumbUrl=" + this.thumbUrl + ", author=" + this.author + ", title=" + this.title + | |||
| ", contentSourceUrl=" + this.contentSourceUrl + ", content=" + this.content + ", digest=" + this.digest + | |||
| ", showCoverPic=" + this.showCoverPic +", url=" + this.url + "]"; | |||
| } | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialNews [" + "articles=" + articles + "]"; | |||
| return "WxMpMaterialNews [" + "articles=" + this.articles + "]"; | |||
| } | |||
| } | |||
| @@ -13,6 +13,10 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpSemanticQuery implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 7685873048199870690L; | |||
| private String query; | |||
| private String category; | |||
| private Float latitude; | |||
| @@ -23,7 +27,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| private String uid; | |||
| public String getQuery() { | |||
| return query; | |||
| return this.query; | |||
| } | |||
| public void setQuery(String query) { | |||
| @@ -31,7 +35,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public String getCategory() { | |||
| return category; | |||
| return this.category; | |||
| } | |||
| public void setCategory(String category) { | |||
| @@ -39,7 +43,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public Float getLatitude() { | |||
| return latitude; | |||
| return this.latitude; | |||
| } | |||
| public void setLatitude(Float latitude) { | |||
| @@ -47,7 +51,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public Float getLongitude() { | |||
| return longitude; | |||
| return this.longitude; | |||
| } | |||
| public void setLongitude(Float longitude) { | |||
| @@ -55,7 +59,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public String getCity() { | |||
| return city; | |||
| return this.city; | |||
| } | |||
| public void setCity(String city) { | |||
| @@ -63,7 +67,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public String getRegion() { | |||
| return region; | |||
| return this.region; | |||
| } | |||
| public void setRegion(String region) { | |||
| @@ -71,7 +75,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| return this.appid; | |||
| } | |||
| public void setAppid(String appid) { | |||
| @@ -79,7 +83,7 @@ public class WxMpSemanticQuery implements Serializable { | |||
| } | |||
| public String getUid() { | |||
| return uid; | |||
| return this.uid; | |||
| } | |||
| public void setUid(String uid) { | |||
| @@ -7,6 +7,10 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpTemplateData implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 6301835292940277870L; | |||
| private String name; | |||
| private String value; | |||
| private String color; | |||
| @@ -26,7 +30,7 @@ public class WxMpTemplateData implements Serializable { | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| return this.name; | |||
| } | |||
| public void setName(String name) { | |||
| @@ -34,7 +38,7 @@ public class WxMpTemplateData implements Serializable { | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| return this.value; | |||
| } | |||
| public void setValue(String value) { | |||
| @@ -42,7 +46,7 @@ public class WxMpTemplateData implements Serializable { | |||
| } | |||
| public String getColor() { | |||
| return color; | |||
| return this.color; | |||
| } | |||
| public void setColor(String color) { | |||
| this.color = color; | |||
| @@ -8,14 +8,18 @@ import java.util.List; | |||
| public class WxMpTemplateMessage implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 5063374783759519418L; | |||
| private String toUser; | |||
| private String templateId; | |||
| private String url; | |||
| private String topColor; | |||
| private List<WxMpTemplateData> data = new ArrayList<WxMpTemplateData>(); | |||
| private List<WxMpTemplateData> data = new ArrayList<>(); | |||
| public String getToUser() { | |||
| return toUser; | |||
| return this.toUser; | |||
| } | |||
| public void setToUser(String toUser) { | |||
| @@ -23,7 +27,7 @@ public class WxMpTemplateMessage implements Serializable { | |||
| } | |||
| public String getTemplateId() { | |||
| return templateId; | |||
| return this.templateId; | |||
| } | |||
| public void setTemplateId(String templateId) { | |||
| @@ -31,7 +35,7 @@ public class WxMpTemplateMessage implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -39,7 +43,7 @@ public class WxMpTemplateMessage implements Serializable { | |||
| } | |||
| public String getTopColor() { | |||
| return topColor; | |||
| return this.topColor; | |||
| } | |||
| public void setTopColor(String topColor) { | |||
| @@ -47,7 +51,7 @@ public class WxMpTemplateMessage implements Serializable { | |||
| } | |||
| public List<WxMpTemplateData> getData() { | |||
| return data; | |||
| return this.data; | |||
| } | |||
| public void setData(List<WxMpTemplateData> data) { | |||
| @@ -24,7 +24,6 @@ public class WxMpUserQuery { | |||
| /** | |||
| * 语言使用默认(zh_CN) | |||
| * | |||
| * @description | |||
| * @param openIdList | |||
| */ | |||
| public WxMpUserQuery(List<String> openIdList) { | |||
| @@ -53,7 +52,7 @@ public class WxMpUserQuery { | |||
| * @return {@link WxMpUserQuery} | |||
| */ | |||
| public WxMpUserQuery add(String openId, String lang) { | |||
| queryParamList.add(new WxMpUserQueryParam(openId, lang)); | |||
| this.queryParamList.add(new WxMpUserQueryParam(openId, lang)); | |||
| return this; | |||
| } | |||
| @@ -68,7 +67,7 @@ public class WxMpUserQuery { | |||
| * @return {@link WxMpUserQuery} | |||
| */ | |||
| public WxMpUserQuery add(String openId) { | |||
| queryParamList.add(new WxMpUserQueryParam(openId)); | |||
| this.queryParamList.add(new WxMpUserQueryParam(openId)); | |||
| return this; | |||
| } | |||
| @@ -79,7 +78,7 @@ public class WxMpUserQuery { | |||
| * @return {@link WxMpUserQuery} | |||
| */ | |||
| public WxMpUserQuery remove(String openId) { | |||
| queryParamList.remove(new WxMpUserQueryParam(openId)); | |||
| this.queryParamList.remove(new WxMpUserQueryParam(openId)); | |||
| return this; | |||
| } | |||
| @@ -91,22 +90,21 @@ public class WxMpUserQuery { | |||
| * @return {@link WxMpUserQuery} | |||
| */ | |||
| public WxMpUserQuery remove(String openId, String lang) { | |||
| queryParamList.remove(new WxMpUserQueryParam(openId, lang)); | |||
| this.queryParamList.remove(new WxMpUserQueryParam(openId, lang)); | |||
| return this; | |||
| } | |||
| /** | |||
| * 获取查询参数列表 | |||
| * | |||
| * @return | |||
| */ | |||
| public List<WxMpUserQueryParam> getQueryParamList() { | |||
| return queryParamList; | |||
| return this.queryParamList; | |||
| } | |||
| public String toJsonString() { | |||
| Map<String, Object> map = new HashMap<>(); | |||
| map.put("user_list", queryParamList); | |||
| map.put("user_list", this.queryParamList); | |||
| return new Gson().toJson(map); | |||
| } | |||
| @@ -136,7 +134,7 @@ public class WxMpUserQuery { | |||
| } | |||
| public String getOpenid() { | |||
| return openid; | |||
| return this.openid; | |||
| } | |||
| public void setOpenid(String openid) { | |||
| @@ -144,7 +142,7 @@ public class WxMpUserQuery { | |||
| } | |||
| public String getLang() { | |||
| return lang; | |||
| return this.lang; | |||
| } | |||
| public void setLang(String lang) { | |||
| @@ -156,8 +154,8 @@ public class WxMpUserQuery { | |||
| final int prime = 31; | |||
| int result = 1; | |||
| result = prime * result + getOuterType().hashCode(); | |||
| result = prime * result + ((lang == null) ? 0 : lang.hashCode()); | |||
| result = prime * result + ((openid == null) ? 0 : openid.hashCode()); | |||
| result = prime * result + ((this.lang == null) ? 0 : this.lang.hashCode()); | |||
| result = prime * result + ((this.openid == null) ? 0 : this.openid.hashCode()); | |||
| return result; | |||
| } | |||
| @@ -172,15 +170,15 @@ public class WxMpUserQuery { | |||
| WxMpUserQueryParam other = (WxMpUserQueryParam) obj; | |||
| if (!getOuterType().equals(other.getOuterType())) | |||
| return false; | |||
| if (lang == null) { | |||
| if (this.lang == null) { | |||
| if (other.lang != null) | |||
| return false; | |||
| } else if (!lang.equals(other.lang)) | |||
| } else if (!this.lang.equals(other.lang)) | |||
| return false; | |||
| if (openid == null) { | |||
| if (this.openid == null) { | |||
| if (other.openid != null) | |||
| return false; | |||
| } else if (!openid.equals(other.openid)) | |||
| } else if (!this.openid.equals(other.openid)) | |||
| return false; | |||
| return true; | |||
| } | |||
| @@ -8,12 +8,16 @@ import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter; | |||
| @XStreamAlias("xml") | |||
| public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -2684778597067990723L; | |||
| @XStreamAlias("Image") | |||
| @XStreamConverter(value = XStreamMediaIdConverter.class) | |||
| private String mediaId; | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -8,6 +8,10 @@ import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
| @XStreamAlias("xml") | |||
| public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -4159937804975448945L; | |||
| @XStreamAlias("Music") | |||
| protected final Music music = new Music(); | |||
| @@ -16,43 +20,43 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getTitle() { | |||
| return music.getTitle(); | |||
| return this.music.getTitle(); | |||
| } | |||
| public void setTitle(String title) { | |||
| music.setTitle(title); | |||
| this.music.setTitle(title); | |||
| } | |||
| public String getDescription() { | |||
| return music.getDescription(); | |||
| return this.music.getDescription(); | |||
| } | |||
| public void setDescription(String description) { | |||
| music.setDescription(description); | |||
| this.music.setDescription(description); | |||
| } | |||
| public String getThumbMediaId() { | |||
| return music.getThumbMediaId(); | |||
| return this.music.getThumbMediaId(); | |||
| } | |||
| public void setThumbMediaId(String thumbMediaId) { | |||
| music.setThumbMediaId(thumbMediaId); | |||
| this.music.setThumbMediaId(thumbMediaId); | |||
| } | |||
| public String getMusicUrl() { | |||
| return music.getMusicUrl(); | |||
| return this.music.getMusicUrl(); | |||
| } | |||
| public void setMusicUrl(String musicUrl) { | |||
| music.setMusicUrl(musicUrl); | |||
| this.music.setMusicUrl(musicUrl); | |||
| } | |||
| public String getHqMusicUrl() { | |||
| return music.getHqMusicUrl(); | |||
| return this.music.getHqMusicUrl(); | |||
| } | |||
| public void setHqMusicUrl(String hqMusicUrl) { | |||
| music.setHqMusicUrl(hqMusicUrl); | |||
| this.music.setHqMusicUrl(hqMusicUrl); | |||
| } | |||
| @XStreamAlias("Music") | |||
| @@ -79,7 +83,7 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| private String hqMusicUrl; | |||
| public String getTitle() { | |||
| return title; | |||
| return this.title; | |||
| } | |||
| public void setTitle(String title) { | |||
| @@ -87,7 +91,7 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getDescription() { | |||
| return description; | |||
| return this.description; | |||
| } | |||
| public void setDescription(String description) { | |||
| @@ -95,7 +99,7 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getThumbMediaId() { | |||
| return thumbMediaId; | |||
| return this.thumbMediaId; | |||
| } | |||
| public void setThumbMediaId(String thumbMediaId) { | |||
| @@ -103,7 +107,7 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getMusicUrl() { | |||
| return musicUrl; | |||
| return this.musicUrl; | |||
| } | |||
| public void setMusicUrl(String musicUrl) { | |||
| @@ -111,7 +115,7 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getHqMusicUrl() { | |||
| return hqMusicUrl; | |||
| return this.hqMusicUrl; | |||
| } | |||
| public void setHqMusicUrl(String hqMusicUrl) { | |||
| @@ -11,18 +11,23 @@ import java.util.List; | |||
| @XStreamAlias("xml") | |||
| public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -4604402850905714772L; | |||
| @XStreamAlias("ArticleCount") | |||
| protected int articleCount; | |||
| @XStreamAlias("Articles") | |||
| protected final List<Item> articles = new ArrayList<Item>(); | |||
| protected final List<Item> articles = new ArrayList<>(); | |||
| public WxMpXmlOutNewsMessage() { | |||
| this.msgType = WxConsts.XML_MSG_NEWS; | |||
| } | |||
| public int getArticleCount() { | |||
| return articleCount; | |||
| return this.articleCount; | |||
| } | |||
| public void addArticle(Item item) { | |||
| @@ -31,7 +36,7 @@ public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public List<Item> getArticles() { | |||
| return articles; | |||
| return this.articles; | |||
| } | |||
| @@ -55,35 +60,35 @@ public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage { | |||
| private String Url; | |||
| public String getTitle() { | |||
| return Title; | |||
| return this.Title; | |||
| } | |||
| public void setTitle(String title) { | |||
| Title = title; | |||
| this.Title = title; | |||
| } | |||
| public String getDescription() { | |||
| return Description; | |||
| return this.Description; | |||
| } | |||
| public void setDescription(String description) { | |||
| Description = description; | |||
| this.Description = description; | |||
| } | |||
| public String getPicUrl() { | |||
| return PicUrl; | |||
| return this.PicUrl; | |||
| } | |||
| public void setPicUrl(String picUrl) { | |||
| PicUrl = picUrl; | |||
| this.PicUrl = picUrl; | |||
| } | |||
| public String getUrl() { | |||
| return Url; | |||
| return this.Url; | |||
| } | |||
| public void setUrl(String url) { | |||
| Url = url; | |||
| this.Url = url; | |||
| } | |||
| } | |||
| @@ -8,6 +8,10 @@ import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
| @XStreamAlias("xml") | |||
| public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -3972786455288763361L; | |||
| @XStreamAlias("Content") | |||
| @XStreamConverter(value=XStreamCDataConverter.class) | |||
| private String content; | |||
| @@ -17,7 +21,7 @@ public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getContent() { | |||
| return content; | |||
| return this.content; | |||
| } | |||
| public void setContent(String content) { | |||
| @@ -8,6 +8,10 @@ import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
| @XStreamAlias("xml") | |||
| public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 1745902309380113978L; | |||
| @XStreamAlias("Video") | |||
| protected final Video video = new Video(); | |||
| @@ -16,27 +20,27 @@ public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getMediaId() { | |||
| return video.getMediaId(); | |||
| return this.video.getMediaId(); | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| video.setMediaId(mediaId); | |||
| this.video.setMediaId(mediaId); | |||
| } | |||
| public String getTitle() { | |||
| return video.getTitle(); | |||
| return this.video.getTitle(); | |||
| } | |||
| public void setTitle(String title) { | |||
| video.setTitle(title); | |||
| this.video.setTitle(title); | |||
| } | |||
| public String getDescription() { | |||
| return video.getDescription(); | |||
| return this.video.getDescription(); | |||
| } | |||
| public void setDescription(String description) { | |||
| video.setDescription(description); | |||
| this.video.setDescription(description); | |||
| } | |||
| @@ -56,7 +60,7 @@ public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage { | |||
| private String description; | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -64,7 +68,7 @@ public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| return this.title; | |||
| } | |||
| public void setTitle(String title) { | |||
| @@ -72,7 +76,7 @@ public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getDescription() { | |||
| return description; | |||
| return this.description; | |||
| } | |||
| public void setDescription(String description) { | |||
| @@ -8,6 +8,10 @@ import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter; | |||
| @XStreamAlias("xml") | |||
| public class WxMpXmlOutVoiceMessage extends WxMpXmlOutMessage { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 240367390249860551L; | |||
| @XStreamAlias("Voice") | |||
| @XStreamConverter(value = XStreamMediaIdConverter.class) | |||
| private String mediaId; | |||
| @@ -17,7 +21,7 @@ public class WxMpXmlOutVoiceMessage extends WxMpXmlOutMessage { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -23,6 +23,7 @@ public final class ImageBuilder extends BaseBuilder<ImageBuilder> { | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpCustomMessage build() { | |||
| WxMpCustomMessage m = super.build(); | |||
| m.setMediaId(this.mediaId); | |||
| @@ -52,13 +52,14 @@ public final class MusicBuilder extends BaseBuilder<MusicBuilder> { | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpCustomMessage build() { | |||
| WxMpCustomMessage m = super.build(); | |||
| m.setMusicUrl(this.musicUrl); | |||
| m.setHqMusicUrl(this.hqMusicUrl); | |||
| m.setTitle(title); | |||
| m.setDescription(description); | |||
| m.setThumbMediaId(thumbMediaId); | |||
| m.setTitle(this.title); | |||
| m.setDescription(this.description); | |||
| m.setThumbMediaId(this.thumbMediaId); | |||
| return m; | |||
| } | |||
| } | |||
| @@ -17,7 +17,7 @@ import java.util.List; | |||
| */ | |||
| public final class NewsBuilder extends BaseBuilder<NewsBuilder> { | |||
| private List<WxMpCustomMessage.WxArticle> articles = new ArrayList<WxMpCustomMessage.WxArticle>(); | |||
| private List<WxMpCustomMessage.WxArticle> articles = new ArrayList<>(); | |||
| public NewsBuilder() { | |||
| this.msgType = WxConsts.CUSTOM_MSG_NEWS; | |||
| @@ -28,6 +28,7 @@ public final class NewsBuilder extends BaseBuilder<NewsBuilder> { | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpCustomMessage build() { | |||
| WxMpCustomMessage m = super.build(); | |||
| m.setArticles(this.articles); | |||
| @@ -23,6 +23,7 @@ public final class TextBuilder extends BaseBuilder<TextBuilder> { | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpCustomMessage build() { | |||
| WxMpCustomMessage m = super.build(); | |||
| m.setContent(this.content); | |||
| @@ -47,12 +47,13 @@ public final class VideoBuilder extends BaseBuilder<VideoBuilder> { | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpCustomMessage build() { | |||
| WxMpCustomMessage m = super.build(); | |||
| m.setMediaId(this.mediaId); | |||
| m.setTitle(title); | |||
| m.setDescription(description); | |||
| m.setThumbMediaId(thumbMediaId); | |||
| m.setTitle(this.title); | |||
| m.setDescription(this.description); | |||
| m.setThumbMediaId(this.thumbMediaId); | |||
| return m; | |||
| } | |||
| } | |||
| @@ -23,6 +23,7 @@ public final class VoiceBuilder extends BaseBuilder<VoiceBuilder> { | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpCustomMessage build() { | |||
| WxMpCustomMessage m = super.build(); | |||
| m.setMediaId(this.mediaId); | |||
| @@ -21,7 +21,7 @@ public class WxMpKfMsgList { | |||
| private Long msgId; | |||
| public List<WxMpKfMsgRecord> getRecords() { | |||
| return records; | |||
| return this.records; | |||
| } | |||
| public void setRecords(List<WxMpKfMsgRecord> records) { | |||
| @@ -29,7 +29,7 @@ public class WxMpKfMsgList { | |||
| } | |||
| public Integer getNumber() { | |||
| return number; | |||
| return this.number; | |||
| } | |||
| public void setNumber(Integer number) { | |||
| @@ -37,7 +37,7 @@ public class WxMpKfMsgList { | |||
| } | |||
| public Long getMsgId() { | |||
| return msgId; | |||
| return this.msgId; | |||
| } | |||
| public void setMsgId(Long msgId) { | |||
| @@ -46,7 +46,7 @@ public class WxMpKfMsgRecord { | |||
| return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
| } | |||
| public String getWorker() { | |||
| return worker; | |||
| return this.worker; | |||
| } | |||
| public void setWorker(String worker) { | |||
| @@ -54,7 +54,7 @@ public class WxMpKfMsgRecord { | |||
| } | |||
| public String getOpenid() { | |||
| return openid; | |||
| return this.openid; | |||
| } | |||
| public void setOpenid(String openid) { | |||
| @@ -62,7 +62,7 @@ public class WxMpKfMsgRecord { | |||
| } | |||
| public String getText() { | |||
| return text; | |||
| return this.text; | |||
| } | |||
| public void setText(String text) { | |||
| @@ -70,7 +70,7 @@ public class WxMpKfMsgRecord { | |||
| } | |||
| public Long getTime() { | |||
| return time; | |||
| return this.time; | |||
| } | |||
| public void setTime(Long time) { | |||
| @@ -78,7 +78,7 @@ public class WxMpKfMsgRecord { | |||
| } | |||
| public Integer getOperateCode() { | |||
| return operateCode; | |||
| return this.operateCode; | |||
| } | |||
| public void setOperateCode(Integer operateCode) { | |||
| @@ -15,6 +15,7 @@ public final class ImageBuilder extends BaseBuilder<ImageBuilder, WxMpXmlOutImag | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpXmlOutImageMessage build() { | |||
| WxMpXmlOutImageMessage m = new WxMpXmlOutImageMessage(); | |||
| setCommon(m); | |||
| @@ -40,14 +40,15 @@ public final class MusicBuilder extends BaseBuilder<MusicBuilder, WxMpXmlOutMusi | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpXmlOutMusicMessage build() { | |||
| WxMpXmlOutMusicMessage m = new WxMpXmlOutMusicMessage(); | |||
| setCommon(m); | |||
| m.setTitle(title); | |||
| m.setDescription(description); | |||
| m.setHqMusicUrl(hqMusicUrl); | |||
| m.setMusicUrl(musicUrl); | |||
| m.setThumbMediaId(thumbMediaId); | |||
| m.setTitle(this.title); | |||
| m.setDescription(this.description); | |||
| m.setHqMusicUrl(this.hqMusicUrl); | |||
| m.setMusicUrl(this.musicUrl); | |||
| m.setThumbMediaId(this.thumbMediaId); | |||
| return m; | |||
| } | |||
| @@ -11,16 +11,17 @@ import java.util.List; | |||
| */ | |||
| public final class NewsBuilder extends BaseBuilder<NewsBuilder, WxMpXmlOutNewsMessage> { | |||
| protected final List<WxMpXmlOutNewsMessage.Item> articles = new ArrayList<WxMpXmlOutNewsMessage.Item>(); | |||
| protected final List<WxMpXmlOutNewsMessage.Item> articles = new ArrayList<>(); | |||
| public NewsBuilder addArticle(WxMpXmlOutNewsMessage.Item item) { | |||
| this.articles.add(item); | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpXmlOutNewsMessage build() { | |||
| WxMpXmlOutNewsMessage m = new WxMpXmlOutNewsMessage(); | |||
| for(WxMpXmlOutNewsMessage.Item item : articles) { | |||
| for(WxMpXmlOutNewsMessage.Item item : this.articles) { | |||
| m.addArticle(item); | |||
| } | |||
| setCommon(m); | |||
| @@ -15,6 +15,7 @@ public final class TextBuilder extends BaseBuilder<TextBuilder, WxMpXmlOutTextMe | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpXmlOutTextMessage build() { | |||
| WxMpXmlOutTextMessage m = new WxMpXmlOutTextMessage(); | |||
| setCommon(m); | |||
| @@ -26,12 +26,13 @@ public final class VideoBuilder extends BaseBuilder<VideoBuilder, WxMpXmlOutVide | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpXmlOutVideoMessage build() { | |||
| WxMpXmlOutVideoMessage m = new WxMpXmlOutVideoMessage(); | |||
| setCommon(m); | |||
| m.setTitle(title); | |||
| m.setDescription(description); | |||
| m.setMediaId(mediaId); | |||
| m.setTitle(this.title); | |||
| m.setDescription(this.description); | |||
| m.setMediaId(this.mediaId); | |||
| return m; | |||
| } | |||
| @@ -15,10 +15,11 @@ public final class VoiceBuilder extends BaseBuilder<VoiceBuilder, WxMpXmlOutVoic | |||
| return this; | |||
| } | |||
| @Override | |||
| public WxMpXmlOutVoiceMessage build() { | |||
| WxMpXmlOutVoiceMessage m = new WxMpXmlOutVoiceMessage(); | |||
| setCommon(m); | |||
| m.setMediaId(mediaId); | |||
| m.setMediaId(this.mediaId); | |||
| return m; | |||
| } | |||
| @@ -8,6 +8,10 @@ import java.io.Serializable; | |||
| * @author miller | |||
| */ | |||
| public class WxMediaImgUploadResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 1996392453428768829L; | |||
| private String url; | |||
| public static WxMediaImgUploadResult fromJson(String json) { | |||
| @@ -15,7 +19,7 @@ public class WxMediaImgUploadResult implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -14,6 +14,11 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpCardResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -7950878428289035637L; | |||
| private String errorCode; | |||
| private String errorMsg; | |||
| @@ -27,7 +32,7 @@ public class WxMpCardResult implements Serializable { | |||
| private Boolean canConsume; | |||
| public String getErrorCode() { | |||
| return errorCode; | |||
| return this.errorCode; | |||
| } | |||
| public void setErrorCode(String errorCode) { | |||
| @@ -35,7 +40,7 @@ public class WxMpCardResult implements Serializable { | |||
| } | |||
| public String getErrorMsg() { | |||
| return errorMsg; | |||
| return this.errorMsg; | |||
| } | |||
| public void setErrorMsg(String errorMsg) { | |||
| @@ -43,7 +48,7 @@ public class WxMpCardResult implements Serializable { | |||
| } | |||
| public String getOpenId() { | |||
| return openId; | |||
| return this.openId; | |||
| } | |||
| public void setOpenId(String openId) { | |||
| @@ -51,7 +56,7 @@ public class WxMpCardResult implements Serializable { | |||
| } | |||
| public WxMpCard getCard() { | |||
| return card; | |||
| return this.card; | |||
| } | |||
| public void setCard(WxMpCard card) { | |||
| @@ -64,7 +69,7 @@ public class WxMpCardResult implements Serializable { | |||
| } | |||
| public String getUserCardStatus() { | |||
| return userCardStatus; | |||
| return this.userCardStatus; | |||
| } | |||
| public void setUserCardStatus(String userCardStatus) { | |||
| @@ -72,7 +77,7 @@ public class WxMpCardResult implements Serializable { | |||
| } | |||
| public Boolean getCanConsume() { | |||
| return canConsume; | |||
| return this.canConsume; | |||
| } | |||
| public void setCanConsume(Boolean canConsume) { | |||
| @@ -17,13 +17,17 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpMassSendResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -4816336807575562818L; | |||
| private String errorCode; | |||
| private String errorMsg; | |||
| private String msgId; | |||
| private String msgDataId; | |||
| public String getErrorCode() { | |||
| return errorCode; | |||
| return this.errorCode; | |||
| } | |||
| public void setErrorCode(String errorCode) { | |||
| @@ -31,7 +35,7 @@ public class WxMpMassSendResult implements Serializable { | |||
| } | |||
| public String getErrorMsg() { | |||
| return errorMsg; | |||
| return this.errorMsg; | |||
| } | |||
| public void setErrorMsg(String errorMsg) { | |||
| @@ -39,7 +43,7 @@ public class WxMpMassSendResult implements Serializable { | |||
| } | |||
| public String getMsgId() { | |||
| return msgId; | |||
| return this.msgId; | |||
| } | |||
| public void setMsgId(String msgId) { | |||
| @@ -47,7 +51,7 @@ public class WxMpMassSendResult implements Serializable { | |||
| } | |||
| public String getMsgDataId() { | |||
| return msgDataId; | |||
| return this.msgDataId; | |||
| } | |||
| public void setMsgDataId(String msgDataId) { | |||
| @@ -60,7 +64,7 @@ public class WxMpMassSendResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMassSendResult [errcode=" + errorCode + ", errmsg=" + errorMsg + ", msg_id=" + msgId + "]"; | |||
| return "WxMassSendResult [errcode=" + this.errorCode + ", errmsg=" + this.errorMsg + ", msg_id=" + this.msgId + "]"; | |||
| } | |||
| } | |||
| @@ -14,12 +14,16 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpMassUploadResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 6568157943644994029L; | |||
| private String type; | |||
| private String mediaId; | |||
| private long createdAt; | |||
| public String getType() { | |||
| return type; | |||
| return this.type; | |||
| } | |||
| public void setType(String type) { | |||
| @@ -27,7 +31,7 @@ public class WxMpMassUploadResult implements Serializable { | |||
| } | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -35,7 +39,7 @@ public class WxMpMassUploadResult implements Serializable { | |||
| } | |||
| public long getCreatedAt() { | |||
| return createdAt; | |||
| return this.createdAt; | |||
| } | |||
| public void setCreatedAt(long createdAt) { | |||
| @@ -48,7 +52,7 @@ public class WxMpMassUploadResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxUploadResult [type=" + type + ", media_id=" + mediaId + ", created_at=" + createdAt + "]"; | |||
| return "WxUploadResult [type=" + this.type + ", media_id=" + this.mediaId + ", created_at=" + this.createdAt + "]"; | |||
| } | |||
| } | |||
| @@ -4,13 +4,17 @@ import java.io.Serializable; | |||
| public class WxMpMaterialCountResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -5568772662085874138L; | |||
| private int voiceCount; | |||
| private int videoCount; | |||
| private int imageCount; | |||
| private int newsCount; | |||
| public int getVoiceCount() { | |||
| return voiceCount; | |||
| return this.voiceCount; | |||
| } | |||
| public void setVoiceCount(int voiceCount) { | |||
| @@ -18,7 +22,7 @@ public class WxMpMaterialCountResult implements Serializable { | |||
| } | |||
| public int getVideoCount() { | |||
| return videoCount; | |||
| return this.videoCount; | |||
| } | |||
| public void setVideoCount(int videoCount) { | |||
| @@ -26,7 +30,7 @@ public class WxMpMaterialCountResult implements Serializable { | |||
| } | |||
| public int getImageCount() { | |||
| return imageCount; | |||
| return this.imageCount; | |||
| } | |||
| public void setImageCount(int imageCount) { | |||
| @@ -34,7 +38,7 @@ public class WxMpMaterialCountResult implements Serializable { | |||
| } | |||
| public int getNewsCount() { | |||
| return newsCount; | |||
| return this.newsCount; | |||
| } | |||
| public void setNewsCount(int newsCount) { | |||
| @@ -43,8 +47,8 @@ public class WxMpMaterialCountResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialCountResult [" + "voiceCount=" + voiceCount + ", videoCount=" + videoCount | |||
| + ", imageCount=" + imageCount + ", newsCount=" + newsCount + "]"; | |||
| return "WxMpMaterialCountResult [" + "voiceCount=" + this.voiceCount + ", videoCount=" + this.videoCount | |||
| + ", imageCount=" + this.imageCount + ", newsCount=" + this.newsCount + "]"; | |||
| } | |||
| } | |||
| @@ -6,12 +6,16 @@ import java.util.List; | |||
| public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -560388368297267884L; | |||
| private int totalCount; | |||
| private int itemCount; | |||
| private List<WxMaterialFileBatchGetNewsItem> items; | |||
| public int getTotalCount() { | |||
| return totalCount; | |||
| return this.totalCount; | |||
| } | |||
| public void setTotalCount(int totalCount) { | |||
| @@ -19,7 +23,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| } | |||
| public int getItemCount() { | |||
| return itemCount; | |||
| return this.itemCount; | |||
| } | |||
| public void setItemCount(int itemCount) { | |||
| @@ -27,7 +31,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| } | |||
| public List<WxMaterialFileBatchGetNewsItem> getItems() { | |||
| return items; | |||
| return this.items; | |||
| } | |||
| public void setItems(List<WxMaterialFileBatchGetNewsItem> items) { | |||
| @@ -36,7 +40,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialFileBatchGetResult [" + "totalCount=" + totalCount + ", itemCount=" + itemCount + ", items=" + items + "]"; | |||
| return "WxMpMaterialFileBatchGetResult [" + "totalCount=" + this.totalCount + ", itemCount=" + this.itemCount + ", items=" + this.items + "]"; | |||
| } | |||
| public static class WxMaterialFileBatchGetNewsItem { | |||
| @@ -46,7 +50,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| private String url; | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -54,7 +58,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| } | |||
| public Date getUpdateTime() { | |||
| return updateTime; | |||
| return this.updateTime; | |||
| } | |||
| public void setUpdateTime(Date updateTime) { | |||
| @@ -62,7 +66,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| return this.name; | |||
| } | |||
| public void setName(String name) { | |||
| @@ -70,7 +74,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -79,7 +83,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMaterialFileBatchGetNewsItem [" + "mediaId=" + mediaId + ", updateTime=" + updateTime + ", name=" + name + ", url=" + url + "]"; | |||
| return "WxMaterialFileBatchGetNewsItem [" + "mediaId=" + this.mediaId + ", updateTime=" + this.updateTime + ", name=" + this.name + ", url=" + this.url + "]"; | |||
| } | |||
| } | |||
| } | |||
| @@ -8,12 +8,16 @@ import java.util.List; | |||
| public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -1617952797921001666L; | |||
| private int totalCount; | |||
| private int itemCount; | |||
| private List<WxMaterialNewsBatchGetNewsItem> items; | |||
| public int getTotalCount() { | |||
| return totalCount; | |||
| return this.totalCount; | |||
| } | |||
| public void setTotalCount(int totalCount) { | |||
| @@ -21,7 +25,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| } | |||
| public int getItemCount() { | |||
| return itemCount; | |||
| return this.itemCount; | |||
| } | |||
| public void setItemCount(int itemCount) { | |||
| @@ -29,7 +33,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| } | |||
| public List<WxMaterialNewsBatchGetNewsItem> getItems() { | |||
| return items; | |||
| return this.items; | |||
| } | |||
| public void setItems(List<WxMaterialNewsBatchGetNewsItem> items) { | |||
| @@ -38,7 +42,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialNewsBatchGetResult [" + "totalCount=" + totalCount + ", itemCount=" + itemCount + ", items=" + items + "]"; | |||
| return "WxMpMaterialNewsBatchGetResult [" + "totalCount=" + this.totalCount + ", itemCount=" + this.itemCount + ", items=" + this.items + "]"; | |||
| } | |||
| public static class WxMaterialNewsBatchGetNewsItem { | |||
| @@ -47,7 +51,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| private WxMpMaterialNews content; | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -55,7 +59,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| } | |||
| public Date getUpdateTime() { | |||
| return updateTime; | |||
| return this.updateTime; | |||
| } | |||
| public void setUpdateTime(Date updateTime) { | |||
| @@ -63,7 +67,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| } | |||
| public WxMpMaterialNews getContent() { | |||
| return content; | |||
| return this.content; | |||
| } | |||
| public void setContent(WxMpMaterialNews content) { | |||
| @@ -72,7 +76,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMaterialNewsBatchGetNewsItem [" + "mediaId=" + mediaId + ", updateTime=" + updateTime + ", content=" + content + "]"; | |||
| return "WxMaterialNewsBatchGetNewsItem [" + "mediaId=" + this.mediaId + ", updateTime=" + this.updateTime + ", content=" + this.content + "]"; | |||
| } | |||
| } | |||
| } | |||
| @@ -6,11 +6,15 @@ import java.io.Serializable; | |||
| public class WxMpMaterialUploadResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -128818731449449537L; | |||
| private String mediaId; | |||
| private String url; | |||
| public String getMediaId() { | |||
| return mediaId; | |||
| return this.mediaId; | |||
| } | |||
| public void setMediaId(String mediaId) { | |||
| @@ -18,7 +22,7 @@ public class WxMpMaterialUploadResult implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -31,7 +35,7 @@ public class WxMpMaterialUploadResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialUploadResult [media_id=" + mediaId + ", url=" + url + "]"; | |||
| return "WxMpMaterialUploadResult [media_id=" + this.mediaId + ", url=" + this.url + "]"; | |||
| } | |||
| } | |||
| @@ -6,12 +6,16 @@ import java.io.Serializable; | |||
| public class WxMpMaterialVideoInfoResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 1269131745333792202L; | |||
| private String title; | |||
| private String description; | |||
| private String downUrl; | |||
| public String getTitle() { | |||
| return title; | |||
| return this.title; | |||
| } | |||
| public void setTitle(String title) { | |||
| @@ -19,7 +23,7 @@ public class WxMpMaterialVideoInfoResult implements Serializable { | |||
| } | |||
| public String getDescription() { | |||
| return description; | |||
| return this.description; | |||
| } | |||
| public void setDescription(String description) { | |||
| @@ -27,7 +31,7 @@ public class WxMpMaterialVideoInfoResult implements Serializable { | |||
| } | |||
| public String getDownUrl() { | |||
| return downUrl; | |||
| return this.downUrl; | |||
| } | |||
| public void setDownUrl(String downUrl) { | |||
| @@ -40,7 +44,7 @@ public class WxMpMaterialVideoInfoResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpMaterialVideoInfoResult [title=" + title + ", description=" + description + ", downUrl=" + downUrl + "]"; | |||
| return "WxMpMaterialVideoInfoResult [title=" + this.title + ", description=" + this.description + ", downUrl=" + this.downUrl + "]"; | |||
| } | |||
| } | |||
| @@ -6,6 +6,11 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
| public class WxMpOAuth2AccessToken implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -1345910558078620805L; | |||
| private String accessToken; | |||
| private int expiresIn = -1; | |||
| @@ -19,7 +24,7 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| private String unionId; | |||
| public String getRefreshToken() { | |||
| return refreshToken; | |||
| return this.refreshToken; | |||
| } | |||
| public void setRefreshToken(String refreshToken) { | |||
| @@ -27,7 +32,7 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| } | |||
| public String getOpenId() { | |||
| return openId; | |||
| return this.openId; | |||
| } | |||
| public void setOpenId(String openId) { | |||
| @@ -35,7 +40,7 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| } | |||
| public String getScope() { | |||
| return scope; | |||
| return this.scope; | |||
| } | |||
| public void setScope(String scope) { | |||
| @@ -43,7 +48,7 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| } | |||
| public String getAccessToken() { | |||
| return accessToken; | |||
| return this.accessToken; | |||
| } | |||
| public void setAccessToken(String accessToken) { | |||
| @@ -51,7 +56,7 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| } | |||
| public int getExpiresIn() { | |||
| return expiresIn; | |||
| return this.expiresIn; | |||
| } | |||
| public void setExpiresIn(int expiresIn) { | |||
| @@ -59,7 +64,7 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| } | |||
| public String getUnionId() { | |||
| return unionId; | |||
| return this.unionId; | |||
| } | |||
| public void setUnionId(String unionId) { | |||
| @@ -73,12 +78,12 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpOAuth2AccessToken{" + | |||
| "accessToken='" + accessToken + '\'' + | |||
| ", expiresTime=" + expiresIn + | |||
| ", refreshToken='" + refreshToken + '\'' + | |||
| ", openId='" + openId + '\'' + | |||
| ", scope='" + scope + '\'' + | |||
| ", unionId='" + unionId + '\'' + | |||
| "accessToken='" + this.accessToken + '\'' + | |||
| ", expiresTime=" + this.expiresIn + | |||
| ", refreshToken='" + this.refreshToken + '\'' + | |||
| ", openId='" + this.openId + '\'' + | |||
| ", scope='" + this.scope + '\'' + | |||
| ", unionId='" + this.unionId + '\'' + | |||
| '}'; | |||
| } | |||
| } | |||
| @@ -12,6 +12,10 @@ import java.io.Serializable; | |||
| * @author ukid | |||
| */ | |||
| public class WxMpPayCallback implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -4143804055690843641L; | |||
| private String return_code; | |||
| private String return_msg; | |||
| @@ -42,111 +46,111 @@ public class WxMpPayCallback implements Serializable { | |||
| private String time_end; | |||
| public String getReturn_code() { | |||
| return return_code; | |||
| return this.return_code; | |||
| } | |||
| public String getReturn_msg() { | |||
| return return_msg; | |||
| return this.return_msg; | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| return this.appid; | |||
| } | |||
| public String getMch_id() { | |||
| return mch_id; | |||
| return this.mch_id; | |||
| } | |||
| public String getDevice_info() { | |||
| return device_info; | |||
| return this.device_info; | |||
| } | |||
| public String getNonce_str() { | |||
| return nonce_str; | |||
| return this.nonce_str; | |||
| } | |||
| public String getSign() { | |||
| return sign; | |||
| return this.sign; | |||
| } | |||
| public String getResult_code() { | |||
| return result_code; | |||
| return this.result_code; | |||
| } | |||
| public String getErr_code() { | |||
| return err_code; | |||
| return this.err_code; | |||
| } | |||
| public String getErr_code_des() { | |||
| return err_code_des; | |||
| return this.err_code_des; | |||
| } | |||
| public String getOpenid() { | |||
| return openid; | |||
| return this.openid; | |||
| } | |||
| public String getIs_subscribe() { | |||
| return is_subscribe; | |||
| return this.is_subscribe; | |||
| } | |||
| public String getTrade_type() { | |||
| return trade_type; | |||
| return this.trade_type; | |||
| } | |||
| public String getBank_type() { | |||
| return bank_type; | |||
| return this.bank_type; | |||
| } | |||
| public String getTotal_fee() { | |||
| return total_fee; | |||
| return this.total_fee; | |||
| } | |||
| public String getFee_type() { | |||
| return fee_type; | |||
| return this.fee_type; | |||
| } | |||
| public String getCash_fee() { | |||
| return cash_fee; | |||
| return this.cash_fee; | |||
| } | |||
| public String getCash_fee_type() { | |||
| return cash_fee_type; | |||
| return this.cash_fee_type; | |||
| } | |||
| public String getCoupon_fee() { | |||
| return coupon_fee; | |||
| return this.coupon_fee; | |||
| } | |||
| public String getCoupon_count() { | |||
| return coupon_count; | |||
| return this.coupon_count; | |||
| } | |||
| public String getCoupon_batch_id_$n() { | |||
| return coupon_batch_id_$n; | |||
| return this.coupon_batch_id_$n; | |||
| } | |||
| public String getCoupon_id_$n() { | |||
| return coupon_id_$n; | |||
| return this.coupon_id_$n; | |||
| } | |||
| public String getCoupon_fee_$n() { | |||
| return coupon_fee_$n; | |||
| return this.coupon_fee_$n; | |||
| } | |||
| public String getTransaction_id() { | |||
| return transaction_id; | |||
| return this.transaction_id; | |||
| } | |||
| public String getOut_trade_no() { | |||
| return out_trade_no; | |||
| return this.out_trade_no; | |||
| } | |||
| public String getAttach() { | |||
| return attach; | |||
| return this.attach; | |||
| } | |||
| public String getTime_end() { | |||
| return time_end; | |||
| return this.time_end; | |||
| } | |||
| public void setReturn_code(String return_code) { | |||
| @@ -259,21 +263,21 @@ public class WxMpPayCallback implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpPayCallback [return_code=" + return_code + ", return_msg=" | |||
| + return_msg + ", appid=" + appid + ", mch_id=" + mch_id | |||
| + ", device_info=" + device_info + ", nonce_str=" + nonce_str | |||
| + ", sign=" + sign + ", result_code=" + result_code | |||
| + ", err_code=" + err_code + ", err_code_des=" + err_code_des | |||
| + ", openid=" + openid + ", is_subscribe=" + is_subscribe | |||
| + ", trade_type=" + trade_type + ", bank_type=" + bank_type | |||
| + ", total_fee=" + total_fee + ", fee_type=" + fee_type | |||
| + ", cash_fee=" + cash_fee + ", cash_fee_type=" + cash_fee_type | |||
| + ", coupon_fee=" + coupon_fee + ", coupon_count=" | |||
| + coupon_count + ", coupon_batch_id_$n=" + coupon_batch_id_$n | |||
| + ", coupon_id_$n=" + coupon_id_$n + ", coupon_fee_$n=" | |||
| + coupon_fee_$n + ", transaction_id=" + transaction_id | |||
| + ", out_trade_no=" + out_trade_no + ", attach=" + attach | |||
| + ", time_end=" + time_end + "]"; | |||
| return "WxMpPayCallback [return_code=" + this.return_code + ", return_msg=" | |||
| + this.return_msg + ", appid=" + this.appid + ", mch_id=" + this.mch_id | |||
| + ", device_info=" + this.device_info + ", nonce_str=" + this.nonce_str | |||
| + ", sign=" + this.sign + ", result_code=" + this.result_code | |||
| + ", err_code=" + this.err_code + ", err_code_des=" + this.err_code_des | |||
| + ", openid=" + this.openid + ", is_subscribe=" + this.is_subscribe | |||
| + ", trade_type=" + this.trade_type + ", bank_type=" + this.bank_type | |||
| + ", total_fee=" + this.total_fee + ", fee_type=" + this.fee_type | |||
| + ", cash_fee=" + this.cash_fee + ", cash_fee_type=" + this.cash_fee_type | |||
| + ", coupon_fee=" + this.coupon_fee + ", coupon_count=" | |||
| + this.coupon_count + ", coupon_batch_id_$n=" + this.coupon_batch_id_$n | |||
| + ", coupon_id_$n=" + this.coupon_id_$n + ", coupon_fee_$n=" | |||
| + this.coupon_fee_$n + ", transaction_id=" + this.transaction_id | |||
| + ", out_trade_no=" + this.out_trade_no + ", attach=" + this.attach | |||
| + ", time_end=" + this.time_end + "]"; | |||
| } | |||
| } | |||
| @@ -85,7 +85,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| private String couponRefundId; | |||
| public String getReturnCode() { | |||
| return returnCode; | |||
| return this.returnCode; | |||
| } | |||
| public void setReturnCode(String returnCode) { | |||
| @@ -93,7 +93,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getReturnMsg() { | |||
| return returnMsg; | |||
| return this.returnMsg; | |||
| } | |||
| public void setReturnMsg(String returnMsg) { | |||
| @@ -101,7 +101,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getResultCode() { | |||
| return resultCode; | |||
| return this.resultCode; | |||
| } | |||
| public void setResultCode(String resultCode) { | |||
| @@ -109,7 +109,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getErrCode() { | |||
| return errCode; | |||
| return this.errCode; | |||
| } | |||
| public void setErrCode(String errCode) { | |||
| @@ -117,7 +117,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getErrCodeDes() { | |||
| return errCodeDes; | |||
| return this.errCodeDes; | |||
| } | |||
| public void setErrCodeDes(String errCodeDes) { | |||
| @@ -125,7 +125,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| return this.appid; | |||
| } | |||
| public void setAppid(String appid) { | |||
| @@ -133,7 +133,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getMchId() { | |||
| return mchId; | |||
| return this.mchId; | |||
| } | |||
| public void setMchId(String mchId) { | |||
| @@ -141,7 +141,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getDeviceInfo() { | |||
| return deviceInfo; | |||
| return this.deviceInfo; | |||
| } | |||
| public void setDeviceInfo(String deviceInfo) { | |||
| @@ -149,7 +149,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getNonceStr() { | |||
| return nonceStr; | |||
| return this.nonceStr; | |||
| } | |||
| public void setNonceStr(String nonceStr) { | |||
| @@ -157,7 +157,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getSign() { | |||
| return sign; | |||
| return this.sign; | |||
| } | |||
| public void setSign(String sign) { | |||
| @@ -165,7 +165,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getTransactionId() { | |||
| return transactionId; | |||
| return this.transactionId; | |||
| } | |||
| public void setTransactionId(String transactionId) { | |||
| @@ -173,7 +173,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getOutTradeNo() { | |||
| return outTradeNo; | |||
| return this.outTradeNo; | |||
| } | |||
| public void setOutTradeNo(String outTradeNo) { | |||
| @@ -181,7 +181,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getOutRefundNo() { | |||
| return outRefundNo; | |||
| return this.outRefundNo; | |||
| } | |||
| public void setOutRefundNo(String outRefundNo) { | |||
| @@ -189,7 +189,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getRefundId() { | |||
| return refundId; | |||
| return this.refundId; | |||
| } | |||
| public void setRefundId(String refundId) { | |||
| @@ -197,7 +197,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getRefundChannel() { | |||
| return refundChannel; | |||
| return this.refundChannel; | |||
| } | |||
| public void setRefundChannel(String refundChannel) { | |||
| @@ -205,7 +205,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getRefundFee() { | |||
| return refundFee; | |||
| return this.refundFee; | |||
| } | |||
| public void setRefundFee(String refundFee) { | |||
| @@ -213,7 +213,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getTotalFee() { | |||
| return totalFee; | |||
| return this.totalFee; | |||
| } | |||
| public void setTotalFee(String totalFee) { | |||
| @@ -221,7 +221,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getFeeType() { | |||
| return feeType; | |||
| return this.feeType; | |||
| } | |||
| public void setFeeType(String feeType) { | |||
| @@ -229,7 +229,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getCashFee() { | |||
| return cashFee; | |||
| return this.cashFee; | |||
| } | |||
| public void setCashFee(String cashFee) { | |||
| @@ -237,7 +237,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getCashRefundfee() { | |||
| return cashRefundfee; | |||
| return this.cashRefundfee; | |||
| } | |||
| public void setCashRefundfee(String cashRefundfee) { | |||
| @@ -245,7 +245,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getCouponRefundFee() { | |||
| return couponRefundFee; | |||
| return this.couponRefundFee; | |||
| } | |||
| public void setCouponRefundFee(String couponRefundFee) { | |||
| @@ -253,7 +253,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getCouponRefundCount() { | |||
| return couponRefundCount; | |||
| return this.couponRefundCount; | |||
| } | |||
| public void setCouponRefundCount(String couponRefundCount) { | |||
| @@ -261,7 +261,7 @@ public class WxMpPayRefundResult implements Serializable { | |||
| } | |||
| public String getCouponRefundId() { | |||
| return couponRefundId; | |||
| return this.couponRefundId; | |||
| } | |||
| public void setCouponRefundId(String couponRefundId) { | |||
| @@ -271,8 +271,8 @@ public class WxMpPayRefundResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "[" + | |||
| "return_code:" + returnCode + ";" + | |||
| "return_msg" + returnMsg + ";"; | |||
| "return_code:" + this.returnCode + ";" + | |||
| "return_msg" + this.returnMsg + ";"; | |||
| } | |||
| } | |||
| @@ -43,91 +43,91 @@ public class WxMpPayResult implements Serializable { | |||
| private String time_end; | |||
| public String getReturn_code() { | |||
| return return_code; | |||
| return this.return_code; | |||
| } | |||
| public String getReturn_msg() { | |||
| return return_msg; | |||
| return this.return_msg; | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| return this.appid; | |||
| } | |||
| public String getMch_id() { | |||
| return mch_id; | |||
| return this.mch_id; | |||
| } | |||
| public String getNonce_str() { | |||
| return nonce_str; | |||
| return this.nonce_str; | |||
| } | |||
| public String getSign() { | |||
| return sign; | |||
| return this.sign; | |||
| } | |||
| public String getResult_code() { | |||
| return result_code; | |||
| return this.result_code; | |||
| } | |||
| public String getErr_code() { | |||
| return err_code; | |||
| return this.err_code; | |||
| } | |||
| public String getErr_code_des() { | |||
| return err_code_des; | |||
| return this.err_code_des; | |||
| } | |||
| public String getTrade_state() { | |||
| return trade_state; | |||
| return this.trade_state; | |||
| } | |||
| public String getDevice_info() { | |||
| return device_info; | |||
| return this.device_info; | |||
| } | |||
| public String getOpenid() { | |||
| return openid; | |||
| return this.openid; | |||
| } | |||
| public String getIs_subscribe() { | |||
| return is_subscribe; | |||
| return this.is_subscribe; | |||
| } | |||
| public String getTrade_type() { | |||
| return trade_type; | |||
| return this.trade_type; | |||
| } | |||
| public String getBank_type() { | |||
| return bank_type; | |||
| return this.bank_type; | |||
| } | |||
| public String getTotal_fee() { | |||
| return total_fee; | |||
| return this.total_fee; | |||
| } | |||
| public String getCoupon_fee() { | |||
| return coupon_fee; | |||
| return this.coupon_fee; | |||
| } | |||
| public String getFee_type() { | |||
| return fee_type; | |||
| return this.fee_type; | |||
| } | |||
| public String getTransaction_id() { | |||
| return transaction_id; | |||
| return this.transaction_id; | |||
| } | |||
| public String getOut_trade_no() { | |||
| return out_trade_no; | |||
| return this.out_trade_no; | |||
| } | |||
| public String getAttach() { | |||
| return attach; | |||
| return this.attach; | |||
| } | |||
| public String getTime_end() { | |||
| return time_end; | |||
| return this.time_end; | |||
| } | |||
| public void setReturn_code(String return_code) { | |||
| @@ -219,7 +219,7 @@ public class WxMpPayResult implements Serializable { | |||
| } | |||
| public String getTrade_state_desc() { | |||
| return trade_state_desc; | |||
| return this.trade_state_desc; | |||
| } | |||
| public void setTrade_state_desc(String trade_state_desc) { | |||
| @@ -229,29 +229,29 @@ public class WxMpPayResult implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpPayResult{" + | |||
| "return_code=" + return_code + | |||
| ", return_msg='" + return_msg + '\'' + | |||
| ", appid='" + appid + '\'' + | |||
| ", mch_id='" + mch_id + '\'' + | |||
| ", nonce_str='" + nonce_str + '\'' + | |||
| ", sign='" + sign + '\'' + | |||
| ", result_code='" + result_code + '\'' + | |||
| ", err_code='" + err_code + '\'' + | |||
| ", err_code_des='" + err_code_des + '\'' + | |||
| ", trade_state=" + trade_state + | |||
| ", trade_state_desc=" + trade_state_desc + | |||
| ", device_info='" + device_info + '\'' + | |||
| ", openid='" + openid + '\'' + | |||
| ", is_subscribe='" + is_subscribe + '\'' + | |||
| ", trade_type='" + trade_type + '\'' + | |||
| ", bank_type='" + bank_type + '\'' + | |||
| ", total_fee='" + total_fee + '\'' + | |||
| ", coupon_fee='" + coupon_fee + '\'' + | |||
| ", fee_type='" + fee_type + '\'' + | |||
| ", transaction_id='" + transaction_id + '\'' + | |||
| ", out_trade_no='" + out_trade_no + '\'' + | |||
| ", attach='" + attach + '\'' + | |||
| ", time_end='" + time_end + '\'' + | |||
| "return_code=" + this.return_code + | |||
| ", return_msg='" + this.return_msg + '\'' + | |||
| ", appid='" + this.appid + '\'' + | |||
| ", mch_id='" + this.mch_id + '\'' + | |||
| ", nonce_str='" + this.nonce_str + '\'' + | |||
| ", sign='" + this.sign + '\'' + | |||
| ", result_code='" + this.result_code + '\'' + | |||
| ", err_code='" + this.err_code + '\'' + | |||
| ", err_code_des='" + this.err_code_des + '\'' + | |||
| ", trade_state=" + this.trade_state + | |||
| ", trade_state_desc=" + this.trade_state_desc + | |||
| ", device_info='" + this.device_info + '\'' + | |||
| ", openid='" + this.openid + '\'' + | |||
| ", is_subscribe='" + this.is_subscribe + '\'' + | |||
| ", trade_type='" + this.trade_type + '\'' + | |||
| ", bank_type='" + this.bank_type + '\'' + | |||
| ", total_fee='" + this.total_fee + '\'' + | |||
| ", coupon_fee='" + this.coupon_fee + '\'' + | |||
| ", fee_type='" + this.fee_type + '\'' + | |||
| ", transaction_id='" + this.transaction_id + '\'' + | |||
| ", out_trade_no='" + this.out_trade_no + '\'' + | |||
| ", attach='" + this.attach + '\'' + | |||
| ", time_end='" + this.time_end + '\'' + | |||
| '}'; | |||
| } | |||
| } | |||
| @@ -13,6 +13,10 @@ import java.io.Serializable; | |||
| * @author chanjarster | |||
| */ | |||
| public class WxMpPrepayIdResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = -8970574397788396143L; | |||
| private String return_code; | |||
| private String return_msg; | |||
| private String appid; | |||
| @@ -27,7 +31,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| private String code_url; | |||
| public String getReturn_code() { | |||
| return return_code; | |||
| return this.return_code; | |||
| } | |||
| public void setReturn_code(String return_code) { | |||
| @@ -35,7 +39,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getReturn_msg() { | |||
| return return_msg; | |||
| return this.return_msg; | |||
| } | |||
| public void setReturn_msg(String return_msg) { | |||
| @@ -43,7 +47,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getAppid() { | |||
| return appid; | |||
| return this.appid; | |||
| } | |||
| public void setAppid(String appid) { | |||
| @@ -51,7 +55,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getMch_id() { | |||
| return mch_id; | |||
| return this.mch_id; | |||
| } | |||
| public void setMch_id(String mch_id) { | |||
| @@ -59,7 +63,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getNonce_str() { | |||
| return nonce_str; | |||
| return this.nonce_str; | |||
| } | |||
| public void setNonce_str(String nonce_str) { | |||
| @@ -67,7 +71,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getSign() { | |||
| return sign; | |||
| return this.sign; | |||
| } | |||
| public void setSign(String sign) { | |||
| @@ -75,7 +79,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getResult_code() { | |||
| return result_code; | |||
| return this.result_code; | |||
| } | |||
| public void setResult_code(String result_code) { | |||
| @@ -83,7 +87,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getPrepay_id() { | |||
| return prepay_id; | |||
| return this.prepay_id; | |||
| } | |||
| public void setPrepay_id(String prepay_id) { | |||
| @@ -91,7 +95,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getTrade_type() { | |||
| return trade_type; | |||
| return this.trade_type; | |||
| } | |||
| public void setTrade_type(String trade_type) { | |||
| @@ -99,7 +103,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getErr_code() { | |||
| return err_code; | |||
| return this.err_code; | |||
| } | |||
| public void setErr_code(String err_code) { | |||
| @@ -107,7 +111,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getErr_code_des() { | |||
| return err_code_des; | |||
| return this.err_code_des; | |||
| } | |||
| public void setErr_code_des(String err_code_des) { | |||
| @@ -115,7 +119,7 @@ public class WxMpPrepayIdResult implements Serializable { | |||
| } | |||
| public String getCode_url() { | |||
| return code_url; | |||
| return this.code_url; | |||
| } | |||
| public void setCode_url(String code_url) { | |||
| @@ -11,12 +11,16 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpQrCodeTicket implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 5777119669111011584L; | |||
| protected String ticket; | |||
| protected int expire_seconds = -1; | |||
| protected String url; | |||
| public String getTicket() { | |||
| return ticket; | |||
| return this.ticket; | |||
| } | |||
| public void setTicket(String ticket) { | |||
| @@ -27,7 +31,7 @@ public class WxMpQrCodeTicket implements Serializable { | |||
| * 如果返回-1说明是永久 | |||
| */ | |||
| public int getExpire_seconds() { | |||
| return expire_seconds; | |||
| return this.expire_seconds; | |||
| } | |||
| public void setExpire_seconds(int expire_seconds) { | |||
| @@ -35,7 +39,7 @@ public class WxMpQrCodeTicket implements Serializable { | |||
| } | |||
| public String getUrl() { | |||
| return url; | |||
| return this.url; | |||
| } | |||
| public void setUrl(String url) { | |||
| @@ -13,6 +13,10 @@ import java.io.Serializable; | |||
| */ | |||
| public class WxMpSemanticQueryResult implements Serializable { | |||
| /** | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 4811088544804441365L; | |||
| private String query; | |||
| private String type; | |||
| private String semantic; | |||
| @@ -21,7 +25,7 @@ public class WxMpSemanticQueryResult implements Serializable { | |||
| private String text; | |||
| public String getQuery() { | |||
| return query; | |||
| return this.query; | |||
| } | |||
| public void setQuery(String query) { | |||
| @@ -29,7 +33,7 @@ public class WxMpSemanticQueryResult implements Serializable { | |||
| } | |||
| public String getType() { | |||
| return type; | |||
| return this.type; | |||
| } | |||
| public void setType(String type) { | |||
| @@ -37,7 +41,7 @@ public class WxMpSemanticQueryResult implements Serializable { | |||
| } | |||
| public String getSemantic() { | |||
| return semantic; | |||
| return this.semantic; | |||
| } | |||
| public void setSemantic(String semantic) { | |||
| @@ -45,7 +49,7 @@ public class WxMpSemanticQueryResult implements Serializable { | |||
| } | |||
| public String getResult() { | |||
| return result; | |||
| return this.result; | |||
| } | |||
| public void setResult(String result) { | |||
| @@ -53,7 +57,7 @@ public class WxMpSemanticQueryResult implements Serializable { | |||
| } | |||
| public String getAnswer() { | |||
| return answer; | |||
| return this.answer; | |||
| } | |||
| public void setAnswer(String answer) { | |||
| @@ -61,7 +65,7 @@ public class WxMpSemanticQueryResult implements Serializable { | |||
| } | |||
| public String getText() { | |||
| return text; | |||
| return this.text; | |||
| } | |||
| public void setText(String text) { | |||
| @@ -37,70 +37,70 @@ public class WxMpUser implements Serializable { | |||
| protected Integer groupId; | |||
| public Boolean getSubscribe() { | |||
| return subscribe; | |||
| return this.subscribe; | |||
| } | |||
| public Boolean isSubscribe() { | |||
| return subscribe; | |||
| return this.subscribe; | |||
| } | |||
| public void setSubscribe(Boolean subscribe) { | |||
| this.subscribe = subscribe; | |||
| } | |||
| public String getOpenId() { | |||
| return openId; | |||
| return this.openId; | |||
| } | |||
| public void setOpenId(String openId) { | |||
| this.openId = openId; | |||
| } | |||
| public String getNickname() { | |||
| return nickname; | |||
| return this.nickname; | |||
| } | |||
| public void setNickname(String nickname) { | |||
| this.nickname = nickname; | |||
| } | |||
| public String getSex() { | |||
| return sex; | |||
| return this.sex; | |||
| } | |||
| public void setSex(String sex) { | |||
| this.sex = sex; | |||
| } | |||
| public String getLanguage() { | |||
| return language; | |||
| return this.language; | |||
| } | |||
| public void setLanguage(String language) { | |||
| this.language = language; | |||
| } | |||
| public String getCity() { | |||
| return city; | |||
| return this.city; | |||
| } | |||
| public void setCity(String city) { | |||
| this.city = city; | |||
| } | |||
| public String getProvince() { | |||
| return province; | |||
| return this.province; | |||
| } | |||
| public void setProvince(String province) { | |||
| this.province = province; | |||
| } | |||
| public String getCountry() { | |||
| return country; | |||
| return this.country; | |||
| } | |||
| public void setCountry(String country) { | |||
| this.country = country; | |||
| } | |||
| public String getHeadImgUrl() { | |||
| return headImgUrl; | |||
| return this.headImgUrl; | |||
| } | |||
| public void setHeadImgUrl(String headImgUrl) { | |||
| this.headImgUrl = headImgUrl; | |||
| } | |||
| public Long getSubscribeTime() { | |||
| return subscribeTime; | |||
| return this.subscribeTime; | |||
| } | |||
| public void setSubscribeTime(Long subscribeTime) { | |||
| this.subscribeTime = subscribeTime; | |||
| } | |||
| public String getUnionId() { | |||
| return unionId; | |||
| return this.unionId; | |||
| } | |||
| public void setUnionId(String unionId) { | |||
| this.unionId = unionId; | |||
| @@ -108,7 +108,7 @@ public class WxMpUser implements Serializable { | |||
| public Integer getSexId() { | |||
| return sexId; | |||
| return this.sexId; | |||
| } | |||
| public void setSexId(Integer sexId) { | |||
| @@ -116,13 +116,13 @@ public class WxMpUser implements Serializable { | |||
| } | |||
| public String getRemark() { | |||
| return remark; | |||
| return this.remark; | |||
| } | |||
| public void setRemark(String remark) { | |||
| this.remark = remark; | |||
| } | |||
| public Integer getGroupId() { | |||
| return groupId; | |||
| return this.groupId; | |||
| } | |||
| public void setGroupId(Integer groupId) { | |||
| this.groupId = groupId; | |||
| @@ -142,19 +142,19 @@ public class WxMpUser implements Serializable { | |||
| @Override | |||
| public String toString() { | |||
| return "WxMpUser{" + | |||
| "subscribe=" + subscribe + | |||
| ", openId='" + openId + '\'' + | |||
| ", nickname='" + nickname + '\'' + | |||
| ", sex='" + sex + '\'' + | |||
| ", language='" + language + '\'' + | |||
| ", city='" + city + '\'' + | |||
| ", province='" + province + '\'' + | |||
| ", country='" + country + '\'' + | |||
| ", headImgUrl='" + headImgUrl + '\'' + | |||
| ", subscribeTime=" + subscribeTime + | |||
| ", unionId='" + unionId + '\'' + | |||
| ", remark='" + remark + '\'' + | |||
| ", groupId='" + groupId + '\'' + | |||
| "subscribe=" + this.subscribe + | |||
| ", openId='" + this.openId + '\'' + | |||
| ", nickname='" + this.nickname + '\'' + | |||
| ", sex='" + this.sex + '\'' + | |||
| ", language='" + this.language + '\'' + | |||
| ", city='" + this.city + '\'' + | |||
| ", province='" + this.province + '\'' + | |||
| ", country='" + this.country + '\'' + | |||
| ", headImgUrl='" + this.headImgUrl + '\'' + | |||
| ", subscribeTime=" + this.subscribeTime + | |||
| ", unionId='" + this.unionId + '\'' + | |||
| ", remark='" + this.remark + '\'' + | |||
| ", groupId='" + this.groupId + '\'' + | |||
| '}'; | |||
| } | |||
| } | |||
| @@ -14,28 +14,28 @@ public class WxMpUserList { | |||
| protected int total = -1; | |||
| protected int count = -1; | |||
| protected List<String> openIds = new ArrayList<String>(); | |||
| protected List<String> openIds = new ArrayList<>(); | |||
| protected String nextOpenId; | |||
| public int getTotal() { | |||
| return total; | |||
| return this.total; | |||
| } | |||
| public void setTotal(int total) { | |||
| this.total = total; | |||
| } | |||
| public int getCount() { | |||
| return count; | |||
| return this.count; | |||
| } | |||
| public void setCount(int count) { | |||
| this.count = count; | |||
| } | |||
| public List<String> getOpenIds() { | |||
| return openIds; | |||
| return this.openIds; | |||
| } | |||
| public void setOpenIds(List<String> openIds) { | |||
| this.openIds = openIds; | |||
| } | |||
| public String getNextOpenId() { | |||
| return nextOpenId; | |||
| return this.nextOpenId; | |||
| } | |||
| public void setNextOpenId(String nextOpenId) { | |||
| this.nextOpenId = nextOpenId; | |||
| @@ -47,72 +47,72 @@ public class WxRedpackResult implements Serializable { | |||
| String sendListid; | |||
| public String getErrCode() { | |||
| return errCode; | |||
| return this.errCode; | |||
| } | |||
| public String getErrCodeDes() { | |||
| return errCodeDes; | |||
| return this.errCodeDes; | |||
| } | |||
| public String getReturnCode() { | |||
| return returnCode; | |||
| return this.returnCode; | |||
| } | |||
| public String getReturnMsg() { | |||
| return returnMsg; | |||
| return this.returnMsg; | |||
| } | |||
| public String getSign() { | |||
| return sign; | |||
| return this.sign; | |||
| } | |||
| public String getResultCode() { | |||
| return resultCode; | |||
| return this.resultCode; | |||
| } | |||
| public String getMchBillno() { | |||
| return mchBillno; | |||
| return this.mchBillno; | |||
| } | |||
| public String getMchId() { | |||
| return mchId; | |||
| return this.mchId; | |||
| } | |||
| public String getWxappid() { | |||
| return wxappid; | |||
| return this.wxappid; | |||
| } | |||
| public String getReOpenid() { | |||
| return reOpenid; | |||
| return this.reOpenid; | |||
| } | |||
| public int getTotalAmount() { | |||
| return totalAmount; | |||
| return this.totalAmount; | |||
| } | |||
| public String getSendTime() { | |||
| return sendTime; | |||
| return this.sendTime; | |||
| } | |||
| public String getSendListid() { | |||
| return sendListid; | |||
| return this.sendListid; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return "WxRedpackResult{" + | |||
| "returnCode=" + returnCode + | |||
| ", returnMsg=" + returnMsg + | |||
| ", sign=" + sign + | |||
| ", errCode=" + errCode + | |||
| ", errCodeDes=" + errCodeDes + | |||
| ", mchBillno=" + mchBillno + | |||
| ", mchId=" + mchId + | |||
| ", wxappid=" + wxappid + | |||
| ", reOpenid=" + reOpenid + | |||
| ", totalAmount=" + totalAmount + | |||
| ", sendTime=" + sendTime + | |||
| ", sendListid=" + sendListid + | |||
| "returnCode=" + this.returnCode + | |||
| ", returnMsg=" + this.returnMsg + | |||
| ", sign=" + this.sign + | |||
| ", errCode=" + this.errCode + | |||
| ", errCodeDes=" + this.errCodeDes + | |||
| ", mchBillno=" + this.mchBillno + | |||
| ", mchId=" + this.mchId + | |||
| ", wxappid=" + this.wxappid + | |||
| ", reOpenid=" + this.reOpenid + | |||
| ", totalAmount=" + this.totalAmount + | |||
| ", sendTime=" + this.sendTime + | |||
| ", sendListid=" + this.sendListid + | |||
| '}'; | |||
| } | |||
| } | |||
| @@ -6,7 +6,6 @@ import me.chanjar.weixin.common.util.http.RequestExecutor; | |||
| import me.chanjar.weixin.common.util.http.Utf8ResponseHandler; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| @@ -24,6 +23,7 @@ public class MaterialDeleteRequestExecutor implements RequestExecutor<Boolean, S | |||
| super(); | |||
| } | |||
| @Override | |||
| public Boolean execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException { | |||
| HttpPost httpPost = new HttpPost(uri); | |||
| if (httpProxy != null) { | |||
| @@ -8,7 +8,6 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import me.chanjar.weixin.mp.bean.WxMpMaterialNews; | |||
| import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| @@ -25,6 +24,7 @@ public class MaterialNewsInfoRequestExecutor implements RequestExecutor<WxMpMate | |||
| super(); | |||
| } | |||
| @Override | |||
| public WxMpMaterialNews execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException { | |||
| HttpPost httpPost = new HttpPost(uri); | |||
| if (httpProxy != null) { | |||
| @@ -8,7 +8,6 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import me.chanjar.weixin.mp.bean.WxMpMaterial; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpMaterialUploadResult; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| @@ -7,7 +7,6 @@ import me.chanjar.weixin.common.util.http.Utf8ResponseHandler; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpMaterialVideoInfoResult; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| @@ -24,6 +23,7 @@ public class MaterialVideoInfoRequestExecutor implements RequestExecutor<WxMpMat | |||
| super(); | |||
| } | |||
| @Override | |||
| public WxMpMaterialVideoInfoResult execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException { | |||
| HttpPost httpPost = new HttpPost(uri); | |||
| if (httpProxy != null) { | |||
| @@ -1,25 +1,25 @@ | |||
| package me.chanjar.weixin.mp.util.http; | |||
| import me.chanjar.weixin.common.bean.result.WxError; | |||
| import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.InputStreamResponseHandler; | |||
| import me.chanjar.weixin.common.util.http.RequestExecutor; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| import org.apache.http.entity.StringEntity; | |||
| import org.apache.http.impl.client.CloseableHttpClient; | |||
| import java.io.ByteArrayInputStream; | |||
| import java.io.File; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import me.chanjar.weixin.common.bean.result.WxError; | |||
| import me.chanjar.weixin.common.exception.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.InputStreamResponseHandler; | |||
| import me.chanjar.weixin.common.util.http.RequestExecutor; | |||
| import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
| public class MaterialVoiceAndImageDownloadRequestExecutor implements RequestExecutor<InputStream, String> { | |||
| @@ -34,6 +34,7 @@ public class MaterialVoiceAndImageDownloadRequestExecutor implements RequestExec | |||
| this.tmpDirFile = tmpDirFile; | |||
| } | |||
| @Override | |||
| public InputStream execute(CloseableHttpClient httpclient, HttpHost httpProxy, String uri, String materialId) throws WxErrorException, IOException { | |||
| HttpPost httpPost = new HttpPost(uri); | |||
| if (httpProxy != null) { | |||
| @@ -44,9 +45,9 @@ public class MaterialVoiceAndImageDownloadRequestExecutor implements RequestExec | |||
| Map<String, String> params = new HashMap<>(); | |||
| params.put("media_id", materialId); | |||
| httpPost.setEntity(new StringEntity(WxGsonBuilder.create().toJson(params))); | |||
| try(CloseableHttpResponse response = httpclient.execute(httpPost)){ | |||
| try (CloseableHttpResponse response = httpclient.execute(httpPost); | |||
| InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response);){ | |||
| // 下载媒体文件出错 | |||
| InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response); | |||
| byte[] responseContent = IOUtils.toByteArray(inputStream); | |||
| String responseContentString = new String(responseContent, "UTF-8"); | |||
| if (responseContentString.length() < 100) { | |||
| @@ -7,7 +7,6 @@ import me.chanjar.weixin.common.util.http.Utf8ResponseHandler; | |||
| import me.chanjar.weixin.mp.bean.result.WxMediaImgUploadResult; | |||
| import org.apache.http.HttpEntity; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| @@ -9,7 +9,6 @@ import me.chanjar.weixin.common.util.http.Utf8ResponseHandler; | |||
| import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; | |||
| import org.apache.http.Header; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.ClientProtocolException; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpGet; | |||
| @@ -47,7 +46,8 @@ public class QrCodeRequestExecutor implements RequestExecutor<File, WxMpQrCodeTi | |||
| httpGet.setConfig(config); | |||
| } | |||
| try (CloseableHttpResponse response = httpclient.execute(httpGet)) { | |||
| try (CloseableHttpResponse response = httpclient.execute(httpGet); | |||
| InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response);) { | |||
| Header[] contentTypeHeader = response.getHeaders("Content-Type"); | |||
| if (contentTypeHeader != null && contentTypeHeader.length > 0) { | |||
| // 出错 | |||
| @@ -56,8 +56,6 @@ public class QrCodeRequestExecutor implements RequestExecutor<File, WxMpQrCodeTi | |||
| throw new WxErrorException(WxError.fromJson(responseContent)); | |||
| } | |||
| } | |||
| InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response); | |||
| return FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), "jpg"); | |||
| } finally { | |||
| httpGet.releaseConnection(); | |||