riku
2019-10-30 57b3b0851b2144073522a43640c2acc9452e1719
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>()