Skip to content

Commit

Permalink
Merge pull request #1 from wechat-group/develop
Browse files Browse the repository at this point in the history
同步Develop
  • Loading branch information
aimilin6688 authored Sep 1, 2016
2 parents 4047f6d + 6f297ae commit 5bbf578
Show file tree
Hide file tree
Showing 145 changed files with 1,076 additions and 820 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -32,25 +32,25 @@
<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'
```

* 企业号:
```xml
<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上,地址为 :
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion weixin-java-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
///////////////////////
// 微信端推送过来的事件类型
///////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();

/**
* 后台清理线程是否已经开启
Expand Down Expand Up @@ -56,19 +56,19 @@ public WxMessageInMemoryDuplicateChecker(Long timeToLive, Long clearPeriod) {
}

protected void checkBackgroundProcessStarted() {
if (backgroundProcessStarted.getAndSet(true)) {
if (this.backgroundProcessStarted.getAndSet(true)) {
return;
}
Thread t = new Thread(new Runnable() {
@Override
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);
}
}
}
Expand All @@ -87,7 +87,7 @@ public boolean isDuplicate(String messageId) {
return false;
}
checkBackgroundProcessStarted();
Long timestamp = msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
Long timestamp = this.msgId2Timestamp.putIfAbsent(messageId, System.currentTimeMillis());
return timestamp != null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public static WxAccessToken fromJson(String json) {
}

public String getAccessToken() {
return accessToken;
return this.accessToken;
}

public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}

public int getExpiresIn() {
return expiresIn;
return this.expiresIn;
}

public void setExpiresIn(int expiresIn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,71 +39,71 @@ public String toString() {
}

public String getAppId() {
return appId;
return this.appId;
}

public void setAppId(String appId) {
this.appId = appId;
}

public String getCardId() {
return cardId;
return this.cardId;
}

public void setCardId(String cardId) {
this.cardId = cardId;
}

public String getCardType() {
return cardType;
return this.cardType;
}

public void setCardType(String cardType) {
this.cardType = cardType;
}

public String getLocationId() {
return locationId;
return this.locationId;
}

public void setLocationId(String locationId) {
this.locationId = locationId;
}

public String getCode() {
return code;
return this.code;
}

public void setCode(String code) {
this.code = code;
}

public String getOpenId() {
return openId;
return this.openId;
}

public void setOpenId(String openId) {
this.openId = openId;
}

public Long getTimestamp() {
return timestamp;
return this.timestamp;
}

public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}

public String getNonceStr() {
return nonceStr;
return this.nonceStr;
}

public void setNonceStr(String nonceStr) {
this.nonceStr = nonceStr;
}

public String getSignature() {
return signature;
return this.signature;
}

public void setSignature(String signature) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,39 @@ public class WxJsapiSignature implements Serializable {
private String signature;

public String getSignature() {
return signature;
return this.signature;
}

public void setSignature(String signature) {
this.signature = signature;
}

public String getNoncestr() {
return noncestr;
return this.noncestr;
}

public void setNoncestr(String noncestr) {
this.noncestr = noncestr;
}

public long getTimestamp() {
return timestamp;
return this.timestamp;
}

public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}

public String getUrl() {
return url;
return this.url;
}

public void setUrl(String url) {
this.url = url;
}

public String getAppid() {
return appid;
return this.appid;
}

public void setAppid(String appid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -40,15 +40,15 @@ public static WxMenu fromJson(InputStream is) {
}

public List<WxMenuButton> getButtons() {
return buttons;
return this.buttons;
}

public void setButtons(List<WxMenuButton> buttons) {
this.buttons = buttons;
}

public WxMenuRule getMatchRule() {
return matchRule;
return this.matchRule;
}

public void setMatchRule(WxMenuRule matchRule) {
Expand All @@ -62,7 +62,7 @@ public String toJson() {
@Override
public String toString() {
return "WxMenu{" +
"buttons=" + buttons +
"buttons=" + this.buttons +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -23,47 +23,47 @@ public String toString() {
}

public String getType() {
return type;
return this.type;
}

public void setType(String type) {
this.type = type;
}

public String getName() {
return name;
return this.name;
}

public void setName(String name) {
this.name = name;
}

public String getKey() {
return key;
return this.key;
}

public void setKey(String key) {
this.key = key;
}

public String getUrl() {
return url;
return this.url;
}

public void setUrl(String url) {
this.url = url;
}

public List<WxMenuButton> getSubButtons() {
return subButtons;
return this.subButtons;
}

public void setSubButtons(List<WxMenuButton> subButtons) {
this.subButtons = subButtons;
}

public String getMediaId() {
return mediaId;
return this.mediaId;
}

public void setMediaId(String mediaId) {
Expand Down
Loading

0 comments on commit 5bbf578

Please sign in to comment.