Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
work2
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢春璐
work2
Commits
fd5e1071
Commit
fd5e1071
authored
6 years ago
by
谢春璐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加解析钉钉打卡记录
parent
2d6c5e36
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
13 deletions
+76
-13
src/main/java/com/zanchina/check/controller/FileController.java
+5
-1
src/main/java/com/zanchina/check/service/FileService.java
+2
-0
src/main/java/com/zanchina/check/service/impl/FileServiceImpl.java
+46
-1
src/main/resources/static/index.html
+23
-11
No files found.
src/main/java/com/zanchina/check/controller/FileController.java
View file @
fd5e1071
...
...
@@ -50,7 +50,8 @@ public class FileController {
List
<
Staff
>
staffList
=
new
ArrayList
<>();
files
=
files
.
stream
().
filter
(
f
->
StringUtils
.
isNotBlank
(
f
.
getOriginalFilename
())).
collect
(
Collectors
.
toList
());
files
=
files
.
stream
().
filter
(
f
->
StringUtils
.
isNotBlank
(
f
.
getOriginalFilename
()))
.
collect
(
Collectors
.
toList
());
files
.
forEach
(
file
->
{
try
{
...
...
@@ -68,6 +69,9 @@ public class FileController {
}
else
if
(
fileName
.
contains
(
"考勤导出"
))
{
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
0
);
staffs
=
fileService
.
workRecord
(
data
);
}
else
if
(
fileName
.
contains
(
"钉钉签到"
))
{
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
2
);
staffs
=
fileService
.
dingdingWorkStatistics
(
data
);
}
staffList
.
addAll
(
staffs
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/zanchina/check/service/FileService.java
View file @
fd5e1071
...
...
@@ -21,4 +21,6 @@ public interface FileService {
List
<
Staff
>
workRecord
(
ExcelData
data
);
List
<
Staff
>
staffListCollect
(
List
<
Staff
>
staffList
);
List
<
Staff
>
dingdingWorkStatistics
(
ExcelData
data
);
}
This diff is collapsed.
Click to expand it.
src/main/java/com/zanchina/check/service/impl/FileServiceImpl.java
View file @
fd5e1071
...
...
@@ -167,6 +167,52 @@ public class FileServiceImpl implements FileService {
}
/**
* 钉钉考勤记录处理
*/
@Override
public
List
<
Staff
>
dingdingWorkStatistics
(
ExcelData
data
)
{
//1. 拿到数据后根据姓名和日期分组
Map
<
String
,
Map
<
String
,
List
<
String
[]>>>
map
=
data
.
getDatas
().
stream
()
.
collect
(
Collectors
.
groupingBy
(
d
->
d
[
0
],
Collectors
.
groupingBy
(
d
->
d
[
4
])));
//2. 取出最大时间和最小时间,计算考勤状态,生成workcheck
List
<
Staff
>
staffList
=
new
ArrayList
<>();
map
.
entrySet
().
forEach
(
entry
->
{
Staff
staff
=
new
Staff
();
staff
.
setName
(
entry
.
getKey
());
entry
.
getValue
().
entrySet
().
forEach
(
entry2
->
{
List
<
Date
>
dateList
=
entry2
.
getValue
().
stream
().
map
(
e
->
DateUtils
.
parseDate
(
e
[
4
].
concat
(
" "
).
concat
(
e
[
5
])))
.
collect
(
Collectors
.
toList
());
WorkCheck
workCheck
=
new
WorkCheck
();
workCheck
.
setDate
(
entry2
.
getKey
());
// 上班时间算一天当中最小的时间
Date
minDate
=
dateList
.
stream
().
min
(
Comparator
.
comparing
(
d
->
d
.
getTime
())).
get
();
workCheck
.
setOnTime
(
DateUtils
.
formatDate
(
minDate
,
DateUtils
.
yyyyMMddHHmm
));
//下班时间算一天当中最大的时间
Date
maxDate
=
dateList
.
stream
().
max
(
Comparator
.
comparing
(
d
->
d
.
getTime
())).
get
();
workCheck
.
setOffTime
(
DateUtils
.
formatDate
(
maxDate
,
DateUtils
.
yyyyMMddHHmm
));
workCheck
.
setState
(
caculateWorkState
(
workCheck
));
staff
.
getWorkCheckList
().
add
(
workCheck
);
});
staff
.
getWorkCheckList
().
sort
(
Comparator
.
comparing
(
WorkCheck:
:
getDate
));
staffList
.
add
(
staff
);
});
return
staffList
;
}
/**
* 计算出勤状态(迟到、早退、迟到和早退、正常)
*/
private
String
caculateWorkState
(
WorkCheck
workCheck
)
{
...
...
@@ -336,7 +382,6 @@ public class FileServiceImpl implements FileService {
}
}
}
}
datas
.
add
(
d
);
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/static/index.html
View file @
fd5e1071
...
...
@@ -10,19 +10,31 @@
<body>
<form
enctype=
"multipart/form-data"
method=
"post"
action=
"/upload"
>
<div
class=
"container"
style=
"padding-top: 20%;"
>
<h4>
上传文件类型支持:1 .打卡机导出表 2 .企业微信上下班打卡记录 3 .企业微信外出打卡记录
</h4>
<p></p>
<div
class=
"container"
style=
"padding-top: 10%;"
>
<div
class=
"row align-items-center"
>
<div
class=
"col"
>
<p>
文件1:
<input
type=
"file"
name=
"file"
/></p>
<p>
文件2:
<input
type=
"file"
name=
"file"
/></p>
<p>
文件3:
<input
type=
"file"
name=
"file"
/></p>
</div>
<div
class=
"col"
>
<table
class=
"table table-bordered"
>
<tbody>
<tr>
<th
scope=
"row"
>
打卡机考勤记录:
</th>
<td><input
type=
"file"
name=
"file"
/></td>
</tr>
<tr>
<th
scope=
"row"
>
企业微信上下班打卡记录:
</th>
<td><input
type=
"file"
name=
"file"
/></td>
</tr>
<tr>
<th
scope=
"row"
>
企业微信外出打卡记录:
</th>
<td><input
type=
"file"
name=
"file"
/></td>
</tr>
<tr>
<th
scope=
"row"
>
钉钉打卡记录:
</th>
<td><input
type=
"file"
name=
"file"
/></td>
</tr>
</tbody>
</table>
<button
type=
"submit"
class=
"btn btn-outline-primary btn-lg btn-block"
>
生成考勤记录
</button>
</div>
</div>
</div>
</form>
...
...
This diff is collapsed.
Click to expand it.
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