package com.flightfeather.uav.repository.impl
|
|
import com.flightfeather.uav.domain.entity.RealTimeData
|
import com.flightfeather.uav.domain.mapper.RealTimeDataMapper
|
import com.flightfeather.uav.repository.AirDataRepository
|
import com.flightfeather.uav.socket.bean.AirPackageData
|
import com.google.gson.Gson
|
import org.springframework.stereotype.Repository
|
|
/**
|
* @author riku
|
* Date: 2020/6/11
|
*/
|
@Repository
|
class AirDataRepositoryImpl(private val realTimeDataMapper: RealTimeDataMapper): AirDataRepository {
|
|
override fun saveAirData(packageData: AirPackageData): Int {
|
|
val data = RealTimeData().apply {
|
deviceCode = packageData.deviceCode
|
latitude
|
longitude
|
altitude
|
height
|
factors = Gson().toJson(packageData.dataUnit)
|
dataTime = packageData.dataTime
|
}
|
realTimeDataMapper.insert(data)
|
|
return 0
|
}
|
}
|