Commit c2726c0e authored by wujipeng's avatar wujipeng
Browse files

钉钉-获取子部门ID列表

parent 78ffcc9a
......@@ -33,16 +33,15 @@ public class DingAttendanceController {
@ApiOperation(value = "获取子部门ID列表")
@GetMapping("/child/{deptId}")
public List<Long> getChildIdList(@PathVariable String deptId) {
public List<Long> getChildIdList(@PathVariable Long deptId) {
String accessToken = permissionConfig.getAccessToken();
try {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsubid");
OapiV2DepartmentListsubidRequest req = new OapiV2DepartmentListsubidRequest();
OapiV2DepartmentListsubidResponse rsp = client.execute(req, "");
req.setDeptId(Long.valueOf(deptId));
Map<String, String> textParams = req.getTextParams();
textParams.put("access_token", accessToken);
req.setDeptId(deptId);
req.setHttpMethod("POST");
OapiV2DepartmentListsubidResponse rsp = client.execute(req, accessToken);
OapiV2DepartmentListsubidResponse.DeptListSubIdResponse result = rsp.getResult();
return result.getDeptIdList();
} catch (ApiException e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment