From 57b3b0851b2144073522a43640c2acc9452e1719 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 30 十月 2019 14:52:34 +0800
Subject: [PATCH] 新增接口: 1. 获取车辆轨迹

---
 src/main/kotlin/com/flightfeather/obd/lightshare/service/impl/ObdDataServiceImpl.kt |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/obd/lightshare/service/impl/ObdDataServiceImpl.kt b/src/main/kotlin/com/flightfeather/obd/lightshare/service/impl/ObdDataServiceImpl.kt
index f843a60..1c1ccfa 100644
--- a/src/main/kotlin/com/flightfeather/obd/lightshare/service/impl/ObdDataServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/obd/lightshare/service/impl/ObdDataServiceImpl.kt
@@ -49,8 +49,34 @@
     override fun getDataStreamCount(deviceCode: String, startTime: String?, endTime: String?): Int
             = dataStreamRepository.getDataStreamCount(deviceCode, startTime, endTime)
 
-    override fun getCoordinate(deviceCode: String): LatLngVo
-            = dataStreamRepository.getCoordinate(deviceCode)
+    override fun getCoordinate(deviceCode: String): LatLngVo{
+        val latLngVo = LatLngVo()
+        dataStreamRepository.getLatestDataStream(deviceCode)?.let {
+            latLngVo.apply {
+                this.deviceCode = it.obdDeviceCode
+                obdDataTime = it.obdDataTime
+                lat = it.obdLat
+                lng = it.obdLong
+            }
+        }
+
+        return latLngVo
+    }
+
+    override fun getTrack(deviceCode: String, startTime: String, endTime: String): List<LatLngVo> {
+        val resultList = mutableListOf<LatLngVo>()
+        //2019.10.30 鐩墠鍓嶇瀹夊崜璁惧畾鏈�闀胯幏鍙栫殑鏃堕暱涓�6灏忔椂鍓嶈嚦鐜板湪鐨勬暟鎹紝鎸夌収obd 姣�10绉掍腑浜х敓涓�鏉℃暟鎹紝鏈�澶�4 * 360 = 1440 鏉�
+        dataStreamRepository.getDataStream(deviceCode, 1, 1500, startTime, endTime).forEach {
+            val latLngVo = LatLngVo().apply {
+                this.deviceCode = it.obdDeviceCode
+                obdDataTime = it.obdDataTime
+                lat = it.obdLat
+                lng = it.obdLong
+            }
+            resultList.add(latLngVo)
+        }
+        return resultList
+    }
 
     override fun getLatestCoordinate(pageNum: Int?, pageSize: Int?): List<LatLngVo> {
         val resultList = mutableListOf<LatLngVo>()

--
Gitblit v1.9.3