标签接口:新增/删除成员标签接口新增partyIds参数

This commit is contained in:
jinyu 2015-09-25 17:27:02 +08:00
parent 5d09dbf7dc
commit 8f0ddd421c
5 changed files with 1926 additions and 1889 deletions

View File

@ -85,8 +85,7 @@ public class WeixinProxy {
* token存储策略 * token存储策略
*/ */
public WeixinProxy(TokenStorager tokenStorager) { public WeixinProxy(TokenStorager tokenStorager) {
this(QyApi.DEFAULT_WEIXIN_ACCOUNT.getId(), QyApi.DEFAULT_WEIXIN_ACCOUNT this(QyApi.DEFAULT_WEIXIN_ACCOUNT.getId(), QyApi.DEFAULT_WEIXIN_ACCOUNT.getSecret(), tokenStorager);
.getSecret(), tokenStorager);
} }
/** /**
@ -108,10 +107,8 @@ public class WeixinProxy {
* @param tokenStorager * @param tokenStorager
* 企业号token存储器 * 企业号token存储器
*/ */
public WeixinProxy(String corpid, String corpsecret, public WeixinProxy(String corpid, String corpsecret, TokenStorager tokenStorager) {
TokenStorager tokenStorager) { this(new TokenHolder(new WeixinTokenCreator(corpid, corpsecret), tokenStorager));
this(new TokenHolder(new WeixinTokenCreator(corpid, corpsecret),
tokenStorager));
} }
public WeixinProxy(TokenHolder tokenHolder) { public WeixinProxy(TokenHolder tokenHolder) {
@ -142,16 +139,18 @@ public class WeixinProxy {
* *
* @param message * @param message
* 客服消息对象 * 客服消息对象
* @return * @return 如果对应用或收件人部门标签任何一个无权限则本次发送失败如果收件人部门或标签不存在发送仍然执行但返回无效的部分
* 如果对应用或收件人部门标签任何一个无权限则本次发送失败如果收件人部门或标签不存在发送仍然执行但返回无效的部分</br> * </br>
* { "errcode": 0, "errmsg": "ok", "invaliduser": "UserID1", * { "errcode": 0, "errmsg": "ok", "invaliduser": "UserID1",
* "invalidparty":"PartyID1", "invalidtag":"TagID1" } * "invalidparty":"PartyID1", "invalidtag":"TagID1" }
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.NotifyApi * @see com.foxinmy.weixin4j.qy.api.NotifyApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">发送接口说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%8F%91%E9%80%81%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E">
* @see <a * 发送接口说明</a>
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%B6%88%E6%81%AF%E7%B1%BB%E5%9E%8B%E5%8F%8A%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F">发送格式说明</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E6%B6%88%E6%81%AF%E7%B1%BB%E5%9E%8B%E5%8F%8A%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F">
* 发送格式说明</a>
* @see com.foxinmy.weixin4j.tuple.Text * @see com.foxinmy.weixin4j.tuple.Text
* @see com.foxinmy.weixin4j.tuple.Image * @see com.foxinmy.weixin4j.tuple.Image
* @see com.foxinmy.weixin4j.tuple.Voice * @see com.foxinmy.weixin4j.tuple.Voice
@ -161,8 +160,7 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.tuple.MpNews * @see com.foxinmy.weixin4j.tuple.MpNews
* @see com.foxinmy.weixin4j.qy.message.NotifyMessage * @see com.foxinmy.weixin4j.qy.message.NotifyMessage
*/ */
public JSONObject sendNotifyMessage(NotifyMessage message) public JSONObject sendNotifyMessage(NotifyMessage message) throws WeixinException {
throws WeixinException {
return notifyApi.sendNotifyMessage(message); return notifyApi.sendNotifyMessage(message);
} }
@ -175,12 +173,12 @@ public class WeixinProxy {
* 应用ID * 应用ID
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MenuApi * @see com.foxinmy.weixin4j.qy.api.MenuApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%9B%E5%BB%BA%E5%BA%94%E7%94%A8%E8%8F%9C%E5%8D%95">创建自定义菜单</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%9B%E5%BB%BA%E5%BA%94%E7%94%A8%E8%8F%9C%E5%8D%95">
* 创建自定义菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
*/ */
public JsonResult createMenu(List<Button> btnList, int agentid) public JsonResult createMenu(List<Button> btnList, int agentid) throws WeixinException {
throws WeixinException {
return menuApi.createMenu(btnList, agentid); return menuApi.createMenu(btnList, agentid);
} }
@ -192,8 +190,9 @@ public class WeixinProxy {
* @return 菜单集合 * @return 菜单集合
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MenuApi * @see com.foxinmy.weixin4j.qy.api.MenuApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E8%8F%9C%E5%8D%95%E5%88%97%E8%A1%A8">查询菜单</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E8%8F%9C%E5%8D%95%E5%88%97%E8%A1%A8">
* 查询菜单</a>
* @see com.foxinmy.weixin4j.model.Button * @see com.foxinmy.weixin4j.model.Button
*/ */
public List<Button> getMenu(int agentid) throws WeixinException { public List<Button> getMenu(int agentid) throws WeixinException {
@ -207,8 +206,9 @@ public class WeixinProxy {
* 应用ID * 应用ID
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MenuApi * @see com.foxinmy.weixin4j.qy.api.MenuApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E8%8F%9C%E5%8D%95">删除菜单</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E8%8F%9C%E5%8D%95">
* 删除菜单</a>
* @return 处理结果 * @return 处理结果
*/ */
public JsonResult deleteMenu(int agentid) throws WeixinException { public JsonResult deleteMenu(int agentid) throws WeixinException {
@ -231,14 +231,15 @@ public class WeixinProxy {
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see com.foxinmy.weixin4j.model.MediaUploadResult * @see com.foxinmy.weixin4j.model.MediaUploadResult
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%B4%E6%97%B6%E7%B4%A0%E6%9D%90%E6%96%87%E4%BB%B6">上传临时素材文件说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E4%B8%B4%E6%97%B6%E7%B4%A0%E6%9D%90%E6%96%87%E4%BB%B6">
* @see <a * 上传临时素材文件说明</a>
* href="http://http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">上传永久素材文件说明</a> * @see <a href=
* "http://http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">
* 上传永久素材文件说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public MediaUploadResult uploadMedia(int agentid, InputStream is, public MediaUploadResult uploadMedia(int agentid, InputStream is, String fileName) throws WeixinException {
String fileName) throws WeixinException {
return mediaApi.uploadMedia(agentid, is, fileName); return mediaApi.uploadMedia(agentid, is, fileName);
} }
@ -255,8 +256,7 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.type.MediaType * @see com.foxinmy.weixin4j.type.MediaType
* @see {@link #downloadMedia(int,String)} * @see {@link #downloadMedia(int,String)}
*/ */
public File downloadMediaFile(int agentid, String mediaId) public File downloadMediaFile(int agentid, String mediaId) throws WeixinException {
throws WeixinException {
return mediaApi.downloadMediaFile(agentid, mediaId); return mediaApi.downloadMediaFile(agentid, mediaId);
} }
@ -270,14 +270,15 @@ public class WeixinProxy {
* @return 媒体下载结果 * @return 媒体下载结果
* @see com.foxinmy.weixin4j.model.MediaDownloadResult * @see com.foxinmy.weixin4j.model.MediaDownloadResult
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E4%B8%B4%E6%97%B6%E7%B4%A0%E6%9D%90%E6%96%87%E4%BB%B6">获取临时媒体说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E4%B8%B4%E6%97%B6%E7%B4%A0%E6%9D%90%E6%96%87%E4%BB%B6">
* @see <a * 获取临时媒体说明</a>
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">获取永久媒体说明</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">
* 获取永久媒体说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public MediaDownloadResult downloadMedia(int agentid, String mediaId) public MediaDownloadResult downloadMedia(int agentid, String mediaId) throws WeixinException {
throws WeixinException {
return mediaApi.downloadMedia(agentid, mediaId); return mediaApi.downloadMedia(agentid, mediaId);
} }
@ -295,12 +296,12 @@ public class WeixinProxy {
* @return 上传到微信服务器返回的媒体标识 * @return 上传到微信服务器返回的媒体标识
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">上传永久媒体素材</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">
* 上传永久媒体素材</a>
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
*/ */
public String uploadMaterialArticle(int agentid, List<MpArticle> articles) public String uploadMaterialArticle(int agentid, List<MpArticle> articles) throws WeixinException {
throws WeixinException {
return mediaApi.uploadMaterialArticle(agentid, articles); return mediaApi.uploadMaterialArticle(agentid, articles);
} }
@ -314,11 +315,11 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">删除永久媒体素材</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%88%A0%E9%99%A4%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90">
* 删除永久媒体素材</a>
*/ */
public JsonResult deleteMaterialMedia(int agentid, String mediaId) public JsonResult deleteMaterialMedia(int agentid, String mediaId) throws WeixinException {
throws WeixinException {
return mediaApi.deleteMaterialMedia(agentid, mediaId); return mediaApi.deleteMaterialMedia(agentid, mediaId);
} }
@ -335,8 +336,7 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
*/ */
public List<MpArticle> downloadArticle(int agentid, String mediaId) public List<MpArticle> downloadArticle(int agentid, String mediaId) throws WeixinException {
throws WeixinException {
return mediaApi.downloadArticle(agentid, mediaId); return mediaApi.downloadArticle(agentid, mediaId);
} }
@ -352,12 +352,12 @@ public class WeixinProxy {
* @return 操作结果 * @return 操作结果
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BF%AE%E6%94%B9%E6%B0%B8%E4%B9%85%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90">修改永久媒体素材</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BF%AE%E6%94%B9%E6%B0%B8%E4%B9%85%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90">
* 修改永久媒体素材</a>
* @see com.foxinmy.weixin4j.tuple.MpArticle * @see com.foxinmy.weixin4j.tuple.MpArticle
*/ */
public String updateMaterialArticle(int agentid, String mediaId, public String updateMaterialArticle(int agentid, String mediaId, List<MpArticle> articles) throws WeixinException {
List<MpArticle> articles) throws WeixinException {
return mediaApi.updateMaterialArticle(agentid, mediaId, articles); return mediaApi.updateMaterialArticle(agentid, mediaId, articles);
} }
@ -370,8 +370,9 @@ public class WeixinProxy {
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see com.foxinmy.weixin4j.model.MediaCounter * @see com.foxinmy.weixin4j.model.MediaCounter
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E6%80%BB%E6%95%B0">获取素材总数</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E6%80%BB%E6%95%B0">
* 获取素材总数</a>
*/ */
public MediaCounter countMaterialMedia(int agentid) throws WeixinException { public MediaCounter countMaterialMedia(int agentid) throws WeixinException {
return mediaApi.countMaterialMedia(agentid); return mediaApi.countMaterialMedia(agentid);
@ -394,11 +395,11 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.model.MediaItem * @see com.foxinmy.weixin4j.model.MediaItem
* @see com.foxinmy.weixin4j.model.Pageable * @see com.foxinmy.weixin4j.model.Pageable
* @see com.foxinmy.weixin4j.model.Pagedata * @see com.foxinmy.weixin4j.model.Pagedata
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8">获取素材列表</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8">
* 获取素材列表</a>
*/ */
public MediaRecord listMaterialMedia(int agentid, MediaType mediaType, public MediaRecord listMaterialMedia(int agentid, MediaType mediaType, Pageable pageable) throws WeixinException {
Pageable pageable) throws WeixinException {
return mediaApi.listMaterialMedia(agentid, mediaType, pageable); return mediaApi.listMaterialMedia(agentid, mediaType, pageable);
} }
@ -414,8 +415,7 @@ public class WeixinProxy {
* @see {@link #listMaterialMedia(int,MediaType, Pageable)} * @see {@link #listMaterialMedia(int,MediaType, Pageable)}
* @throws WeixinException * @throws WeixinException
*/ */
public List<MediaItem> listAllMaterialMedia(int agentid, MediaType mediaType) public List<MediaItem> listAllMaterialMedia(int agentid, MediaType mediaType) throws WeixinException {
throws WeixinException {
return mediaApi.listAllMaterialMedia(agentid, mediaType); return mediaApi.listAllMaterialMedia(agentid, mediaType);
} }
@ -425,8 +425,9 @@ public class WeixinProxy {
* @param party * @param party
* 部门对象 * 部门对象
* @see com.foxinmy.weixin4j.qy.model.Party * @see com.foxinmy.weixin4j.qy.model.Party
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E5.88.9B.E5.BB.BA.E9.83.A8.E9.97.A8">创建部门说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E5.88.9B.E5.BB.BA.E9.83.A8.E9.97.A8">
* 创建部门说明</a>
* @see com.foxinmy.weixin4j.qy.api.PartyApi * @see com.foxinmy.weixin4j.qy.api.PartyApi
* @return 部门ID * @return 部门ID
* @throws WeixinException * @throws WeixinException
@ -441,8 +442,9 @@ public class WeixinProxy {
* @param party * @param party
* 部门对象 * 部门对象
* @see com.foxinmy.weixin4j.qy.model.Party * @see com.foxinmy.weixin4j.qy.model.Party
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E6.9B.B4.E6.96.B0.E9.83.A8.E9.97.A8">更新部门说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E6.9B.B4.E6.96.B0.E9.83.A8.E9.97.A8">
* 更新部门说明</a>
* @see com.foxinmy.weixin4j.qy.api.PartyApi * @see com.foxinmy.weixin4j.qy.api.PartyApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
@ -457,8 +459,9 @@ public class WeixinProxy {
* @param partyId * @param partyId
* 部门ID获取指定部门ID下的子部门 传入0表示获取全部子部门 * 部门ID获取指定部门ID下的子部门 传入0表示获取全部子部门
* @see com.foxinmy.weixin4j.qy.model.Party * @see com.foxinmy.weixin4j.qy.model.Party
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E5.88.97.E8.A1.A8">获取部门列表</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E5.88.97.E8.A1.A8">
* 获取部门列表</a>
* @see com.foxinmy.weixin4j.qy.api.PartyApi * @see com.foxinmy.weixin4j.qy.api.PartyApi
* @return 部门列表 * @return 部门列表
* @throws WeixinException * @throws WeixinException
@ -472,8 +475,9 @@ public class WeixinProxy {
* *
* @param partyId * @param partyId
* 部门ID * 部门ID
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E5.88.A0.E9.99.A4.E9.83.A8.E9.97.A8">删除部门说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E5.88.A0.E9.99.A4.E9.83.A8.E9.97.A8">
* 删除部门说明</a>
* @see com.foxinmy.weixin4j.qy.api.PartyApi * @see com.foxinmy.weixin4j.qy.api.PartyApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
@ -490,13 +494,13 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.qy.api.MediaApi * @see com.foxinmy.weixin4j.qy.api.MediaApi
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see {@link #replaceparty(String,Callback)} * @see {@link #replaceparty(String,Callback)}
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.80.9A.E8.AE.AF.E5.BD.95.E6.9B.B4.E6.96.B0">批量任务</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.80.9A.E8.AE.AF.E5.BD.95.E6.9B.B4.E6.96.B0">
* 批量任务</a>
* @return 上传后的mediaId * @return 上传后的mediaId
* @throws WeixinException * @throws WeixinException
*/ */
public String batchUploadParties(List<Party> parties) public String batchUploadParties(List<Party> parties) throws WeixinException {
throws WeixinException {
return mediaApi.batchUploadParties(parties); return mediaApi.batchUploadParties(parties);
} }
@ -506,8 +510,9 @@ public class WeixinProxy {
* @param user * @param user
* 成员对象 * 成员对象
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">创建成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">
* 创建成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
@ -524,14 +529,14 @@ public class WeixinProxy {
* @param avatar * @param avatar
* 头像文件 * 头像文件
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">创建成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">
* 创建成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult createUser(User user, InputStream avatar) public JsonResult createUser(User user, InputStream avatar) throws WeixinException {
throws WeixinException {
return userApi.createUser(user, avatar); return userApi.createUser(user, avatar);
} }
@ -541,8 +546,9 @@ public class WeixinProxy {
* @param user * @param user
* 成员对象 * 成员对象
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">更新成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">
* 更新成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
@ -559,14 +565,14 @@ public class WeixinProxy {
* @param avatar * @param avatar
* 头像文件 * 头像文件
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">更新成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">
* 更新成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult updateUser(User user, InputStream avatar) public JsonResult updateUser(User user, InputStream avatar) throws WeixinException {
throws WeixinException {
return userApi.updateUser(user, avatar); return userApi.updateUser(user, avatar);
} }
@ -576,8 +582,9 @@ public class WeixinProxy {
* @param userid * @param userid
* 成员唯一ID * 成员唯一ID
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E6.88.90.E5.91.98">获取成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E6.88.90.E5.91.98">
* 获取成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 成员对象 * @return 成员对象
* @throws WeixinException * @throws WeixinException
@ -596,10 +603,12 @@ public class WeixinProxy {
* @return 成员对象 * @return 成员对象
* @see {@link #getUser(String)} * @see {@link #getUser(String)}
* @see {@link #getUserIdByCode(String,int)} * @see {@link #getUserIdByCode(String,int)}
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">企业获取code</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">
* @see <a * 企业获取code</a>
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">根据code获取成员信息</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">
* 根据code获取成员信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public User getUserByCode(String code) throws WeixinException { public User getUserByCode(String code) throws WeixinException {
@ -614,10 +623,12 @@ public class WeixinProxy {
* @return { "UserId":"USERID", "DeviceId":"DEVICEID" } or * @return { "UserId":"USERID", "DeviceId":"DEVICEID" } or
* {"OpenId":"OPENID","DeviceId":"DEVICEID"} * {"OpenId":"OPENID","DeviceId":"DEVICEID"}
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">企业获取code</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">
* @see <a * 企业获取code</a>
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">根据code获取成员信息</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">
* 根据code获取成员信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JSONObject getUserIdByCode(String code) throws WeixinException { public JSONObject getUserIdByCode(String code) throws WeixinException {
@ -632,18 +643,19 @@ public class WeixinProxy {
* @param fetchChild * @param fetchChild
* 是否递归获取子部门下面的成员 非必须 * 是否递归获取子部门下面的成员 非必须
* @param userStatus * @param userStatus
* 成员状态 status可叠加 非必须 * 成员状态 status可叠加 非必须 未填写则默认为未关注(4)
* @param findDetail * @param findDetail
* 是否获取详细信息 * 是否获取详细信息
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98">获取部门成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98">
* 获取部门成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 成员列表 * @return 成员列表
* @throws WeixinException * @throws WeixinException
*/ */
public List<User> listUser(int departId, boolean fetchChild, public List<User> listUser(int departId, boolean fetchChild, UserStatus userStatus, boolean findDetail)
UserStatus userStatus, boolean findDetail) throws WeixinException { throws WeixinException {
return userApi.listUser(departId, fetchChild, userStatus, findDetail); return userApi.listUser(departId, fetchChild, userStatus, findDetail);
} }
@ -666,8 +678,9 @@ public class WeixinProxy {
* *
* @param userid * @param userid
* 成员ID * 成员ID
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.A0.E9.99.A4.E6.88.90.E5.91.98">删除成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.A0.E9.99.A4.E6.88.90.E5.91.98">
* 删除成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
@ -688,8 +701,7 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult batchDeleteUser(List<String> userIds) public JsonResult batchDeleteUser(List<String> userIds) throws WeixinException {
throws WeixinException {
return userApi.batchDeleteUser(userIds); return userApi.batchDeleteUser(userIds);
} }
@ -702,12 +714,12 @@ public class WeixinProxy {
* 推送到微信上的提示语只有认证号可以使用当使用微信推送时该字段默认为请关注XXX企业号邮件邀请时该字段无效 * 推送到微信上的提示语只有认证号可以使用当使用微信推送时该字段默认为请关注XXX企业号邮件邀请时该字段无效
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @return 调用结果 * @return 调用结果
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">
* 邀请成员关注说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public InviteType inviteUser(String userId, String tips) public InviteType inviteUser(String userId, String tips) throws WeixinException {
throws WeixinException {
return userApi.inviteUser(userId, tips); return userApi.inviteUser(userId, tips);
} }
@ -715,10 +727,12 @@ public class WeixinProxy {
* 创建标签(创建的标签属于管理组;默认为未加锁状态) * 创建标签(创建的标签属于管理组;默认为未加锁状态)
* *
* @param tag * @param tag
* 标签对象</br>标签名称长度为1~64个字节标签名不可与其他标签重名</br>标签id整型 * 标签对象</br>
* 指定此参数时新增的标签会生成对应的标签id不指定时则以目前最大的id自增 * 标签名称长度为1~64个字节标签名不可与其他标签重名</br>
* @see <a * 标签id整型 指定此参数时新增的标签会生成对应的标签id不指定时则以目前最大的id自增
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">创建标签说明</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">
* 创建标签说明</a>
* @see com.foxinmy.weixin4j.qy.api.TagApi * @see com.foxinmy.weixin4j.qy.api.TagApi
* @return 标签ID * @return 标签ID
* @throws WeixinException * @throws WeixinException
@ -750,8 +764,9 @@ public class WeixinProxy {
* @param tagId * @param tagId
* 标签ID * 标签ID
* @return 处理结果 * @return 处理结果
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE">删除标签说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE">
* 删除标签说明</a>
* @see com.foxinmy.weixin4j.qy.api.TagApi * @see com.foxinmy.weixin4j.qy.api.TagApi
* @throws WeixinException * @throws WeixinException
*/ */
@ -762,8 +777,9 @@ public class WeixinProxy {
/** /**
* 获取标签列表 * 获取标签列表
* *
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E5.88.97.E8.A1.A8">获取标签列表说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E5.88.97.E8.A1.A8">
* 获取标签列表说明</a>
* @see com.foxinmy.weixin4j.qy.model.Tag * @see com.foxinmy.weixin4j.qy.model.Tag
* @see com.foxinmy.weixin4j.qy.api.TagApi * @see com.foxinmy.weixin4j.qy.api.TagApi
* @return 标签列表 * @return 标签列表
@ -779,8 +795,9 @@ public class WeixinProxy {
* @param tagId * @param tagId
* 标签ID * 标签ID
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">获取标签成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
* 获取标签成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.TagApi * @see com.foxinmy.weixin4j.qy.api.TagApi
* @return 成员列表 * @return 成员列表
* @throws WeixinException * @throws WeixinException
@ -796,16 +813,18 @@ public class WeixinProxy {
* @param tagId * @param tagId
* 标签ID * 标签ID
* @param userIds * @param userIds
* 成员ID * 企业成员ID列表注意userlistpartylist不能同时为空
* @see <a * @param partyIds
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.A2.9E.E5.8A.A0.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">新增标签成员说明</a> * 企业部门ID列表注意userlistpartylist不能同时为空
* @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.A2.9E.E5.8A.A0.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
* 新增标签成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.TagApi * @see com.foxinmy.weixin4j.qy.api.TagApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult addTagUsers(int tagId, List<String> userIds) public JsonResult addTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException {
throws WeixinException { return tagApi.addTagUsers(tagId, userIds, partyIds);
return tagApi.addTagUsers(tagId, userIds);
} }
/** /**
@ -815,16 +834,18 @@ public class WeixinProxy {
* @param tagId * @param tagId
* 标签ID * 标签ID
* @param userIds * @param userIds
* 成员ID * 企业成员ID列表注意userlistpartylist不能同时为空
* @see <a * @param partyIds
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">删除标签成员说明</a> * 企业部门ID列表注意userlistpartylist不能同时为空
* @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
* 删除标签成员说明</a>
* @see com.foxinmy.weixin4j.qy.api.TagApi * @see com.foxinmy.weixin4j.qy.api.TagApi
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult deleteTagUsers(int tagId, List<String> userIds) public JsonResult deleteTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException {
throws WeixinException { return tagApi.deleteTagUsers(tagId, userIds, partyIds);
return tagApi.deleteTagUsers(tagId, userIds);
} }
/** /**
@ -832,8 +853,9 @@ public class WeixinProxy {
* *
* @return IP地址 * @return IP地址
* @see com.foxinmy.weixin4j.qy.api.HelperApi * @see com.foxinmy.weixin4j.qy.api.HelperApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">获取IP地址</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%9B%9E%E8%B0%83%E6%A8%A1%E5%BC%8F#.E8.8E.B7.E5.8F.96.E5.BE.AE.E4.BF.A1.E6.9C.8D.E5.8A.A1.E5.99.A8.E7.9A.84ip.E6.AE.B5">
* 获取IP地址</a>
* @throws WeixinException * @throws WeixinException
*/ */
public List<String> getCallbackip() throws WeixinException { public List<String> getCallbackip() throws WeixinException {
@ -848,8 +870,9 @@ public class WeixinProxy {
* @return 应用信息 * @return 应用信息
* @see com.foxinmy.weixin4j.qy.model.AgentInfo * @see com.foxinmy.weixin4j.qy.model.AgentInfo
* @see com.foxinmy.weixin4j.qy.api.AgentApi * @see com.foxinmy.weixin4j.qy.api.AgentApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%8F%B7%E5%BA%94%E7%94%A8">企业号应用的信息</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E5%8F%B7%E5%BA%94%E7%94%A8">
* 企业号应用的信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public AgentInfo getAgent(int agentid) throws WeixinException { public AgentInfo getAgent(int agentid) throws WeixinException {
@ -863,8 +886,9 @@ public class WeixinProxy {
* 设置参数 * 设置参数
* @see com.foxinmy.weixin4j.qy.model.AgentSetter * @see com.foxinmy.weixin4j.qy.model.AgentSetter
* @see com.foxinmy.weixin4j.qy.api.AgentApi * @see com.foxinmy.weixin4j.qy.api.AgentApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%AE%BE%E7%BD%AE%E4%BC%81%E4%B8%9A%E5%8F%B7%E5%BA%94%E7%94%A8">设置企业号信息</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%AE%BE%E7%BD%AE%E4%BC%81%E4%B8%9A%E5%8F%B7%E5%BA%94%E7%94%A8">
* 设置企业号信息</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
@ -877,8 +901,9 @@ public class WeixinProxy {
* *
* @see com.foxinmy.weixin4j.qy.model.AgentOverview * @see com.foxinmy.weixin4j.qy.model.AgentOverview
* @see com.foxinmy.weixin4j.qy.api.AgentApi * @see com.foxinmy.weixin4j.qy.api.AgentApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8%E6%A6%82%E5%86%B5%E5%88%97%E8%A1%A8">获取应用概况</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8%E6%A6%82%E5%86%B5%E5%88%97%E8%A1%A8">
* 获取应用概况</a>
* @return 应用概况列表 * @return 应用概况列表
* @throws WeixinException * @throws WeixinException
*/ */
@ -899,12 +924,12 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.qy.model.IdParameter * @see com.foxinmy.weixin4j.qy.model.IdParameter
* @see com.foxinmy.weixin4j.qy.model.Callback * @see com.foxinmy.weixin4j.qy.model.Callback
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">
* 邀请成员关注</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchInviteUser(IdParameter parameter, Callback callback, public String batchInviteUser(IdParameter parameter, Callback callback, String tips) throws WeixinException {
String tips) throws WeixinException {
return batchApi.inviteUser(parameter, callback, tips); return batchApi.inviteUser(parameter, callback, tips);
} }
@ -912,7 +937,8 @@ public class WeixinProxy {
* 批量更新成员,本接口以userid为主键增量更新企业号通讯录成员 * 批量更新成员,本接口以userid为主键增量更新企业号通讯录成员
* <p> * <p>
* 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br> * 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br>
* 2.文件中存在通讯录中也存在的成员更新成员在文件中指定的字段值 </br> 3.文件中存在通讯录中不存在的成员执行添加操作</br> * 2.文件中存在通讯录中也存在的成员更新成员在文件中指定的字段值 </br>
* 3.文件中存在通讯录中不存在的成员执行添加操作</br>
* 4.通讯录中存在文件中不存在的成员保持不变</br> * 4.通讯录中存在文件中不存在的成员保持不变</br>
* </p> * </p>
* *
@ -923,19 +949,20 @@ public class WeixinProxy {
* @return 异步任务id最大长度为64字符 * @return 异步任务id最大长度为64字符
* @see com.foxinmy.weixin4j.qy.model.Callback * @see com.foxinmy.weixin4j.qy.model.Callback
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.A2.9E.E9.87.8F.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">批量更新成员</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.A2.9E.E9.87.8F.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">
* 批量更新成员</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchSyncUser(String mediaId, Callback callback) public String batchSyncUser(String mediaId, Callback callback) throws WeixinException {
throws WeixinException {
return batchApi.syncUser(mediaId, callback); return batchApi.syncUser(mediaId, callback);
} }
/** /**
* 批量覆盖成员,本接口以userid为主键全量覆盖企业号通讯录成员任务完成后企业号通讯录成员与提交的文件完全保持一致 * 批量覆盖成员,本接口以userid为主键全量覆盖企业号通讯录成员任务完成后企业号通讯录成员与提交的文件完全保持一致
* <p> * <p>
* 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br> 2.文件中存在通讯录中也存在的成员完全以文件为准</br> * 1.模板中的部门需填写部门ID多个部门用分号分隔部门ID必须为数字</br>
* 2.文件中存在通讯录中也存在的成员完全以文件为准</br>
* 3.文件中存在通讯录中不存在的成员执行添加操作</br> * 3.文件中存在通讯录中不存在的成员执行添加操作</br>
* 4.通讯录中存在文件中不存在的成员执行删除操作出于安全考虑如果需要删除的成员多于50人 * 4.通讯录中存在文件中不存在的成员执行删除操作出于安全考虑如果需要删除的成员多于50人
* 且多于现有人数的20%以上系统将中止导入并返回相应的错误码 * 且多于现有人数的20%以上系统将中止导入并返回相应的错误码
@ -948,12 +975,12 @@ public class WeixinProxy {
* @return 异步任务id最大长度为64字符 * @return 异步任务id最大长度为64字符
* @see com.foxinmy.weixin4j.qy.model.Callback * @see com.foxinmy.weixin4j.qy.model.Callback
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E6.88.90.E5.91.98">批量覆盖成员</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E6.88.90.E5.91.98">
* 批量覆盖成员</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchReplaceUser(String mediaId, Callback callback) public String batchReplaceUser(String mediaId, Callback callback) throws WeixinException {
throws WeixinException {
return batchApi.replaceUser(mediaId, callback); return batchApi.replaceUser(mediaId, callback);
} }
@ -966,8 +993,9 @@ public class WeixinProxy {
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see {@link #syncuser(String,Callback)} * @see {@link #syncuser(String,Callback)}
* @see {@link #replaceuser(String,Callback)} * @see {@link #replaceuser(String,Callback)}
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.80.9A.E8.AE.AF.E5.BD.95.E6.9B.B4.E6.96.B0">批量任务</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E9.80.9A.E8.AE.AF.E5.BD.95.E6.9B.B4.E6.96.B0">
* 批量任务</a>
* @return 上传后的mediaId * @return 上传后的mediaId
* @throws WeixinException * @throws WeixinException
*/ */
@ -978,7 +1006,8 @@ public class WeixinProxy {
/** /**
* 批量覆盖部门,本接口以partyid为键全量覆盖企业号通讯录组织架构任务完成后企业号通讯录组织架构与提交的文件完全保持一致 * 批量覆盖部门,本接口以partyid为键全量覆盖企业号通讯录组织架构任务完成后企业号通讯录组织架构与提交的文件完全保持一致
* <p> * <p>
* 1.文件中存在通讯录中也存在的部门执行修改操作</br> 2.文件中存在通讯录中不存在的部门执行添加操作</br> * 1.文件中存在通讯录中也存在的部门执行修改操作</br>
* 2.文件中存在通讯录中不存在的部门执行添加操作</br>
* 3.文件中不存在通讯录中存在的部门当部门为空时执行删除操作</br> * 3.文件中不存在通讯录中存在的部门当部门为空时执行删除操作</br>
* 4.CSV文件中部门名称部门ID父部门ID为必填字段部门ID必须为数字排序为可选字段置空或填0不修改排序 * 4.CSV文件中部门名称部门ID父部门ID为必填字段部门ID必须为数字排序为可选字段置空或填0不修改排序
* </p> * </p>
@ -990,12 +1019,12 @@ public class WeixinProxy {
* @return 异步任务id最大长度为64字符 * @return 异步任务id最大长度为64字符
* @see com.foxinmy.weixin4j.qy.model.Callback * @see com.foxinmy.weixin4j.qy.model.Callback
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E9.83.A8.E9.97.A8">批量覆盖部门</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E5.85.A8.E9.87.8F.E8.A6.86.E7.9B.96.E9.83.A8.E9.97.A8">
* 批量覆盖部门</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String batchReplaceParty(String mediaId, Callback callback) public String batchReplaceParty(String mediaId, Callback callback) throws WeixinException {
throws WeixinException {
return batchApi.replaceParty(mediaId, callback); return batchApi.replaceParty(mediaId, callback);
} }
@ -1007,8 +1036,9 @@ public class WeixinProxy {
* @return 效果信息 * @return 效果信息
* @see com.foxinmy.weixin4j.qy.model.BatchResult * @see com.foxinmy.weixin4j.qy.model.BatchResult
* @see com.foxinmy.weixin4j.qy.api.BatchApi * @see com.foxinmy.weixin4j.qy.api.BatchApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E8.8E.B7.E5.8F.96.E5.BC.82.E6.AD.A5.E4.BB.BB.E5.8A.A1.E7.BB.93.E6.9E.9C">获取异步任务执行结果</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E8.8E.B7.E5.8F.96.E5.BC.82.E6.AD.A5.E4.BB.BB.E5.8A.A1.E7.BB.93.E6.9E.9C">
* 获取异步任务执行结果</a>
* @throws WeixinException * @throws WeixinException
*/ */
public BatchResult getBatchResult(String jobId) throws WeixinException { public BatchResult getBatchResult(String jobId) throws WeixinException {
@ -1026,11 +1056,11 @@ public class WeixinProxy {
* @return 结果数组 第一个元素为对应的openid 第二个元素则为应用的appid(如果有) * @return 结果数组 第一个元素为对应的openid 第二个元素则为应用的appid(如果有)
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">userid转换成openid</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">
* userid转换成openid</a>
*/ */
public String[] userid2openid(String userid, int agentid) public String[] userid2openid(String userid, int agentid) throws WeixinException {
throws WeixinException {
return userApi.userid2openid(userid, agentid); return userApi.userid2openid(userid, agentid);
} }
@ -1043,8 +1073,9 @@ public class WeixinProxy {
* @return 该openid在企业号中对应的成员userid * @return 该openid在企业号中对应的成员userid
* @throws WeixinException * @throws WeixinException
* @see com.foxinmy.weixin4j.qy.api.UserApi * @see com.foxinmy.weixin4j.qy.api.UserApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">openid转换成userid</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">
* openid转换成userid</a>
*/ */
public String openid2userid(String openid) throws WeixinException { public String openid2userid(String openid) throws WeixinException {
return userApi.openid2userid(openid); return userApi.openid2userid(openid);
@ -1058,8 +1089,9 @@ public class WeixinProxy {
* @return 会话ID * @return 会话ID
* @see com.foxinmy.weixin4j.qy.api.ChatApi * @see com.foxinmy.weixin4j.qy.api.ChatApi
* @see com.foxinmy.weixin4j.qy.model.ChatInfo * @see com.foxinmy.weixin4j.qy.model.ChatInfo
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">创建会话</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E5.88.9B.E5.BB.BA.E4.BC.9A.E8.AF.9D">
* 创建会话</a>
* @throws WeixinException * @throws WeixinException
*/ */
public String createChat(ChatInfo chatInfo) throws WeixinException { public String createChat(ChatInfo chatInfo) throws WeixinException {
@ -1074,8 +1106,9 @@ public class WeixinProxy {
* @return 会话信息 * @return 会话信息
* @see com.foxinmy.weixin4j.qy.api.ChatApi * @see com.foxinmy.weixin4j.qy.api.ChatApi
* @see com.foxinmy.weixin4j.qy.model.ChatInfo * @see com.foxinmy.weixin4j.qy.model.ChatInfo
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E8.8E.B7.E5.8F.96.E4.BC.9A.E8.AF.9D">获取会话</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E8.8E.B7.E5.8F.96.E4.BC.9A.E8.AF.9D">
* 获取会话</a>
* @throws WeixinException * @throws WeixinException
*/ */
public ChatInfo getChat(String chatId) throws WeixinException { public ChatInfo getChat(String chatId) throws WeixinException {
@ -1096,12 +1129,12 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @see com.foxinmy.weixin4j.qy.api.ChatApi * @see com.foxinmy.weixin4j.qy.api.ChatApi
* @see com.foxinmy.weixin4j.qy.model.ChatInfo * @see com.foxinmy.weixin4j.qy.model.ChatInfo
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E4.BF.AE.E6.94.B9.E4.BC.9A.E8.AF.9D.E4.BF.A1.E6.81.AF">修改会话信息</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E4.BF.AE.E6.94.B9.E4.BC.9A.E8.AF.9D.E4.BF.A1.E6.81.AF">
* 修改会话信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult updateChat(ChatInfo chatInfo, String operator, public JsonResult updateChat(ChatInfo chatInfo, String operator, List<String> addUsers, List<String> deleteUsers)
List<String> addUsers, List<String> deleteUsers)
throws WeixinException { throws WeixinException {
return chatApi.updateChat(chatInfo, operator, addUsers, deleteUsers); return chatApi.updateChat(chatInfo, operator, addUsers, deleteUsers);
} }
@ -1115,12 +1148,12 @@ public class WeixinProxy {
* 操作人userid * 操作人userid
* @return 处理结果 * @return 处理结果
* @see com.foxinmy.weixin4j.qy.api.ChatApi * @see com.foxinmy.weixin4j.qy.api.ChatApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E9.80.80.E5.87.BA.E4.BC.9A.E8.AF.9D">退出会话</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E9.80.80.E5.87.BA.E4.BC.9A.E8.AF.9D">
* 退出会话</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult quitChat(String chatId, String operator) public JsonResult quitChat(String chatId, String operator) throws WeixinException {
throws WeixinException {
return chatApi.quitChat(chatId, operator); return chatApi.quitChat(chatId, operator);
} }
@ -1135,12 +1168,12 @@ public class WeixinProxy {
* 会话类型single|group分别表示群聊|单聊 * 会话类型single|group分别表示群聊|单聊
* @return 处理结果 * @return 处理结果
* @see com.foxinmy.weixin4j.qy.api.ChatApi * @see com.foxinmy.weixin4j.qy.api.ChatApi
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E6.B8.85.E9.99.A4.E4.BC.9A.E8.AF.9D.E6.9C.AA.E8.AF.BB.E7.8A.B6.E6.80.81">清除会话未读状态</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E6.B8.85.E9.99.A4.E4.BC.9A.E8.AF.9D.E6.9C.AA.E8.AF.BB.E7.8A.B6.E6.80.81">
* 清除会话未读状态</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult clearChatNotify(String targetId, String owner, public JsonResult clearChatNotify(String targetId, String owner, ChatType chatType) throws WeixinException {
ChatType chatType) throws WeixinException {
return chatApi.clearChatNotify(targetId, owner, chatType); return chatApi.clearChatNotify(targetId, owner, chatType);
} }
@ -1158,8 +1191,7 @@ public class WeixinProxy {
* @return 列表中不存在的成员剩余合法成员会继续执行 * @return 列表中不存在的成员剩余合法成员会继续执行
* @throws WeixinException * @throws WeixinException
*/ */
public List<String> setChatMute(List<ChatMute> chatMutes) public List<String> setChatMute(List<ChatMute> chatMutes) throws WeixinException {
throws WeixinException {
return chatApi.setChatMute(chatMutes); return chatApi.setChatMute(chatMutes);
} }
@ -1171,12 +1203,12 @@ public class WeixinProxy {
* @return 处理结果 * @return 处理结果
* @see com.foxinmy.weixin4j.qy.api.ChatApi * @see com.foxinmy.weixin4j.qy.api.ChatApi
* @see com.foxinmy.weixin4j.qy.message.ChatMessage * @see com.foxinmy.weixin4j.qy.message.ChatMessage
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E5.8F.91.E6.B6.88.E6.81.AF">发送消息</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E5%8F%B7%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E#.E5.8F.91.E6.B6.88.E6.81.AF">
* 发送消息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult sendChatMessage(ChatMessage message) public JsonResult sendChatMessage(ChatMessage message) throws WeixinException {
throws WeixinException {
return chatApi.sendChatMessage(message); return chatApi.sendChatMessage(message);
} }

View File

@ -19,8 +19,9 @@ import com.foxinmy.weixin4j.token.TokenHolder;
* @author jy * @author jy
* @date 2014年11月19日 * @date 2014年11月19日
* @since JDK 1.7 * @since JDK 1.7
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE">管理标签</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE">
* 管理标签</a>
*/ */
public class TagApi extends QyApi { public class TagApi extends QyApi {
private final TokenHolder tokenHolder; private final TokenHolder tokenHolder;
@ -33,10 +34,12 @@ public class TagApi extends QyApi {
* 创建标签(创建的标签属于管理组默认为加锁状态加锁状态下只有本管理组才可以增删成员解锁状态下其它管理组也可以增删成员) * 创建标签(创建的标签属于管理组默认为加锁状态加锁状态下只有本管理组才可以增删成员解锁状态下其它管理组也可以增删成员)
* *
* @param tag * @param tag
* 标签对象</br>标签名称长度为1~64个字节标签名不可与其他标签重名</br>标签id整型 * 标签对象</br>
* 指定此参数时新增的标签会生成对应的标签id不指定时则以目前最大的id自增 * 标签名称长度为1~64个字节标签名不可与其他标签重名</br>
* @see <a * 标签id整型 指定此参数时新增的标签会生成对应的标签id不指定时则以目前最大的id自增
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">创建标签说明</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">
* 创建标签说明</a>
* @return 标签ID * @return 标签ID
* @throws WeixinException * @throws WeixinException
*/ */
@ -47,8 +50,7 @@ public class TagApi extends QyApi {
if (obj.getIntValue("tagid") <= 0) { if (obj.getIntValue("tagid") <= 0) {
obj.remove("tagid"); obj.remove("tagid");
} }
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(tag_create_uri, token.getAccessToken()),
String.format(tag_create_uri, token.getAccessToken()),
obj.toJSONString()); obj.toJSONString());
return response.getAsJson().getIntValue("tagid"); return response.getAsJson().getIntValue("tagid");
} }
@ -68,8 +70,7 @@ public class TagApi extends QyApi {
public JsonResult updateTag(Tag tag) throws WeixinException { public JsonResult updateTag(Tag tag) throws WeixinException {
String tag_update_uri = getRequestUri("tag_update_uri"); String tag_update_uri = getRequestUri("tag_update_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(tag_update_uri, token.getAccessToken()),
String.format(tag_update_uri, token.getAccessToken()),
JSON.toJSONString(tag)); JSON.toJSONString(tag));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
@ -80,23 +81,24 @@ public class TagApi extends QyApi {
* @param tagId * @param tagId
* 标签ID * 标签ID
* @return 处理结果 * @return 处理结果
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE">删除标签说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE">
* 删除标签说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult deleteTag(int tagId) throws WeixinException { public JsonResult deleteTag(int tagId) throws WeixinException {
String tag_delete_uri = getRequestUri("tag_delete_uri"); String tag_delete_uri = getRequestUri("tag_delete_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( WeixinResponse response = weixinExecutor.get(String.format(tag_delete_uri, token.getAccessToken(), tagId));
tag_delete_uri, token.getAccessToken(), tagId));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
/** /**
* 获取标签列表 * 获取标签列表
* *
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E5.88.97.E8.A1.A8">获取标签列表说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E5.88.97.E8.A1.A8">
* 获取标签列表说明</a>
* @return 标签列表 * @return 标签列表
* @see com.foxinmy.weixin4j.qy.model.Tag * @see com.foxinmy.weixin4j.qy.model.Tag
* @throws WeixinException * @throws WeixinException
@ -104,10 +106,8 @@ public class TagApi extends QyApi {
public List<Tag> listTag() throws WeixinException { public List<Tag> listTag() throws WeixinException {
String tag_list_uri = getRequestUri("tag_list_uri"); String tag_list_uri = getRequestUri("tag_list_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format(tag_list_uri, WeixinResponse response = weixinExecutor.get(String.format(tag_list_uri, token.getAccessToken()));
token.getAccessToken())); return JSON.parseArray(response.getAsJson().getString("taglist"), Tag.class);
return JSON.parseArray(response.getAsJson().getString("taglist"),
Tag.class);
} }
/** /**
@ -116,69 +116,72 @@ public class TagApi extends QyApi {
* @param tagId * @param tagId
* 标签ID * 标签ID
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">获取标签成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
* 获取标签成员说明</a>
* @return 成员列表 * @return 成员列表
* @throws WeixinException * @throws WeixinException
*/ */
public List<User> getTagUsers(int tagId) throws WeixinException { public List<User> getTagUsers(int tagId) throws WeixinException {
String tag_get_user_uri = getRequestUri("tag_get_user_uri"); String tag_get_user_uri = getRequestUri("tag_get_user_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( WeixinResponse response = weixinExecutor.get(String.format(tag_get_user_uri, token.getAccessToken(), tagId));
tag_get_user_uri, token.getAccessToken(), tagId)); return JSON.parseArray(response.getAsJson().getString("userlist"), User.class);
return JSON.parseArray(response.getAsJson().getString("userlist"),
User.class);
} }
/** /**
* 新增标签成员(标签对管理组可见且未加锁成员属于管理组管辖范围)<br> * 新增标签成员(标签对管理组可见且未加锁成员属于管理组管辖范围)<br>
* <font color="red">若部分userid非法则在text中体现</font> * <font color="red">若部分userid或partyid非法则在text中体现</font>
* *
* @param tagId * @param tagId
* 标签ID * 标签ID
* @param userIds * @param userIds
* 成员ID * 企业成员ID列表注意userlistpartylist不能同时为空单次请求长度不超过1000
* @see <a * @param partyIds
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.A2.9E.E5.8A.A0.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">新增标签成员说明</a> * 企业部门ID列表注意userlistpartylist不能同时为空单次请求长度不超过100
* @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.A2.9E.E5.8A.A0.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
* 新增标签成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult addTagUsers(int tagId, List<String> userIds) public JsonResult addTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException {
throws WeixinException {
String tag_add_user_uri = getRequestUri("tag_add_user_uri"); String tag_add_user_uri = getRequestUri("tag_add_user_uri");
return excuteUsers(tag_add_user_uri, tagId, userIds); return excuteUsers(tag_add_user_uri, tagId, userIds, partyIds);
} }
/** /**
* 删除标签成员(标签对管理组未加锁成员属于管理组管辖范围)<br> * 删除标签成员(标签对管理组未加锁成员属于管理组管辖范围)<br>
* <font color="red">若部分userid非法则在text中体现</font> * <font color="red">若部分userid或partyid非法则在text中体现</font>
* *
* @param tagId * @param tagId
* 标签ID * 标签ID
* @param userIds * @param userIds
* 成员ID * 企业成员ID列表注意userlistpartylist不能同时为空
* @see <a * @param partyIds
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">删除标签成员说明</a> * 企业部门ID列表注意userlistpartylist不能同时为空
* @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.A0.E9.99.A4.E6.A0.87.E7.AD.BE.E6.88.90.E5.91.98">
* 删除标签成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult deleteTagUsers(int tagId, List<String> userIds) public JsonResult deleteTagUsers(int tagId, List<String> userIds, List<Integer> partyIds) throws WeixinException {
throws WeixinException {
String tag_delete_user_uri = getRequestUri("tag_delete_user_uri"); String tag_delete_user_uri = getRequestUri("tag_delete_user_uri");
return excuteUsers(tag_delete_user_uri, tagId, userIds); return excuteUsers(tag_delete_user_uri, tagId, userIds, partyIds);
} }
private JsonResult excuteUsers(String uri, int tagId, List<String> userIds) private JsonResult excuteUsers(String uri, int tagId, List<String> userIds, List<Integer> partyIds)
throws WeixinException { throws WeixinException {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("tagid", tagId); obj.put("tagid", tagId);
obj.put("userlist", userIds); obj.put("userlist", userIds);
obj.put("partylist", partyIds);
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(uri, token.getAccessToken()), obj.toJSONString());
String.format(uri, token.getAccessToken()), obj.toJSONString());
obj = response.getAsJson(); obj = response.getAsJson();
JsonResult result = JSON.toJavaObject(obj, JsonResult.class); int code = obj.getIntValue("errcode");
result.setText(obj.getString("invalidlist")); obj.remove("errcode");
return result; return new JsonResult(code, obj.remove("errmsg").toString(), obj.toJSONString());
} }
} }

View File

@ -25,8 +25,9 @@ import com.foxinmy.weixin4j.token.TokenHolder;
* @date 2014年11月19日 * @date 2014年11月19日
* @since JDK 1.7 * @since JDK 1.7
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98">管理成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98">
* 管理成员说明</a>
*/ */
public class UserApi extends QyApi { public class UserApi extends QyApi {
private final MediaApi mediaApi; private final MediaApi mediaApi;
@ -43,8 +44,9 @@ public class UserApi extends QyApi {
* @param user * @param user
* 成员对象 * 成员对象
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">创建成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">
* 创建成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
@ -61,13 +63,13 @@ public class UserApi extends QyApi {
* @param avatar * @param avatar
* 头像文件 * 头像文件
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">创建成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.9B.E5.BB.BA.E6.88.90.E5.91.98">
* 创建成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult createUser(User user, InputStream avatar) public JsonResult createUser(User user, InputStream avatar) throws WeixinException {
throws WeixinException {
String user_create_uri = getRequestUri("user_create_uri"); String user_create_uri = getRequestUri("user_create_uri");
return excute(user_create_uri, user, avatar); return excute(user_create_uri, user, avatar);
} }
@ -78,8 +80,9 @@ public class UserApi extends QyApi {
* @param user * @param user
* 成员对象 * 成员对象
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">更新成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">
* 更新成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
@ -96,19 +99,18 @@ public class UserApi extends QyApi {
* @param avatar * @param avatar
* 头像文件 * 头像文件
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">更新成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E6.9B.B4.E6.96.B0.E6.88.90.E5.91.98">
* 更新成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult updateUser(User user, InputStream avatar) public JsonResult updateUser(User user, InputStream avatar) throws WeixinException {
throws WeixinException {
String user_update_uri = getRequestUri("user_update_uri"); String user_update_uri = getRequestUri("user_update_uri");
return excute(user_update_uri, user, avatar); return excute(user_update_uri, user, avatar);
} }
private JsonResult excute(String uri, User user, InputStream avatar) private JsonResult excute(String uri, User user, InputStream avatar) throws WeixinException {
throws WeixinException {
JSONObject obj = (JSONObject) JSON.toJSON(user); JSONObject obj = (JSONObject) JSON.toJSON(user);
Object val = obj.remove("extattr"); Object val = obj.remove("extattr");
if (val != null) { if (val != null) {
@ -126,8 +128,7 @@ public class UserApi extends QyApi {
obj.put("avatar_mediaid", obj.remove("avatar")); obj.put("avatar_mediaid", obj.remove("avatar"));
} }
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(uri, token.getAccessToken()), obj.toJSONString());
String.format(uri, token.getAccessToken()), obj.toJSONString());
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
@ -137,16 +138,16 @@ public class UserApi extends QyApi {
* @param userid * @param userid
* 成员唯一ID * 成员唯一ID
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E6.88.90.E5.91.98">获取成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E6.88.90.E5.91.98">
* 获取成员说明</a>
* @return 成员对象 * @return 成员对象
* @throws WeixinException * @throws WeixinException
*/ */
public User getUser(String userid) throws WeixinException { public User getUser(String userid) throws WeixinException {
String user_get_uri = getRequestUri("user_get_uri"); String user_get_uri = getRequestUri("user_get_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( WeixinResponse response = weixinExecutor.get(String.format(user_get_uri, token.getAccessToken(), userid));
user_get_uri, token.getAccessToken(), userid));
JSONObject obj = response.getAsJson(); JSONObject obj = response.getAsJson();
Object attrs = obj.getJSONObject("extattr").remove("attrs"); Object attrs = obj.getJSONObject("extattr").remove("attrs");
if (attrs != null) { if (attrs != null) {
@ -164,10 +165,12 @@ public class UserApi extends QyApi {
* @return 成员对象 * @return 成员对象
* @see {@link #getUser(String)} * @see {@link #getUser(String)}
* @see {@link #getUserIdByCode(String,int)} * @see {@link #getUserIdByCode(String,int)}
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">企业获取code</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">
* @see <a * 企业获取code</a>
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">根据code获取成员信息</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">
* 根据code获取成员信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public User getUserByCode(String code) throws WeixinException { public User getUserByCode(String code) throws WeixinException {
@ -182,16 +185,15 @@ public class UserApi extends QyApi {
* @param authCode * @param authCode
* oauth2.0授权企业号管理员登录产生的code * oauth2.0授权企业号管理员登录产生的code
* @return 登陆信息 * @return 登陆信息
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E7%AE%A1%E7%90%86%E5%91%98%E7%99%BB%E5%BD%95%E4%BF%A1%E6%81%AF">授权获取企业号管理员登录信息</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E4%BC%81%E4%B8%9A%E7%AE%A1%E7%90%86%E5%91%98%E7%99%BB%E5%BD%95%E4%BF%A1%E6%81%AF">
* 授权获取企业号管理员登录信息</a>
* @see com.foxinmy.weixin4j.qy.model.OUserInfo * @see com.foxinmy.weixin4j.qy.model.OUserInfo
* @throws WeixinException * @throws WeixinException
*/ */
public OUserInfo getOUserInfoByCode(String providerToken, String authCode) public OUserInfo getOUserInfoByCode(String providerToken, String authCode) throws WeixinException {
throws WeixinException {
String oauth_logininfo_uri = getRequestUri("oauth_logininfo_uri"); String oauth_logininfo_uri = getRequestUri("oauth_logininfo_uri");
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(oauth_logininfo_uri, providerToken),
String.format(oauth_logininfo_uri, providerToken),
String.format("{\"auth_code\":\"%s\"}", authCode)); String.format("{\"auth_code\":\"%s\"}", authCode));
return JSON.parseObject(response.getAsString(), OUserInfo.class); return JSON.parseObject(response.getAsString(), OUserInfo.class);
} }
@ -202,17 +204,18 @@ public class UserApi extends QyApi {
* @param code * @param code
* 通过员工授权获取到的code每次员工授权带上的code将不一样code只能使用一次5分钟未被使用自动过期 * 通过员工授权获取到的code每次员工授权带上的code将不一样code只能使用一次5分钟未被使用自动过期
* @return { "UserId":"USERID", "DeviceId":"DEVICEID" } * @return { "UserId":"USERID", "DeviceId":"DEVICEID" }
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/indexo.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">企业获取code</a> * "http://qydev.weixin.qq.com/wiki/indexo.php?title=%E4%BC%81%E4%B8%9A%E8%8E%B7%E5%8F%96code">
* @see <a * 企业获取code</a>
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">根据code获取成员信息</a> * @see <a href=
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E6%A0%B9%E6%8D%AEcode%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF">
* 根据code获取成员信息</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JSONObject getUserIdByCode(String code) throws WeixinException { public JSONObject getUserIdByCode(String code) throws WeixinException {
String user_getid_uri = getRequestUri("user_getid_uri"); String user_getid_uri = getRequestUri("user_getid_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( WeixinResponse response = weixinExecutor.get(String.format(user_getid_uri, token.getAccessToken(), code));
user_getid_uri, token.getAccessToken(), code));
return response.getAsJson(); return response.getAsJson();
} }
@ -224,23 +227,25 @@ public class UserApi extends QyApi {
* @param fetchChild * @param fetchChild
* 是否递归获取子部门下面的成员 非必须 * 是否递归获取子部门下面的成员 非必须
* @param userStatus * @param userStatus
* 成员状态 status可叠加 非必须 * 成员状态 status可叠加 非必须 未填写则默认为未关注(4)
* @param findDetail * @param findDetail
* 是否获取详细信息 * 是否获取详细信息
* @see com.foxinmy.weixin4j.qy.model.User * @see com.foxinmy.weixin4j.qy.model.User
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98">获取部门成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98">
* 获取部门成员说明</a>
* @return 成员列表 * @return 成员列表
* @throws WeixinException * @throws WeixinException
*/ */
public List<User> listUser(int departId, boolean fetchChild, public List<User> listUser(int departId, boolean fetchChild, UserStatus userStatus, boolean findDetail)
UserStatus userStatus, boolean findDetail) throws WeixinException { throws WeixinException {
String user_list_uri = findDetail ? getRequestUri("user_list_uri") String user_list_uri = findDetail ? getRequestUri("user_list_uri") : getRequestUri("user_slist_uri");
: getRequestUri("user_slist_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( if (userStatus == null) {
user_list_uri, token.getAccessToken(), departId, fetchChild ? 1 userStatus = UserStatus.UNFOLLOW;
: 0, userStatus.getVal())); }
WeixinResponse response = weixinExecutor.get(String.format(user_list_uri, token.getAccessToken(), departId,
fetchChild ? 1 : 0, userStatus.getVal()));
List<User> list = null; List<User> list = null;
if (findDetail) { if (findDetail) {
JSONArray arrays = response.getAsJson().getJSONArray("userlist"); JSONArray arrays = response.getAsJson().getJSONArray("userlist");
@ -255,8 +260,7 @@ public class UserApi extends QyApi {
list.add(JSON.toJavaObject(obj, User.class)); list.add(JSON.toJavaObject(obj, User.class));
} }
} else { } else {
list = JSON.parseArray(response.getAsJson().getString("userlist"), list = JSON.parseArray(response.getAsJson().getString("userlist"), User.class);
User.class);
} }
return list; return list;
} }
@ -279,16 +283,16 @@ public class UserApi extends QyApi {
* *
* @param userid * @param userid
* 成员ID * 成员ID
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.A0.E9.99.A4.E6.88.90.E5.91.98">删除成员说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E5.88.A0.E9.99.A4.E6.88.90.E5.91.98">
* 删除成员说明</a>
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult deleteUser(String userid) throws WeixinException { public JsonResult deleteUser(String userid) throws WeixinException {
String user_delete_uri = getRequestUri("user_delete_uri"); String user_delete_uri = getRequestUri("user_delete_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( WeixinResponse response = weixinExecutor.get(String.format(user_delete_uri, token.getAccessToken(), userid));
user_delete_uri, token.getAccessToken(), userid));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
@ -303,14 +307,13 @@ public class UserApi extends QyApi {
* @return 处理结果 * @return 处理结果
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult batchDeleteUser(List<String> userIds) public JsonResult batchDeleteUser(List<String> userIds) throws WeixinException {
throws WeixinException {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("useridlist", userIds); obj.put("useridlist", userIds);
String user_delete_uri = getRequestUri("user_batchdelete_uri"); String user_delete_uri = getRequestUri("user_batchdelete_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.post(String.format( WeixinResponse response = weixinExecutor
user_delete_uri, token.getAccessToken(), obj.toJSONString())); .post(String.format(user_delete_uri, token.getAccessToken(), obj.toJSONString()));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
@ -320,15 +323,15 @@ public class UserApi extends QyApi {
* @param userid * @param userid
* 成员ID * 成员ID
* @return 调用结果 * @return 调用结果
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%85%B3%E6%B3%A8%E4%B8%8E%E5%8F%96%E6%B6%88%E5%85%B3%E6%B3%A8">二次验证说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%85%B3%E6%B3%A8%E4%B8%8E%E5%8F%96%E6%B6%88%E5%85%B3%E6%B3%A8">
* 二次验证说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public JsonResult authsucc(String userId) throws WeixinException { public JsonResult authsucc(String userId) throws WeixinException {
String user_authsucc_uri = getRequestUri("user_authsucc_uri"); String user_authsucc_uri = getRequestUri("user_authsucc_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.get(String.format( WeixinResponse response = weixinExecutor.get(String.format(user_authsucc_uri, token.getAccessToken(), userId));
user_authsucc_uri, token.getAccessToken(), userId));
return response.getAsJsonResult(); return response.getAsJsonResult();
} }
@ -340,19 +343,18 @@ public class UserApi extends QyApi {
* @param tips * @param tips
* 推送到微信上的提示语只有认证号可以使用当使用微信推送时该字段默认为请关注XXX企业号邮件邀请时该字段无效 * 推送到微信上的提示语只有认证号可以使用当使用微信推送时该字段默认为请关注XXX企业号邮件邀请时该字段无效
* @return 邀请类型 * @return 邀请类型
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">邀请成员关注说明</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%88%90%E5%91%98#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8">
* 邀请成员关注说明</a>
* @throws WeixinException * @throws WeixinException
*/ */
public InviteType inviteUser(String userId, String tips) public InviteType inviteUser(String userId, String tips) throws WeixinException {
throws WeixinException {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("userid", userId); obj.put("userid", userId);
obj.put("invite_tips", tips); obj.put("invite_tips", tips);
String invite_user_uri = getRequestUri("invite_user_uri"); String invite_user_uri = getRequestUri("invite_user_uri");
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(invite_user_uri, token.getAccessToken()),
String.format(invite_user_uri, token.getAccessToken()),
obj.toJSONString()); obj.toJSONString());
int type = response.getAsJson().getIntValue("type"); int type = response.getAsJson().getIntValue("type");
if (type == 1) { if (type == 1) {
@ -374,19 +376,18 @@ public class UserApi extends QyApi {
* 需要发送红包的应用ID若只是使用微信支付和企业转账则无需该参数 传入0或负数则忽略 * 需要发送红包的应用ID若只是使用微信支付和企业转账则无需该参数 传入0或负数则忽略
* @return 结果数组 第一个元素为对应的openid 第二个元素则为应用的appid(如果有) * @return 结果数组 第一个元素为对应的openid 第二个元素则为应用的appid(如果有)
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">userid转换成openid</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">
* userid转换成openid</a>
*/ */
public String[] userid2openid(String userid, int agentid) public String[] userid2openid(String userid, int agentid) throws WeixinException {
throws WeixinException {
JSONObject obj = new JSONObject(); JSONObject obj = new JSONObject();
obj.put("userid", userid); obj.put("userid", userid);
if (agentid > 0) { if (agentid > 0) {
obj.put("agentid", agentid); obj.put("agentid", agentid);
} }
String userid2openid_uri = getRequestUri("userid2openid_uri"); String userid2openid_uri = getRequestUri("userid2openid_uri");
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(userid2openid_uri, tokenHolder.getAccessToken()),
String.format(userid2openid_uri, tokenHolder.getAccessToken()),
obj.toJSONString()); obj.toJSONString());
obj = response.getAsJson(); obj = response.getAsJson();
return new String[] { obj.getString("openid"), obj.getString("appid") }; return new String[] { obj.getString("openid"), obj.getString("appid") };
@ -400,13 +401,13 @@ public class UserApi extends QyApi {
* 在使用微信支付微信红包和企业转账之后返回结果的openid * 在使用微信支付微信红包和企业转账之后返回结果的openid
* @return 该openid在企业号中对应的成员userid * @return 该openid在企业号中对应的成员userid
* @throws WeixinException * @throws WeixinException
* @see <a * @see <a href=
* href="http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">openid转换成userid</a> * "http://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3">
* openid转换成userid</a>
*/ */
public String openid2userid(String openid) throws WeixinException { public String openid2userid(String openid) throws WeixinException {
String openid2userid_uri = getRequestUri("openid2userid_uri"); String openid2userid_uri = getRequestUri("openid2userid_uri");
WeixinResponse response = weixinExecutor.post( WeixinResponse response = weixinExecutor.post(String.format(openid2userid_uri, tokenHolder.getAccessToken()),
String.format(openid2userid_uri, tokenHolder.getAccessToken()),
String.format("{\"openid\": \"%s\"}", openid)); String.format("{\"openid\": \"%s\"}", openid));
return response.getAsJson().getString("userid"); return response.getAsJson().getString("userid");
} }

View File

@ -51,13 +51,13 @@ public class TagTest extends TokenTest {
@Test @Test
public void addUsers() throws WeixinException { public void addUsers() throws WeixinException {
JsonResult result = tagApi.addTagUsers(1, Arrays.asList("jinyu")); JsonResult result = tagApi.addTagUsers(1, Arrays.asList("jinyu"), null);
Assert.assertEquals("ok", result.getDesc()); Assert.assertEquals("ok", result.getDesc());
} }
@Test @Test
public void deleteUsers() throws WeixinException { public void deleteUsers() throws WeixinException {
JsonResult result = tagApi.deleteTagUsers(1, Arrays.asList("jinyu")); JsonResult result = tagApi.deleteTagUsers(1, Arrays.asList("jinyu"), null);
Assert.assertEquals("ok", result.getDesc()); Assert.assertEquals("ok", result.getDesc());
System.out.println(result); System.out.println(result);
} }

View File

@ -30,3 +30,4 @@ target/*
Thumbs.db Thumbs.db
/target/ /target/
.DS_Store .DS_Store
/target/