🎨 修复企业微信人事助手 getEmployeeFieldInfo 接口 userid 参数类型错误
This commit is contained in:
@@ -37,12 +37,12 @@ public interface WxCpHrService {
|
||||
* 权限说明:
|
||||
* 需要配置人事助手的secret,调用接口前需给对应成员赋予人事小助手应用的权限。
|
||||
*
|
||||
* @param userids 员工userid列表,不超过20个
|
||||
* @param fields 指定字段key列表,不填则返回全部字段
|
||||
* @param userid 员工userid
|
||||
* @param fields 指定字段key列表,不填则返回全部字段
|
||||
* @return 员工档案数据响应 wx cp hr employee field data resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(List<String> userids, List<String> fields) throws WxErrorException;
|
||||
WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(String userid, List<String> fields) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新员工档案数据.
|
||||
|
||||
@@ -39,15 +39,12 @@ public class WxCpHrServiceImpl implements WxCpHrService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(List<String> userids, List<String> fields) throws WxErrorException {
|
||||
if (userids == null || userids.isEmpty()) {
|
||||
public WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(String userid, List<String> fields) throws WxErrorException {
|
||||
if (userid == null || userid.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("userid 不能为空");
|
||||
}
|
||||
if (userids.size() > 20) {
|
||||
throw new IllegalArgumentException("userid 每次最多传入20个");
|
||||
}
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.add("userid", WxCpGsonBuilder.create().toJsonTree(userids));
|
||||
jsonObject.addProperty("userid", userid);
|
||||
if (fields != null && !fields.isEmpty()) {
|
||||
jsonObject.add("fields", WxCpGsonBuilder.create().toJsonTree(fields));
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class WxCpHrServiceImplTest {
|
||||
public void testGetEmployeeFieldInfo() throws WxErrorException {
|
||||
WxCpHrService hrService = this.wxCpService.getHrService();
|
||||
WxCpHrEmployeeFieldDataResp resp = hrService.getEmployeeFieldInfo(
|
||||
Collections.singletonList(this.configStorage.getUserId()), null);
|
||||
this.configStorage.getUserId(), null);
|
||||
assertThat(resp).isNotNull();
|
||||
assertThat(resp.getEmployeeFieldList()).isNotNull();
|
||||
log.info("获取员工档案数据: {}", resp);
|
||||
|
||||
Reference in New Issue
Block a user