Skip to content

Commit 3b43911

Browse files
committed
🎨 #1857 【企业微信】获取获取部门成员详情接口返回值增加第三方应用专有的open_userid字段
1 parent 9850151 commit 3b43911

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpUserService.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,24 @@ public interface WxCpUserService {
2525
* </pre>
2626
*
2727
* @param userId 用户id
28+
* @throws WxErrorException the wx error exception
2829
*/
2930
void authenticate(String userId) throws WxErrorException;
3031

3132
/**
3233
* <pre>
33-
* 获取部门成员(详情).
34+
* 获取部门成员详情
35+
* 请求方式:GET(HTTPS)
36+
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID&fetch_child=FETCH_CHILD
3437
*
35-
* 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.28.E8.AF.A6.E6.83.85.29
38+
* 文档地址:https://work.weixin.qq.com/api/doc/90000/90135/90201
3639
* </pre>
3740
*
3841
* @param departId 必填。部门id
3942
* @param fetchChild 非必填。1/0:是否递归获取子部门下面的成员
4043
* @param status 非必填。0获取全部员工,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加
44+
* @return the list
45+
* @throws WxErrorException the wx error exception
4146
*/
4247
List<WxCpUser> listByDepartment(Long departId, Boolean fetchChild, Integer status) throws WxErrorException;
4348

@@ -51,20 +56,24 @@ public interface WxCpUserService {
5156
* @param departId 必填。部门id
5257
* @param fetchChild 非必填。1/0:是否递归获取子部门下面的成员
5358
* @param status 非必填。0获取全部员工,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加
59+
* @return the list
60+
* @throws WxErrorException the wx error exception
5461
*/
5562
List<WxCpUser> listSimpleByDepartment(Long departId, Boolean fetchChild, Integer status) throws WxErrorException;
5663

5764
/**
5865
* 新建用户.
5966
*
6067
* @param user 用户对象
68+
* @throws WxErrorException the wx error exception
6169
*/
6270
void create(WxCpUser user) throws WxErrorException;
6371

6472
/**
6573
* 更新用户.
6674
*
6775
* @param user 用户对象
76+
* @throws WxErrorException the wx error exception
6877
*/
6978
void update(WxCpUser user) throws WxErrorException;
7079

@@ -75,13 +84,16 @@ public interface WxCpUserService {
7584
* </pre>
7685
*
7786
* @param userIds 员工UserID列表。对应管理端的帐号
87+
* @throws WxErrorException the wx error exception
7888
*/
7989
void delete(String... userIds) throws WxErrorException;
8090

8191
/**
8292
* 获取用户.
8393
*
8494
* @param userid 用户id
95+
* @return the by id
96+
* @throws WxErrorException the wx error exception
8597
*/
8698
WxCpUser getById(String userid) throws WxErrorException;
8799

@@ -97,6 +109,8 @@ public interface WxCpUserService {
97109
* @param userIds 成员ID列表, 最多支持1000个。
98110
* @param partyIds 部门ID列表,最多支持100个。
99111
* @param tagIds 标签ID列表,最多支持100个。
112+
* @return the wx cp invite result
113+
* @throws WxErrorException the wx error exception
100114
*/
101115
WxCpInviteResult invite(List<String> userIds, List<String> partyIds, List<String> tagIds) throws WxErrorException;
102116

@@ -114,9 +128,8 @@ public interface WxCpUserService {
114128
*
115129
* @param userId 企业内的成员id
116130
* @param agentId 非必填,整型,仅用于发红包。其它场景该参数不要填,如微信支付、企业转账、电子发票
117-
* @return map对象,可能包含以下值:
118-
* - openid 企业微信成员userid对应的openid,若有传参agentid,则是针对该agentid的openid。否则是针对企业微信corpid的openid
119-
* - appid 应用的appid,若请求包中不包含agentid则不返回appid。该appid在使用微信红包时会用到
131+
* @return map对象 ,可能包含以下值: - openid 企业微信成员userid对应的openid,若有传参agentid,则是针对该agentid的openid。否则是针对企业微信corpid的openid - appid 应用的appid,若请求包中不包含agentid则不返回appid。该appid在使用微信红包时会用到
132+
* @throws WxErrorException the wx error exception
120133
*/
121134
Map<String, String> userId2Openid(String userId, Integer agentId) throws WxErrorException;
122135

@@ -134,6 +147,7 @@ public interface WxCpUserService {
134147
*
135148
* @param openid 在使用微信支付、微信红包和企业转账之后,返回结果的openid
136149
* @return userid 该openid在企业微信对应的成员userid
150+
* @throws WxErrorException the wx error exception
137151
*/
138152
String openid2UserId(String openid) throws WxErrorException;
139153

@@ -149,7 +163,7 @@ public interface WxCpUserService {
149163
* </pre>
150164
*
151165
* @param mobile 手机号码。长度为5~32个字节
152-
* @return userid mobile对应的成员userid
166+
* @return userid mobile对应的成员userid
153167
* @throws WxErrorException .
154168
*/
155169
String getUserId(String mobile) throws WxErrorException;
@@ -164,7 +178,7 @@ public interface WxCpUserService {
164178
* </pre>
165179
*
166180
* @param userId 外部联系人的userid
167-
* @return 联系人详情
181+
* @return 联系人详情 external contact
168182
* @throws WxErrorException .
169183
*/
170184
WxCpExternalContactInfo getExternalContact(String userId) throws WxErrorException;

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpUser.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public class WxCpUser implements Serializable {
3333
private String avatar;
3434
private String thumbAvatar;
3535
private String mainDepartment;
36+
/**
37+
* 全局唯一。对于同一个服务商,不同应用获取到企业内同一个成员的open_userid是相同的,最多64个字节。仅第三方应用可获取
38+
*/
39+
private String openUserId;
3640

3741
/**
3842
* 地址。长度最大128个字符

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/util/json/WxCpUserGsonAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public WxCpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationC
8686
user.setTelephone(GsonHelper.getString(o, "telephone"));
8787
user.setQrCode(GsonHelper.getString(o, "qr_code"));
8888
user.setToInvite(GsonHelper.getBoolean(o, "to_invite"));
89+
user.setOpenUserId(GsonHelper.getString(o, "open_userid"));
8990
user.setMainDepartment(GsonHelper.getString(o, "main_department"));
9091

9192
if (GsonHelper.isNotNull(o.get(EXTRA_ATTR))) {

0 commit comments

Comments
 (0)