mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🎨 #1690 企业微信外部联系人客户详情接口增加几个字段
* 外部联系人客户详情新增增加字段 增加字段: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>
This commit is contained in:
parent
2755bc9d50
commit
a776e9cf11
2
pom.xml
2
pom.xml
@ -92,7 +92,7 @@
|
|||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<name>huangxiaoming</name>
|
<name>huangxiaoming</name>
|
||||||
<email>huangxiaoming@163.com</email>
|
<email>huangxm129@163.com</email>
|
||||||
<url>https://github.com/huangxm129</url>
|
<url>https://github.com/huangxm129</url>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
@ -255,7 +255,7 @@ public interface WxCpExternalContactService {
|
|||||||
* @param tagId
|
* @param tagId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
WxCpUserExternalTagGroup getCorpTagList(String [] tagId) throws WxErrorException;
|
WxCpUserExternalTagGroupList getCorpTagList(String [] tagId) throws WxErrorException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +266,7 @@ public interface WxCpExternalContactService {
|
|||||||
* @param tagGroup
|
* @param tagGroup
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
WxCpUserExternalTagGroup addCorpTag(WxCpUserExternalTagGroup tagGroup)throws WxErrorException;
|
WxCpUserExternalTagGroupInfo addCorpTag(WxCpUserExternalTagGroupInfo tagGroup)throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -225,22 +225,22 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxCpUserExternalTagGroup getCorpTagList(String[] tagId) throws WxErrorException {
|
public WxCpUserExternalTagGroupList getCorpTagList(String[] tagId) throws WxErrorException {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
if(ArrayUtils.isNotEmpty(tagId)){
|
if(ArrayUtils.isNotEmpty(tagId)){
|
||||||
json.add("tag_id",new Gson().toJsonTree(tagId).getAsJsonArray());
|
json.add("tag_id",new Gson().toJsonTree(tagId).getAsJsonArray());
|
||||||
}
|
}
|
||||||
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_TAG_LIST);
|
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CORP_TAG_LIST);
|
||||||
final String result = this.mainService.post(url,json.toString());
|
final String result = this.mainService.post(url,json.toString());
|
||||||
return WxCpUserExternalTagGroup.fromJson(result);
|
return WxCpUserExternalTagGroupList.fromJson(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_CORP_TAG);
|
||||||
final String result = this.mainService.post(url,tagGroup.toJson());
|
final String result = this.mainService.post(url,tagGroup.toJson());
|
||||||
return WxCpUserExternalTagGroup.fromJson(result);
|
return WxCpUserExternalTagGroupInfo.fromJson(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,6 +119,12 @@ public class WxCpUserExternalContactInfo {
|
|||||||
@SerializedName("remark_mobiles")
|
@SerializedName("remark_mobiles")
|
||||||
private String[] remarkMobiles;
|
private String[] remarkMobiles;
|
||||||
private Tag[] tags;
|
private Tag[] tags;
|
||||||
|
@SerializedName("remark_corp_name")
|
||||||
|
private String remarkCorpName;
|
||||||
|
@SerializedName("add_way")
|
||||||
|
private String addWay;
|
||||||
|
@SerializedName("oper_userid")
|
||||||
|
private String operUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class WxCpUserExternalTagGroup extends WxCpBaseResp {
|
public class WxCpUserExternalTagGroupInfo extends WxCpBaseResp {
|
||||||
|
|
||||||
@SerializedName("group_id")
|
@SerializedName("group_id")
|
||||||
private String groupId;
|
private String groupId;
|
||||||
@ -63,7 +63,7 @@ public class WxCpUserExternalTagGroup extends WxCpBaseResp {
|
|||||||
return WxGsonBuilder.create().toJson(this);
|
return WxGsonBuilder.create().toJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WxCpUserExternalTagGroup fromJson(String json) {
|
public static WxCpUserExternalTagGroupInfo fromJson(String json) {
|
||||||
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroup.class);
|
return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalTagGroupInfo.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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<WxCpUserExternalTagGroupList.TagGroup> 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> 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);
|
||||||
|
}
|
||||||
|
}
|
@ -5,10 +5,7 @@ import com.google.inject.Inject;
|
|||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
import me.chanjar.weixin.cp.api.ApiTestModule;
|
import me.chanjar.weixin.cp.api.ApiTestModule;
|
||||||
import me.chanjar.weixin.cp.api.WxCpService;
|
import me.chanjar.weixin.cp.api.WxCpService;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
import me.chanjar.weixin.cp.bean.*;
|
||||||
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.apache.commons.lang3.time.DateFormatUtils;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -110,7 +107,7 @@ public class WxCpExternalContactServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetCorpTagList() throws WxErrorException {
|
public void testGetCorpTagList() throws WxErrorException {
|
||||||
String tag[]={};
|
String tag[]={};
|
||||||
WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().getCorpTagList(null);
|
WxCpUserExternalTagGroupList result = this.wxCpService.getExternalContactService().getCorpTagList(null);
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
}
|
}
|
||||||
@ -118,19 +115,18 @@ public class WxCpExternalContactServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testAddCorpTag() throws WxErrorException {
|
public void testAddCorpTag() throws WxErrorException {
|
||||||
|
|
||||||
List<WxCpUserExternalTagGroup.Tag> list = new ArrayList<>();
|
List<WxCpUserExternalTagGroupInfo.Tag> list = new ArrayList<>();
|
||||||
|
WxCpUserExternalTagGroupInfo.Tag tag = new WxCpUserExternalTagGroupInfo.Tag();
|
||||||
WxCpUserExternalTagGroup.Tag tag = new WxCpUserExternalTagGroup.Tag();
|
tag.setName("测试标签2");
|
||||||
tag.setName("测试标签1");
|
|
||||||
tag.setOrder(1);
|
tag.setOrder(1);
|
||||||
list.add(tag);
|
list.add(tag);
|
||||||
|
|
||||||
WxCpUserExternalTagGroup tagGroup = new WxCpUserExternalTagGroup();
|
WxCpUserExternalTagGroupInfo tagGroup = new WxCpUserExternalTagGroupInfo();
|
||||||
tagGroup.setGroupName("其他");
|
tagGroup.setGroupName("其他");
|
||||||
tagGroup.setOrder(1);
|
tagGroup.setOrder(1);
|
||||||
tagGroup.setTag(list);
|
tagGroup.setTag(list);
|
||||||
|
|
||||||
WxCpUserExternalTagGroup result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
|
WxCpUserExternalTagGroupInfo result = this.wxCpService.getExternalContactService().addCorpTag(tagGroup);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +137,7 @@ public class WxCpExternalContactServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testEditCorpTag() throws WxErrorException {
|
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);
|
System.out.println(result);
|
||||||
assertNotNull(result);
|
assertNotNull(result);
|
||||||
@ -150,7 +146,7 @@ public class WxCpExternalContactServiceImplTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testDelCorpTag() throws WxErrorException {
|
public void testDelCorpTag() throws WxErrorException {
|
||||||
|
|
||||||
String tagId[] = {"et2omCCwAArxYqGJQn4MNMS_zQKhIUfQ"};
|
String tagId[] = {"et2omCCwAA6PtGsfeEOQMENl3Ub1FA6A"};
|
||||||
String groupId[] = {};
|
String groupId[] = {};
|
||||||
|
|
||||||
WxCpBaseResp result = this.wxCpService.getExternalContactService().delCorpTag(tagId,groupId);
|
WxCpBaseResp result = this.wxCpService.getExternalContactService().delCorpTag(tagId,groupId);
|
||||||
|
Loading…
Reference in New Issue
Block a user