@@ -271,7 +271,8 @@ public List<WxCpDepart> departGet() throws WxErrorException {
271271 return WxCpGsonBuilder .INSTANCE .create ()
272272 .fromJson (
273273 tmpJsonElement .getAsJsonObject ().get ("department" ),
274- new TypeToken <List <WxCpDepart >>() { }.getType ()
274+ new TypeToken <List <WxCpDepart >>() {
275+ }.getType ()
275276 );
276277 }
277278
@@ -389,7 +390,8 @@ public List<WxCpTag> tagGet() throws WxErrorException {
389390 return WxCpGsonBuilder .INSTANCE .create ()
390391 .fromJson (
391392 tmpJsonElement .getAsJsonObject ().get ("taglist" ),
392- new TypeToken <List <WxCpTag >>() { }.getType ()
393+ new TypeToken <List <WxCpTag >>() {
394+ }.getType ()
393395 );
394396 }
395397
@@ -406,15 +408,24 @@ public List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException {
406408 }
407409
408410 @ 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 {
410412 String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers" ;
411413 JsonObject jsonObject = new JsonObject ();
412414 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 );
416428 }
417- jsonObject .add ("userlist" , jsonArray );
418429 post (url , jsonObject .toString ());
419430 }
420431
0 commit comments