Skip to content

Commit a776e9c

Browse files
authored
🎨 #1690 企业微信外部联系人客户详情接口增加几个字段
* 外部联系人客户详情新增增加字段 增加字段:remark_corp_name,addWay,oper_userid Signed-off-by: huangxiaoming <[email protected]> * 修改测试类 Signed-off-by: huangxiaoming <[email protected]> * 客户标签组查询列表功能修改 Signed-off-by: huangxiaoming <[email protected]> * 修改测试类 Signed-off-by: huangxiaoming <[email protected]> * 修改 add_way字段错误 Signed-off-by: huangxiaoming <[email protected]>
1 parent 2755bc9 commit a776e9c

File tree

7 files changed

+100
-23
lines changed

7 files changed

+100
-23
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</developer>
9393
<developer>
9494
<name>huangxiaoming</name>
95-
<email>huangxiaoming@163.com</email>
95+
<email>huangxm129@163.com</email>
9696
<url>https://github.com/huangxm129</url>
9797
</developer>
9898
</developers>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public interface WxCpExternalContactService {
255255
* @param tagId
256256
* @return
257257
*/
258-
WxCpUserExternalTagGroup getCorpTagList(String [] tagId) throws WxErrorException;
258+
WxCpUserExternalTagGroupList getCorpTagList(String [] tagId) throws WxErrorException;
259259

260260

261261
/**
@@ -266,7 +266,7 @@ public interface WxCpExternalContactService {
266266
* @param tagGroup
267267
* @return
268268
*/
269-
WxCpUserExternalTagGroup addCorpTag(WxCpUserExternalTagGroup tagGroup)throws WxErrorException;
269+
WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup)throws WxErrorException;
270270

271271
/**
272272
* <pre>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,22 +225,22 @@ public WxCpMsgTemplateAddResult addMsgTemplate(WxCpMsgTemplate wxCpMsgTemplate)
225225
}
226226

227227
@Override
228-
public WxCpUserExternalTagGroup getCorpTagList(String[] tagId) throws WxErrorException {
228+
public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErrorException {
229229
JsonObject json = new JsonObject();
230230
if(ArrayUtils.isNotEmpty(tagId)){
231231
json.add("tag_id",new Gson().toJsonTree(tagId).getAsJsonArray());
232232
}
233233
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_TAG_LIST);
234234
final String result = this.mainService.post(url,json.toString());
235-
return WxCpUserExternalTagGroup.fromJson(result);
235+
return WxCpUserExternalTagGroupList.fromJson(result);
236236
}
237237

238238
@Override
239-
public WxCpUserExternalTagGroup addCorpTag(WxCpUserExternalTagGroup tagGroup) throws WxErrorException{
239+
public WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup) throws WxErrorException{
240240

241241
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_CORP_TAG);
242242
final String result = this.mainService.post(url,tagGroup.toJson());
243-
return WxCpUserExternalTagGroup.fromJson(result);
243+
return WxCpUserExternalTagGroupInfo.fromJson(result);
244244
}
245245

246246
@Override

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalContactInfo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ public static class FollowedUser {
119119
@SerializedName("remark_mobiles")
120120
private String[] remarkMobiles;
121121
private Tag[] tags;
122+
@SerializedName("remark_corp_name")
123+
private String remarkCorpName;
124+
@SerializedName("add_way")
125+
private String addWay;
126+
@SerializedName("oper_userid")
127+
private String operUserId;
122128

123129
}
124130

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroup.java renamed to weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUserExternalTagGroupInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
@Getter
1515
@Setter
16-
public class WxCpUserExternalTagGroup extends WxCpBaseResp {
16+
public class WxCpUserExternalTagGroupInfo extends WxCpBaseResp {
1717

1818
@SerializedName("group_id")
1919
private String groupId;
@@ -63,7 +63,7 @@ public String toJson() {
6363
return WxGsonBuilder.create().toJson(this);
6464
}
6565

66-
public static WxCpUserExternalTagGroup fromJson(String json) {
67-
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroup.class);
66+
public static WxCpUserExternalTagGroupInfo fromJson(String json) {
67+
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroupInfo.class);
6868
}
6969
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package me.chanjar.weixin.cp.bean;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Getter;
5+
import lombok.Setter;
6+
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
7+
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
8+
9+
import java.util.List;
10+
11+
/**
12+
*
13+
*/
14+
@Getter
15+
@Setter
16+
public class WxCpUserExternalTagGroupList extends WxCpBaseResp {
17+
18+
@SerializedName("tag_group")
19+
private List<WxCpUserExternalTagGroupList.TagGroup> tagGroupList;
20+
21+
@Getter
22+
@Setter
23+
public static class TagGroup{
24+
@SerializedName("group_id")
25+
private String groupId;
26+
27+
@SerializedName("group_name")
28+
private String groupName;
29+
30+
@SerializedName("create_time")
31+
private Long createTime;
32+
33+
@SerializedName("order")
34+
private Integer order;
35+
36+
@SerializedName("deleted")
37+
private Boolean deleted;
38+
39+
40+
@SerializedName("tag")
41+
private List<Tag> tag;
42+
43+
@Getter
44+
@Setter
45+
public static class Tag {
46+
47+
/**
48+
* 客户群ID
49+
*/
50+
@SerializedName("id")
51+
private String id;
52+
53+
@SerializedName("name")
54+
private String name;
55+
56+
@SerializedName("create_time")
57+
private Long createTime;
58+
59+
@SerializedName("order")
60+
private Integer order;
61+
62+
@SerializedName("deleted")
63+
private Boolean deleted;
64+
65+
}
66+
}
67+
68+
public String toJson() {
69+
return WxGsonBuilder.create().toJson(this);
70+
}
71+
72+
public static WxCpUserExternalTagGroupList fromJson(String json) {
73+
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroupList.class);
74+
}
75+
}

weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
import me.chanjar.weixin.common.error.WxErrorException;
66
import me.chanjar.weixin.cp.api.ApiTestModule;
77
import me.chanjar.weixin.cp.api.WxCpService;
8-
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
9-
import me.chanjar.weixin.cp.bean.WxCpContactWayInfo;
10-
import me.chanjar.weixin.cp.bean.WxCpUserExternalContactInfo;
11-
import me.chanjar.weixin.cp.bean.WxCpUserExternalTagGroup;
8+
import me.chanjar.weixin.cp.bean.*;
129
import org.apache.commons.lang3.time.DateFormatUtils;
1310
import org.testng.annotations.Guice;
1411
import org.testng.annotations.Test;
@@ -110,27 +107,26 @@ public void testGetContactDetail() throws WxErrorException {
110107
@Test
111108
public void testGetCorpTagList() throws WxErrorException {
112109
String tag[]={};
113-
WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().getCorpTagList(null);
110+
WxCpUserExternalTagGroupList result = this.wxCpService.getExternalContactService().getCorpTagList(null);
114111
System.out.println(result);
115112
assertNotNull(result);
116113
}
117114

118115
@Test
119116
public void testAddCorpTag() throws WxErrorException {
120117

121-
List<WxCpUserExternalTagGroup.Tag> list = new ArrayList<>();
122-
123-
WxCpUserExternalTagGroup.Tag tag = new WxCpUserExternalTagGroup.Tag();
124-
tag.setName("测试标签1");
118+
List<WxCpUserExternalTagGroupInfo.Tag> list = new ArrayList<>();
119+
WxCpUserExternalTagGroupInfo.Tag tag = new WxCpUserExternalTagGroupInfo.Tag();
120+
tag.setName("测试标签2");
125121
tag.setOrder(1);
126122
list.add(tag);
127123

128-
WxCpUserExternalTagGroup tagGroup = new WxCpUserExternalTagGroup();
124+
WxCpUserExternalTagGroupInfo tagGroup = new WxCpUserExternalTagGroupInfo();
129125
tagGroup.setGroupName("其他");
130126
tagGroup.setOrder(1);
131127
tagGroup.setTag(list);
132128

133-
WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
129+
WxCpUserExternalTagGroupInfo result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
134130

135131

136132

@@ -141,7 +137,7 @@ public void testAddCorpTag() throws WxErrorException {
141137
@Test
142138
public void testEditCorpTag() throws WxErrorException {
143139

144-
WxCpBaseResp result = this.wxCpService.getExternalContactService().editCorpTag("et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ", "未知", 2);
140+
WxCpBaseResp result = this.wxCpService.getExternalContactService().editCorpTag("et2omCCwAA6PtGsfeEOQMENl3Ub1FA6A", "未知6", 2);
145141

146142
System.out.println(result);
147143
assertNotNull(result);
@@ -150,7 +146,7 @@ public void testEditCorpTag() throws WxErrorException {
150146
@Test
151147
public void testDelCorpTag() throws WxErrorException {
152148

153-
String tagId[] = {"et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ"};
149+
String tagId[] = {"et2omCCwAA6PtGsfeEOQMENl3Ub1FA6A"};
154150
String groupId[] = {};
155151

156152
WxCpBaseResp result = this.wxCpService.getExternalContactService().delCorpTag(tagId,groupId);

0 commit comments

Comments
 (0)