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
e425a3f2
Commit
e425a3f2
authored
Dec 18, 2023
by
廖旭伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
5cd0c10a
f992d4c3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
233 additions
and
167 deletions
+233
-167
attendance-performance-manager-ui/admin/src/assets/utils/index.js
...ce-performance-manager-ui/admin/src/assets/utils/index.js
+151
-136
attendance-performance-manager-ui/admin/src/views/attendance/record/list.vue
...nce-manager-ui/admin/src/views/attendance/record/list.vue
+52
-20
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
...tendance/service/impl/AttendanceRecordHikServiceImpl.java
+30
-11
No files found.
attendance-performance-manager-ui/admin/src/assets/utils/index.js
View file @
e425a3f2
This diff is collapsed.
Click to expand it.
attendance-performance-manager-ui/admin/src/views/attendance/record/list.vue
View file @
e425a3f2
...
...
@@ -335,8 +335,6 @@ export default {
},
/** 导出Excel */
doExport
()
{
this
.
isExport
=
true
;
this
.
progress
=
true
;
let
params
=
{};
for
(
let
value
of
this
.
config
.
search
)
{
if
(
this
.
query
[
value
.
name
])
{
...
...
@@ -349,25 +347,59 @@ export default {
if
(
this
.
checkList
.
length
>
0
)
{
params
[
"
properties
"
]
=
this
.
checkList
;
}
this
.
$download
(
"
/attendance/record/exportExcel
"
,
{
...
params
,
},
{
type
:
"
excel
"
}
)
.
then
(()
=>
{
this
.
percent
=
100
;
this
.
progress
=
false
;
this
.
isExport
=
false
;
this
.
checkList
=
[];
})
.
catch
((
error
)
=>
{
this
.
progress
=
false
;
let
flag
=
this
.
checkDate
(
params
.
attendanceDateStart
,
params
.
attendanceDateEnd
,
1
);
if
(
!
flag
)
{
this
.
isExport
=
true
;
this
.
isExport
=
false
;
this
.
$message
.
error
(
error
.
message
);
});
this
.
progress
=
true
;
this
.
$download
(
"
/attendance/record/exportExcel
"
,
{
...
params
,
},
{
type
:
"
excel
"
}
)
.
then
((
res
)
=>
{
this
.
percent
=
100
;
this
.
progress
=
false
;
this
.
isExport
=
false
;
this
.
checkList
=
[];
})
.
catch
((
error
)
=>
{
this
.
percent
=
100
;
this
.
progress
=
false
;
this
.
isExport
=
false
;
this
.
$message
.
error
(
error
.
message
);
});
}
},
checkDate
(
startTime
,
endTime
,
compDay
)
{
if
(
startTime
==
""
||
startTime
==
null
||
startTime
==
undefined
)
{
this
.
$message
.
error
(
"
开始时间为空,请检查!
"
);
return
true
;
}
if
(
endTime
==
""
||
endTime
==
null
||
endTime
==
undefined
)
{
this
.
$message
.
error
(
"
结束时间为空,请检查!
"
);
return
true
;
}
var
data1
=
Date
.
parse
(
startTime
.
replace
(
/-/g
,
"
/
"
));
var
data2
=
Date
.
parse
(
endTime
.
replace
(
/-/g
,
"
/
"
));
var
datadiff
=
data2
-
data1
;
var
time
=
parseInt
(
compDay
)
*
(
60
*
60
*
24
*
1000
);
if
(
datadiff
<
0
)
{
this
.
$message
.
error
(
"
开始时间应小于结束时间
"
);
return
true
;
}
if
(
datadiff
>
time
)
{
this
.
$message
.
error
(
"
时间间隔大于
"
+
parseInt
(
compDay
)
+
"
天,请检查!
"
);
return
true
;
}
return
false
;
},
setdialog
()
{
this
.
isdialog
=
true
;
...
...
attendance-performance-manager/src/main/java/com/mortals/xhx/module/attendance/service/impl/AttendanceRecordHikServiceImpl.java
View file @
e425a3f2
package
com.mortals.xhx.module.attendance.service.impl
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.service.IUser
;
...
...
@@ -82,6 +83,10 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
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
));
List
<
AttendanceRecordEntity
>
saveList
=
new
ArrayList
<>();
List
<
AttendanceRecordEntity
>
updateList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Long
,
List
<
AttendanceRecordHikEntity
>>
itemEntry
:
listMap
.
entrySet
())
{
//按人员
Long
staffId
=
itemEntry
.
getKey
();
...
...
@@ -114,6 +119,9 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
//通过员工id查询考勤组人员信息
List
<
AttendanceGroupStaffEntity
>
attendanceGroupStaffEntities
=
attendanceGroupStaffService
.
find
(
new
AttendanceGroupStaffQuery
().
staffId
(
staffId
));
//过滤重复考勤组与人员
attendanceGroupStaffEntities
=
attendanceGroupStaffEntities
.
stream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getGroupId
()
+
"#"
+
x
.
getStaffId
(),
y
->
y
,
(
o
,
n
)
->
n
)).
values
().
stream
().
collect
(
Collectors
.
toList
());
List
<
AttendanceRecordDetailEntity
>
detailEntityList
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
attendanceGroupStaffEntities
)
&&
attendanceGroupStaffEntities
.
size
()
==
1
)
{
//checkAttendGroupByOne(attendanceRecordEntity, detailEntityList, attendanceDate, attendanceGroupStaffEntities.get(0), context);
...
...
@@ -137,6 +145,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
//如果考勤人员信息list长度大于1 则该考勤人员有多个考勤组.
if
(
StringUtils
.
isNotNull
(
attendanceGroupStaffEntities
)
&&
attendanceGroupStaffEntities
.
size
()
>
1
)
{
for
(
AttendanceGroupStaffEntity
groupStaffEntity
:
attendanceGroupStaffEntities
)
{
detailEntityList
=
new
ArrayList
<>();
//多考勤组 todo 暂时和单一覆盖
//checkAttendGroupByOne(attendanceRecordEntity, detailEntityList, attendanceDate, groupStaffEntity, context);
//查询考勤组
...
...
@@ -185,8 +194,8 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
//判断是否存在记录 如果存在 则更新 维度 staffId attendanceDate shiftsId attendanceGroupId
AttendanceRecordQuery
query
=
new
AttendanceRecordQuery
();
query
.
setStaffId
(
attendanceRecordEntity
.
getStaffId
());
// query.setClassId(attendanceRecordEntity.getClassId());
// query.setAttendanceGroupId(attendanceRecordEntity.getAttendanceGroupId());
// query.setClassId(attendanceRecordEntity.getClassId());
// query.setAttendanceGroupId(attendanceRecordEntity.getAttendanceGroupId());
query
.
setAttendanceDate
(
attendanceRecordEntity
.
getAttendanceDate
());
AttendanceRecordEntity
recordEntity
=
attendanceRecordService
.
selectOne
(
query
);
...
...
@@ -194,9 +203,13 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
attendanceRecordEntity
.
setId
(
recordEntity
.
getId
());
attendanceRecordEntity
.
setUpdateTime
(
new
Date
());
attendanceRecordEntity
.
setUpdateUserId
(
this
.
getContextUserId
(
context
));
attendanceRecordService
.
update
(
attendanceRecordEntity
,
context
);
updateList
.
add
(
attendanceRecordEntity
);
// attendanceRecordService.update(attendanceRecordEntity, context);
}
else
{
attendanceRecordService
.
save
(
attendanceRecordEntity
,
context
);
saveList
.
add
(
attendanceRecordEntity
);
// attendanceRecordService.save(attendanceRecordEntity, context);
}
}
...
...
@@ -204,6 +217,16 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
if
(!
ObjectUtils
.
isEmpty
(
saveList
))
{
attendanceRecordService
.
save
(
saveList
,
context
);
}
if
(!
ObjectUtils
.
isEmpty
(
updateList
))
{
List
<
List
<
AttendanceRecordEntity
>>
partition
=
ListUtil
.
partition
(
updateList
,
30
);
for
(
List
<
AttendanceRecordEntity
>
attendanceRecordEntities
:
partition
)
{
attendanceRecordService
.
update
(
attendanceRecordEntities
,
context
);
}
}
}
...
...
@@ -225,7 +248,7 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
AttendanceRecordEntity
attendanceRecordEntity
=
new
AttendanceRecordEntity
();
attendanceRecordEntity
.
initAttrValue
();
//分日期 遍历考勤记录 考勤记录一天只生成一条 详细多条
List
<
AttendanceRecordDetailEntity
>
detailEntityList
=
null
;
List
<
AttendanceRecordDetailEntity
>
detailEntityList
=
null
;
for
(
AttendanceRecordHikEntity
item
:
attendanceRecordHikEntities
)
{
detailEntityList
=
new
ArrayList
<>();
//对主表的对象进行赋值
...
...
@@ -413,7 +436,6 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
errorEntityList
.
add
(
errorEntity
);
}
...
...
@@ -427,10 +449,9 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
private
Boolean
checkDouble
(
List
<
AttendanceRecordErrorEntity
>
errorEntityList
,
AttendanceRecordErrorEntity
checkError
){
private
Boolean
checkDouble
(
List
<
AttendanceRecordErrorEntity
>
errorEntityList
,
AttendanceRecordErrorEntity
checkError
)
{
//检测 新加 的错误 是否存在与列表中
boolean
bool
=
true
;
boolean
bool
=
true
;
for
(
AttendanceRecordErrorEntity
error
:
errorEntityList
)
{
//
...
...
@@ -441,8 +462,6 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
}
return
bool
;
}
...
...
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