🎨 #3925 【企业微信】修复HR助手getEmployeeFieldInfo接口getAll参数问题
This commit is contained in:
@@ -9,9 +9,9 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 人事助手相关接口.
|
||||
* 官方文档:https://developer.work.weixin.qq.com/document/path/99132
|
||||
* 官方文档:<a href="https://developer.work.weixin.qq.com/document/path/99132">...</a>
|
||||
*
|
||||
* @author <a href="https://github.com/leejoker">leejoker</a> created on 2024-01-01
|
||||
* @author copilot
|
||||
*/
|
||||
public interface WxCpHrService {
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface WxCpHrService {
|
||||
* 获取员工档案字段信息.
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/hr/get_fields?access_token=ACCESS_TOKEN
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/hr/get_fields?access_token=ACCESS_TOKEN">...</a>
|
||||
* 权限说明:
|
||||
* 需要配置人事助手的secret,调用接口前需给对应成员赋予人事小助手应用的权限。
|
||||
*
|
||||
@@ -33,22 +33,30 @@ public interface WxCpHrService {
|
||||
* 获取员工档案数据.
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/hr/get_staff_info?access_token=ACCESS_TOKEN
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/hr/get_staff_info?access_token=ACCESS_TOKEN">...</a>
|
||||
* 权限说明:
|
||||
* 需要配置人事助手的secret,调用接口前需给对应成员赋予人事小助手应用的权限。
|
||||
*
|
||||
* @param userid 员工userid
|
||||
* @param fields 指定字段key列表,不填则返回全部字段
|
||||
* @param fields 指定字段key列表
|
||||
* @return 员工档案数据响应 wx cp hr employee field data resp
|
||||
* @throws WxErrorException the wx error exception
|
||||
*/
|
||||
WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(String userid, List<String> fields) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 获取员工档案数据.
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/hr/get_staff_info?access_token=ACCESS_TOKEN">...</a>
|
||||
*/
|
||||
WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(String userid, boolean getAll, List<String> fields) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 更新员工档案数据.
|
||||
* <p>
|
||||
* 请求方式:POST(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/hr/update_staff_info?access_token=ACCESS_TOKEN
|
||||
* 请求地址:<a href="https://qyapi.weixin.qq.com/cgi-bin/hr/update_staff_info?access_token=ACCESS_TOKEN">...</a>
|
||||
* 权限说明:
|
||||
* 需要配置人事助手的secret,调用接口前需给对应成员赋予人事小助手应用的权限。
|
||||
*
|
||||
|
||||
@@ -40,11 +40,17 @@ public class WxCpHrServiceImpl implements WxCpHrService {
|
||||
|
||||
@Override
|
||||
public WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(String userid, List<String> fields) throws WxErrorException {
|
||||
return getEmployeeFieldInfo(userid, false, fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxCpHrEmployeeFieldDataResp getEmployeeFieldInfo(String userid, boolean getAll, List<String> fields) throws WxErrorException {
|
||||
if (userid == null || userid.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("userid 不能为空");
|
||||
}
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("userid", userid);
|
||||
jsonObject.addProperty("get_all", getAll);
|
||||
if (fields != null && !fields.isEmpty()) {
|
||||
jsonObject.add("fields", WxCpGsonBuilder.create().toJsonTree(fields));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user