Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4b2bcbc6
authored
May 18, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
开发试驾数据
1 parent
74a30ef2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
26 deletions
src/main/java/cn/com/glsx/admin/modules/controller/EffectiveTestDriveReportController.java
src/main/java/cn/com/glsx/admin/modules/controller/EffectiveTestDriveReportController.java
View file @
4b2bcbc
...
@@ -8,6 +8,7 @@ import com.github.pagehelper.Page;
...
@@ -8,6 +8,7 @@ import com.github.pagehelper.Page;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.time.DateFormatUtils
;
import
org.apache.commons.lang.time.DateFormatUtils
;
...
@@ -16,14 +17,15 @@ import org.slf4j.LoggerFactory;
...
@@ -16,14 +17,15 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 项目名:oms-tiger-shield
* 项目名:oms-tiger-shield
...
@@ -31,18 +33,17 @@ import java.util.List;
...
@@ -31,18 +33,17 @@ import java.util.List;
* 作者: Yanglinlong
* 作者: Yanglinlong
* 日期: 2021/5/6 10:46
* 日期: 2021/5/6 10:46
*/
*/
@Slf4j
@RestController
@RestController
@RequestMapping
(
value
=
"/
report/
effectiveTestDriveReport"
)
@RequestMapping
(
value
=
"/effectiveTestDriveReport"
)
public
class
EffectiveTestDriveReportController
{
public
class
EffectiveTestDriveReportController
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EffectiveTestDriveReportController
.
class
);
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EffectiveTestDriveReportController
.
class
);
@Autowired
@Autowired
private
EffectiveTestDriveReportService
effectiveTestDriveReportService
;
private
EffectiveTestDriveReportService
effectiveTestDriveReportService
;
@GetMapping
(
"/listEffectiveTestDriveReportPage"
)
@GetMapping
(
"/list"
)
@ResponseBody
public
R
listGqWindReportPage
(
EffectiveTestDriveDTO
reportRequest
,
Page
page
)
{
public
R
listGqWindReportPage
(
EffectiveTestDriveDTO
reportRequest
,
Page
page
)
{
try
{
PageHelper
.
startPage
(
page
.
getPageNum
(),
page
.
getPageSize
(),
true
);
PageHelper
.
startPage
(
page
.
getPageNum
(),
page
.
getPageSize
(),
true
);
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
...
@@ -51,42 +52,30 @@ public class EffectiveTestDriveReportController {
...
@@ -51,42 +52,30 @@ public class EffectiveTestDriveReportController {
// 获取报表详细数据
// 获取报表详细数据
List
<
EffectiveTestDriveReportExcel
>
reportList
=
effectiveTestDriveReportService
.
listEffectiveTestDriveReportPage
(
reportRequest
,
testDrivePageList
);
List
<
EffectiveTestDriveReportExcel
>
reportList
=
effectiveTestDriveReportService
.
listEffectiveTestDriveReportPage
(
reportRequest
,
testDrivePageList
);
if
(
CollectionUtils
.
isNotEmpty
(
reportList
)
&&
CollectionUtils
.
isNotEmpty
(
testDrivePage
List
))
{
if
(
CollectionUtils
.
isNotEmpty
(
testDrivePageList
)
&&
CollectionUtils
.
isNotEmpty
(
report
List
))
{
long
total
=
((
Page
<
EffectiveTestDriveReportExcel
>)
testDrivePageList
).
getTotal
();
long
total
=
((
Page
<
EffectiveTestDriveReportExcel
>)
testDrivePageList
).
getTotal
();
return
R
.
ok
();
Map
data
=
new
HashMap
(
3
);
}
data
.
put
(
"list"
,
reportList
);
return
R
.
ok
();
data
.
put
(
"totalPages"
,
total
);
}
catch
(
Exception
e
)
{
data
.
put
(
"totalElements"
,
total
);
e
.
printStackTrace
();
return
R
.
ok
().
data
(
data
);
return
R
.
error
(
e
.
getMessage
());
}
}
return
R
.
error
();
}
}
@
RequestMapping
(
value
=
"/exportEffectiveTestDrive
Report"
)
@
GetMapping
(
value
=
"/export
Report"
)
@SysLog
(
"导出试驾车辆数据"
)
@SysLog
(
"导出试驾车辆数据"
)
public
void
exportGqWindReport
(
EffectiveTestDriveDTO
reportRequest
,
HttpServletResponse
response
)
{
public
void
exportGqWindReport
(
EffectiveTestDriveDTO
reportRequest
,
HttpServletResponse
response
)
throws
IOException
{
try
{
String
fileName
=
"有效试驾次数统计(按日"
+
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd"
)
+
")表"
;
String
fileName
=
"有效试驾次数统计(按日"
+
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd"
)
+
")表"
;
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
=
effectiveTestDriveReportService
.
getTestDrivePageList
(
reportRequest
);
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
=
effectiveTestDriveReportService
.
getTestDrivePageList
(
reportRequest
);
// 封装数据
// 封装数据
InputStream
inputStream
=
effectiveTestDriveReportService
.
exportEffectiveTestDriveReport
(
reportRequest
,
testDrivePageList
);
InputStream
inputStream
=
effectiveTestDriveReportService
.
exportEffectiveTestDriveReport
(
reportRequest
,
testDrivePageList
);
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
FileIOUtil
.
download
(
inputStream
,
FileIOUtil
.
MimeType
.
EXCEL2007
,
fileName
,
response
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"exportEffectiveTestDriveReport wrong message:"
+
e
.
getMessage
());
}
finally
{
try
{
IOUtils
.
closeQuietly
(
response
.
getOutputStream
());
IOUtils
.
closeQuietly
(
response
.
getOutputStream
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
;
}
}
@GetMapping
(
value
=
"/getYearWithData"
)
@GetMapping
(
value
=
"/getYearWithData"
)
@ResponseBody
@SysLog
(
"获取下拉选接口"
)
@SysLog
(
"获取下拉选接口"
)
public
R
getYearWithData
()
{
public
R
getYearWithData
()
{
List
<
String
>
yearList
=
effectiveTestDriveReportService
.
getYearWithData
();
List
<
String
>
yearList
=
effectiveTestDriveReportService
.
getYearWithData
();
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment