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
d4f2d24b
Commit
d4f2d24b
authored
Feb 28, 2025
by
wujipeng
Browse files
优化
parent
79153234
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/ruzhoukj/sms/controller/DingAttendanceController.java
View file @
d4f2d24b
...
...
@@ -13,14 +13,12 @@ import com.ruzhoukj.sms.service.DingAttendanceService;
import
com.taobao.api.ApiException
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.checkerframework.checker.nullness.qual.Nullable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -55,12 +53,12 @@ public class DingAttendanceController {
List
<
DingAttendanceVO
>
data
=
Lists
.
newArrayList
();
rsp
.
getRecordresult
().
forEach
(
recordresult
->
{
data
.
add
(
DingAttendanceVO
.
builder
()
.
userId
(
recordresult
.
getUserId
())
.
userAddress
(
recordresult
.
getUserAddress
())
.
userCheckTime
(
recordresult
.
getUserCheckTime
())
.
timeResult
(
recordresult
.
getTimeResult
())
.
checkType
(
recordresult
.
getCheckType
())
.
sourceType
(
recordresult
.
getSourceType
())
.
userId
(
recordresult
.
getUserId
())
.
userAddress
(
recordresult
.
getUserAddress
())
.
userCheckTime
(
recordresult
.
getUserCheckTime
())
.
timeResult
(
recordresult
.
getTimeResult
())
.
checkType
(
recordresult
.
getCheckType
())
.
sourceType
(
recordresult
.
getSourceType
())
.
build
());
});
...
...
src/main/resources/com/ruzhoukj/sms/dao/DingAttendanceDao.xml
View file @
d4f2d24b
...
...
@@ -6,21 +6,24 @@
<select
id=
"getSyncData"
resultType=
"com.ruzhoukj.sms.model.vo.DingAttendanceVO"
>
SELECT min.id,
min.name,
min.user_id as userId,
min.user_id
as userId,
MIN(min.user_check_time) AS checkTimeOn,
MAX(max.offduty_max_time) AS checkTimeOff,
min.user_address as userAddress,
min.time_result as timeResult
,
min.user_address
as userAddress,
min.time_result
as timeResult
FROM ding_attendance min
LEFT JOIN (SELECT user_id,
MAX(user_check_time) AS offduty_max_time
FROM ding_attendance
WHERE user_check_time BETWEEN #{checkDateFrom} AND #{checkDateTo}
AND check_type = 'OffDuty'
GROUP BY user_id -- 按 user_id 分组
) max ON min.user_id = max.user_id
WHERE min.user_check_time BETWEEN #{checkDateFrom} AND #{checkDateTo}
AND check_type = 'OffDuty'
GROUP BY user_id -- 按 user_id 分组
) max
ON min.user_id = max.user_id
WHERE min.user_check_time BETWEEN #{checkDateFrom}
AND #{checkDateTo}
AND min.check_type = 'OnDuty'
GROUP BY min.id, min.name, min.user_id, min.user_address, min.time_result;
GROUP BY min.id, min.name, min.user_id, min.user_address, min.time_result, min.user_check_time
order by min.user_check_time
</select>
</mapper>
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