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
54035d10
Commit
54035d10
authored
Aug 06, 2018
by
谢春璐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f1929307
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
9 deletions
+36
-9
src/main/java/com/zanchina/check/common/ExcelWrite.java
+1
-0
src/main/java/com/zanchina/check/controller/FileController.java
+7
-2
src/main/resources/static/index.html
+3
-0
src/test/java/com/zanchina/check/CheckApplicationTests.java
+25
-7
No files found.
src/main/java/com/zanchina/check/common/ExcelWrite.java
View file @
54035d10
...
@@ -5,6 +5,7 @@ import java.io.FileInputStream;
...
@@ -5,6 +5,7 @@ import java.io.FileInputStream;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.hssf.usermodel.HSSFCellStyle
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.poifs.filesystem.POIFSFileSystem
;
import
org.apache.poi.poifs.filesystem.POIFSFileSystem
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Cell
;
...
...
src/main/java/com/zanchina/check/controller/FileController.java
View file @
54035d10
...
@@ -10,6 +10,7 @@ import java.util.ArrayList;
...
@@ -10,6 +10,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
...
@@ -37,7 +38,7 @@ public class FileController {
...
@@ -37,7 +38,7 @@ public class FileController {
@PostMapping
(
"upload"
)
@PostMapping
(
"upload"
)
@ResponseBody
@ResponseBody
public
ResponseEntity
<
byte
[]>
uploadAndExport
(
public
ResponseEntity
<
byte
[]>
uploadAndExport
(
HttpServletRequest
request
)
{
HttpServletRequest
request
,
HttpServletResponse
response
)
{
try
{
try
{
ExcelRead
inst
=
ExcelRead
.
getInst
();
ExcelRead
inst
=
ExcelRead
.
getInst
();
...
@@ -76,7 +77,11 @@ public class FileController {
...
@@ -76,7 +77,11 @@ public class FileController {
return
fileService
.
checkExport
(
staffList1
);
return
fileService
.
checkExport
(
staffList1
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
try
{
response
.
getWriter
().
print
(
e
.
getMessage
());
}
catch
(
IOException
e2
)
{
return
null
;
}
}
}
return
null
;
return
null
;
...
...
src/main/resources/static/index.html
View file @
54035d10
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
<form
enctype=
"multipart/form-data"
method=
"post"
action=
"/upload"
>
<form
enctype=
"multipart/form-data"
method=
"post"
action=
"/upload"
>
<div
class=
"container"
style=
"padding-top: 20%;"
>
<div
class=
"container"
style=
"padding-top: 20%;"
>
<h4>
上传文件类型支持:1 .打卡机导出表 2 .企业微信上下班打卡记录 3 .企业微信外出打卡记录
</h4>
<p></p>
<div
class=
"row align-items-center"
>
<div
class=
"row align-items-center"
>
<div
class=
"col"
>
<div
class=
"col"
>
<p>
文件1:
<input
type=
"file"
name=
"file"
/></p>
<p>
文件1:
<input
type=
"file"
name=
"file"
/></p>
...
...
src/test/java/com/zanchina/check/CheckApplicationTests.java
View file @
54035d10
...
@@ -2,8 +2,12 @@ package com.zanchina.check;
...
@@ -2,8 +2,12 @@ package com.zanchina.check;
import
com.zanchina.check.common.DateUtils
;
import
com.zanchina.check.common.DateUtils
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
@@ -16,14 +20,28 @@ public class CheckApplicationTests {
...
@@ -16,14 +20,28 @@ public class CheckApplicationTests {
@Test
@Test
public
void
contextLoads
()
throws
ParseException
{
public
void
contextLoads
()
throws
ParseException
{
Date
d1
=
DateUtils
.
parseDate
(
"9:00"
,
DateUtils
.
HHmm
);
// Date d1 = DateUtils.parseDate("9:00", DateUtils.HHmm);
Date
d2
=
DateUtils
.
parseDate
(
"2018/06/19 9:00"
,
DateUtils
.
yyyyMMddHHmm1
);
// Date d2 = DateUtils.parseDate("2018/06/19 9:00", DateUtils.yyyyMMddHHmm1);
//
// List<String> allDatesOfTwoDate = DateUtils.getAllDatesOfTwoDate("2018-06-30", "2018-07-15");
//
// Date date = DateUtils.parseDate("2018-07-31".concat(" ").concat("08:55"), DateUtils.yyyyMMddHHmm);
//
// System.out.print(date);
List
<
String
>
strings
=
new
ArrayList
<>();
strings
.
add
(
"b1"
);
strings
.
add
(
"c"
);
strings
.
add
(
"a1"
);
strings
.
add
(
"b1"
);
strings
.
add
(
"a1"
);
strings
.
add
(
"b2"
);
strings
.
add
(
"a2"
);
System
.
out
.
print
(
strings
);
strings
.
sort
(
Comparator
.
comparing
(
s
->
s
));
System
.
out
.
print
(
strings
);
List
<
String
>
allDatesOfTwoDate
=
DateUtils
.
getAllDatesOfTwoDate
(
"2018-06-30"
,
"2018-07-15"
);
Date
date
=
DateUtils
.
parseDate
(
"2018-07-31"
.
concat
(
" "
).
concat
(
"08:55"
),
DateUtils
.
yyyyMMddHHmm
);
System
.
out
.
print
(
date
);
}
}
}
}
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