Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
c8583e92
Commit
c8583e92
authored
Oct 09, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理代码
parent
0b5188d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
...tendance/service/impl/AttendanceRecordHikServiceImpl.java
+14
-3
No files found.
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
View file @
c8583e92
...
...
@@ -28,6 +28,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import
com.mortals.xhx.module.attendance.dao.AttendanceRecordHikDao
;
import
com.mortals.framework.model.Context
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
java.util.*
;
...
...
@@ -101,6 +102,9 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
public
void
addAttendanceOtherRecordList
(
List
<
AttendanceRecordHikEntity
>
hikEntityList
,
AttendanceRecordHikEntity
attendanceRecordHikQuery
,
Context
context
)
throws
Exception
{
StopWatch
stopWatch
=
new
StopWatch
(
"stopwatch stat attendance"
);
//耗时计算
stopWatch
.
start
(
"数据获取"
);
List
<
AttendanceRecordHikEntity
>
collect
=
hikEntityList
.
stream
().
sorted
(
Comparator
.
comparing
(
AttendanceRecordHikEntity:
:
getAttendanceDate
)).
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
AttendanceRecordHikEntity
>>
listMap
=
collect
.
stream
().
collect
(
Collectors
.
groupingBy
(
AttendanceRecordHikEntity:
:
getStaffId
));
Map
<
Long
,
List
<
AttendanceGroupStaffEntity
>>
groupStaffMap
=
attendanceGroupStaffService
.
find
(
new
AttendanceGroupStaffQuery
()).
parallelStream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getStaffId
()));
...
...
@@ -116,11 +120,14 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
query
.
setAttendanceDateStart
(
attendanceDateStart
);
query
.
setAttendanceDateEnd
(
attendanceDateEnd
);
Map
<
Long
,
AttendanceRecordEntity
>
staffRecordMap
=
attendanceRecordService
.
find
(
query
).
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getStaffId
(),
y
->
y
,
(
o
,
n
)
->
n
));
stopWatch
.
stop
();
log
.
info
(
"考勤数据获取耗时:{}ms"
,
stopWatch
.
getLastTaskTimeMillis
());
//获取日期
List
<
AttendanceRecordEntity
>
saveList
=
new
ArrayList
<>();
List
<
AttendanceRecordEntity
>
updateList
=
new
ArrayList
<>();
listMap
.
entrySet
().
stream
().
forEach
(
itemEntry
->
{
//按人员 todo 改为多线程并行计算
stopWatch
.
start
(
"人员计算耗时"
);
Long
staffId
=
itemEntry
.
getKey
();
List
<
AttendanceRecordHikEntity
>
recordHikEntityList
=
itemEntry
.
getValue
();
Map
<
String
,
List
<
AttendanceRecordHikEntity
>>
dateRecordMap
=
recordHikEntityList
.
stream
().
collect
(
Collectors
.
groupingBy
(
hikEntity
->
DateUtil
.
formatDate
(
hikEntity
.
getAttendanceDate
())));
...
...
@@ -242,9 +249,11 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
saveList
.
add
(
attendanceRecordEntity
);
}
}
stopWatch
.
stop
();
log
.
info
(
"考勤数据计算耗时:{}ms"
,
stopWatch
.
getLastTaskTimeMillis
());
}
});
// }
stopWatch
.
start
(
"考勤新增与更新耗时"
);
if
(!
ObjectUtils
.
isEmpty
(
saveList
))
{
log
.
info
(
"新增考勤记录数:"
+
saveList
.
size
());
attendanceRecordService
.
save
(
saveList
);
...
...
@@ -254,6 +263,8 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
log
.
info
(
"更新考勤记录数:"
+
updateList
.
size
());
attendanceRecordService
.
update
(
updateList
);
}
stopWatch
.
stop
();
log
.
info
(
"考勤数据新增与更新耗时:{}ms"
,
stopWatch
.
getLastTaskTimeMillis
());
}
public
void
addAttendanceRecordList
(
List
<
AttendanceRecordHikEntity
>
hikEntityList
,
Context
context
)
throws
Exception
{
...
...
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