riku
2021-11-22 316bb4380e276a0b9e2745ad126a5c6c0e4b221d
src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt
@@ -4,7 +4,13 @@
import com.flightfeather.uav.common.utils.ExcelUtil
import com.flightfeather.uav.dataprocess.DataProcess
import com.flightfeather.uav.domain.entity.RealTimeData
import com.flightfeather.uav.domain.entity.RealTimeDataVehicle
import com.flightfeather.uav.domain.mapper.RealTimeDataVehicleMapper
import com.flightfeather.uav.lightshare.service.RealTimeDataService
import com.flightfeather.uav.model.epw.EPWDataPrep
import com.flightfeather.uav.repository.AirDataRepository
import com.flightfeather.uav.repository.impl.AirDataRepositoryImpl
import com.flightfeather.uav.socket.eunm.UWDeviceType
import com.github.pagehelper.PageHelper
import org.apache.poi.xssf.streaming.SXSSFWorkbook
import org.junit.Test
@@ -18,6 +24,9 @@
import java.io.File
import java.io.FileOutputStream
import java.util.*
import kotlin.math.atan
import kotlin.math.cos
import kotlin.math.sin
@RunWith(SpringRunner::class)
@SpringBootTest
@@ -25,6 +34,12 @@
    @Autowired
    lateinit var realTimeDataService: RealTimeDataService
    @Autowired
    lateinit var realTimeDataVehicleMapper: RealTimeDataVehicleMapper
    @Autowired
    lateinit var airDataRepository: AirDataRepositoryImpl
    @Test
    fun outToExcel() {
@@ -119,6 +134,46 @@
    @Test
    fun dataPreprocessing() {
        realTimeDataService.dataPreprocessing()
        val r = realTimeDataService.dataPreprocessing()
        println(r.data)
    }
    @Test
    fun averageData() {
        val r = realTimeDataService.averageData()
        println(r.data)
    }
    @Test
    fun dataCalibration() {
        val r = realTimeDataService.dataCalibration()
        println(r.data)
    }
    @Test
    fun dataTransform() {
        var page = 1
        var total = -1
        var count = 0
        while (total == -1 || page <= total) {
            println("------车载数据转换start------")
            val res = realTimeDataService.getOriginData("0a0000000001", "2021-01-01 00:00:00", "2021-10-25 15:37:21", page, 50000)
            res.head?.let {
                total = it.totalPage
            }
            if (page == 1) {
                println("总页数:$total")
            }
            println("当前页数:$page")
            res.data?.forEach {vo ->
                val d = RealTimeDataVehicle()
                airDataRepository.dataTransform(vo, d)
                realTimeDataVehicleMapper.insert(d)
                count++
            }
            page++
        }
    }
}