Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
ops
Commits
6d24a84e
Commit
6d24a84e
authored
Feb 28, 2025
by
wujipeng
Browse files
钉钉-获取子部门ID列表
parent
0cd4136b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/controller/DingAttendanceController.java
View file @
6d24a84e
package
com.ruzhoukj.sms.controller
;
package
com.ruzhoukj.sms.controller
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiV2DepartmentListsubidRequest
;
import
com.dingtalk.api.response.OapiV2DepartmentListsubidResponse
;
import
com.ruzhoukj.sms.ding.PermissionConfig
;
import
com.taobao.api.ApiException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author : wujipeng
* @author : wujipeng
* @date : 2025/2/28 10:00
* @date : 2025/2/28 10:00
* @Version: 1.0
* @Version: 1.0
* @Desc : 钉钉考勤管理
* @Desc : 钉钉考勤管理
*/
*/
@Api
(
tags
=
"钉钉考勤管理"
)
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"/ding/attendance"
)
@RequestMapping
(
"/ding/attendance"
)
public
class
DingAttendanceController
{
public
class
DingAttendanceController
{
@Resource
private
PermissionConfig
permissionConfig
;
@ApiOperation
(
value
=
"获取子部门ID列表"
)
@GetMapping
(
"/child"
)
public
List
<
Long
>
getDeptTree
(
String
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
);
OapiV2DepartmentListsubidResponse
.
DeptListSubIdResponse
result
=
rsp
.
getResult
();
return
result
.
getDeptIdList
();
}
catch
(
ApiException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
}
src/main/java/com/ruzhoukj/sms/controller/DingDeptController.java
0 → 100644
View file @
6d24a84e
package
com.ruzhoukj.sms.controller
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author : wujipeng
* @date : 2025/2/28 10:34
* @Version: 1.0
* @Desc : 钉钉部门管理
*/
@Api
(
tags
=
"钉钉部门管理"
)
@RestController
@RequestMapping
(
"/ding/dept"
)
public
class
DingDeptController
{
}
src/main/java/com/ruzhoukj/sms/controller/DingEmployeeController.java
View file @
6d24a84e
...
@@ -22,6 +22,7 @@ import java.util.Map;
...
@@ -22,6 +22,7 @@ import java.util.Map;
* @Version: 1.0
* @Version: 1.0
* @Desc : 钉钉员工管理
* @Desc : 钉钉员工管理
*/
*/
@Api
(
tags
=
"钉钉员工管理"
)
@RestController
@RestController
@RequestMapping
(
"/ding/employee"
)
@RequestMapping
(
"/ding/employee"
)
public
class
DingEmployeeController
{
public
class
DingEmployeeController
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment