mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-26 02:39:18 +08:00
部门API的支持
This commit is contained in:
@@ -3,7 +3,7 @@ package me.chanjar.weixin.enterprise.bean;
|
||||
import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder;
|
||||
|
||||
/**
|
||||
* 微信用户分组
|
||||
* 微信部门
|
||||
* @author Daniel Qian
|
||||
*
|
||||
*/
|
||||
@@ -11,7 +11,9 @@ public class WxCpDepart {
|
||||
|
||||
private long id = -1;
|
||||
private String name;
|
||||
private long count;
|
||||
private long parentId;
|
||||
private long order;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -24,13 +26,7 @@ public class WxCpDepart {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public long getCount() {
|
||||
return count;
|
||||
}
|
||||
public void setCount(long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
||||
public static WxCpDepart fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpDepart.class);
|
||||
}
|
||||
@@ -38,9 +34,14 @@ public class WxCpDepart {
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxGroup [id=" + id + ", name=" + name + ", count=" + count + "]";
|
||||
return "WxCpDepart{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", parentId=" + parentId +
|
||||
", order=" + order +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ import com.google.inject.Inject;
|
||||
*/
|
||||
@Test(groups = "groupAPI", dependsOnGroups = "baseAPI")
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxGroupAPITest {
|
||||
public class WxCpDepartAPITest {
|
||||
|
||||
@Inject
|
||||
protected WxCpServiceImpl wxService;
|
||||
|
||||
protected WxCpDepart group;
|
||||
protected WxCpDepart depart;
|
||||
|
||||
public void testGroupCreate() throws WxErrorException {
|
||||
WxCpDepart res = wxService.departmentCreate("测试分组1");
|
||||
@@ -36,15 +36,15 @@ public class WxGroupAPITest {
|
||||
Assert.assertNotNull(groupList);
|
||||
Assert.assertTrue(groupList.size() > 0);
|
||||
for (WxCpDepart g : groupList) {
|
||||
group = g;
|
||||
depart = g;
|
||||
Assert.assertNotNull(g.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods={"testGroupGet", "testGroupCreate"})
|
||||
public void getGroupUpdate() throws WxErrorException {
|
||||
group.setName("分组改名");
|
||||
wxService.departmentUpdate(group);
|
||||
depart.setName("分组改名");
|
||||
wxService.departmentUpdate(depart);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxCpBaseAPITest" />
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMessageAPITest" />
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMenuAPITest" />
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxGroupAPITest" />
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxCpDepartAPITest" />
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMediaAPITest" />
|
||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMessageRouterTest" />
|
||||
</classes>
|
||||
|
||||
Reference in New Issue
Block a user