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 9a53cf49
authored
May 19, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
开发试驾数据 修改编码格式
1 parent
1b1a0670
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
49 deletions
src/main/java/cn/com/glsx/admin/modules/controller/EffectiveTestDriveReportController.java
src/main/resources/mapper/EffectiveTestDriveReportMapper.xml
src/main/java/cn/com/glsx/admin/modules/controller/EffectiveTestDriveReportController.java
View file @
9a53cf4
...
...
@@ -3,12 +3,12 @@ package cn.com.glsx.admin.modules.controller;
import
cn.com.glsx.admin.modules.model.EffectiveTestDriveDTO
;
import
cn.com.glsx.admin.modules.model.excel.EffectiveTestDriveReportExcel
;
import
cn.com.glsx.admin.modules.service.EffectiveTestDriveReportService
;
import
com.alibaba.excel.EasyExcel
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.common.annotation.SysLog
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.office.excel.EasyExcelUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -20,8 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -35,7 +33,7 @@ import java.util.Map;
*/
@Slf4j
@RestController
@RequestMapping
(
value
=
"/effective
TestDriveR
eport"
)
@RequestMapping
(
value
=
"/effective
testdriver
eport"
)
@Api
(
value
=
"试驾报表管理"
,
tags
=
{
"试驾报表管理"
})
public
class
EffectiveTestDriveReportController
{
...
...
@@ -68,24 +66,20 @@ public class EffectiveTestDriveReportController {
return
R
.
error
();
}
@GetMapping
(
value
=
"/export
R
eport"
)
@GetMapping
(
value
=
"/export
r
eport"
)
@SysLog
(
"导出试驾车辆数据"
)
@ApiOperation
(
value
=
"试驾报表导出"
)
public
void
exportGqWindReport
(
EffectiveTestDriveDTO
reportRequest
)
throws
IOException
{
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setCharacterEncoding
(
"utf-8"
);
public
void
exportGqWindReport
(
EffectiveTestDriveDTO
reportRequest
)
throws
Exception
{
String
fileName
=
"有效试驾次数统计(按日"
+
DateFormatUtils
.
format
(
new
Date
(),
"yyyy-MM-dd"
)
+
")表"
;
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
fileName
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
// 优先查询试驾 d_electric_fence_drive 表获取分页页数
List
<
EffectiveTestDriveReportExcel
>
testDrivePageList
=
effectiveTestDriveReportService
.
getTestDrivePageList
(
reportRequest
);
// 封装数据
List
<
EffectiveTestDriveReportExcel
>
testDriveReportExcels
=
effectiveTestDriveReportService
.
exportEffectiveTestDriveReport
(
reportRequest
,
testDrivePageList
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
+
".xlsx"
);
EasyExcel
.
write
(
response
.
getOutputStream
(),
EffectiveTestDriveReportExcel
.
class
).
autoCloseStream
(
true
).
sheet
(
"有效试驾次数统计(按日)表"
).
doWrite
(
testDriveReportExcel
s
);
// 调用公用方法导出 excel表格
EasyExcel
Utils
.
writeExcel
((
HttpServletResponse
)
response
.
getOutputStream
(),
testDriveReportExcels
,
fileName
,
"有效试驾次数统计(按日)表"
,
EffectiveTestDriveReportExcel
.
clas
s
);
}
@GetMapping
(
value
=
"/get
YearWithD
ata"
)
@GetMapping
(
value
=
"/get
yearwithd
ata"
)
@SysLog
(
"获取下拉选接口"
)
@ApiOperation
(
value
=
"获取有试驾数据的年份"
)
public
R
getYearWithData
()
{
...
...
src/main/resources/mapper/EffectiveTestDriveReportMapper.xml
View file @
9a53cf4
...
...
@@ -29,33 +29,33 @@
parameterType=
"cn.com.glsx.admin.modules.model.EffectiveTestDriveDTO"
resultMap=
"PageBaseMap"
>
SELECT
d
u.username shopCode,
d
u.userRemark shopName,
d
efs.sn,
d
efs.standno,
d
vts.vehicle_type_name vehicleTypeName
from
d_electric_fence_sns d
efs
inner join
d_electric_fence def on def.id = d
efs.fenceId
left join
d_user du on du.d_LoginUserId = d
ef.loginUserId
left join
d_vehicle dv on dv.standno = d
efs.standno
left join
d_vehicle_type_standno dvts on dvts.standno = d
v.standno
left join
d_class dc on dv.classId = d
c.classid
where
defs.fenceId = d
ef.id
and
d
ef.bizFenceType = 1
t
u.username shopCode,
t
u.userRemark shopName,
t
efs.sn,
t
efs.standno,
t
vts.vehicle_type_name vehicleTypeName
from
t_electric_fence_sns t
efs
inner join
t_electric_fence tef on tef.id = t
efs.fenceId
left join
t_user tu on tu.d_LoginUserId = t
ef.loginUserId
left join
t_vehicle tv on tv.standno = t
efs.standno
left join
t_vehicle_type_standno tvts on tvts.standno = t
v.standno
left join
t_class tc on tv.classId = t
c.classid
where
tefs.fenceId = t
ef.id
and
t
ef.bizFenceType = 1
<if
test=
"shopCode!=null and shopCode!=''"
>
and
d
u.username like '%${shopCode}%'
and
t
u.username like '%${shopCode}%'
</if>
<if
test=
"shopName!=null and shopName!=''"
>
and
d
u.userRemark like '%${shopName}%'
and
t
u.userRemark like '%${shopName}%'
</if>
<if
test=
"guangBenClassId != null and guangBenClassId != '' "
>
and
d
c.vehicleGroupId = #{guangBenClassId,jdbcType=INTEGER}
and
t
c.vehicleGroupId = #{guangBenClassId,jdbcType=INTEGER}
</if>
and
d
vts.vehicle_type_name IN
and
t
vts.vehicle_type_name IN
<foreach
collection=
"splitList"
item=
"vehicleTypeName"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{vehicleTypeName}
</foreach>
order by
d
ef.id
order by
t
ef.id
</select>
<select
id=
"getEffectiveTestDriveData"
...
...
@@ -63,52 +63,52 @@
resultMap=
"BaseResultMap"
>
SELECT tall.shopCode, tall.shopName, tall.vehicleTypeName, tall.sn, tall.standno, left(tall.statDate,7)
statDate, tall.cnt, day(tall.statDate) dayCount , sum(cnt) cnttotal FROM
(select
du.username shopCode, du.userRemark shopName, d
vts.vehicle_type_name vehicleTypeName,
d
efdd.sn,
dv.standno, DATE_FORMAT(defdd.journey_time,'%Y-%m-%d') statDate, sum(case when d
efdd.percent >= 80 then 1 else 0
(select
tu.username shopCode, tu.userRemark shopName, t
vts.vehicle_type_name vehicleTypeName,
t
efdd.sn,
tv.standno, DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate, sum(case when t
efdd.percent >= 80 then 1 else 0
end) cnt
from
d
_electric_fence_drive defdd
left join
d_electric_fence def on def.id = d
efdd.fence_id
left join
d_track_info dti on dti.sn = d
efdd.sn
left join
d_vehicle dv on dv.vehicleId = d
ti.vehicleId
left join
d_vehicle_type_standno dvts on dvts.standno = d
v.standno
left join
d_user du on du.d_LoginUserId = d
ef.loginUserId
from
t
_electric_fence_drive defdd
left join
t_electric_fence def on tef.id = t
efdd.fence_id
left join
t_track_info dti on tti.sn = t
efdd.sn
left join
t_vehicle dv on tv.vehicleId = t
ti.vehicleId
left join
t_vehicle_type_standno tvts on tvts.standno = t
v.standno
left join
t_user du on tu.d_LoginUserId = t
ef.loginUserId
<where>
<choose>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
left(
d
efdd.journey_time,7) = CONCAT(#{year,jdbcType=VARCHAR},'-',#{month,jdbcType=VARCHAR})
left(
t
efdd.journey_time,7) = CONCAT(#{year,jdbcType=VARCHAR},'-',#{month,jdbcType=VARCHAR})
</when>
<otherwise>
<if
test=
"year != null and year != '' "
>
left(
d
efdd.journey_time,4) = #{year,jdbcType=VARCHAR}
left(
t
efdd.journey_time,4) = #{year,jdbcType=VARCHAR}
</if>
<if
test=
"month != null and month != '' "
>
right(left(journey_time,7),2) = #{month,jdbcType=VARCHAR}
right(left(
tefdd.
journey_time,7),2) = #{month,jdbcType=VARCHAR}
</if>
</otherwise>
</choose>
<if
test=
"shopCode !=null and shopCode != ''"
>
and
d
u.username like '%${shopCode}%'
and
t
u.username like '%${shopCode}%'
</if>
<if
test=
"shopName !=null and shopName != ''"
>
and
d
u.userRemark like '%${shopName}%'
and
t
u.userRemark like '%${shopName}%'
</if>
<if
test=
"sn !=null and sn != ''"
>
and
d
efdd.sn = #{sn,jdbcType=VARCHAR}
and
t
efdd.sn = #{sn,jdbcType=VARCHAR}
</if>
and
d
vts.vehicle_type_name IN
and
t
vts.vehicle_type_name IN
<foreach
collection=
"splitList"
item=
"vehicleTypeName"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{vehicleTypeName}
</foreach>
</where>
GROUP BY
defdd.sn,defdd.fence_id,statDate order by d
u.username) tall GROUP BY tall.shopCode, tall.sn,
GROUP BY
tefdd.sn,tefdd.fence_id,statDate order by t
u.username) tall GROUP BY tall.shopCode, tall.sn,
tall.statDate ORDER BY tall.shopCode
</select>
<select
id=
"getYearWithData"
resultType=
"java.lang.String"
>
select distinct left(journey_time,4) from
d
_electric_fence_drive
select distinct left(journey_time,4) from
t
_electric_fence_drive
</select>
</mapper>
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