Skip to content

Commit b1f5d07

Browse files
committed
部门API的支持
1 parent e7922a9 commit b1f5d07

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

weixin-java-enterprise/src/main/java/me/chanjar/weixin/enterprise/bean/WxCpDepart.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
import me.chanjar.weixin.enterprise.util.json.WxCpGsonBuilder;
44

55
/**
6-
* 微信用户分组
6+
* 微信部门
77
* @author Daniel Qian
88
*
99
*/
1010
public class WxCpDepart {
1111

1212
private long id = -1;
1313
private String name;
14-
private long count;
14+
private long parentId;
15+
private long order;
16+
1517
public long getId() {
1618
return id;
1719
}
@@ -24,23 +26,22 @@ public String getName() {
2426
public void setName(String name) {
2527
this.name = name;
2628
}
27-
public long getCount() {
28-
return count;
29-
}
30-
public void setCount(long count) {
31-
this.count = count;
32-
}
33-
29+
3430
public static WxCpDepart fromJson(String json) {
3531
return WxCpGsonBuilder.create().fromJson(json, WxCpDepart.class);
3632
}
3733

3834
public String toJson() {
3935
return WxCpGsonBuilder.create().toJson(this);
4036
}
37+
4138
@Override
4239
public String toString() {
43-
return "WxGroup [id=" + id + ", name=" + name + ", count=" + count + "]";
40+
return "WxCpDepart{" +
41+
"id=" + id +
42+
", name='" + name + '\'' +
43+
", parentId=" + parentId +
44+
", order=" + order +
45+
'}';
4446
}
45-
4647
}

weixin-java-enterprise/src/test/java/me/chanjar/weixin/enterprise/api/WxGroupAPITest.java renamed to weixin-java-enterprise/src/test/java/me/chanjar/weixin/enterprise/api/WxCpDepartAPITest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
*/
1919
@Test(groups = "groupAPI", dependsOnGroups = "baseAPI")
2020
@Guice(modules = ApiTestModule.class)
21-
public class WxGroupAPITest {
21+
public class WxCpDepartAPITest {
2222

2323
@Inject
2424
protected WxCpServiceImpl wxService;
2525

26-
protected WxCpDepart group;
26+
protected WxCpDepart depart;
2727

2828
public void testGroupCreate() throws WxErrorException {
2929
WxCpDepart res = wxService.departmentCreate("测试分组1");
@@ -36,15 +36,15 @@ public void testGroupGet() throws WxErrorException {
3636
Assert.assertNotNull(groupList);
3737
Assert.assertTrue(groupList.size() > 0);
3838
for (WxCpDepart g : groupList) {
39-
group = g;
39+
depart = g;
4040
Assert.assertNotNull(g.getName());
4141
}
4242
}
4343

4444
@Test(dependsOnMethods={"testGroupGet", "testGroupCreate"})
4545
public void getGroupUpdate() throws WxErrorException {
46-
group.setName("分组改名");
47-
wxService.departmentUpdate(group);
46+
depart.setName("分组改名");
47+
wxService.departmentUpdate(depart);
4848
}
4949

5050
}

weixin-java-enterprise/src/test/resources/testng.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<class name="me.chanjar.weixin.enterprise.api.WxCpBaseAPITest" />
77
<class name="me.chanjar.weixin.enterprise.api.WxCpMessageAPITest" />
88
<class name="me.chanjar.weixin.enterprise.api.WxCpMenuAPITest" />
9-
<class name="me.chanjar.weixin.enterprise.api.WxGroupAPITest" />
9+
<class name="me.chanjar.weixin.enterprise.api.WxCpDepartAPITest" />
1010
<class name="me.chanjar.weixin.enterprise.api.WxCpMediaAPITest" />
1111
<class name="me.chanjar.weixin.enterprise.api.WxCpMessageRouterTest" />
1212
</classes>

0 commit comments

Comments
 (0)