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 38ad1eed
authored
May 20, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
开发试驾数据
1 parent
1c47c72b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
55 deletions
src/main/java/cn/com/glsx/admin/modules/controller/TrialDriveReportController.java
src/main/java/cn/com/glsx/admin/modules/model/param/TrialDriveReportSearch.java
src/main/java/cn/com/glsx/admin/modules/service/TrialDriveReportService.java
src/main/resources/mapper/TrialDriveReportMapper.xml
src/main/java/cn/com/glsx/admin/modules/controller/TrialDriveReportController.java
View file @
38ad1ee
...
@@ -62,7 +62,7 @@ public class TrialDriveReportController {
...
@@ -62,7 +62,7 @@ public class TrialDriveReportController {
data
.
put
(
"totalElements"
,
total
);
data
.
put
(
"totalElements"
,
total
);
return
R
.
ok
().
data
(
data
);
return
R
.
ok
().
data
(
data
);
}
}
return
R
.
error
(
);
return
R
.
ok
().
data
(
"没有查询到任何数据"
);
}
}
@GetMapping
(
value
=
"/export"
)
@GetMapping
(
value
=
"/export"
)
...
...
src/main/java/cn/com/glsx/admin/modules/model/param/TrialDriveReportSearch.java
View file @
38ad1ee
...
@@ -5,15 +5,16 @@ import lombok.Data;
...
@@ -5,15 +5,16 @@ import lombok.Data;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
class
TrialDriveReportSearch
extends
Page
{
public
class
TrialDriveReportSearch
extends
Page
{
/**
/**
*
勾选的i
d
*
组织下用户的I
d
*/
*/
private
List
<
String
>
i
dList
;
private
Set
<
Long
>
userI
dList
;
/**
/**
* 限制展示的车辆
* 限制展示的车辆
...
@@ -21,11 +22,6 @@ public class TrialDriveReportSearch extends Page {
...
@@ -21,11 +22,6 @@ public class TrialDriveReportSearch extends Page {
private
List
<
String
>
splitList
;
private
List
<
String
>
splitList
;
/**
/**
* 广本分组ID
*/
private
Integer
guangBenClassId
;
/**
* sn 号
* sn 号
*/
*/
private
String
sn
;
private
String
sn
;
...
@@ -49,5 +45,4 @@ public class TrialDriveReportSearch extends Page {
...
@@ -49,5 +45,4 @@ public class TrialDriveReportSearch extends Page {
* 特约店名称
* 特约店名称
*/
*/
private
String
shopName
;
private
String
shopName
;
}
}
src/main/java/cn/com/glsx/admin/modules/service/TrialDriveReportService.java
View file @
38ad1ee
...
@@ -11,7 +11,6 @@ import com.glsx.plat.context.utils.PropertiesUtils;
...
@@ -11,7 +11,6 @@ import com.glsx.plat.context.utils.PropertiesUtils;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.*
;
...
@@ -30,22 +29,16 @@ public class TrialDriveReportService {
...
@@ -30,22 +29,16 @@ public class TrialDriveReportService {
public
List
<
TrialDriveReportExport
>
search
(
TrialDriveReportSearch
search
)
{
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"
));
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
String
[]
splitArr
=
needToShowVehicleTypeList
.
split
(
","
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
List
<
String
>
splitList
=
Arrays
.
asList
(
splitArr
);
search
.
setSplitList
(
splitList
);
search
.
setSplitList
(
splitList
);
search
.
setGuangBenClassId
(
guangBenClassId
);
Integer
rolePermissionType
=
ShieldContextHolder
.
getRolePermissionType
();
Integer
rolePermissionType
=
ShieldContextHolder
.
getRolePermissionType
();
//非管理员 并且 数据权限不是全部 的需要加上用户权限涉及的全部用户id
//非管理员 并且 数据权限不是全部 的需要加上用户权限涉及的全部用户id
if
(!
ShieldContextHolder
.
isSuperAdmin
()
&&
!
UserConstants
.
RolePermitCastType
.
all
.
getCode
().
equals
(
rolePermissionType
))
{
boolean
superAdminFlag
=
ShieldContextHolder
.
isSuperAdmin
();
if
(!
superAdminFlag
&&
!
UserConstants
.
RolePermitCastType
.
all
.
getCode
().
equals
(
rolePermissionType
))
{
Set
<
Long
>
userIdList
=
ShieldContextHolder
.
getVisibleCreatorIds
();
Set
<
Long
>
userIdList
=
ShieldContextHolder
.
getVisibleCreatorIds
();
if
(
org
.
apache
.
commons
.
collections4
.
CollectionUtils
.
isNotEmpty
(
userIdList
))
{
search
.
setUserIdList
(
userIdList
);
//ShieldContextHolder.getVisibleCreatorIds()
}
else
{
}
}
}
return
trialDriveReportMapper
.
getTestDrivePageList
(
search
);
return
trialDriveReportMapper
.
getTestDrivePageList
(
search
);
...
...
src/main/resources/mapper/TrialDriveReportMapper.xml
View file @
38ad1ee
...
@@ -29,32 +29,35 @@
...
@@ -29,32 +29,35 @@
parameterType=
"cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
parameterType=
"cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
resultMap=
"PageBaseMap"
>
resultMap=
"PageBaseMap"
>
SELECT
SELECT
tu.
username
shopCode,
tu.
account
shopCode,
tu.user
Remark
shopName,
tu.user
name
shopName,
tefs.sn,
tefs.sn,
tefs.
standno
,
tefs.
vin
,
tv
ts.vehicle_type
_name vehicleTypeName
tv
.model
_name vehicleTypeName
from t_electric_fence_sns tefs
from t_electric_fence_sns tefs
inner join t_electric_fence tef on tef.id = tefs.fenceId
inner join t_electric_fence tef on tef.id = tefs.fence_id
left join t_user tu on tu.d_LoginUserId = tef.loginUserId
left join t_user tu on tu.id = tef.created_by
left join t_vehicle tv on tv.standno = tefs.standno
left join t_vehicle tv on tv.vin = tefs.vin
left join t_vehicle_type_standno tvts on tvts.standno = tv.standno
where tefs.fence_id = tef.id
left join t_class tc on tv.classId = tc.classid
and tef.biz_fence_type = 1
where tefs.fenceId = tef.id
and tef.bizFenceType = 1
<if
test=
"shopCode!=null and shopCode!=''"
>
<if
test=
"shopCode!=null and shopCode!=''"
>
and tu.
username
like '%${shopCode}%'
and tu.
account
like '%${shopCode}%'
</if>
</if>
<if
test=
"shopName!=null and shopName!=''"
>
<if
test=
"shopName!=null and shopName!=''"
>
and tu.user
Remark
like '%${shopName}%'
and tu.user
name
like '%${shopName}%'
</if>
</if>
<if
test=
"guangBenClassId != null and guangBenClassId != '' "
>
<if
test=
"userIdList != null"
>
and tc.vehicleGroupId = #{guangBenClassId,jdbcType=INTEGER}
and tc.id IN
<foreach
collection=
"userIdList"
item=
"userId"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{userId}
</foreach>
</if>
<if
test=
"splitList != null"
>
and tv.model_name IN
<foreach
collection=
"splitList"
item=
"vehicleTypeName"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{vehicleTypeName}
</foreach>
</if>
</if>
and tvts.vehicle_type_name IN
<foreach
collection=
"splitList"
item=
"vehicleTypeName"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{vehicleTypeName}
</foreach>
order by tef.id
order by tef.id
</select>
</select>
...
@@ -63,18 +66,16 @@
...
@@ -63,18 +66,16 @@
resultMap=
"BaseResultMap"
>
resultMap=
"BaseResultMap"
>
SELECT tall.shopCode, tall.shopName, tall.vehicleTypeName, tall.sn, tall.standno, left(tall.statDate,7)
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
statDate, tall.cnt, day(tall.statDate) dayCount , sum(cnt) cnttotal FROM
(select tu.
username shopCode, tu.userRemark shopName, tvts.vehicle_type
_name vehicleTypeName,
(select tu.
account shopCode, tu.username shopName, tv.model
_name vehicleTypeName,
tefdd.sn,
tefdd.sn,
tv.standno, DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate, sum(case when tefdd.percent >= 80
t
v.standno, DATE_FORMAT(tefdd.journey_time,'%Y-%m-%d') statDate, sum(case when tefdd.percent >= 80 t
hen 1 else 0
then 1 else 0
end) cnt
end) cnt
from t_electric_fence_drive defdd
from t_electric_fence_drive tefdd
left join t_electric_fence def on tef.id = tefdd.fence_id
left join t_electric_fence tef on tef.id = tefdd.fence_id
left join t_track_info dti on tti.sn = tefdd.sn
left join t_vehicle_device tvv on tvv.sn = tefdd.sn
left join t_vehicle dv on tv.vehicleId = tti.vehicleId
left join t_vehicle tv on tv.id = tvv.vehicle_id
left join t_vehicle_type_standno tvts on tvts.standno = tv.standno
left join t_user tu on tu.id = tef.created_by
left join t_user du on tu.d_LoginUserId = tef.loginUserId
<where>
<where>
<choose>
<choose>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
left(tefdd.journey_time,7) = CONCAT(#{year,jdbcType=VARCHAR},'-',#{month,jdbcType=VARCHAR})
left(tefdd.journey_time,7) = CONCAT(#{year,jdbcType=VARCHAR},'-',#{month,jdbcType=VARCHAR})
...
@@ -90,20 +91,22 @@
...
@@ -90,20 +91,22 @@
</choose>
</choose>
<if
test=
"shopCode !=null and shopCode != ''"
>
<if
test=
"shopCode !=null and shopCode != ''"
>
and tu.
username
like '%${shopCode}%'
and tu.
account
like '%${shopCode}%'
</if>
</if>
<if
test=
"shopName !=null and shopName != ''"
>
<if
test=
"shopName !=null and shopName != ''"
>
and tu.user
Remark
like '%${shopName}%'
and tu.user
name
like '%${shopName}%'
</if>
</if>
<if
test=
"sn !=null and sn != ''"
>
<if
test=
"sn !=null and sn != ''"
>
and tefdd.sn = #{sn,jdbcType=VARCHAR}
and tefdd.sn = #{sn,jdbcType=VARCHAR}
</if>
</if>
and tvts.vehicle_type_name IN
<if
test=
"splitList != null"
>
<foreach
collection=
"splitList"
item=
"vehicleTypeName"
index=
"index"
open=
"("
close=
")"
separator=
","
>
and tv.model_name IN
#{vehicleTypeName}
<foreach
collection=
"splitList"
item=
"vehicleTypeName"
index=
"index"
open=
"("
close=
")"
separator=
","
>
</foreach>
#{vehicleTypeName}
</foreach>
</if>
</where>
</where>
GROUP BY tefdd.sn,tefdd.fence_id,statDate order by tu.
username
) tall GROUP BY tall.shopCode, tall.sn,
GROUP BY tefdd.sn,tefdd.fence_id,statDate order by tu.
account
) tall GROUP BY tall.shopCode, tall.sn,
tall.statDate ORDER BY tall.shopCode
tall.statDate ORDER BY tall.shopCode
</select>
</select>
...
...
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