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。 | 
| String | getUserIdByEmail(String email,
                int emailType)
 通过邮箱获取其所对应的userid。 | 
| WxCpDeptUserResult | getUserListId(String cursor,
             Integer limit)获取成员ID列表
 获取企业成员的userid与对应的部门ID列表,预计于2022年8月8号发布。 | 
| 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. | 
| WxCpOpenUseridToUseridResult | openUseridToUserid(List<String> openUseridList,
                  String sourceAgentId)open_userid转换为userid
 将代开发应用或第三方应用获取的密文open_userid转换为明文userid
 
 文档地址:https://developer.work.weixin.qq.com/document/path/95884#userid%E8%BD%AC%E6%8D%A2
 权限说明:
 需要使用自建应用或基础应用的access_token
 成员需要同时在access_token和source_agentid所对应应用的可见范围内
  | 
| void | update(WxCpUser user)更新用户. | 
| Map<String,String> | userId2Openid(String userId,
             Integer agentId)
  userid转openid. | 
| WxCpUseridToOpenUseridResult | useridToOpenUserid(ArrayList<String> useridList)userid转换为open_userid
 将自建应用或代开发应用获取的userid转换为第三方应用的userid
 https://developer.work.weixin.qq.com/document/path/95603 | 
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 - .String getUserIdByEmail(String email, int emailType) throws WxErrorException
通过邮箱获取其所对应的userid。 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/get_userid_by_email?access_token=ACCESS_TOKEN 文档地址:https://developer.work.weixin.qq.com/document/path/95895
email - 邮箱emailType - 邮箱类型:1-企业邮箱;2-个人邮箱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 - .WxCpUseridToOpenUseridResult useridToOpenUserid(ArrayList<String> useridList) throws WxErrorException
useridList - the userid listWxErrorException - the wx error exceptionWxCpOpenUseridToUseridResult openUseridToUserid(List<String> openUseridList, String sourceAgentId) throws WxErrorException
文档地址:https://developer.work.weixin.qq.com/document/path/95884#userid%E8%BD%AC%E6%8D%A2 权限说明: 需要使用自建应用或基础应用的access_token 成员需要同时在access_token和source_agentid所对应应用的可见范围内
openUseridList - open_userid列表,最多不超过1000个。必须是source_agentid对应的应用所获取sourceAgentId - 企业授权的代开发自建应用或第三方应用的agentidWxErrorException - the wx error exceptionWxCpDeptUserResult getUserListId(String cursor, Integer limit) throws WxErrorException
请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/list_id?access_token=ACCESS_TOKEN
cursor - the cursorlimit - the limitWxErrorException - the wx error exceptionCopyright © 2024. All rights reserved.