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 26a30d20
authored
May 19, 2021
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
试驾报表
1 parent
7a938a17
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
139 additions
and
84 deletions
src/main/java/cn/com/glsx/admin/modules/controller/ElectricFenceController.java
src/main/java/cn/com/glsx/admin/modules/controller/EffectiveTestDriveReportController.java → src/main/java/cn/com/glsx/admin/modules/controller/TrialDriveReportController.java
src/main/java/cn/com/glsx/admin/modules/controller/TrialDriveShopController.java
src/main/java/cn/com/glsx/admin/modules/mapper/EffectiveTestDriveReportMapper.java → src/main/java/cn/com/glsx/admin/modules/mapper/TrialDriveReportMapper.java
src/main/java/cn/com/glsx/admin/modules/model/ElectricFenceSnsDTO.java
src/main/java/cn/com/glsx/admin/modules/model/ElectricFenceSnsModel.java
src/main/java/cn/com/glsx/admin/modules/model/excel/EffectiveTestDriveReportExcel.java → src/main/java/cn/com/glsx/admin/modules/model/export/TrialDriveReportExport.java
src/main/java/cn/com/glsx/admin/modules/model/param/ElectricFenceBO.java
src/main/java/cn/com/glsx/admin/modules/model/param/TrialDriveReportSearch.java
src/main/java/cn/com/glsx/admin/modules/service/EffectiveTestDriveReportService.java → src/main/java/cn/com/glsx/admin/modules/service/TrialDriveReportService.java
src/main/resources/mapper/EffectiveTestDriveReportMapper.xml → src/main/resources/mapper/TrialDriveReportMapper.xml
src/main/java/cn/com/glsx/admin/modules/controller/ElectricFenceController.java
View file @
26a30d2
...
@@ -31,12 +31,14 @@ public class ElectricFenceController {
...
@@ -31,12 +31,14 @@ public class ElectricFenceController {
@Autowired
@Autowired
private
ElectricFenceService
electricFenceService
;
private
ElectricFenceService
electricFenceService
;
@ApiOperation
(
value
=
"围栏列表查询"
)
@GetMapping
(
"/search"
)
@GetMapping
(
"/search"
)
public
R
search
(
ElectricFenceSearch
search
)
{
public
R
search
(
ElectricFenceSearch
search
)
{
PageInfo
<
ElectricFenceDTO
>
pageInfo
=
electricFenceService
.
search
(
search
);
PageInfo
<
ElectricFenceDTO
>
pageInfo
=
electricFenceService
.
search
(
search
);
return
R
.
ok
().
putPageData
(
pageInfo
);
return
R
.
ok
().
putPageData
(
pageInfo
);
}
}
@ApiOperation
(
value
=
"围栏列表导出"
)
@GetMapping
(
value
=
"/export"
)
@GetMapping
(
value
=
"/export"
)
public
void
export
(
HttpServletResponse
response
,
ElectricFenceSearch
search
)
throws
Exception
{
public
void
export
(
HttpServletResponse
response
,
ElectricFenceSearch
search
)
throws
Exception
{
List
<
ElectricFenceExport
>
list
=
electricFenceService
.
export
(
search
);
List
<
ElectricFenceExport
>
list
=
electricFenceService
.
export
(
search
);
...
...
src/main/java/cn/com/glsx/admin/modules/controller/
EffectiveTest
DriveReportController.java
→
src/main/java/cn/com/glsx/admin/modules/controller/
Trial
DriveReportController.java
View file @
26a30d2
package
cn
.
com
.
glsx
.
admin
.
modules
.
controller
;
package
cn
.
com
.
glsx
.
admin
.
modules
.
controller
;
import
cn.com.glsx.admin.modules.model.
EffectiveTestDriveDTO
;
import
cn.com.glsx.admin.modules.model.
export.TrialDriveReportExport
;
import
cn.com.glsx.admin.modules.model.
excel.EffectiveTestDriveReportExcel
;
import
cn.com.glsx.admin.modules.model.
param.TrialDriveReportSearch
;
import
cn.com.glsx.admin.modules.service.
EffectiveTest
DriveReportService
;
import
cn.com.glsx.admin.modules.service.
Trial
DriveReportService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
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
com.glsx.plat.office.excel.EasyExcelUtils
;
import
com.glsx.plat.office.excel.EasyExcelUtils
;
...
@@ -33,30 +32,30 @@ import java.util.Map;
...
@@ -33,30 +32,30 @@ import java.util.Map;
*/
*/
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
value
=
"/
effectivetest
drivereport"
)
@RequestMapping
(
value
=
"/
trial
drivereport"
)
@Api
(
value
=
"试驾报表管理"
,
tags
=
{
"试驾报表管理"
})
@Api
(
value
=
"试驾报表管理"
,
tags
=
{
"试驾报表管理"
})
public
class
EffectiveTest
DriveReportController
{
public
class
Trial
DriveReportController
{
@Autowired
@Autowired
private
EffectiveTestDriveReportService
effectiveTest
DriveReportService
;
private
TrialDriveReportService
trial
DriveReportService
;
@Autowired
@Autowired
private
HttpServletResponse
response
;
private
HttpServletResponse
response
;
@GetMapping
(
"/
list
"
)
@GetMapping
(
"/
search
"
)
@SysLog
(
"查询试驾数据"
)
@SysLog
(
"查询试驾数据"
)
@ApiOperation
(
value
=
"试驾报表查询"
)
@ApiOperation
(
value
=
"试驾报表查询"
)
public
R
listGqWindReportPage
(
EffectiveTestDriveDTO
reportRequest
,
PageInfo
page
)
{
public
R
search
(
TrialDriveReportSearch
search
)
{
PageHelper
.
startPage
(
page
.
getPageNum
(),
page
.
getPageSize
(),
true
);
PageHelper
.
startPage
(
search
.
getPageNumber
(),
search
.
getPageSize
(),
true
);
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
=
effectiveTestDriveReportService
.
getTestDrivePageList
(
reportRequest
);
List
<
TrialDriveReportExport
>
testDrivePageList
=
trialDriveReportService
.
search
(
search
);
// 获取报表详细数据
// 获取报表详细数据
List
<
EffectiveTestDriveReportExcel
>
reportList
=
effectiveTestDriveReportService
.
listEffectiveTestDriveReportPage
(
reportRequest
,
testDrivePageList
);
List
<
TrialDriveReportExport
>
reportList
=
trialDriveReportService
.
listEffectiveTestDriveReportPage
(
search
,
testDrivePageList
);
if
(
CollectionUtils
.
isNotEmpty
(
testDrivePageList
)
&&
CollectionUtils
.
isNotEmpty
(
reportList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
testDrivePageList
)
&&
CollectionUtils
.
isNotEmpty
(
reportList
))
{
long
total
=
((
Page
<
EffectiveTestDriveReportExcel
>)
testDrivePageList
).
getTotal
();
long
total
=
((
Page
<
TrialDriveReportExport
>)
testDrivePageList
).
getTotal
();
Map
data
=
new
HashMap
(
3
);
Map
data
=
new
HashMap
(
3
);
data
.
put
(
"list"
,
reportList
);
data
.
put
(
"list"
,
reportList
);
data
.
put
(
"totalPages"
,
total
);
data
.
put
(
"totalPages"
,
total
);
...
@@ -66,24 +65,24 @@ public class EffectiveTestDriveReportController {
...
@@ -66,24 +65,24 @@ public class EffectiveTestDriveReportController {
return
R
.
error
();
return
R
.
error
();
}
}
@GetMapping
(
value
=
"/export
report
"
)
@GetMapping
(
value
=
"/export"
)
@SysLog
(
"导出试驾车辆数据"
)
@SysLog
(
"导出试驾车辆数据"
)
@ApiOperation
(
value
=
"试驾报表导出"
)
@ApiOperation
(
value
=
"试驾报表导出"
)
public
void
exportGqWindReport
(
EffectiveTestDriveDTO
reportRequest
)
throws
Exception
{
public
void
exportGqWindReport
(
TrialDriveReportSearch
search
)
throws
Exception
{
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
<
TrialDriveReportExport
>
testDrivePageList
=
trialDriveReportService
.
search
(
search
);
// 封装数据
// 封装数据
List
<
EffectiveTestDriveReportExcel
>
testDriveReportExcels
=
effectiveTestDriveReportService
.
exportEffectiveTestDriveReport
(
reportRequest
,
testDrivePageList
);
List
<
TrialDriveReportExport
>
testDriveReportExcels
=
trialDriveReportService
.
exportEffectiveTestDriveReport
(
search
,
testDrivePageList
);
// 调用公用方法导出 excel表格
// 调用公用方法导出 excel表格
EasyExcelUtils
.
writeExcel
((
HttpServletResponse
)
response
.
getOutputStream
(),
testDriveReportExcels
,
fileName
,
"有效试驾次数统计(按日)表"
,
EffectiveTestDriveReportExcel
.
class
);
EasyExcelUtils
.
writeExcel
((
HttpServletResponse
)
response
.
getOutputStream
(),
testDriveReportExcels
,
fileName
,
"有效试驾次数统计(按日)表"
,
TrialDriveReportExport
.
class
);
}
}
@GetMapping
(
value
=
"/
getyearwithdata
"
)
@GetMapping
(
value
=
"/
years
"
)
@SysLog
(
"获取下拉选接口"
)
@SysLog
(
"获取下拉选接口"
)
@ApiOperation
(
value
=
"获取有试驾数据的年份"
)
@ApiOperation
(
value
=
"获取有试驾数据的年份"
)
public
R
getYearWithData
()
{
public
R
getYearWithData
()
{
List
<
String
>
yearList
=
effectiveTest
DriveReportService
.
getYearWithData
();
List
<
String
>
yearList
=
trial
DriveReportService
.
getYearWithData
();
return
R
.
ok
().
data
(
yearList
);
return
R
.
ok
().
data
(
yearList
);
}
}
}
}
src/main/java/cn/com/glsx/admin/modules/controller/TrialDriveShopController.java
View file @
26a30d2
...
@@ -31,12 +31,14 @@ public class TrialDriveShopController {
...
@@ -31,12 +31,14 @@ public class TrialDriveShopController {
@Autowired
@Autowired
private
TrialDriveShopService
trialDriveShopService
;
private
TrialDriveShopService
trialDriveShopService
;
@ApiOperation
(
value
=
"特约店列表查询"
)
@GetMapping
(
"/search"
)
@GetMapping
(
"/search"
)
public
R
search
(
TrialDriveShopSearch
search
)
{
public
R
search
(
TrialDriveShopSearch
search
)
{
PageInfo
<
TrialDriveShopDTO
>
pageInfo
=
trialDriveShopService
.
search
(
search
);
PageInfo
<
TrialDriveShopDTO
>
pageInfo
=
trialDriveShopService
.
search
(
search
);
return
R
.
ok
().
putPageData
(
pageInfo
);
return
R
.
ok
().
putPageData
(
pageInfo
);
}
}
@ApiOperation
(
value
=
"特约店列表导出"
)
@GetMapping
(
value
=
"/export"
)
@GetMapping
(
value
=
"/export"
)
public
void
export
(
HttpServletResponse
response
,
TrialDriveShopSearch
search
)
throws
Exception
{
public
void
export
(
HttpServletResponse
response
,
TrialDriveShopSearch
search
)
throws
Exception
{
List
<
TrialDriveShopExport
>
list
=
trialDriveShopService
.
export
(
search
);
List
<
TrialDriveShopExport
>
list
=
trialDriveShopService
.
export
(
search
);
...
...
src/main/java/cn/com/glsx/admin/modules/mapper/
EffectiveTest
DriveReportMapper.java
→
src/main/java/cn/com/glsx/admin/modules/mapper/
Trial
DriveReportMapper.java
View file @
26a30d2
package
cn
.
com
.
glsx
.
admin
.
modules
.
mapper
;
package
cn
.
com
.
glsx
.
admin
.
modules
.
mapper
;
import
cn.com.glsx.admin.modules.entity.ElectricFenceDrive
;
import
cn.com.glsx.admin.modules.entity.ElectricFenceDrive
;
import
cn.com.glsx.admin.modules.model.
EffectiveTestDriveDTO
;
import
cn.com.glsx.admin.modules.model.
export.TrialDriveReportExport
;
import
cn.com.glsx.admin.modules.model.
excel.EffectiveTestDriveReportExcel
;
import
cn.com.glsx.admin.modules.model.
param.TrialDriveReportSearch
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -12,11 +12,11 @@ import java.util.List;
...
@@ -12,11 +12,11 @@ import java.util.List;
* 试驾数据Mapper层
* 试驾数据Mapper层
*/
*/
@Mapper
@Mapper
public
interface
EffectiveTest
DriveReportMapper
extends
CommonBaseMapper
<
ElectricFenceDrive
>
{
public
interface
Trial
DriveReportMapper
extends
CommonBaseMapper
<
ElectricFenceDrive
>
{
List
<
EffectiveTestDriveReportExcel
>
getTestDrivePageList
(
EffectiveTestDriveDTO
reportRequest
);
List
<
TrialDriveReportExport
>
getTestDrivePageList
(
TrialDriveReportSearch
search
);
List
<
EffectiveTestDriveReportExcel
>
getEffectiveTestDriveData
(
EffectiveTestDriveDTO
reportRequest
);
List
<
TrialDriveReportExport
>
getEffectiveTestDriveData
(
TrialDriveReportSearch
search
);
List
<
String
>
getYearWithData
();
List
<
String
>
getYearWithData
();
}
}
src/main/java/cn/com/glsx/admin/modules/model/ElectricFenceSnsDTO.java
View file @
26a30d2
...
@@ -15,11 +15,4 @@ public class ElectricFenceSnsDTO extends ElectricFenceSnsModel {
...
@@ -15,11 +15,4 @@ public class ElectricFenceSnsDTO extends ElectricFenceSnsModel {
*/
*/
private
String
lat
;
private
String
lat
;
/**
* 解析地址
*/
private
String
address
;
private
String
gpsTime
;
}
}
src/main/java/cn/com/glsx/admin/modules/model/ElectricFenceSnsModel.java
View file @
26a30d2
...
@@ -23,4 +23,14 @@ public class ElectricFenceSnsModel {
...
@@ -23,4 +23,14 @@ public class ElectricFenceSnsModel {
*/
*/
private
String
userTel
;
private
String
userTel
;
/**
* gps上点时间
*/
private
String
gpsTime
;
/**
* 解析位置
*/
private
String
address
;
}
}
src/main/java/cn/com/glsx/admin/modules/model/ex
cel/EffectiveTestDriveReportExcel
.java
→
src/main/java/cn/com/glsx/admin/modules/model/ex
port/TrialDriveReportExport
.java
View file @
26a30d2
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
.
ex
cel
;
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
.
ex
port
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
...
@@ -10,7 +10,7 @@ import lombok.Data;
...
@@ -10,7 +10,7 @@ import lombok.Data;
* @Date 2021/1/19
* @Date 2021/1/19
*/
*/
@Data
@Data
public
class
EffectiveTestDriveReportExcel
{
public
class
TrialDriveReportExport
{
// 围栏Id
// 围栏Id
@ExcelIgnore
@ExcelIgnore
private
Integer
fenceId
;
private
Integer
fenceId
;
...
...
src/main/java/cn/com/glsx/admin/modules/model/param/ElectricFenceBO.java
View file @
26a30d2
...
@@ -19,9 +19,9 @@ public class ElectricFenceBO {
...
@@ -19,9 +19,9 @@ public class ElectricFenceBO {
private
Long
id
;
private
Long
id
;
/**
/**
*
栅
栏名称
*
围
栏名称
*/
*/
@NotBlank
(
message
=
"
栅
栏名称不能为空"
)
@NotBlank
(
message
=
"
围
栏名称不能为空"
)
private
String
fenceName
;
private
String
fenceName
;
/**
/**
* 围栏编号
* 围栏编号
...
@@ -31,15 +31,12 @@ public class ElectricFenceBO {
...
@@ -31,15 +31,12 @@ public class ElectricFenceBO {
* 业务围栏类型 0警情围栏,1试驾围栏
* 业务围栏类型 0警情围栏,1试驾围栏
*/
*/
private
Integer
bizFenceType
;
private
Integer
bizFenceType
;
/**
* 定位信息类型 1gps,2基站
*/
private
Integer
locationType
;
/**
/**
* 围栏形状类型 1.圆形(默认) 2.矩形 3.多边形 4.行政区域
* 围栏形状类型 1.圆形(默认) 2.矩形 3.多边形 4.行政区域
*/
*/
private
Integer
shapeType
;
private
Integer
shapeType
;
/**
/**
* 半径(米)
* 半径(米)
*/
*/
...
...
src/main/java/cn/com/glsx/admin/modules/model/param/TrialDriveReportSearch.java
0 → 100644
View file @
26a30d2
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
.
param
;
import
cn.hutool.db.Page
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
@Data
@Accessors
(
chain
=
true
)
public
class
TrialDriveReportSearch
extends
Page
{
/**
* 勾选的id
*/
private
List
<
String
>
idList
;
/**
* 限制展示的车辆
*/
private
List
<
String
>
splitList
;
/**
* 广本分组ID
*/
private
Integer
guangBenClassId
;
/**
* sn 号
*/
private
String
sn
;
/**
* 查询年份
*/
private
String
year
;
/**
* 查询月份
*/
private
String
month
;
/**
* 特约店代码
*/
private
String
shopCode
;
/**
* 特约店名称
*/
private
String
shopName
;
}
src/main/java/cn/com/glsx/admin/modules/service/
EffectiveTest
DriveReportService.java
→
src/main/java/cn/com/glsx/admin/modules/service/
Trial
DriveReportService.java
View file @
26a30d2
package
cn
.
com
.
glsx
.
admin
.
modules
.
service
;
package
cn
.
com
.
glsx
.
admin
.
modules
.
service
;
import
cn.com.glsx.admin.modules.mapper.
EffectiveTest
DriveReportMapper
;
import
cn.com.glsx.admin.modules.mapper.
Trial
DriveReportMapper
;
import
cn.com.glsx.admin.modules.model.
EffectiveTestDriveDTO
;
import
cn.com.glsx.admin.modules.model.
export.TrialDriveReportExport
;
import
cn.com.glsx.admin.modules.model.
excel.EffectiveTestDriveReportExcel
;
import
cn.com.glsx.admin.modules.model.
param.TrialDriveReportSearch
;
import
cn.com.glsx.admin.modules.utils.DateUtil
;
import
cn.com.glsx.admin.modules.utils.DateUtil
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
import
com.glsx.plat.context.utils.PropertiesUtils
;
...
@@ -11,7 +11,6 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -11,7 +11,6 @@ import org.apache.commons.collections.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
/**
/**
...
@@ -21,76 +20,76 @@ import java.util.*;
...
@@ -21,76 +20,76 @@ import java.util.*;
*/
*/
@Slf4j
@Slf4j
@Service
@Service
public
class
EffectiveTest
DriveReportService
{
public
class
Trial
DriveReportService
{
@Autowired
@Autowired
private
EffectiveTestDriveReportMapper
effectiveTest
DriveReportMapper
;
private
TrialDriveReportMapper
trial
DriveReportMapper
;
public
List
<
EffectiveTestDriveReportExcel
>
getTestDrivePageList
(
EffectiveTestDriveDTO
reportRequest
)
{
public
List
<
TrialDriveReportExport
>
search
(
TrialDriveReportSearch
search
)
{
String
needToShowVehicleTypeList
=
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.needtoshow"
);
String
needToShowVehicleTypeList
=
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.needtoshow"
);
Integer
guangBenClassId
=
Integer
.
parseInt
(
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.guangBenClassId"
));
Integer
guangBenClassId
=
Integer
.
parseInt
(
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.guangBenClassId"
));
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
reportRequest
.
setSplitList
(
splitList
);
search
.
setSplitList
(
splitList
);
reportRequest
.
setGuangBenClassId
(
guangBenClassId
);
search
.
setGuangBenClassId
(
guangBenClassId
);
return
effectiveTestDriveReportMapper
.
getTestDrivePageList
(
reportRequest
);
return
trialDriveReportMapper
.
getTestDrivePageList
(
search
);
}
}
public
List
<
EffectiveTestDriveReportExcel
>
listEffectiveTestDriveReportPage
(
EffectiveTestDriveDTO
reportRequest
,
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
)
{
public
List
<
TrialDriveReportExport
>
listEffectiveTestDriveReportPage
(
TrialDriveReportSearch
search
,
List
<
TrialDriveReportExport
>
testDrivePageList
)
{
String
month
=
reportRequest
.
getMonth
();
String
month
=
search
.
getMonth
();
if
(
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
)
&&
Integer
.
parseInt
(
month
)
<
10
)
{
if
(
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
)
&&
Integer
.
parseInt
(
month
)
<
10
)
{
month
=
(
"0"
).
concat
(
month
);
month
=
(
"0"
).
concat
(
month
);
reportRequest
.
setMonth
(
month
);
search
.
setMonth
(
month
);
}
}
HashMap
<
String
,
EffectiveTestDriveReportExcel
>
excelHashMap
=
new
HashMap
<>();
HashMap
<
String
,
TrialDriveReportExport
>
excelHashMap
=
new
HashMap
<>();
// 需要展示的车型
// 需要展示的车型
String
needToShowVehicleTypeList
=
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.needtoshow"
);
String
needToShowVehicleTypeList
=
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.needtoshow"
);
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
for
(
EffectiveTestDriveReportExcel
testDrivePage
:
testDrivePageList
)
{
for
(
TrialDriveReportExport
testDrivePage
:
testDrivePageList
)
{
reportRequest
.
setSplitList
(
splitList
);
search
.
setSplitList
(
splitList
);
reportRequest
.
setSn
(
testDrivePage
.
getSn
());
search
.
setSn
(
testDrivePage
.
getSn
());
List
<
EffectiveTestDriveReportExcel
>
testDriveDataOneList
=
effectiveTestDriveReportMapper
.
getEffectiveTestDriveData
(
reportRequest
);
List
<
TrialDriveReportExport
>
testDriveDataOneList
=
trialDriveReportMapper
.
getEffectiveTestDriveData
(
search
);
excelHashMap
=
makeDriveData
(
testDriveDataOneList
,
testDrivePageList
,
reportRequest
.
getYear
(),
reportRequest
.
getMonth
());
excelHashMap
=
makeDriveData
(
testDriveDataOneList
,
testDrivePageList
,
search
.
getYear
(),
search
.
getMonth
());
}
}
testDrivePageList
=
new
ArrayList
<>(
excelHashMap
.
values
());
testDrivePageList
=
new
ArrayList
<>(
excelHashMap
.
values
());
// 将数据集合按照店代码排序
// 将数据集合按照店代码排序
testDrivePageList
.
sort
(
new
Comparator
<
EffectiveTestDriveReportExcel
>()
{
testDrivePageList
.
sort
(
new
Comparator
<
TrialDriveReportExport
>()
{
@Override
@Override
public
int
compare
(
EffectiveTestDriveReportExcel
o1
,
EffectiveTestDriveReportExcel
o2
)
{
public
int
compare
(
TrialDriveReportExport
o1
,
TrialDriveReportExport
o2
)
{
return
o1
.
getShopCode
().
compareToIgnoreCase
(
o2
.
getShopCode
());
return
o1
.
getShopCode
().
compareToIgnoreCase
(
o2
.
getShopCode
());
}
}
});
});
return
testDrivePageList
;
return
testDrivePageList
;
}
}
public
List
<
EffectiveTestDriveReportExcel
>
exportEffectiveTestDriveReport
(
EffectiveTestDriveDTO
reportRequest
,
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
)
throws
IOException
{
public
List
<
TrialDriveReportExport
>
exportEffectiveTestDriveReport
(
TrialDriveReportSearch
search
,
List
<
TrialDriveReportExport
>
testDrivePageList
)
{
//获取查询的月参数
//获取查询的月参数
String
month
=
reportRequest
.
getMonth
();
String
month
=
search
.
getMonth
();
if
(
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
)
&&
Integer
.
parseInt
(
month
)
<
10
)
{
if
(
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
)
&&
Integer
.
parseInt
(
month
)
<
10
)
{
month
=
(
"0"
).
concat
(
month
);
month
=
(
"0"
).
concat
(
month
);
reportRequest
.
setMonth
(
month
);
search
.
setMonth
(
month
);
}
}
HashMap
<
String
,
EffectiveTestDriveReportExcel
>
excelHashMap
=
new
HashMap
<>();
HashMap
<
String
,
TrialDriveReportExport
>
excelHashMap
=
new
HashMap
<>();
// 需要展示的车型
// 需要展示的车型
String
needToShowVehicleTypeList
=
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.needtoshow"
);
String
needToShowVehicleTypeList
=
PropertiesUtils
.
getProperty
(
"glsx.effectivetestdrive.needtoshow"
);
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
for
(
EffectiveTestDriveReportExcel
testDrivePage
:
testDrivePageList
)
{
for
(
TrialDriveReportExport
testDrivePage
:
testDrivePageList
)
{
reportRequest
.
setSplitList
(
splitList
);
search
.
setSplitList
(
splitList
);
reportRequest
.
setSn
(
testDrivePage
.
getSn
());
search
.
setSn
(
testDrivePage
.
getSn
());
List
<
EffectiveTestDriveReportExcel
>
testDriveDataOneList
=
effectiveTestDriveReportMapper
.
getEffectiveTestDriveData
(
reportRequest
);
List
<
TrialDriveReportExport
>
testDriveDataOneList
=
trialDriveReportMapper
.
getEffectiveTestDriveData
(
search
);
excelHashMap
=
makeDriveData
(
testDriveDataOneList
,
testDrivePageList
,
reportRequest
.
getYear
(),
reportRequest
.
getMonth
());
excelHashMap
=
makeDriveData
(
testDriveDataOneList
,
testDrivePageList
,
search
.
getYear
(),
search
.
getMonth
());
}
}
List
<
EffectiveTestDriveReportExcel
>
effectiveTestDriveList
=
new
ArrayList
<>(
excelHashMap
.
values
());
List
<
TrialDriveReportExport
>
effectiveTestDriveList
=
new
ArrayList
<>(
excelHashMap
.
values
());
if
(
CollectionUtils
.
isEmpty
(
effectiveTestDriveList
))
{
if
(
CollectionUtils
.
isEmpty
(
effectiveTestDriveList
))
{
return
null
;
return
null
;
}
}
// 将数据集合按照店代码排序
// 将数据集合按照店代码排序
testDrivePageList
.
sort
(
new
Comparator
<
EffectiveTestDriveReportExcel
>()
{
testDrivePageList
.
sort
(
new
Comparator
<
TrialDriveReportExport
>()
{
@Override
@Override
public
int
compare
(
EffectiveTestDriveReportExcel
o1
,
EffectiveTestDriveReportExcel
o2
)
{
public
int
compare
(
TrialDriveReportExport
o1
,
TrialDriveReportExport
o2
)
{
return
o1
.
getShopCode
().
compareToIgnoreCase
(
o2
.
getShopCode
());
return
o1
.
getShopCode
().
compareToIgnoreCase
(
o2
.
getShopCode
());
}
}
});
});
...
@@ -100,7 +99,7 @@ public class EffectiveTestDriveReportService {
...
@@ -100,7 +99,7 @@ public class EffectiveTestDriveReportService {
public
List
<
String
>
getYearWithData
()
{
public
List
<
String
>
getYearWithData
()
{
// 获取有数据的年份
// 获取有数据的年份
return
effectiveTest
DriveReportMapper
.
getYearWithData
();
return
trial
DriveReportMapper
.
getYearWithData
();
}
}
/**
/**
...
@@ -112,7 +111,7 @@ public class EffectiveTestDriveReportService {
...
@@ -112,7 +111,7 @@ public class EffectiveTestDriveReportService {
* @param month
* @param month
* @return
* @return
*/
*/
private
HashMap
<
String
,
EffectiveTestDriveReportExcel
>
makeDriveData
(
List
<
EffectiveTestDriveReportExcel
>
testDriveDataOneList
,
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
,
String
year
,
String
month
)
{
private
HashMap
<
String
,
TrialDriveReportExport
>
makeDriveData
(
List
<
TrialDriveReportExport
>
testDriveDataOneList
,
List
<
TrialDriveReportExport
>
testDrivePageList
,
String
year
,
String
month
)
{
//获取查询的年月参数
//获取查询的年月参数
String
yearAndMonth
=
null
;
String
yearAndMonth
=
null
;
if
(
StringUtils
.
isNotEmpty
(
year
)
&&
StringUtils
.
isNotBlank
(
year
)
&&
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
))
{
if
(
StringUtils
.
isNotEmpty
(
year
)
&&
StringUtils
.
isNotBlank
(
year
)
&&
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
))
{
...
@@ -127,18 +126,18 @@ public class EffectiveTestDriveReportService {
...
@@ -127,18 +126,18 @@ public class EffectiveTestDriveReportService {
}
}
HashMap
<
String
,
EffectiveTestDriveReportExcel
>
excelHashMap
=
new
HashMap
<>();
HashMap
<
String
,
TrialDriveReportExport
>
excelHashMap
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
sumHashMap
=
new
HashMap
<>();
HashMap
<
String
,
Integer
>
sumHashMap
=
new
HashMap
<>();
// 试驾表格需要展示的车辆类型
// 试驾表格需要展示的车辆类型
try
{
try
{
// 初始化map中的每个对象
// 初始化map中的每个对象
for
(
EffectiveTestDriveReportExcel
drivePageExcel
:
testDrivePageList
)
{
for
(
TrialDriveReportExport
drivePageExcel
:
testDrivePageList
)
{
excelHashMap
.
put
(
drivePageExcel
.
getShopCode
()
+
drivePageExcel
.
getSn
(),
drivePageExcel
);
excelHashMap
.
put
(
drivePageExcel
.
getShopCode
()
+
drivePageExcel
.
getSn
(),
drivePageExcel
);
sumHashMap
.
put
(
drivePageExcel
.
getShopCode
()
+
drivePageExcel
.
getSn
(),
0
);
sumHashMap
.
put
(
drivePageExcel
.
getShopCode
()
+
drivePageExcel
.
getSn
(),
0
);
}
}
// 填充每一个有试驾车辆的数据
// 填充每一个有试驾车辆的数据
for
(
EffectiveTestDriveReportExcel
driveDataOne
:
testDriveDataOneList
)
{
for
(
TrialDriveReportExport
driveDataOne
:
testDriveDataOneList
)
{
EffectiveTestDriveReportExcel
driveReportData
=
new
EffectiveTestDriveReportExcel
();
TrialDriveReportExport
driveReportData
=
new
TrialDriveReportExport
();
int
summation
=
0
;
int
summation
=
0
;
switch
(
driveDataOne
.
getDayCount
())
{
switch
(
driveDataOne
.
getDayCount
())
{
case
1
:
case
1
:
...
@@ -361,7 +360,7 @@ public class EffectiveTestDriveReportService {
...
@@ -361,7 +360,7 @@ public class EffectiveTestDriveReportService {
default
:
default
:
driveReportData
.
setDayNum1
(
0
);
driveReportData
.
setDayNum1
(
0
);
}
}
EffectiveTestDriveReportExcel
testDriveReportExcel
=
excelHashMap
.
get
(
driveDataOne
.
getShopCode
()
+
driveDataOne
.
getSn
());
TrialDriveReportExport
testDriveReportExcel
=
excelHashMap
.
get
(
driveDataOne
.
getShopCode
()
+
driveDataOne
.
getSn
());
// 设置总计数量
// 设置总计数量
testDriveReportExcel
.
setSummation
(
sumHashMap
.
get
(
driveDataOne
.
getShopCode
()
+
driveDataOne
.
getSn
()));
testDriveReportExcel
.
setSummation
(
sumHashMap
.
get
(
driveDataOne
.
getShopCode
()
+
driveDataOne
.
getSn
()));
// 填充行程时间
// 填充行程时间
...
@@ -371,7 +370,7 @@ public class EffectiveTestDriveReportService {
...
@@ -371,7 +370,7 @@ public class EffectiveTestDriveReportService {
}
}
// 将没有数据的部分用 O 替代
// 将没有数据的部分用 O 替代
for
(
EffectiveTestDriveReportExcel
drivePageExcel
:
testDrivePageList
)
{
for
(
TrialDriveReportExport
drivePageExcel
:
testDrivePageList
)
{
// 获取当天的最大天数
// 获取当天的最大天数
int
maxDayNum
=
31
;
int
maxDayNum
=
31
;
if
(
StringUtils
.
isNotEmpty
(
year
)
&&
StringUtils
.
isNotBlank
(
year
)
&&
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
))
{
if
(
StringUtils
.
isNotEmpty
(
year
)
&&
StringUtils
.
isNotBlank
(
year
)
&&
StringUtils
.
isNotEmpty
(
month
)
&&
StringUtils
.
isNotBlank
(
month
))
{
...
...
src/main/resources/mapper/
EffectiveTest
DriveReportMapper.xml
→
src/main/resources/mapper/
Trial
DriveReportMapper.xml
View file @
26a30d2
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"
cn.com.glsx.admin.modules.mapper.EffectiveTest
DriveReportMapper"
>
<mapper
namespace=
"
Trial
DriveReportMapper"
>
<resultMap
id=
"BaseResultMap"
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.admin.modules.model.ex
cel.EffectiveTestDriveReportExcel
"
>
type=
"cn.com.glsx.admin.modules.model.ex
port.TrialDriveReportExport
"
>
<result
column=
"shopCode"
jdbcType=
"VARCHAR"
property=
"shopCode"
/>
<result
column=
"shopCode"
jdbcType=
"VARCHAR"
property=
"shopCode"
/>
<result
column=
"shopName"
jdbcType=
"VARCHAR"
property=
"shopName"
/>
<result
column=
"shopName"
jdbcType=
"VARCHAR"
property=
"shopName"
/>
<result
column=
"vehicleTypeName"
jdbcType=
"VARCHAR"
property=
"vehicleTypeName"
/>
<result
column=
"vehicleTypeName"
jdbcType=
"VARCHAR"
property=
"vehicleTypeName"
/>
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
</resultMap>
</resultMap>
<resultMap
id=
"PageBaseMap"
<resultMap
id=
"PageBaseMap"
type=
"cn.com.glsx.admin.modules.model.ex
cel.EffectiveTestDriveReportExcel
"
>
type=
"cn.com.glsx.admin.modules.model.ex
port.TrialDriveReportExport
"
>
<result
column=
"fenceId"
jdbcType=
"INTEGER"
property=
"fenceId"
/>
<result
column=
"fenceId"
jdbcType=
"INTEGER"
property=
"fenceId"
/>
<result
column=
"electricFenceName"
jdbcType=
"VARCHAR"
property=
"electricFenceName"
/>
<result
column=
"electricFenceName"
jdbcType=
"VARCHAR"
property=
"electricFenceName"
/>
<result
column=
"shopCode"
jdbcType=
"VARCHAR"
property=
"shopCode"
/>
<result
column=
"shopCode"
jdbcType=
"VARCHAR"
property=
"shopCode"
/>
...
...
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