Skip to content

Commit a9f9e30

Browse files
authored
🐛 #1699 企业微信模块修复添加企业客户标签接口
* 外部联系人客户详情新增增加字段 增加字段:remark_corp_name,addWay,oper_userid Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改测试类 Signed-off-by: huangxiaoming <huangxm129@163.com> * 客户标签组查询列表功能修改 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改测试类 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改 add_way字段错误 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改添加企业客户标签后无返回信息 Signed-off-by: huangxiaoming <huangxm129@163.com> * 外部联系人客户详情新增增加字段 增加字段:remark_corp_name,addWay,oper_userid Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改测试类 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改测试类 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改 add_way字段错误 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改添加企业客户标签后无返回信息 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改错误 Signed-off-by: huangxiaoming <huangxm129@163.com> * 修改冲突 Signed-off-by: huangxiaoming <huangxm129@163.com>
1 parent a776e9c commit a9f9e30

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErro
239239
public WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup) throws WxErrorException{
240240

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

@@ -262,7 +262,7 @@ public WxCpBaseResp delCorpTag(String[] tagId, String[] groupId) throws WxErrorE
262262
json.add("tag_id",new Gson().toJsonTree(tagId).getAsJsonArray());
263263
}
264264
if(ArrayUtils.isNotEmpty(groupId)){
265-
json.add("group_id",new Gson().toJsonTree(tagId).getAsJsonArray());
265+
json.add("group_id",new Gson().toJsonTree(groupId).getAsJsonArray());
266266
}
267267

268268
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(DEL_CORP_TAG);

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

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,35 @@
1515
@Setter
1616
public class WxCpUserExternalTagGroupInfo extends WxCpBaseResp {
1717

18-
@SerializedName("group_id")
19-
private String groupId;
18+
@SerializedName("tag_group")
19+
private TagGroup tagGroup;
2020

21-
@SerializedName("group_name")
22-
private String groupName;
21+
@Getter
22+
@Setter
23+
public static class TagGroup {
24+
25+
@SerializedName("group_id")
26+
private String groupId;
27+
28+
@SerializedName("group_name")
29+
private String groupName;
2330

24-
@SerializedName("create_time")
25-
private Long createTime;
31+
@SerializedName("create_time")
32+
private Long createTime;
2633

27-
@SerializedName("order")
28-
private Integer order;
34+
@SerializedName("order")
35+
private Integer order;
2936

30-
@SerializedName("deleted")
31-
private Boolean deleted;
37+
@SerializedName("deleted")
38+
private Boolean deleted;
3239

40+
@SerializedName("tag")
41+
private List<Tag> tag;
3342

34-
@SerializedName("tag")
35-
private List<Tag> tag;
43+
public String toJson() {
44+
return WxGsonBuilder.create().toJson(this);
45+
}
46+
}
3647

3748
@Getter
3849
@Setter

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,20 @@ public void testAddCorpTag() throws WxErrorException {
117117

118118
List<WxCpUserExternalTagGroupInfo.Tag> list = new ArrayList<>();
119119
WxCpUserExternalTagGroupInfo.Tag tag = new WxCpUserExternalTagGroupInfo.Tag();
120-
tag.setName("测试标签2");
120+
tag.setName("测试标签20");
121121
tag.setOrder(1);
122122
list.add(tag);
123123

124-
WxCpUserExternalTagGroupInfo tagGroup = new WxCpUserExternalTagGroupInfo();
124+
WxCpUserExternalTagGroupInfo tagGroupInfo = new WxCpUserExternalTagGroupInfo();
125+
WxCpUserExternalTagGroupInfo.TagGroup tagGroup = new WxCpUserExternalTagGroupInfo.TagGroup();
125126
tagGroup.setGroupName("其他");
126127
tagGroup.setOrder(1);
127128
tagGroup.setTag(list);
129+
tagGroupInfo.setTagGroup(tagGroup);
128130

129-
WxCpUserExternalTagGroupInfo result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
131+
WxCpUserExternalTagGroupInfo result = this.wxCpService.getExternalContactService().addCorpTag(tagGroupInfo);
130132

131-
132-
133-
System.out.println(result);
133+
System.out.println(result.toJson());
134134
assertNotNull(result);
135135
}
136136

@@ -146,8 +146,8 @@ public void testEditCorpTag() throws WxErrorException {
146146
@Test
147147
public void testDelCorpTag() throws WxErrorException {
148148

149-
String tagId[] = {"et2omCCwAA6PtGsfeEOQMENl3Ub1FA6A"};
150-
String groupId[] = {};
149+
String tagId[] = {};
150+
String groupId[] = {"et2omCCwAAM3WzL00QpK9xARab3HGkAg"};
151151

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

0 commit comments

Comments
 (0)