Commit 254f0d34 by 向延琳

里程列表,里程列表导出

1 parent 8e4a0687
......@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;
......@@ -47,10 +48,22 @@ public class JourneyService {
search.setCheckedOrgIds(Lists.newArrayList(search.getOrgId()));
userApiService.setCheckedOrgUsers(search);
}
List<JourneyExport> journeyList = vehicleMapper.findJourneyList(search);
getDeviceMileage(journeyList);
return journeyList;
if (CollectionUtils.isEmpty(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;
}
/**
......
......@@ -715,9 +715,12 @@
select tvd.id, tw.partner_order_no as workOrderNo,
tv.owner_name as ownerName,
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
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_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
where tv.del_flag = 0
......@@ -824,9 +827,13 @@
tw.partner_order_no as workOrderNo,
tv.owner_name as ownerName,
tvd.sn as sn,
tv.vin as vin
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
tv.vin as vin,
tdj begin_time as journeyStartTime,
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_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
where tv.del_flag = 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!