Skip to content

Commit 471b4a7

Browse files
committed
清理企业号api
1 parent 258f35a commit 471b4a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+108
-854
lines changed

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/util/xml/AdapterCDATA.java renamed to weixin-java-enterprise/src/main/java/me/chanjar/weixin/common/AdapterCDATA.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.chanjar.weixin.enterprise.util.xml;
1+
package me.chanjar.weixin.common;
22

33
import javax.xml.bind.annotation.adapters.XmlAdapter;
44

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/util/fs/FileUtils.java renamed to weixin-java-enterprise/src/main/java/me/chanjar/weixin/common/FileUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.chanjar.weixin.enterprise.util.fs;
1+
package me.chanjar.weixin.common;
22

33
import java.io.File;
44
import java.io.FileOutputStream;

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/util/json/GsonHelper.java renamed to weixin-java-enterprise/src/main/java/me/chanjar/weixin/common/GsonHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* arose from modification of the original source, or other redistribution of this source
77
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
88
*/
9-
package me.chanjar.weixin.enterprise.util.json;
9+
package me.chanjar.weixin.common;
1010

1111

1212
import com.google.gson.JsonElement;

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/util/xml/MediaIdMarshaller.java renamed to weixin-java-enterprise/src/main/java/me/chanjar/weixin/common/MediaIdMarshaller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.chanjar.weixin.enterprise.util.xml;
1+
package me.chanjar.weixin.common;
22

33
import javax.xml.bind.annotation.adapters.XmlAdapter;
44

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/util/xml/XmlTransformer.java renamed to weixin-java-enterprise/src/main/java/me/chanjar/weixin/common/XmlTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.chanjar.weixin.enterprise.util.xml;
1+
package me.chanjar.weixin.common;
22

33
import java.io.IOException;
44
import java.io.InputStream;

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/api/WxConsts.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class WxConsts {
1717
public static final String XML_MSG_LOCATION = "location";
1818
public static final String XML_MSG_LINK = "link";
1919
public static final String XML_MSG_EVENT = "event";
20-
20+
2121
///////////////////////
2222
// 客服消息的消息类型
2323
///////////////////////

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/api/WxCpService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.List;
77

88
import me.chanjar.weixin.enterprise.bean.*;
9-
import me.chanjar.weixin.enterprise.bean.WxCpDepartment;
9+
import me.chanjar.weixin.enterprise.bean.WxCpDepart;
1010
import me.chanjar.weixin.enterprise.bean.result.WxMediaUploadResult;
1111
import me.chanjar.weixin.enterprise.bean.result.WxUser;
1212
import me.chanjar.weixin.enterprise.exception.WxErrorException;
@@ -131,7 +131,7 @@ public interface WxCpService {
131131
* @param name 分组名字(30个字符以内)
132132
* @throws WxErrorException
133133
*/
134-
public WxCpDepartment departmentCreate(String name) throws WxErrorException;
134+
public WxCpDepart departmentCreate(String name) throws WxErrorException;
135135

136136
/**
137137
* <pre>
@@ -141,7 +141,7 @@ public interface WxCpService {
141141
* @return
142142
* @throws WxErrorException
143143
*/
144-
public List<WxCpDepartment> departmentGet() throws WxErrorException;
144+
public List<WxCpDepart> departmentGet() throws WxErrorException;
145145

146146
/**
147147
* <pre>
@@ -153,7 +153,7 @@ public interface WxCpService {
153153
* @param group 要更新的group,group的id,name必须设置
154154
* @throws WxErrorException
155155
*/
156-
public void departmentUpdate(WxCpDepartment group) throws WxErrorException;
156+
public void departmentUpdate(WxCpDepart group) throws WxErrorException;
157157

158158
/**
159159
* <pre>
@@ -163,7 +163,7 @@ public interface WxCpService {
163163
* @param department
164164
* @throws WxErrorException
165165
*/
166-
public void departmentDelete(WxCpDepartment department) throws WxErrorException;
166+
public void departmentDelete(WxCpDepart department) throws WxErrorException;
167167

168168
public void userCreate(WxUser user) throws WxErrorException;
169169

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/api/WxCpServiceImpl.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import me.chanjar.weixin.enterprise.bean.*;
1212
import me.chanjar.weixin.enterprise.util.http.SimpleGetRequestExecutor;
1313
import me.chanjar.weixin.enterprise.util.crypto.SHA1;
14+
import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder;
1415
import org.apache.commons.lang3.StringUtils;
1516
import org.apache.http.client.ClientProtocolException;
1617
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -19,17 +20,16 @@
1920
import org.apache.http.impl.client.CloseableHttpClient;
2021
import org.apache.http.impl.client.HttpClients;
2122

22-
import me.chanjar.weixin.enterprise.bean.WxCpDepartment;
23+
import me.chanjar.weixin.enterprise.bean.WxCpDepart;
2324
import me.chanjar.weixin.enterprise.bean.result.WxError;
2425
import me.chanjar.weixin.enterprise.bean.result.WxMediaUploadResult;
2526
import me.chanjar.weixin.enterprise.bean.result.WxUser;
2627
import me.chanjar.weixin.enterprise.exception.WxErrorException;
27-
import me.chanjar.weixin.enterprise.util.fs.FileUtils;
28+
import me.chanjar.weixin.common.FileUtils;
2829
import me.chanjar.weixin.enterprise.util.http.MediaDownloadRequestExecutor;
2930
import me.chanjar.weixin.enterprise.util.http.MediaUploadRequestExecutor;
3031
import me.chanjar.weixin.enterprise.util.http.RequestExecutor;
3132
import me.chanjar.weixin.enterprise.util.http.SimplePostRequestExecutor;
32-
import me.chanjar.weixin.enterprise.util.json.WxGsonBuilder;
3333

3434
import com.google.gson.JsonElement;
3535
import com.google.gson.JsonObject;
@@ -142,7 +142,7 @@ public File mediaDownload(String media_id) throws WxErrorException {
142142
}
143143

144144

145-
public WxCpDepartment departmentCreate(String name) throws WxErrorException {
145+
public WxCpDepart departmentCreate(String name) throws WxErrorException {
146146
// TODO
147147
String url = "https://api.weixin.qq.com/cgi-bin/groups/create";
148148
JsonObject json = new JsonObject();
@@ -154,16 +154,16 @@ public WxCpDepartment departmentCreate(String name) throws WxErrorException {
154154
new SimplePostRequestExecutor(),
155155
url,
156156
json.toString());
157-
return WxCpDepartment.fromJson(responseContent);
157+
return WxCpDepart.fromJson(responseContent);
158158
}
159159

160-
public void departmentUpdate(WxCpDepartment group) throws WxErrorException {
160+
public void departmentUpdate(WxCpDepart group) throws WxErrorException {
161161
// TODO
162162
String url = "https://api.weixin.qq.com/cgi-bin/groups/update";
163163
execute(new SimplePostRequestExecutor(), url, group.toJson());
164164
}
165165

166-
public List<WxCpDepartment> departmentGet() throws WxErrorException {
166+
public List<WxCpDepart> departmentGet() throws WxErrorException {
167167
// TODO
168168
String url = "https://api.weixin.qq.com/cgi-bin/groups/get";
169169
String responseContent = execute(new SimpleGetRequestExecutor(), url, null);
@@ -172,12 +172,12 @@ public List<WxCpDepartment> departmentGet() throws WxErrorException {
172172
* 查询时返回的是 { groups : [ { id : ..., name : ..., count : ... }, ... ] }
173173
*/
174174
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
175-
return WxGsonBuilder.INSTANCE.create()
176-
.fromJson(tmpJsonElement.getAsJsonObject().get("groups"), new TypeToken<List<WxCpDepartment>>() {
175+
return WxCpGsonBuilder.INSTANCE.create()
176+
.fromJson(tmpJsonElement.getAsJsonObject().get("groups"), new TypeToken<List<WxCpDepart>>() {
177177
}.getType());
178178
}
179179

180-
public void departmentDelete(WxCpDepartment department) throws WxErrorException {
180+
public void departmentDelete(WxCpDepart department) throws WxErrorException {
181181
// TODO
182182

183183
}

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/bean/WxAccessToken.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package me.chanjar.weixin.enterprise.bean;
22

3-
import me.chanjar.weixin.enterprise.util.json.WxGsonBuilder;
3+
import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder;
44

55
public class WxAccessToken {
66

@@ -25,7 +25,7 @@ public void setExpiresIn(int expiresIn) {
2525
}
2626

2727
public static WxAccessToken fromJson(String json) {
28-
return WxGsonBuilder.create().fromJson(json, WxAccessToken.class);
28+
return WxCpGsonBuilder.create().fromJson(json, WxAccessToken.class);
2929
}
3030

3131
}

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/bean/WxCpDepartment.java renamed to weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/bean/WxCpDepart.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package me.chanjar.weixin.enterprise.bean;
22

3-
import me.chanjar.weixin.enterprise.util.json.WxGsonBuilder;
3+
import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder;
44

55
/**
66
* 微信用户分组
77
* @author Daniel Qian
88
*
99
*/
10-
public class WxCpDepartment {
10+
public class WxCpDepart {
1111

1212
private long id = -1;
1313
private String name;
@@ -31,12 +31,12 @@ public void setCount(long count) {
3131
this.count = count;
3232
}
3333

34-
public static WxCpDepartment fromJson(String json) {
35-
return WxGsonBuilder.create().fromJson(json, WxCpDepartment.class);
34+
public static WxCpDepart fromJson(String json) {
35+
return WxCpGsonBuilder.create().fromJson(json, WxCpDepart.class);
3636
}
3737

3838
public String toJson() {
39-
return WxGsonBuilder.create().toJson(this);
39+
return WxCpGsonBuilder.create().toJson(this);
4040
}
4141
@Override
4242
public String toString() {

0 commit comments

Comments
 (0)