package com.flightfeather.uav.lightshare.service.impl
|
|
import com.flightfeather.uav.common.utils.DateUtil
|
import com.flightfeather.uav.lightshare.service.RealTimeDataService
|
import org.junit.Test
|
|
import org.junit.Assert.*
|
import org.junit.runner.RunWith
|
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.boot.test.context.SpringBootTest
|
import org.springframework.test.context.junit4.SpringRunner
|
import java.io.File
|
import java.io.FileOutputStream
|
import java.util.*
|
|
@RunWith(SpringRunner::class)
|
@SpringBootTest
|
class RealTimeDataServiceImplTest {
|
|
@Autowired
|
lateinit var realTimeDataService: RealTimeDataService
|
|
@Test
|
fun outToExcel() {
|
if (realTimeDataService is RealTimeDataServiceImpl) {
|
val workbook = realTimeDataService.outToWorkbook("0a0000000001", "2021-07-05 00:00:00", "2021-07-06 23:59:59")
|
val fileName = "污染溯源权重模型${DateUtil.instance.dateToString(Date(), "yyyy-MM-ddHHmmss")}.xls"
|
val filePath = "E:\\工作\\开发\\走航监测\\格式化数据\\$fileName"
|
val out = FileOutputStream(File(filePath))
|
workbook.write(out)
|
workbook.close()
|
out.flush()
|
out.close()
|
}
|
}
|
}
|