@@ -271,7 +271,8 @@ public List<WxCpDepart> departGet() throws WxErrorException {
271
271
return WxCpGsonBuilder .INSTANCE .create ()
272
272
.fromJson (
273
273
tmpJsonElement .getAsJsonObject ().get ("department" ),
274
- new TypeToken <List <WxCpDepart >>() { }.getType ()
274
+ new TypeToken <List <WxCpDepart >>() {
275
+ }.getType ()
275
276
);
276
277
}
277
278
@@ -389,7 +390,8 @@ public List<WxCpTag> tagGet() throws WxErrorException {
389
390
return WxCpGsonBuilder .INSTANCE .create ()
390
391
.fromJson (
391
392
tmpJsonElement .getAsJsonObject ().get ("taglist" ),
392
- new TypeToken <List <WxCpTag >>() { }.getType ()
393
+ new TypeToken <List <WxCpTag >>() {
394
+ }.getType ()
393
395
);
394
396
}
395
397
@@ -406,15 +408,24 @@ public List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException {
406
408
}
407
409
408
410
@ Override
409
- public void tagAddUsers (String tagId , List <String > userIds ) throws WxErrorException {
411
+ public void tagAddUsers (String tagId , List <String > userIds , List < String > partyIds ) throws WxErrorException {
410
412
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers" ;
411
413
JsonObject jsonObject = new JsonObject ();
412
414
jsonObject .addProperty ("tagid" , tagId );
413
- JsonArray jsonArray = new JsonArray ();
414
- for (String userId : userIds ) {
415
- jsonArray .add (new JsonPrimitive (userId ));
415
+ if (userIds != null ) {
416
+ JsonArray jsonArray = new JsonArray ();
417
+ for (String userId : userIds ) {
418
+ jsonArray .add (new JsonPrimitive (userId ));
419
+ }
420
+ jsonObject .add ("userlist" , jsonArray );
421
+ }
422
+ if (partyIds != null ) {
423
+ JsonArray jsonArray = new JsonArray ();
424
+ for (String userId : partyIds ) {
425
+ jsonArray .add (new JsonPrimitive (userId ));
426
+ }
427
+ jsonObject .add ("partylist" , jsonArray );
416
428
}
417
- jsonObject .add ("userlist" , jsonArray );
418
429
post (url , jsonObject .toString ());
419
430
}
420
431
0 commit comments