Commit c2726c0e authored by wujipeng's avatar wujipeng
Browse files

钉钉-获取子部门ID列表

parent 78ffcc9a
...@@ -33,16 +33,15 @@ public class DingAttendanceController { ...@@ -33,16 +33,15 @@ public class DingAttendanceController {
@ApiOperation(value = "获取子部门ID列表") @ApiOperation(value = "获取子部门ID列表")
@GetMapping("/child/{deptId}") @GetMapping("/child/{deptId}")
public List<Long> getChildIdList(@PathVariable String deptId) { public List<Long> getChildIdList(@PathVariable Long deptId) {
String accessToken = permissionConfig.getAccessToken(); String accessToken = permissionConfig.getAccessToken();
try { try {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsubid"); DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/v2/department/listsubid");
OapiV2DepartmentListsubidRequest req = new OapiV2DepartmentListsubidRequest(); OapiV2DepartmentListsubidRequest req = new OapiV2DepartmentListsubidRequest();
OapiV2DepartmentListsubidResponse rsp = client.execute(req, ""); req.setDeptId(deptId);
req.setDeptId(Long.valueOf(deptId)); req.setHttpMethod("POST");
Map<String, String> textParams = req.getTextParams(); OapiV2DepartmentListsubidResponse rsp = client.execute(req, accessToken);
textParams.put("access_token", accessToken);
OapiV2DepartmentListsubidResponse.DeptListSubIdResponse result = rsp.getResult(); OapiV2DepartmentListsubidResponse.DeptListSubIdResponse result = rsp.getResult();
return result.getDeptIdList(); return result.getDeptIdList();
} catch (ApiException e) { } 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