diff --git a/pom.xml b/pom.xml index 7df2c1832f..d1b8da28a5 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,7 @@ huangxiaoming - huangxiaoming@163.com + huangxm129@163.com https://github.com/huangxm129 diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java index e1806d0977..12d7944627 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java @@ -255,7 +255,7 @@ public interface WxCpExternalContactService { * @param tagId * @return */ - WxCpUserExternalTagGroup getCorpTagList(String [] tagId) throws WxErrorException; + WxCpUserExternalTagGroupList getCorpTagList(String [] tagId) throws WxErrorException; /** @@ -266,7 +266,7 @@ public interface WxCpExternalContactService { * @param tagGroup * @return */ - WxCpUserExternalTagGroup addCorpTag(WxCpUserExternalTagGroup tagGroup)throws WxErrorException; + WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup)throws WxErrorException; /** *
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java
index 01477c8547..f9058f0179 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java
@@ -225,22 +225,22 @@ public WxCpMsgTemplateAddResult addMsgTemplate(WxCpMsgTemplate wxCpMsgTemplate)
   }
 
   @Override
-  public WxCpUserExternalTagGroup getCorpTagList(String[] tagId) throws WxErrorException {
+  public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErrorException {
     JsonObject json = new JsonObject();
     if(ArrayUtils.isNotEmpty(tagId)){
       json.add("tag_id",new Gson().toJsonTree(tagId).getAsJsonArray());
     }
     final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_TAG_LIST);
     final String result = this.mainService.post(url,json.toString());
-    return WxCpUserExternalTagGroup.fromJson(result);
+    return WxCpUserExternalTagGroupList.fromJson(result);
   }
 
   @Override
-  public WxCpUserExternalTagGroup addCorpTag(WxCpUserExternalTagGroup tagGroup) throws WxErrorException{
+  public WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup) throws WxErrorException{
 
     final String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_CORP_TAG);
     final String result = this.mainService.post(url,tagGroup.toJson());
-    return WxCpUserExternalTagGroup.fromJson(result);
+    return WxCpUserExternalTagGroupInfo.fromJson(result);
   }
 
   @Override
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalContactInfo.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalContactInfo.java
index d099e4eeb6..6e290ce063 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalContactInfo.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalContactInfo.java
@@ -119,6 +119,12 @@ public static class FollowedUser {
     @SerializedName("remark_mobiles")
     private String[] remarkMobiles;
     private Tag[] tags;
+    @SerializedName("remark_corp_name")
+    private String remarkCorpName;
+    @SerializedName("add_way")
+    private String addWay;
+    @SerializedName("oper_userid")
+    private String operUserId;
 
   }
 
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroup.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupInfo.java
similarity index 88%
rename from weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroup.java
rename to weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupInfo.java
index 1dff12057b..16d20d7eca 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroup.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupInfo.java
@@ -13,7 +13,7 @@
  */
 @Getter
 @Setter
-public class WxCpUserExternalTagGroup extends WxCpBaseResp {
+public class WxCpUserExternalTagGroupInfo extends WxCpBaseResp {
 
   @SerializedName("group_id")
   private String groupId;
@@ -63,7 +63,7 @@ public String toJson() {
     return WxGsonBuilder.create().toJson(this);
   }
 
-  public static WxCpUserExternalTagGroup fromJson(String json) {
-    return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroup.class);
+  public static WxCpUserExternalTagGroupInfo fromJson(String json) {
+    return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroupInfo.class);
   }
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupList.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupList.java
new file mode 100644
index 0000000000..f77433cb4b
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupList.java
@@ -0,0 +1,75 @@
+package me.chanjar.weixin.cp.bean;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+import java.util.List;
+
+/**
+ *
+ */
+@Getter
+@Setter
+public class WxCpUserExternalTagGroupList extends WxCpBaseResp {
+
+  @SerializedName("tag_group")
+  private List tagGroupList;
+
+  @Getter
+  @Setter
+  public static class TagGroup{
+    @SerializedName("group_id")
+    private String groupId;
+
+    @SerializedName("group_name")
+    private String groupName;
+
+    @SerializedName("create_time")
+    private Long createTime;
+
+    @SerializedName("order")
+    private Integer order;
+
+    @SerializedName("deleted")
+    private Boolean deleted;
+
+
+    @SerializedName("tag")
+    private List tag;
+
+    @Getter
+    @Setter
+    public static class Tag {
+
+      /**
+       * 客户群ID
+       */
+      @SerializedName("id")
+      private String id;
+
+      @SerializedName("name")
+      private String name;
+
+      @SerializedName("create_time")
+      private Long  createTime;
+
+      @SerializedName("order")
+      private Integer  order;
+
+      @SerializedName("deleted")
+      private Boolean  deleted;
+
+    }
+  }
+
+  public String toJson() {
+    return WxGsonBuilder.create().toJson(this);
+  }
+
+  public static WxCpUserExternalTagGroupList fromJson(String json) {
+    return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroupList.class);
+  }
+}
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java
index f23108315e..2c63496f3f 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java
@@ -5,10 +5,7 @@
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.cp.api.ApiTestModule;
 import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.WxCpBaseResp;
-import me.chanjar.weixin.cp.bean.WxCpContactWayInfo;
-import me.chanjar.weixin.cp.bean.WxCpUserExternalContactInfo;
-import me.chanjar.weixin.cp.bean.WxCpUserExternalTagGroup;
+import me.chanjar.weixin.cp.bean.*;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
@@ -110,7 +107,7 @@ public void testGetContactDetail() throws WxErrorException {
   @Test
   public void testGetCorpTagList() throws WxErrorException {
     String tag[]={};
-    WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().getCorpTagList(null);
+    WxCpUserExternalTagGroupList result = this.wxCpService.getExternalContactService().getCorpTagList(null);
     System.out.println(result);
     assertNotNull(result);
   }
@@ -118,19 +115,18 @@ public void testGetCorpTagList() throws WxErrorException {
   @Test
   public void testAddCorpTag() throws WxErrorException {
 
-    List list = new ArrayList<>();
-
-    WxCpUserExternalTagGroup.Tag  tag = new  WxCpUserExternalTagGroup.Tag();
-    tag.setName("测试标签1");
+    List list = new ArrayList<>();
+    WxCpUserExternalTagGroupInfo.Tag  tag = new  WxCpUserExternalTagGroupInfo.Tag();
+    tag.setName("测试标签2");
     tag.setOrder(1);
     list.add(tag);
 
-    WxCpUserExternalTagGroup tagGroup = new WxCpUserExternalTagGroup();
+    WxCpUserExternalTagGroupInfo tagGroup = new WxCpUserExternalTagGroupInfo();
     tagGroup.setGroupName("其他");
     tagGroup.setOrder(1);
     tagGroup.setTag(list);
 
-    WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
+    WxCpUserExternalTagGroupInfo result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
 
 
 
@@ -141,7 +137,7 @@ public void testAddCorpTag() throws WxErrorException {
   @Test
   public void testEditCorpTag() throws WxErrorException {
 
-    WxCpBaseResp result = this.wxCpService.getExternalContactService().editCorpTag("et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ", "未知", 2);
+    WxCpBaseResp result = this.wxCpService.getExternalContactService().editCorpTag("et2omCCwAA6PtGsfeEOQMENl3Ub1FA6A", "未知6", 2);
 
     System.out.println(result);
     assertNotNull(result);
@@ -150,7 +146,7 @@ public void testEditCorpTag() throws WxErrorException {
   @Test
   public void testDelCorpTag() throws WxErrorException {
 
-    String tagId[] = {"et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ"};
+    String tagId[] = {"et2omCCwAA6PtGsfeEOQMENl3Ub1FA6A"};
     String groupId[] = {};
 
     WxCpBaseResp result = this.wxCpService.getExternalContactService().delCorpTag(tagId,groupId);