1
0
mirror of synced 2025-12-23 18:48:00 +08:00

🆕 #1493 企业微信增加管理企业客户标签的相关接口

This commit is contained in:
huangxm129
2020-07-26 23:08:56 +08:00
committed by GitHub
parent 0758049ea9
commit 694f2c2b96
7 changed files with 272 additions and 1 deletions

View File

@@ -8,10 +8,12 @@ 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 org.apache.commons.lang3.time.DateFormatUtils;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -105,4 +107,70 @@ public class WxCpExternalContactServiceImplTest {
assertNotNull(result);
}
@Test
public void testGetCorpTagList() throws WxErrorException {
String tag[]={};
WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().getCorpTagList(null);
System.out.println(result);
assertNotNull(result);
}
@Test
public void testAddCorpTag() throws WxErrorException {
List<WxCpUserExternalTagGroup.Tag> list = new ArrayList<>();
WxCpUserExternalTagGroup.Tag tag = new WxCpUserExternalTagGroup.Tag();
tag.setName("测试标签1");
tag.setOrder(1);
list.add(tag);
WxCpUserExternalTagGroup tagGroup = new WxCpUserExternalTagGroup();
tagGroup.setGroupName("其他");
tagGroup.setOrder(1);
tagGroup.setTag(list);
WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
System.out.println(result);
assertNotNull(result);
}
@Test
public void testEditCorpTag() throws WxErrorException {
WxCpBaseResp result = this.wxCpService.getExternalContactService().editCorpTag("et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ", "未知", 2);
System.out.println(result);
assertNotNull(result);
}
@Test
public void testDelCorpTag() throws WxErrorException {
String tagId[] = {"et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ"};
String groupId[] = {};
WxCpBaseResp result = this.wxCpService.getExternalContactService().delCorpTag(tagId,groupId);
System.out.println(result);
assertNotNull(result);
}
@Test
public void testMarkTag() throws WxErrorException {
String userid="HuangXiaoMing";
String externalUserid="wo2omCCwAAzR0Rt1omz-90o_XJkPGXIQ";
String addTag[] = {"et2omCCwAAzdcSK-RV80YS9sbpCXlNlQ"};
String removeTag[] = {};
WxCpBaseResp result = this.wxCpService.getExternalContactService().markTag(userid,externalUserid,addTag,removeTag);
System.out.println(result);
assertNotNull(result);
}
}

View File

@@ -73,7 +73,7 @@ public class WxCpUserServiceImplTest {
@Test
public void testListByDepartment() throws Exception {
List<WxCpUser> users = this.wxCpService.getUserService().listByDepartment(1L, true, 0);
List<WxCpUser> users = this.wxCpService.getUserService().listByDepartment(2L, true, 0);
assertNotEquals(users.size(), 0);
for (WxCpUser user : users) {
System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE));