Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
d1b17ea7
Commit
d1b17ea7
authored
Oct 08, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-count-vehicle' into base-modify
parents
8fd1d17c
c8646562
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
9 deletions
+28
-9
VehicleCountRecordBiz.java
.../com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
+24
-7
VehicleCountRecordController.java
...c/platform/vehicle/rest/VehicleCountRecordController.java
+4
-2
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
View file @
d1b17ea7
...
@@ -24,12 +24,11 @@ import org.joda.time.format.DateTimeFormat;
...
@@ -24,12 +24,11 @@ import org.joda.time.format.DateTimeFormat;
import
org.joda.time.format.DateTimeFormatter
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.FileNotFoundException
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.FileOutputStream
;
import
java.io.*
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -87,6 +86,7 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
...
@@ -87,6 +86,7 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
*
*
* @return
* @return
*/
*/
@Scheduled
(
cron
=
"59 59 23 * * ?"
)
public
void
addAll
()
{
public
void
addAll
()
{
Long
nowTime
=
getDayStart
();
Long
nowTime
=
getDayStart
();
Long
lastTime
=
nowTime
+
24
*
3600
*
1000
-
1
;
Long
lastTime
=
nowTime
+
24
*
3600
*
1000
-
1
;
...
@@ -362,14 +362,31 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
...
@@ -362,14 +362,31 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
}
}
}
}
public
void
export
(
ExcelParamDto
excelParamDto
)
{
public
void
export
(
HttpServletResponse
response
,
ExcelParamDto
excelParamDto
)
{
ExcelExport
ee1
=
new
ExcelExport
();
ExcelExport
ee1
=
new
ExcelExport
();
ee1
.
addSheetByArray
(
excelParamDto
.
getName
(),
excelParamDto
.
getData
(),
excelParamDto
.
getHeader
());
ee1
.
addSheetByArray
(
excelParamDto
.
getName
(),
excelParamDto
.
getData
(),
excelParamDto
.
getHeader
());
OutputStream
fis
;
OutputStream
fis
;
try
{
try
{
fis
=
new
FileOutputStream
(
"D:\\"
+
excelParamDto
.
getName
()
+
".xlsx"
);
fis
=
new
FileOutputStream
(
"/data/temp/"
+
excelParamDto
.
getName
()
+
".xlsx"
);
ee1
.
getWorkbook
().
write
(
fis
);
ee1
.
getWorkbook
().
write
(
fis
);
// 下载本地文件
String
fileName
=
excelParamDto
.
getName
()
+
".xlsx"
;
// 文件的默认保存名
// 读到流中
InputStream
inStream
=
new
FileInputStream
(
"d:/"
+
fileName
);
// 文件的存放路径
// 设置输出的格式
response
.
reset
();
response
.
setContentType
(
"bin"
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment; filename=\""
+
fileName
+
"\""
);
// 循环取出流中的数据
byte
[]
b
=
new
byte
[
100
];
int
len
;
try
{
while
((
len
=
inStream
.
read
(
b
))
>
0
)
response
.
getOutputStream
().
write
(
b
,
0
,
len
);
inStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleCountRecordController.java
View file @
d1b17ea7
...
@@ -7,6 +7,8 @@ import com.xxfc.platform.vehicle.pojo.ExcelParamDto;
...
@@ -7,6 +7,8 @@ import com.xxfc.platform.vehicle.pojo.ExcelParamDto;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
@RestController
@RestController
@RequestMapping
(
value
=
"/vehicleCount"
)
@RequestMapping
(
value
=
"/vehicleCount"
)
public
class
VehicleCountRecordController
{
public
class
VehicleCountRecordController
{
...
@@ -26,8 +28,8 @@ public class VehicleCountRecordController {
...
@@ -26,8 +28,8 @@ public class VehicleCountRecordController {
}
}
@PostMapping
(
"/app/unauth/export"
)
@PostMapping
(
"/app/unauth/export"
)
public
ObjectRestResponse
export
(
@RequestBody
ExcelParamDto
excelParamDto
)
{
public
ObjectRestResponse
export
(
HttpServletResponse
response
,
@RequestBody
ExcelParamDto
excelParamDto
)
{
vehicleCountRecordBiz
.
export
(
excelParamDto
);
vehicleCountRecordBiz
.
export
(
response
,
excelParamDto
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
}
}
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