Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dd_school
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqi
dd_school
Commits
65d46f7a
Commit
65d46f7a
authored
Nov 20, 2023
by
xuwenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增获取钉钉用户打卡请假记录
parent
251a8886
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
181 additions
and
2 deletions
+181
-2
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+13
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/teacher/SchoolTeacherLeaveController.java
+2
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/mapper/teacher/SchoolTeacherMapper.java
+5
-0
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/teacher/SchoolTeacherLeaveServiceImpl.java
+4
-0
smart-campus/src/main/java/yangtz/cs/liu/dingding/controller/dingClock/DingClockController.java
+35
-0
smart-campus/src/main/java/yangtz/cs/liu/dingding/service/dingClock/IDingClockService.java
+8
-0
smart-campus/src/main/java/yangtz/cs/liu/dingding/service/impl/dingClock/DingClockServiceImpl.java
+0
-0
smart-campus/src/main/java/yangtz/cs/liu/dingding/utils/DingClockUtils.java
+105
-0
smart-campus/src/main/resources/mapper/teacher/SchoolTeacherLeaveMapper.xml
+2
-2
smart-campus/src/main/resources/mapper/teacher/SchoolTeacherMapper.xml
+7
-0
No files found.
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
View file @
65d46f7a
...
@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
yangtz.cs.liu.dingding.controller.DingJiaXiaoController
;
import
yangtz.cs.liu.dingding.controller.DingJiaXiaoController
;
import
yangtz.cs.liu.dingding.controller.dingClock.DingClockController
;
import
yangtz.cs.liu.dingding.controller.dingDept.DdDeptController
;
import
yangtz.cs.liu.dingding.controller.dingDept.DdDeptController
;
import
yangtz.cs.liu.dingding.controller.dingUser.DingUserController
;
import
yangtz.cs.liu.dingding.controller.dingUser.DingUserController
;
...
@@ -21,6 +22,8 @@ public class RyTask
...
@@ -21,6 +22,8 @@ public class RyTask
DdDeptController
ddDeptController
;
DdDeptController
ddDeptController
;
@Autowired
@Autowired
DingUserController
dingUserController
;
DingUserController
dingUserController
;
@Autowired
DingClockController
dingClockController
;
public
void
ryMultipleParams
(
String
s
,
Boolean
b
,
Long
l
,
Double
d
,
Integer
i
)
public
void
ryMultipleParams
(
String
s
,
Boolean
b
,
Long
l
,
Double
d
,
Integer
i
)
{
{
...
@@ -57,4 +60,14 @@ public class RyTask
...
@@ -57,4 +60,14 @@ public class RyTask
dingUserController
.
syncDdUser
();
dingUserController
.
syncDdUser
();
}
}
//获取钉钉用户一周内打卡记录
public
void
getListRecord
(){
dingClockController
.
getListRecord
();
}
//获取钉钉用户一周内请假记录
public
void
getTeacherLeave
(){
dingClockController
.
getTeacherLeave
();
}
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/controller/teacher/SchoolTeacherLeaveController.java
View file @
65d46f7a
...
@@ -140,10 +140,12 @@ public class SchoolTeacherLeaveController extends BaseController {
...
@@ -140,10 +140,12 @@ public class SchoolTeacherLeaveController extends BaseController {
SchoolTeacherLeave
leave
=
schoolTeacherLeaveService
.
getById
(
id
);
SchoolTeacherLeave
leave
=
schoolTeacherLeaveService
.
getById
(
id
);
TeacherLeaveVO
vo
=
new
TeacherLeaveVO
();
TeacherLeaveVO
vo
=
new
TeacherLeaveVO
();
BeanUtils
.
copyProperties
(
leave
,
vo
);
BeanUtils
.
copyProperties
(
leave
,
vo
);
if
(
StringUtils
.
isNotEmpty
(
leave
.
getApplyType
())){
if
(!
leave
.
getApplyType
().
equals
(
TYPE
)){
if
(!
leave
.
getApplyType
().
equals
(
TYPE
)){
String
dayCourse
=
HolidayDateUtil
.
dayCourse
(
leave
.
getTotalTime
());
String
dayCourse
=
HolidayDateUtil
.
dayCourse
(
leave
.
getTotalTime
());
vo
.
setDayCourse
(
dayCourse
);
vo
.
setDayCourse
(
dayCourse
);
}
}
}
return
AjaxResult
.
success
(
vo
);
return
AjaxResult
.
success
(
vo
);
}
}
...
...
smart-campus/src/main/java/yangtz/cs/liu/campus/mapper/teacher/SchoolTeacherMapper.java
View file @
65d46f7a
...
@@ -124,4 +124,9 @@ public interface SchoolTeacherMapper extends BaseMapper<SchoolTeacher>{
...
@@ -124,4 +124,9 @@ public interface SchoolTeacherMapper extends BaseMapper<SchoolTeacher>{
* 根据userId 查询 unionId
* 根据userId 查询 unionId
*/
*/
String
getUnionIdByUserId
(
Long
userId
);
String
getUnionIdByUserId
(
Long
userId
);
/**
* 获取打卡教师列表
*/
List
<
SchoolTeacher
>
selectClockTeacher
();
}
}
smart-campus/src/main/java/yangtz/cs/liu/campus/service/impl/teacher/SchoolTeacherLeaveServiceImpl.java
View file @
65d46f7a
...
@@ -129,6 +129,10 @@ public class SchoolTeacherLeaveServiceImpl extends ServiceImpl<SchoolTeacherLeav
...
@@ -129,6 +129,10 @@ public class SchoolTeacherLeaveServiceImpl extends ServiceImpl<SchoolTeacherLeav
}
else
{
}
else
{
leave
.
setTaskName
(
"未启动"
);
leave
.
setTaskName
(
"未启动"
);
}
}
//判断是否是从钉钉获取到的请假申请(钉钉获取的请假申请没有请假原因)
if
(
StringUtils
.
isEmpty
(
leave
.
getReasonForLeave
())){
leave
.
setTaskName
(
"已结束"
);
}
}
}
return
teacherLeaveVO
;
return
teacherLeaveVO
;
}
}
...
...
smart-campus/src/main/java/yangtz/cs/liu/dingding/controller/dingClock/DingClockController.java
0 → 100644
View file @
65d46f7a
package
yangtz
.
cs
.
liu
.
dingding
.
controller
.
dingClock
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
yangtz.cs.liu.dingding.service.dingClock.IDingClockService
;
/**
* 钉钉用户打卡记录
*/
@RestController
@RequestMapping
(
"/dd/school/clock"
)
public
class
DingClockController
{
@Autowired
private
IDingClockService
dingClockService
;
/**
* 获取全部用户一周内打卡记录
*/
@PostMapping
(
"/getListRecord"
)
public
AjaxResult
getListRecord
(){
return
AjaxResult
.
success
(
dingClockService
.
getListRecord
());
}
/**
* 获取全部用户一周内请假记
*/
@PostMapping
(
"/getTeacherLeave"
)
public
AjaxResult
getTeacherLeave
(){
return
AjaxResult
.
success
(
dingClockService
.
getTeacherLeave
());
}
}
smart-campus/src/main/java/yangtz/cs/liu/dingding/service/dingClock/IDingClockService.java
0 → 100644
View file @
65d46f7a
package
yangtz
.
cs
.
liu
.
dingding
.
service
.
dingClock
;
public
interface
IDingClockService
{
String
getListRecord
();
String
getTeacherLeave
();
}
smart-campus/src/main/java/yangtz/cs/liu/dingding/service/impl/dingClock/DingClockServiceImpl.java
0 → 100644
View file @
65d46f7a
This diff is collapsed.
Click to expand it.
smart-campus/src/main/java/yangtz/cs/liu/dingding/utils/DingClockUtils.java
0 → 100644
View file @
65d46f7a
package
yangtz
.
cs
.
liu
.
dingding
.
utils
;
import
com.dingtalk.api.DefaultDingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiAttendanceGetleavestatusRequest
;
import
com.dingtalk.api.request.OapiAttendanceGetupdatedataRequest
;
import
com.dingtalk.api.request.OapiAttendanceListRecordRequest
;
import
com.dingtalk.api.response.OapiAttendanceGetleavestatusResponse
;
import
com.dingtalk.api.response.OapiAttendanceGetupdatedataResponse
;
import
com.dingtalk.api.response.OapiAttendanceListRecordResponse
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.taobao.api.ApiException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* 考勤
*/
@Component
public
class
DingClockUtils
{
@Autowired
private
AccessTokenUtils
accessTokenUtils
;
/**
* 查询打卡记录详情
* @param userIds 企业内的员工ID列表,最大值50。
* @param checkDateFrom 查询考勤打卡记录的起始工作日 格式为:yyyy-MM-dd hh:mm:ss
* @param checkDateTo 查询考勤打卡记录的结束工作日 格式为:yyyy-MM-dd hh:mm:ss
* @param isI18n 是否为海外企业使用 true:海外平台使用 false(默认):国内平台使用
* @return
*/
public
List
<
OapiAttendanceListRecordResponse
.
Recordresult
>
listRecord
(
List
<
String
>
userIds
,
String
checkDateFrom
,
String
checkDateTo
,
Boolean
isI18n
){
//获取access_token
String
token
=
accessTokenUtils
.
getToken
();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/attendance/listRecord"
);
OapiAttendanceListRecordRequest
req
=
new
OapiAttendanceListRecordRequest
();
req
.
setUserIds
(
userIds
);
req
.
setCheckDateFrom
(
checkDateFrom
);
req
.
setCheckDateTo
(
checkDateTo
);
req
.
setIsI18n
(
isI18n
);
OapiAttendanceListRecordResponse
rsp
=
client
.
execute
(
req
,
token
);
return
rsp
.
getRecordresult
();
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
return
new
ArrayList
<>();
}
/**
* 获取用户考勤数据 获取指定用户当天的考勤数据 可获取用户的考勤数据,包括打卡流水记录、打卡结果和审批列表等
* @param userId 用户的userId
* @param workDate 查询日期
* @return
*/
public
OapiAttendanceGetupdatedataResponse
.
AtCheckInfoForOpenVo
getupdatedata
(
String
userId
,
Date
workDate
){
//获取access_token
String
token
=
accessTokenUtils
.
getToken
();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/topapi/attendance/getupdatedata"
);
OapiAttendanceGetupdatedataRequest
req
=
new
OapiAttendanceGetupdatedataRequest
();
req
.
setUserid
(
userId
);
req
.
setWorkDate
(
workDate
);
OapiAttendanceGetupdatedataResponse
rsp
=
client
.
execute
(
req
,
token
);
return
rsp
.
getResult
();
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
return
new
OapiAttendanceGetupdatedataResponse
.
AtCheckInfoForOpenVo
();
}
/**
* 查询请假状态 查询指定企业下指定用户在指定时间段内每天的请假状态和请假时长信息
* @param userIds 待查询用户的ID列表,每次最多100个
* @param startTime 开始时间 ,Unix时间戳,支持最多180天的查询
* @param endTime 结束时间,Unix时间戳,支持最多180天的查询
* @param offSet 支持分页查询,与size参数同时设置时才生效,此参数代表偏移量,偏移量从0开始
* @param size 支持分页查询,与offset参数同时设置时才生效,此参数代表分页大小,最大20
*/
public
OapiAttendanceGetleavestatusResponse
.
LeaveStatusListVO
getleavestatus
(
String
userIds
,
Long
startTime
,
Long
endTime
,
Long
offSet
,
Long
size
){
//获取access_token
String
token
=
accessTokenUtils
.
getToken
();
try
{
DingTalkClient
client
=
new
DefaultDingTalkClient
(
"https://oapi.dingtalk.com/topapi/attendance/getleavestatus"
);
OapiAttendanceGetleavestatusRequest
req
=
new
OapiAttendanceGetleavestatusRequest
();
req
.
setUseridList
(
userIds
);
req
.
setStartTime
(
startTime
);
req
.
setEndTime
(
endTime
);
req
.
setOffset
(
offSet
);
req
.
setSize
(
size
);
OapiAttendanceGetleavestatusResponse
rsp
=
client
.
execute
(
req
,
token
);
return
rsp
.
getResult
();
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
}
return
new
OapiAttendanceGetleavestatusResponse
.
LeaveStatusListVO
();
}
}
smart-campus/src/main/resources/mapper/teacher/SchoolTeacherLeaveMapper.xml
View file @
65d46f7a
...
@@ -58,10 +58,10 @@
...
@@ -58,10 +58,10 @@
<![CDATA[and date_format( start_time,'%Y-%m-%d') <= date_format( #{entity.endTime},'%Y-%m-%d')]]>
<![CDATA[and date_format( start_time,'%Y-%m-%d') <= date_format( #{entity.endTime},'%Y-%m-%d')]]>
</if>
</if>
<if
test=
"submitState == 0"
>
<if
test=
"submitState == 0"
>
and instance_id is null
and instance_id is n
ot n
ull
</if>
</if>
<if
test=
"submitState == 1"
>
<if
test=
"submitState == 1"
>
and instance_id is n
ot n
ull
and instance_id is null
</if>
</if>
and del_flag = '0'
and del_flag = '0'
</where>
</where>
...
...
smart-campus/src/main/resources/mapper/teacher/SchoolTeacherMapper.xml
View file @
65d46f7a
...
@@ -47,6 +47,13 @@
...
@@ -47,6 +47,13 @@
from school_teacher
from school_teacher
</sql>
</sql>
<select
id=
"selectClockTeacher"
resultMap=
"SchoolTeacherResult"
>
select t.id, t.device_num, t.teacher_name, t.teacher_tel, t.teacher_code, t.id_card, t.home_address, t.nation, t.pic_url,
t.birthday, t.education, t.sex, t.dd_user_id, t.union_id, t.create_by, t.create_time, t.update_by, t.update_time
from school_teacher t
where t.id != 1
</select>
<select
id=
"selectSchoolTeacherList"
resultType=
"com.ruoyi.common.core.domain.entity.SchoolTeacher"
>
<select
id=
"selectSchoolTeacherList"
resultType=
"com.ruoyi.common.core.domain.entity.SchoolTeacher"
>
select t.id,t.device_num,t.teacher_name, t.teacher_tel, t.teacher_code, t.id_card, t.home_address, t.nation, t.pic_url, t.birthday,
select t.id,t.device_num,t.teacher_name, t.teacher_tel, t.teacher_code, t.id_card, t.home_address, t.nation, t.pic_url, t.birthday,
t.education, t.sex,u.dept_id,d.dept_name,u.status,u.sign,u.avatar,u.employee_type
t.education, t.sex,u.dept_id,d.dept_name,u.status,u.sign,u.avatar,u.employee_type
...
...
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