diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java index 70d59046..ac07ea6b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java @@ -399,7 +399,7 @@ public interface WxCpService { * @param tagId * @param userIds */ - void tagAddUsers(String tagId, List userIds) throws WxErrorException; + void tagAddUsers(String tagId, List userIds, List partyIds) throws WxErrorException; /** *
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java
index c04d7533..0ef29b55 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java
@@ -271,7 +271,8 @@ public class WxCpServiceImpl implements WxCpService {
     return WxCpGsonBuilder.INSTANCE.create()
         .fromJson(
             tmpJsonElement.getAsJsonObject().get("department"),
-            new TypeToken>() { }.getType()
+            new TypeToken>() {
+            }.getType()
         );
   }
 
@@ -389,7 +390,8 @@ public class WxCpServiceImpl implements WxCpService {
     return WxCpGsonBuilder.INSTANCE.create()
         .fromJson(
             tmpJsonElement.getAsJsonObject().get("taglist"),
-            new TypeToken>() { }.getType()
+            new TypeToken>() {
+            }.getType()
         );
   }
 
@@ -406,15 +408,24 @@ public class WxCpServiceImpl implements WxCpService {
   }
 
   @Override
-  public void tagAddUsers(String tagId, List userIds) throws WxErrorException {
+  public void tagAddUsers(String tagId, List userIds, List partyIds) throws WxErrorException {
     String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers";
     JsonObject jsonObject = new JsonObject();
     jsonObject.addProperty("tagid", tagId);
-    JsonArray jsonArray = new JsonArray();
-    for (String userId : userIds) {
-      jsonArray.add(new JsonPrimitive(userId));
+    if (userIds != null) {
+      JsonArray jsonArray = new JsonArray();
+      for (String userId : userIds) {
+        jsonArray.add(new JsonPrimitive(userId));
+      }
+      jsonObject.add("userlist", jsonArray);
+    }
+    if (partyIds != null) {
+      JsonArray jsonArray = new JsonArray();
+      for (String userId : partyIds) {
+        jsonArray.add(new JsonPrimitive(userId));
+      }
+      jsonObject.add("partylist", jsonArray);
     }
-    jsonObject.add("userlist", jsonArray);
     post(url, jsonObject.toString());
   }