Skip to content

Commit 008c1c7

Browse files
authored
Merge branch 'binarywang:develop' into develop
2 parents d7ecfe3 + 84c69d4 commit 008c1c7

File tree

22 files changed

+1029
-648
lines changed

22 files changed

+1029
-648
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
</a>
5454
</td>
5555
<td align="center">
56-
<a href="#" target="_blank">
57-
<img height="120" src="images/banners/aliyun.jpg" alt="ad">
56+
<a href="https://www.crmeb.com/xiazai" target="_blank">
57+
<img height="120" src="https://crmebjavamer.oss-cn-beijing.aliyuncs.com/crmebimage/gitee/WechatIMG202.jpg" alt="ad">
5858
</a>
5959
</td>
6060
</tr>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ public static class EventType {
302302
public static final String VIEW = "VIEW";
303303
public static final String MASS_SEND_JOB_FINISH = "MASSSENDJOBFINISH";
304304

305+
public static final String SYS_APPROVAL_CHANGE = "sys_approval_change";
305306
/**
306307
* 扫码推事件的事件推送
307308
*/

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveService.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ public interface WxCpOaWeDriveService {
4848
* 请求方式:POST(HTTPS)
4949
* 请求地址: <a href="https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_dismiss?access_token=ACCESS_TOKEN">...</a>
5050
*
51-
* @param userId the user id
5251
* @param spaceId the space id
5352
* @return wx cp base resp
5453
* @throws WxErrorException the wx error exception
5554
*/
56-
WxCpBaseResp spaceDismiss(@NonNull String userId, @NonNull String spaceId) throws WxErrorException;
55+
WxCpBaseResp spaceDismiss(@NonNull String spaceId) throws WxErrorException;
5756

5857
/**
5958
* 获取空间信息
@@ -62,12 +61,11 @@ public interface WxCpOaWeDriveService {
6261
* 请求方式:POST(HTTPS)
6362
* 请求地址: <a href="https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_info?access_token=ACCESS_TOKEN">...</a>
6463
*
65-
* @param userId the user id
6664
* @param spaceId the space id
6765
* @return wx cp space info
6866
* @throws WxErrorException the wx error exception
6967
*/
70-
WxCpSpaceInfo spaceInfo(@NonNull String userId, @NonNull String spaceId) throws WxErrorException;
68+
WxCpSpaceInfo spaceInfo(@NonNull String spaceId) throws WxErrorException;
7169

7270
/**
7371
* 添加成员/部门
@@ -115,12 +113,11 @@ public interface WxCpOaWeDriveService {
115113
* 请求方式:POST(HTTPS)
116114
* 请求地址: <a href="https://qyapi.weixin.qq.com/cgi-bin/wedrive/space_share?access_token=ACCESS_TOKEN">...</a>
117115
*
118-
* @param userId the user id
119116
* @param spaceId the space id
120117
* @return wx cp space share
121118
* @throws WxErrorException the wx error exception
122119
*/
123-
WxCpSpaceShare spaceShare(@NonNull String userId, @NonNull String spaceId) throws WxErrorException;
120+
WxCpSpaceShare spaceShare(@NonNull String spaceId) throws WxErrorException;
124121

125122
/**
126123
* 获取文件列表
@@ -155,18 +152,18 @@ public interface WxCpOaWeDriveService {
155152
* 请求方式:POST(HTTPS)
156153
* 请求地址: <a href="https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_download?access_token=ACCESS_TOKEN">...</a>
157154
*
158-
* @param fileId 文件fileid(只支持下载普通文件,不支持下载文件夹或微文档)
155+
* @param fileId 文件fileid(只支持下载普通文件,不支持下载文件夹或微文档)
159156
* @param selectedTicket 微盘和文件选择器jsapi返回的selectedTicket。若填此参数,则不需要填fileid。
160157
* @return {
161-
* "errcode": 0,
162-
* "errmsg": "ok",
163-
* "download_url": "DOWNLOAD_URL",
164-
* "cookie_name": "COOKIE_NAME",
165-
* "cookie_value": "COOKIE_VALUE"
158+
* "errcode": 0,
159+
* "errmsg": "ok",
160+
* "download_url": "DOWNLOAD_URL",
161+
* "cookie_name": "COOKIE_NAME",
162+
* "cookie_value": "COOKIE_VALUE"
166163
* }
167164
* @throws WxErrorException the wx error exception
168165
*/
169-
WxCpFileDownload fileDownload( String fileId, String selectedTicket) throws WxErrorException;
166+
WxCpFileDownload fileDownload(String fileId, String selectedTicket) throws WxErrorException;
170167

171168
/**
172169
* 重命名文件
@@ -271,14 +268,13 @@ WxCpFileCreate fileCreate(@NonNull String spaceId, @NonNull String fatherId, @No
271268
* 请求方式:POST(HTTPS)
272269
* 请求地址: <a href="https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_setting?access_token=ACCESS_TOKEN">...</a>
273270
*
274-
* @param userId the user id
275271
* @param fileId the file id
276272
* @param authScope the auth scope
277273
* @param auth the auth
278274
* @return wx cp base resp
279275
* @throws WxErrorException the wx error exception
280276
*/
281-
WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException;
277+
WxCpBaseResp fileSetting(@NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException;
282278

283279
/**
284280
* 获取分享链接
@@ -287,11 +283,10 @@ WxCpFileCreate fileCreate(@NonNull String spaceId, @NonNull String fatherId, @No
287283
* 请求方式:POST(HTTPS)
288284
* 请求地址: <a href="https://qyapi.weixin.qq.com/cgi-bin/wedrive/file_share?access_token=ACCESS_TOKEN">...</a>
289285
*
290-
* @param userId the user id
291286
* @param fileId the file id
292287
* @return wx cp file share
293288
* @throws WxErrorException the wx error exception
294289
*/
295-
WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException;
290+
WxCpFileShare fileShare(@NonNull String fileId) throws WxErrorException;
296291

297292
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaWeDriveServiceImpl.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,18 @@ public WxCpBaseResp spaceRename(@NonNull WxCpSpaceRenameRequest request) throws
3939
}
4040

4141
@Override
42-
public WxCpBaseResp spaceDismiss(@NonNull String userId, @NonNull String spaceId) throws WxErrorException {
42+
public WxCpBaseResp spaceDismiss(@NonNull String spaceId) throws WxErrorException {
4343
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_DISMISS);
4444
JsonObject jsonObject = new JsonObject();
45-
jsonObject.addProperty("userid", userId);
4645
jsonObject.addProperty("spaceid", spaceId);
4746
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
4847
return WxCpBaseResp.fromJson(responseContent);
4948
}
5049

5150
@Override
52-
public WxCpSpaceInfo spaceInfo(@NonNull String userId, @NonNull String spaceId) throws WxErrorException {
51+
public WxCpSpaceInfo spaceInfo(@NonNull String spaceId) throws WxErrorException {
5352
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_INFO);
5453
JsonObject jsonObject = new JsonObject();
55-
jsonObject.addProperty("userid", userId);
5654
jsonObject.addProperty("spaceid", spaceId);
5755
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
5856
return WxCpSpaceInfo.fromJson(responseContent);
@@ -80,10 +78,9 @@ public WxCpBaseResp spaceSetting(@NonNull WxCpSpaceSettingRequest request) throw
8078
}
8179

8280
@Override
83-
public WxCpSpaceShare spaceShare(@NonNull String userId, @NonNull String spaceId) throws WxErrorException {
81+
public WxCpSpaceShare spaceShare(@NonNull String spaceId) throws WxErrorException {
8482
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(SPACE_SHARE);
8583
JsonObject jsonObject = new JsonObject();
86-
jsonObject.addProperty("userid", userId);
8784
jsonObject.addProperty("spaceid", spaceId);
8885
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
8986
return WxCpSpaceShare.fromJson(responseContent);
@@ -166,11 +163,9 @@ public WxCpBaseResp fileAclDel(@NonNull WxCpFileAclDelRequest request) throws Wx
166163
}
167164

168165
@Override
169-
public WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId, @NonNull Integer authScope,
170-
Integer auth) throws WxErrorException {
166+
public WxCpBaseResp fileSetting(@NonNull String fileId, @NonNull Integer authScope, Integer auth) throws WxErrorException {
171167
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_SETTING);
172168
JsonObject jsonObject = new JsonObject();
173-
jsonObject.addProperty("userid", userId);
174169
jsonObject.addProperty("fileid", fileId);
175170
jsonObject.addProperty("auth_scope", authScope);
176171
if (auth != null) {
@@ -181,10 +176,9 @@ public WxCpBaseResp fileSetting(@NonNull String userId, @NonNull String fileId,
181176
}
182177

183178
@Override
184-
public WxCpFileShare fileShare(@NonNull String userId, @NonNull String fileId) throws WxErrorException {
179+
public WxCpFileShare fileShare(@NonNull String fileId) throws WxErrorException {
185180
String apiUrl = this.cpService.getWxCpConfigStorage().getApiUrl(FILE_SHARE);
186181
JsonObject jsonObject = new JsonObject();
187-
jsonObject.addProperty("userid", userId);
188182
jsonObject.addProperty("fileid", fileId);
189183
String responseContent = this.cpService.post(apiUrl, jsonObject.toString());
190184
return WxCpFileShare.fromJson(responseContent);

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/util/json/WxCpUserGsonAdapter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,12 @@ private void buildExtraAttrs(JsonObject o, WxCpUser user) {
127127

128128
switch (type) {
129129
case 0: {
130-
attr.setTextValue(GsonHelper.getString(attrJsonElement.getAsJsonObject().get("text").getAsJsonObject(),
131-
"value"));
130+
JsonElement textJsonElement = attrJsonElement.getAsJsonObject().get("text");
131+
if (textJsonElement != null && !textJsonElement.isJsonNull() && textJsonElement.isJsonObject()) {
132+
attr.setTextValue(GsonHelper.getString(textJsonElement.getAsJsonObject(), "value"));
133+
} else {
134+
attr.setTextValue(null); // Clear or set a default value to avoid stale data
135+
}
132136
break;
133137
}
134138
case 1: {

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpOaWeDriveServiceTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public void test() throws Exception {
5959
/*
6060
* 获取分享链接
6161
*/
62-
WxCpFileShare fileShare = cpService.getOaWeDriveService().fileShare(uId, fileId2);
62+
WxCpFileShare fileShare = cpService.getOaWeDriveService().fileShare(fileId2);
6363
log.info("获取分享链接返回结果为:{}", fileShare.toJson());
6464

6565
/*
6666
* 分享设置
6767
*/
68-
WxCpBaseResp fileSetting = cpService.getOaWeDriveService().fileSetting(uId, fileId2, 2, 1);
68+
WxCpBaseResp fileSetting = cpService.getOaWeDriveService().fileSetting(fileId2, 2, 1);
6969
log.info("分享设置返回结果为:{}", fileSetting.toJson());
7070

7171
/*
@@ -200,13 +200,13 @@ public void test() throws Exception {
200200
/*
201201
* 获取邀请链接
202202
*/
203-
WxCpSpaceShare spaceShare = cpService.getOaWeDriveService().spaceShare(uId, spId);
203+
WxCpSpaceShare spaceShare = cpService.getOaWeDriveService().spaceShare(spId);
204204
log.info("获取邀请链接信息为:{}", spaceShare.toJson());
205205

206206
/*
207207
* 获取空间信息
208208
*/
209-
WxCpSpaceInfo data = cpService.getOaWeDriveService().spaceInfo(uId, spId);
209+
WxCpSpaceInfo data = cpService.getOaWeDriveService().spaceInfo(spId);
210210
log.info("获取空间信息为:{}", data.toJson());
211211

212212
/*
@@ -252,7 +252,7 @@ public void test() throws Exception {
252252
/*
253253
* 获取空间信息
254254
*/
255-
WxCpSpaceInfo spaceInfo = cpService.getOaWeDriveService().spaceInfo("WangKai", "s.ww45d3e188865aca30.652091685u4h");
255+
WxCpSpaceInfo spaceInfo = cpService.getOaWeDriveService().spaceInfo("s.ww45d3e188865aca30.652091685u4h");
256256
log.info("获取空间信息,spaceInfo信息为:{}", spaceInfo.toJson());
257257

258258
/*
@@ -279,7 +279,7 @@ public void test() throws Exception {
279279
/*
280280
* 解散空间
281281
*/
282-
WxCpBaseResp thisResp = cpService.getOaWeDriveService().spaceDismiss("WangKai", spaceCreateData.getSpaceId());
282+
WxCpBaseResp thisResp = cpService.getOaWeDriveService().spaceDismiss(spaceCreateData.getSpaceId());
283283
log.info("解散成功:{}", thisResp.toJson());
284284

285285
}

0 commit comments

Comments
 (0)