mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-11-02 12:38:22 +08:00
update
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
package me.chanjar.weixin.cp.bean.messagebuilder;
|
package me.chanjar.weixin.cp.bean.messagebuilder;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +15,7 @@ public final class FileBuilder extends BaseBuilder<FileBuilder> {
|
|||||||
private String mediaId;
|
private String mediaId;
|
||||||
|
|
||||||
public FileBuilder() {
|
public FileBuilder() {
|
||||||
this.msgType = WxCpConsts.CUSTOM_MSG_FILE;
|
this.msgType = WxConsts.CUSTOM_MSG_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileBuilder mediaId(String media_id) {
|
public FileBuilder mediaId(String media_id) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package me.chanjar.weixin.cp.bean.messagebuilder;
|
package me.chanjar.weixin.cp.bean.messagebuilder;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +15,7 @@ public final class ImageBuilder extends BaseBuilder<ImageBuilder> {
|
|||||||
private String mediaId;
|
private String mediaId;
|
||||||
|
|
||||||
public ImageBuilder() {
|
public ImageBuilder() {
|
||||||
this.msgType = WxCpConsts.CUSTOM_MSG_IMAGE;
|
this.msgType = WxConsts.CUSTOM_MSG_IMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageBuilder mediaId(String media_id) {
|
public ImageBuilder mediaId(String media_id) {
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
package me.chanjar.weixin.cp.bean.messagebuilder;
|
package me.chanjar.weixin.cp.bean.messagebuilder;
|
||||||
|
|
||||||
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpConsts;
|
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图文消息builder
|
* 图文消息builder
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -20,7 +20,7 @@ public final class NewsBuilder extends BaseBuilder<NewsBuilder> {
|
|||||||
private List<WxCpMessage.WxArticle> articles = new ArrayList<WxCpMessage.WxArticle>();
|
private List<WxCpMessage.WxArticle> articles = new ArrayList<WxCpMessage.WxArticle>();
|
||||||
|
|
||||||
public NewsBuilder() {
|
public NewsBuilder() {
|
||||||
this.msgType = WxCpConsts.CUSTOM_MSG_NEWS;
|
this.msgType = WxConsts.CUSTOM_MSG_NEWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NewsBuilder addArticle(WxCpMessage.WxArticle article) {
|
public NewsBuilder addArticle(WxCpMessage.WxArticle article) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package me.chanjar.weixin.cp.bean.messagebuilder;
|
package me.chanjar.weixin.cp.bean.messagebuilder;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +15,7 @@ public final class TextBuilder extends BaseBuilder<TextBuilder> {
|
|||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
public TextBuilder() {
|
public TextBuilder() {
|
||||||
this.msgType = WxCpConsts.CUSTOM_MSG_TEXT;
|
this.msgType = WxConsts.CUSTOM_MSG_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextBuilder content(String content) {
|
public TextBuilder content(String content) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package me.chanjar.weixin.cp.bean.messagebuilder;
|
package me.chanjar.weixin.cp.bean.messagebuilder;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,7 +24,7 @@ public final class VideoBuilder extends BaseBuilder<VideoBuilder> {
|
|||||||
private String thumbMediaId;
|
private String thumbMediaId;
|
||||||
|
|
||||||
public VideoBuilder() {
|
public VideoBuilder() {
|
||||||
this.msgType = WxCpConsts.CUSTOM_MSG_VIDEO;
|
this.msgType = WxConsts.CUSTOM_MSG_VIDEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VideoBuilder mediaId(String mediaId) {
|
public VideoBuilder mediaId(String mediaId) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package me.chanjar.weixin.cp.bean.messagebuilder;
|
package me.chanjar.weixin.cp.bean.messagebuilder;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
import me.chanjar.weixin.cp.bean.WxCpMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,7 +15,7 @@ public final class VoiceBuilder extends BaseBuilder<VoiceBuilder> {
|
|||||||
private String mediaId;
|
private String mediaId;
|
||||||
|
|
||||||
public VoiceBuilder() {
|
public VoiceBuilder() {
|
||||||
this.msgType = WxCpConsts.CUSTOM_MSG_VOICE;
|
this.msgType = WxConsts.CUSTOM_MSG_VOICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VoiceBuilder mediaId(String media_id) {
|
public VoiceBuilder mediaId(String media_id) {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import com.google.inject.Inject;
|
|||||||
public class WxCpDepartAPITest {
|
public class WxCpDepartAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxCpServiceImpl wxService;
|
protected WxCpServiceImpl wxCpService;
|
||||||
|
|
||||||
protected WxCpDepart depart;
|
protected WxCpDepart depart;
|
||||||
|
|
||||||
@ -30,13 +30,13 @@ public class WxCpDepartAPITest {
|
|||||||
depart.setName("子部门" + System.currentTimeMillis());
|
depart.setName("子部门" + System.currentTimeMillis());
|
||||||
depart.setParentId(1);
|
depart.setParentId(1);
|
||||||
depart.setOrder(1);
|
depart.setOrder(1);
|
||||||
Integer departId = wxService.departCreate(depart);
|
Integer departId = wxCpService.departCreate(depart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testDepartCreate")
|
@Test(dependsOnMethods = "testDepartCreate")
|
||||||
public void testDepartGet() throws WxErrorException {
|
public void testDepartGet() throws WxErrorException {
|
||||||
System.out.println("=================获取部门");
|
System.out.println("=================获取部门");
|
||||||
List<WxCpDepart> departList = wxService.departGet();
|
List<WxCpDepart> departList = wxCpService.departGet();
|
||||||
Assert.assertNotNull(departList);
|
Assert.assertNotNull(departList);
|
||||||
Assert.assertTrue(departList.size() > 0);
|
Assert.assertTrue(departList.size() > 0);
|
||||||
for (WxCpDepart g : departList) {
|
for (WxCpDepart g : departList) {
|
||||||
@ -50,14 +50,14 @@ public class WxCpDepartAPITest {
|
|||||||
public void testDepartUpdate() throws WxErrorException {
|
public void testDepartUpdate() throws WxErrorException {
|
||||||
System.out.println("=================更新部门");
|
System.out.println("=================更新部门");
|
||||||
depart.setName("子部门改名" + System.currentTimeMillis());
|
depart.setName("子部门改名" + System.currentTimeMillis());
|
||||||
wxService.departUpdate(depart);
|
wxCpService.departUpdate(depart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testDepartUpdate")
|
@Test(dependsOnMethods = "testDepartUpdate")
|
||||||
public void testDepartDelete() throws WxErrorException {
|
public void testDepartDelete() throws WxErrorException {
|
||||||
System.out.println("=================删除部门");
|
System.out.println("=================删除部门");
|
||||||
System.out.println(depart.getId() + ":" + depart.getName());
|
System.out.println(depart.getId() + ":" + depart.getName());
|
||||||
wxService.departDelete(depart.getId());
|
wxCpService.departDelete(depart.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import java.util.List;
|
|||||||
public class WxCpUserAPITest {
|
public class WxCpUserAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxCpServiceImpl wxService;
|
protected WxCpServiceImpl wxCpService;
|
||||||
|
|
||||||
protected WxCpDepart depart;
|
protected WxCpDepart depart;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class WxCpUserAPITest {
|
|||||||
user.setPosition("老婆");
|
user.setPosition("老婆");
|
||||||
user.setTel("3300393");
|
user.setTel("3300393");
|
||||||
user.addExtAttr("爱好", "老公");
|
user.addExtAttr("爱好", "老公");
|
||||||
wxService.userCreate(user);
|
wxCpService.userCreate(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testUserCreate")
|
@Test(dependsOnMethods = "testUserCreate")
|
||||||
@ -44,23 +44,23 @@ public class WxCpUserAPITest {
|
|||||||
user.setUserId("xiaohe.yang");
|
user.setUserId("xiaohe.yang");
|
||||||
user.setName("杨宝");
|
user.setName("杨宝");
|
||||||
user.addExtAttr("爱好", "老公2");
|
user.addExtAttr("爱好", "老公2");
|
||||||
wxService.userUpdate(user);
|
wxCpService.userUpdate(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testUserUpdate")
|
@Test(dependsOnMethods = "testUserUpdate")
|
||||||
public void testUserGet() throws WxErrorException {
|
public void testUserGet() throws WxErrorException {
|
||||||
WxCpUser user = wxService.userGet("xiaohe.yang");
|
WxCpUser user = wxCpService.userGet("xiaohe.yang");
|
||||||
Assert.assertNotNull(user);
|
Assert.assertNotNull(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testUserGet")
|
@Test(dependsOnMethods = "testUserGet")
|
||||||
public void testDepartGetUsers() throws WxErrorException {
|
public void testDepartGetUsers() throws WxErrorException {
|
||||||
List<WxCpUser> users = wxService.departGetUsers(1, true, 0);
|
List<WxCpUser> users = wxCpService.departGetUsers(1, true, 0);
|
||||||
Assert.assertNotEquals(users.size(), 0);
|
Assert.assertNotEquals(users.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testDepartGetUsers")
|
@Test(dependsOnMethods = "testDepartGetUsers")
|
||||||
public void testUserDelete() throws WxErrorException {
|
public void testUserDelete() throws WxErrorException {
|
||||||
wxService.userDelete("xiaohe.yang");
|
wxCpService.userDelete("xiaohe.yang");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user