| | |
| | | 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.flightfeather.uav.socket.bean.AirDataPackage |
| | | import com.google.gson.Gson |
| | | import org.springframework.stereotype.Repository |
| | | |
| | |
| | | @Repository |
| | | class AirDataRepositoryImpl(private val realTimeDataMapper: RealTimeDataMapper): AirDataRepository { |
| | | |
| | | override fun saveAirData(packageData: AirPackageData): Int { |
| | | override fun saveAirData(dataPackage: AirDataPackage): Int { |
| | | |
| | | val data = RealTimeData().apply { |
| | | deviceCode = packageData.deviceCode |
| | | deviceCode = dataPackage.deviceCode |
| | | latitude |
| | | longitude |
| | | altitude |
| | | height |
| | | factors = Gson().toJson(packageData.dataUnit) |
| | | dataTime = packageData.dataTime |
| | | factors = Gson().toJson(dataPackage.dataUnit) |
| | | dataTime = dataPackage.dataTime |
| | | } |
| | | realTimeDataMapper.insert(data) |
| | | |