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 254f0d34
authored
Apr 11, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
里程列表,里程列表导出
1 parent
8e4a0687
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
src/main/java/cn/com/glsx/admin/modules/service/JourneyService.java
src/main/resources/mapper/VehicleMapper.xml
src/main/java/cn/com/glsx/admin/modules/service/JourneyService.java
View file @
254f0d3
...
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
...
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.StopWatch
;
import
org.springframework.util.StopWatch
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -47,10 +48,22 @@ public class JourneyService {
...
@@ -47,10 +48,22 @@ public class JourneyService {
search
.
setCheckedOrgIds
(
Lists
.
newArrayList
(
search
.
getOrgId
()));
search
.
setCheckedOrgIds
(
Lists
.
newArrayList
(
search
.
getOrgId
()));
userApiService
.
setCheckedOrgUsers
(
search
);
userApiService
.
setCheckedOrgUsers
(
search
);
}
}
List
<
JourneyExport
>
journeyList
=
vehicleMapper
.
findJourneyList
(
search
);
List
<
JourneyExport
>
journeyList
=
vehicleMapper
.
findJourneyList
(
search
);
getDeviceMileage
(
journeyList
);
if
(
CollectionUtils
.
isEmpty
(
journeyList
))
{
return
journeyList
;
return
Lists
.
newArrayList
();
}
//里程单位转换
return
journeyList
.
stream
().
map
(
this
::
convertKm
).
collect
(
Collectors
.
toList
());
}
/**
* 里程单位转换
*/
private
JourneyExport
convertKm
(
JourneyExport
journey
)
{
Optional
.
ofNullable
(
journey
.
getDistance
())
.
map
(
distance
->
distance
/
1000.0
)
.
ifPresent
(
journey:
:
setDistance
);
return
journey
;
}
}
/**
/**
...
...
src/main/resources/mapper/VehicleMapper.xml
View file @
254f0d3
...
@@ -715,9 +715,12 @@
...
@@ -715,9 +715,12 @@
select tvd.id, tw.partner_order_no as workOrderNo,
select tvd.id, tw.partner_order_no as workOrderNo,
tv.owner_name as ownerName,
tv.owner_name as ownerName,
tvd.sn as sn,
tvd.sn as sn,
tv.vin as vin
tv.vin as vin,
tdjo.total_journey_count as tripCount,
tdjo.distance as distance
from t_vehicle tv
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device_journey_overview tdjo on tvd.id = tdjo.vd_id
left join t_device td on td.sn = tvd.sn
left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
where tv.del_flag = 0
where tv.del_flag = 0
...
@@ -824,9 +827,13 @@
...
@@ -824,9 +827,13 @@
tw.partner_order_no as workOrderNo,
tw.partner_order_no as workOrderNo,
tv.owner_name as ownerName,
tv.owner_name as ownerName,
tvd.sn as sn,
tvd.sn as sn,
tv.vin as vin
tv.vin as vin,
from t_vehicle tv
tdj begin_time as journeyStartTime,
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
tdj end_time as journeyEndTime,
tdj mileage as distance
from t_device_journey tdj
left join t_vehicle_device tvd on tvd.id = tdj.vd_id
left join t_vehicle tv on tvd.id = tvd.vehicle_id
left join t_device td on td.sn = tvd.sn
left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
where tv.del_flag = 0
where tv.del_flag = 0
...
...
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