public interface WxCpUserService
用户管理接口 Created by BinaryWang on 2017/6/24.
| 限定符和类型 | 方法和说明 |
|---|---|
void |
authenticate(String userId)
用在二次验证的时候.
|
void |
create(WxCpUser user)
新建用户.
|
void |
delete(String... userIds)
删除用户/批量删除成员.
|
Integer |
getActiveStat(Date date)
获取企业活跃成员数。
|
WxCpUser |
getById(String userid)
获取用户.
|
WxCpExternalContactInfo |
getExternalContact(String userId)
获取外部联系人详情.
|
String |
getJoinQrCode(int sizeType)
获取加入企业二维码。
|
String |
getUserId(String mobile)
通过手机号获取其所对应的userid。
|
WxCpInviteResult |
invite(List<String> userIds,
List<String> partyIds,
List<String> tagIds)
邀请成员.
|
List<WxCpUser> |
listByDepartment(Long departId,
Boolean fetchChild,
Integer status)
获取部门成员详情
请求方式:GET(HTTPS)
请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/list?
|
List<WxCpUser> |
listSimpleByDepartment(Long departId,
Boolean fetchChild,
Integer status)
获取部门成员.
|
String |
openid2UserId(String openid)
openid转userid.
|
void |
update(WxCpUser user)
更新用户.
|
Map<String,String> |
userId2Openid(String userId,
Integer agentId)
userid转openid.
|
void authenticate(String userId) throws WxErrorException
用在二次验证的时候. 企业在员工验证成功后,调用本方法告诉企业号平台该员工关注成功。
userId - 用户idWxErrorException - the wx error exceptionList<WxCpUser> listByDepartment(Long departId, Boolean fetchChild, Integer status) throws WxErrorException
获取部门成员详情 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID&fetch_child=FETCH_CHILD 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/90201
departId - 必填。部门idfetchChild - 非必填。1/0:是否递归获取子部门下面的成员status - 非必填。0获取全部员工,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加WxErrorException - the wx error exceptionList<WxCpUser> listSimpleByDepartment(Long departId, Boolean fetchChild, Integer status) throws WxErrorException
获取部门成员. http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98
departId - 必填。部门idfetchChild - 非必填。1/0:是否递归获取子部门下面的成员status - 非必填。0获取全部员工,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加WxErrorException - the wx error exceptionvoid create(WxCpUser user) throws WxErrorException
user - 用户对象WxErrorException - the wx error exceptionvoid update(WxCpUser user) throws WxErrorException
user - 用户对象WxErrorException - the wx error exceptionvoid delete(String... userIds) throws WxErrorException
删除用户/批量删除成员. http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E6.89.B9.E9.87.8F.E5.88.A0.E9.99.A4.E6.88.90.E5.91.98
userIds - 员工UserID列表。对应管理端的帐号WxErrorException - the wx error exceptionWxCpUser getById(String userid) throws WxErrorException
userid - 用户idWxErrorException - the wx error exceptionWxCpInviteResult invite(List<String> userIds, List<String> partyIds, List<String> tagIds) throws WxErrorException
邀请成员. 企业可通过接口批量邀请成员使用企业微信,邀请后将通过短信或邮件下发通知。 请求方式:POST(HTTPS) 请求地址: https://qyapi.weixin.qq.com/cgi-bin/batch/invite?access_token=ACCESS_TOKEN 文档地址:https://work.weixin.qq.com/api/doc#12543
userIds - 成员ID列表, 最多支持1000个。partyIds - 部门ID列表,最多支持100个。tagIds - 标签ID列表,最多支持100个。WxErrorException - the wx error exceptionMap<String,String> userId2Openid(String userId, Integer agentId) throws WxErrorException
userid转openid. 该接口使用场景为微信支付、微信红包和企业转账。 在使用微信支付的功能时,需要自行将企业微信的userid转成openid。 在使用微信红包功能时,需要将应用id和userid转成appid和openid才能使用。 注:需要成员使用微信登录企业微信或者关注微信插件才能转成openid 文档地址:https://work.weixin.qq.com/api/doc#11279
userId - 企业内的成员idagentId - 非必填,整型,仅用于发红包。其它场景该参数不要填,如微信支付、企业转账、电子发票WxErrorException - the wx error exceptionString openid2UserId(String openid) throws WxErrorException
openid转userid. 该接口主要应用于使用微信支付、微信红包和企业转账之后的结果查询。 开发者需要知道某个结果事件的openid对应企业微信内成员的信息时,可以通过调用该接口进行转换查询。 权限说明: 管理组需对openid对应的企业微信成员有查看权限。 文档地址:https://work.weixin.qq.com/api/doc#11279
openid - 在使用微信支付、微信红包和企业转账之后,返回结果的openidWxErrorException - the wx error exceptionString getUserId(String mobile) throws WxErrorException
通过手机号获取其所对应的userid。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/getuserid?access_token=ACCESS_TOKEN 文档地址:https://work.weixin.qq.com/api/doc#90001/90143/91693
mobile - 手机号码。长度为5~32个字节WxErrorException - .WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException
企业可通过此接口,根据外部联系人的userid,拉取外部联系人详情。权限说明: 企业需要使用外部联系人管理secret所获取的accesstoken来调用 第三方应用需拥有“企业客户”权限。 第三方应用调用时,返回的跟进人follow_user仅包含应用可见范围之内的成员。
userId - 外部联系人的useridWxErrorException - .String getJoinQrCode(int sizeType) throws WxErrorException
获取加入企业二维码。 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/corp/get_join_qrcode?access_token=ACCESS_TOKEN&size_type=SIZE_TYPE 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/91714
sizeType - qrcode尺寸类型,1: 171 x 171; 2: 399 x 399; 3: 741 x 741; 4: 2052 x 2052WxErrorException - .Integer getActiveStat(Date date) throws WxErrorException
获取企业活跃成员数。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/get_active_stat?access_token=ACCESS_TOKEN 文档地址:https://developer.work.weixin.qq.com/document/path/92714
date - 具体某天的活跃人数,最长支持获取30天前数据WxErrorException - .Copyright © 2022. All rights reserved.