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
ed42e81f
Commit
ed42e81f
authored
6 years ago
by
谢春璐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4e2b90fd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
201 additions
and
57 deletions
+201
-57
src/main/java/com/zanchina/check/controller/FileController.java
+55
-31
src/main/java/com/zanchina/check/service/FileService.java
+6
-1
src/main/java/com/zanchina/check/service/impl/FileServiceImpl.java
+118
-18
src/main/resources/static/index.html
+22
-7
No files found.
src/main/java/com/zanchina/check/controller/FileController.java
View file @
ed42e81f
...
@@ -48,47 +48,71 @@ public class FileController {
...
@@ -48,47 +48,71 @@ public class FileController {
try
{
try
{
ExcelRead
inst
=
ExcelRead
.
getInst
();
ExcelRead
inst
=
ExcelRead
.
getInst
();
List
<
MultipartFile
>
files
=
((
MultipartHttpServletRequest
)
request
)
MultipartFile
insideFile
=
((
MultipartHttpServletRequest
)
request
).
getFile
(
"inside"
);
.
getFiles
(
"file"
);
MultipartFile
outFile
=
((
MultipartHttpServletRequest
)
request
).
getFile
(
"outside"
);
//补卡
MultipartFile
repairFile
=
((
MultipartHttpServletRequest
)
request
).
getFile
(
"repair"
);
//请假
MultipartFile
leaveFile
=
((
MultipartHttpServletRequest
)
request
).
getFile
(
"leave"
);
//加班
MultipartFile
overtimeFile
=
((
MultipartHttpServletRequest
)
request
).
getFile
(
"overtime"
);
List
<
Staff
>
staffList
=
new
ArrayList
<>();
List
<
Staff
>
staffList
=
new
ArrayList
<>();
Map
<
String
,
Set
<
String
>>
repairMap
=
new
HashMap
<>();
Map
<
String
,
Set
<
String
>>
leaveMap
=
new
HashMap
<>();
Map
<
String
,
Set
<
String
>>
overtimeMap
=
new
HashMap
<>();
Map
<
String
,
Set
<
String
>>
overtimeMap
=
new
HashMap
<>();
files
=
files
.
stream
().
filter
(
f
->
StringUtils
.
isNotBlank
(
f
.
getOriginalFilename
()))
InputStream
inputStream
;
.
collect
(
Collectors
.
toList
());
String
fileName
;
for
(
MultipartFile
file
:
files
)
{
ExcelData
data
;
try
{
List
<
Staff
>
staffs
;
InputStream
inputStream
=
file
.
getInputStream
();
try
{
String
fileName
=
file
.
getOriginalFilename
();
ExcelData
data
=
null
;
if
(
Objects
.
nonNull
(
insideFile
)
&&
StringUtils
.
isNotEmpty
(
insideFile
.
getOriginalFilename
()))
{
List
<
Staff
>
staffs
=
new
ArrayList
<>(
0
);
inputStream
=
insideFile
.
getInputStream
();
fileName
=
insideFile
.
getOriginalFilename
();
if
(
fileName
.
contains
(
"上下班打卡_日报"
))
{
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
2
);
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
2
);
staffs
=
fileService
.
wechatWorkInStatistics
(
data
);
staffs
=
fileService
.
wechatWorkInStatistics
(
data
);
}
else
if
(
fileName
.
contains
(
"外出打卡_日报"
))
{
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
2
);
staffs
=
fileService
.
wechatWorkOutStatistics
(
data
);
}
else
if
(
fileName
.
contains
(
"审批记录"
))
{
//加班
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
0
);
overtimeMap
=
fileService
.
overtimeRecord
(
data
);
}
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
);
staffList
.
addAll
(
staffs
);
}
if
(
Objects
.
nonNull
(
outFile
)
&&
StringUtils
.
isNotEmpty
(
outFile
.
getOriginalFilename
()))
{
inputStream
=
outFile
.
getInputStream
();
fileName
=
outFile
.
getOriginalFilename
();
}
catch
(
IOException
e
)
{
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
2
);
e
.
printStackTrace
();
staffs
=
fileService
.
wechatWorkOutStatistics
(
data
);
staffList
.
addAll
(
staffs
);
}
}
if
(
Objects
.
nonNull
(
repairFile
)
&&
StringUtils
.
isNotEmpty
(
repairFile
.
getOriginalFilename
()))
{
inputStream
=
repairFile
.
getInputStream
();
fileName
=
repairFile
.
getOriginalFilename
();
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
0
);
repairMap
=
fileService
.
repairRecord
(
data
);
}
if
(
Objects
.
nonNull
(
leaveFile
)
&&
StringUtils
.
isNotEmpty
(
leaveFile
.
getOriginalFilename
()))
{
inputStream
=
leaveFile
.
getInputStream
();
fileName
=
leaveFile
.
getOriginalFilename
();
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
0
);
leaveMap
=
fileService
.
leaveRecord
(
data
);
}
if
(
Objects
.
nonNull
(
overtimeFile
)
&&
StringUtils
.
isNotEmpty
(
overtimeFile
.
getOriginalFilename
()))
{
inputStream
=
overtimeFile
.
getInputStream
();
fileName
=
overtimeFile
.
getOriginalFilename
();
data
=
inst
.
parse
(
inputStream
,
fileName
,
false
,
0
);
overtimeMap
=
fileService
.
overtimeRecord
(
data
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
List
<
Staff
>
staffList1
=
fileService
.
staffListCollect
(
staffList
);
List
<
Staff
>
staffList1
=
fileService
.
staffListCollect
(
staffList
);
return
fileService
.
checkExport
(
staffList1
,
overtimeMap
);
return
fileService
.
checkExport
(
staffList1
,
overtimeMap
,
repairMap
,
leaveMap
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/zanchina/check/service/FileService.java
View file @
ed42e81f
...
@@ -16,7 +16,8 @@ import org.springframework.http.ResponseEntity;
...
@@ -16,7 +16,8 @@ import org.springframework.http.ResponseEntity;
public
interface
FileService
{
public
interface
FileService
{
ResponseEntity
<
byte
[]>
checkExport
(
List
<
Staff
>
staffList
,
Map
<
String
,
Set
<
String
>>
map
)
throws
Exception
;
ResponseEntity
<
byte
[]>
checkExport
(
List
<
Staff
>
staffList
,
Map
<
String
,
Set
<
String
>>
overtimeMap
,
Map
<
String
,
Set
<
String
>>
repairMap
,
Map
<
String
,
Set
<
String
>>
leaveMap
)
throws
Exception
;
List
<
Staff
>
wechatWorkOutStatistics
(
ExcelData
data
);
List
<
Staff
>
wechatWorkOutStatistics
(
ExcelData
data
);
...
@@ -29,4 +30,8 @@ public interface FileService {
...
@@ -29,4 +30,8 @@ public interface FileService {
List
<
Staff
>
dingdingWorkStatistics
(
ExcelData
data
);
List
<
Staff
>
dingdingWorkStatistics
(
ExcelData
data
);
Map
<
String
,
Set
<
String
>>
overtimeRecord
(
ExcelData
data
);
Map
<
String
,
Set
<
String
>>
overtimeRecord
(
ExcelData
data
);
Map
<
String
,
Set
<
String
>>
repairRecord
(
ExcelData
data
);
Map
<
String
,
Set
<
String
>>
leaveRecord
(
ExcelData
data
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/zanchina/check/service/impl/FileServiceImpl.java
View file @
ed42e81f
...
@@ -324,7 +324,8 @@ public class FileServiceImpl implements FileService {
...
@@ -324,7 +324,8 @@ public class FileServiceImpl implements FileService {
}
}
@Override
@Override
public
ResponseEntity
<
byte
[]>
checkExport
(
List
<
Staff
>
staffList
,
Map
<
String
,
Set
<
String
>>
overtimeMap
)
public
ResponseEntity
<
byte
[]>
checkExport
(
List
<
Staff
>
staffList
,
Map
<
String
,
Set
<
String
>>
overtimeMap
,
Map
<
String
,
Set
<
String
>>
repairMap
,
Map
<
String
,
Set
<
String
>>
leaveMap
)
throws
Exception
{
throws
Exception
{
ExcelData
data
=
new
ExcelData
();
ExcelData
data
=
new
ExcelData
();
...
@@ -367,7 +368,11 @@ public class FileServiceImpl implements FileService {
...
@@ -367,7 +368,11 @@ public class FileServiceImpl implements FileService {
String
[]
d
=
new
String
[
titleStrArr
.
length
];
String
[]
d
=
new
String
[
titleStrArr
.
length
];
//查看此人是否有加班数据
//查看此人是否有加班数据
Set
<
String
>
strings
=
overtimeMap
.
get
(
staff
.
getName
());
Set
<
String
>
overtimeDate
=
overtimeMap
.
get
(
staff
.
getName
());
//查看此人是否有补打卡数据
Set
<
String
>
repairDate
=
repairMap
.
get
(
staff
.
getName
());
//查看此人是否有请假数据
Set
<
String
>
leaveDate
=
leaveMap
.
get
(
staff
.
getName
());
for
(
String
title
:
titleList
)
{
for
(
String
title
:
titleList
)
{
if
(
"姓名"
.
equalsIgnoreCase
(
title
))
{
if
(
"姓名"
.
equalsIgnoreCase
(
title
))
{
...
@@ -383,10 +388,12 @@ public class FileServiceImpl implements FileService {
...
@@ -383,10 +388,12 @@ public class FileServiceImpl implements FileService {
String
today
=
title
.
substring
(
0
,
title
.
indexOf
(
"("
));
String
today
=
title
.
substring
(
0
,
title
.
indexOf
(
"("
));
String
detail
=
""
;
String
detail
=
""
;
Boolean
isOverTime
=
false
;
Boolean
isOverTime
=
false
;
Boolean
isRepair
=
false
;
Boolean
isleave
=
false
;
// 判断当天是否有加班数据
// 判断当天是否有加班数据
if
(
Objects
.
nonNull
(
strings
)
&&
!
strings
.
isEmpty
())
{
if
(
Objects
.
nonNull
(
overtimeDate
)
&&
!
overtimeDate
.
isEmpty
())
{
List
<
String
>
overtime
=
strings
.
stream
().
filter
(
s
->
s
.
equalsIgnoreCase
(
today
))
List
<
String
>
overtime
=
overtimeDate
.
stream
().
filter
(
s
->
s
.
equalsIgnoreCase
(
today
))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
if
(
Objects
.
nonNull
(
overtime
)
&&
overtime
.
size
()
>
0
)
{
if
(
Objects
.
nonNull
(
overtime
)
&&
overtime
.
size
()
>
0
)
{
...
@@ -394,6 +401,38 @@ public class FileServiceImpl implements FileService {
...
@@ -394,6 +401,38 @@ public class FileServiceImpl implements FileService {
}
}
}
}
// 判断当天是否有补打卡数据
if
(
Objects
.
nonNull
(
repairDate
)
&&
!
repairDate
.
isEmpty
())
{
List
<
String
>
repair
=
repairDate
.
stream
().
filter
(
s
->
s
.
equalsIgnoreCase
(
today
))
.
collect
(
Collectors
.
toList
());
if
(
Objects
.
nonNull
(
repair
)
&&
repair
.
size
()
>
0
)
{
isRepair
=
true
;
}
}
// 判断当天是否有请假数据
if
(
Objects
.
nonNull
(
leaveDate
)
&&
!
leaveDate
.
isEmpty
())
{
List
<
String
>
leave
=
leaveDate
.
stream
().
filter
(
s
->
s
.
equalsIgnoreCase
(
today
))
.
collect
(
Collectors
.
toList
());
if
(
Objects
.
nonNull
(
leave
)
&&
leave
.
size
()
>
0
)
{
isleave
=
true
;
}
}
if
(
isOverTime
)
{
detail
=
detail
.
concat
(
"加班"
);
}
if
(
isleave
)
{
detail
=
detail
.
concat
(
"请假"
);
}
if
(
isRepair
)
{
detail
=
detail
.
concat
(
"补打卡"
);
}
for
(
WorkCheck
check
:
staff
.
getWorkCheckList
())
{
for
(
WorkCheck
check
:
staff
.
getWorkCheckList
())
{
if
(
today
.
equalsIgnoreCase
(
if
(
today
.
equalsIgnoreCase
(
...
@@ -402,12 +441,10 @@ public class FileServiceImpl implements FileService {
...
@@ -402,12 +441,10 @@ public class FileServiceImpl implements FileService {
isExist
=
true
;
isExist
=
true
;
if
(!
isWeekend
)
{
if
(!
isWeekend
)
{
detail
=
check
.
getState
().
concat
(
","
).
concat
(
check
.
getApprove
(
));
detail
=
detail
.
concat
(
check
.
getState
().
concat
(
","
));
}
}
if
(
isOverTime
)
{
detail
.
concat
(
"加班"
);
}
d
[
index
]
=
detail
.
concat
(
"("
)
d
[
index
]
=
detail
.
concat
(
"("
)
.
concat
(
DateUtils
.
getHHmmTime
(
DateUtils
.
parseDate
(
check
.
getOnTime
()))).
concat
(
"~"
)
.
concat
(
DateUtils
.
getHHmmTime
(
DateUtils
.
parseDate
(
check
.
getOnTime
()))).
concat
(
"~"
)
...
@@ -423,15 +460,7 @@ public class FileServiceImpl implements FileService {
...
@@ -423,15 +460,7 @@ public class FileServiceImpl implements FileService {
}
}
if
(!
isExist
)
{
if
(!
isExist
)
{
if
(
isWeekend
)
{
d
[
index
]
=
detail
;
if
(
isOverTime
)
{
d
[
index
]
=
"加班"
;
}
else
{
d
[
index
]
=
"未加班"
;
}
}
else
{
d
[
index
]
=
"无记录"
;
}
}
}
}
}
}
}
...
@@ -467,7 +496,7 @@ public class FileServiceImpl implements FileService {
...
@@ -467,7 +496,7 @@ public class FileServiceImpl implements FileService {
Set
<
String
>
dateList
=
new
HashSet
<>();
Set
<
String
>
dateList
=
new
HashSet
<>();
value
.
stream
()
.
filter
(
strings
->
strings
[
9
].
equalsIgnoreCase
(
"已通过"
))
value
.
stream
()
.
forEach
(
strings1
->
{
.
forEach
(
strings1
->
{
try
{
try
{
...
@@ -489,4 +518,75 @@ public class FileServiceImpl implements FileService {
...
@@ -489,4 +518,75 @@ public class FileServiceImpl implements FileService {
return
overtimeData
;
return
overtimeData
;
}
}
@Override
public
Map
<
String
,
Set
<
String
>>
repairRecord
(
ExcelData
data
)
{
//1. 根据员工姓名分组
Map
<
String
,
List
<
String
[]>>
map
=
data
.
getDatas
().
stream
().
collect
(
Collectors
.
groupingBy
(
d
->
d
[
2
]));
Map
<
String
,
Set
<
String
>>
repairData
=
new
HashMap
<>();
map
.
entrySet
().
forEach
(
entry
->
{
String
name
=
entry
.
getKey
();
List
<
String
[]>
value
=
entry
.
getValue
();
Set
<
String
>
dateList
=
new
HashSet
<>();
value
.
stream
()
.
forEach
(
strings1
->
{
try
{
String
date
=
DateUtils
.
formatDate
(
DateUtils
.
parseDate
(
strings1
[
6
],
DateUtils
.
yyyyMMddHHmm1
),
DateUtils
.
yyyyMMdd
);
dateList
.
add
(
date
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
repairData
.
put
(
name
,
dateList
);
});
return
repairData
;
}
@Override
public
Map
<
String
,
Set
<
String
>>
leaveRecord
(
ExcelData
data
)
{
//1. 根据员工姓名分组
Map
<
String
,
List
<
String
[]>>
map
=
data
.
getDatas
().
stream
().
collect
(
Collectors
.
groupingBy
(
d
->
d
[
2
]));
Map
<
String
,
Set
<
String
>>
leaveData
=
new
HashMap
<>();
map
.
entrySet
().
forEach
(
entry
->
{
String
name
=
entry
.
getKey
();
List
<
String
[]>
value
=
entry
.
getValue
();
Set
<
String
>
dateList
=
new
HashSet
<>();
value
.
stream
()
.
forEach
(
strings1
->
{
try
{
String
start
=
DateUtils
.
formatDate
(
DateUtils
.
parseDate
(
strings1
[
6
].
substring
(
0
,
strings1
[
6
].
lastIndexOf
(
" "
)),
DateUtils
.
yyyyMMdd1
),
DateUtils
.
yyyyMMdd
);
String
end
=
DateUtils
.
formatDate
(
DateUtils
.
parseDate
(
strings1
[
7
].
substring
(
0
,
strings1
[
7
].
lastIndexOf
(
" "
)),
DateUtils
.
yyyyMMdd1
),
DateUtils
.
yyyyMMdd
);
dateList
.
addAll
(
DateUtils
.
getAllDatesOfTwoDate
(
start
,
end
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
});
leaveData
.
put
(
name
,
dateList
);
});
return
leaveData
;
}
}
}
This diff is collapsed.
Click to expand it.
src/main/resources/static/index.html
View file @
ed42e81f
...
@@ -6,6 +6,12 @@
...
@@ -6,6 +6,12 @@
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<title>
考勤
</title>
<title>
考勤
</title>
</head>
</head>
<style>
span
{
font-size
:
larger
;
color
:
red
;
}
</style>
<body>
<body>
<form
enctype=
"multipart/form-data"
method=
"post"
action=
"/upload"
>
<form
enctype=
"multipart/form-data"
method=
"post"
action=
"/upload"
>
...
@@ -15,25 +21,34 @@
...
@@ -15,25 +21,34 @@
<tbody>
<tbody>
<tr>
<tr>
<th
scope=
"row"
>
企业微信
上下班打卡
记录:
</th>
<th
scope=
"row"
>
企业微信
<span>
上下班打卡
</span>
记录:
</th>
<td><input
type=
"file"
name=
"
fil
e"
/></td>
<td><input
type=
"file"
name=
"
insid
e"
/></td>
</tr>
</tr>
<tr>
<tr>
<th
scope=
"row"
>
企业微信
外出打卡
记录:
</th>
<th
scope=
"row"
>
企业微信
<span>
外出打卡
</span>
记录:
</th>
<td><input
type=
"file"
name=
"
fil
e"
/></td>
<td><input
type=
"file"
name=
"
outsid
e"
/></td>
</tr>
</tr>
<tr>
<tr>
<th
scope=
"row"
>
企业微信加班审批记录:
</th>
<th
scope=
"row"
>
企业微信
<span>
补打卡
</span>
审批记录:
</th>
<td><input
type=
"file"
name=
"file"
/></td>
<td><input
type=
"file"
name=
"repair"
/></td>
</tr>
<tr>
<th
scope=
"row"
>
企业微信
<span>
请假
</span>
审批记录:
</th>
<td><input
type=
"file"
name=
"leave"
/></td>
</tr>
</tr>
<tr>
<tr>
<th
scope=
"row"
>
企业微信
<span>
加班
</span>
审批记录:
</th>
<td><input
type=
"file"
name=
"overtime"
/></td>
</tr>
<!--<tr>
<th scope="row">打卡机考勤记录:</th>
<th scope="row">打卡机考勤记录:</th>
<td><input type="file" name="file"/></td>
<td><input type="file" name="file"/></td>
</tr>
</tr>
<tr>
<tr>
<th scope="row">钉钉打卡记录:</th>
<th scope="row">钉钉打卡记录:</th>
<td><input type="file" name="file"/></td>
<td><input type="file" name="file"/></td>
</tr>
</tr>
-->
</tbody>
</tbody>
</table>
</table>
...
...
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