| | |
| | | package com.flightfeather.uav.lightshare.service.impl |
| | | |
| | | import com.flightfeather.uav.common.utils.DateUtil |
| | | import com.flightfeather.uav.common.utils.ExcelUtil |
| | | import com.flightfeather.uav.dataprocess.DataProcess |
| | | import com.flightfeather.uav.domain.entity.RealTimeData |
| | | import com.flightfeather.uav.lightshare.service.RealTimeDataService |
| | | import com.github.pagehelper.PageHelper |
| | | import org.apache.poi.xssf.streaming.SXSSFWorkbook |
| | | import org.junit.Test |
| | | |
| | | import org.junit.Assert.* |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit4.SpringRunner |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.io.File |
| | | import java.io.FileOutputStream |
| | | import java.util.* |
| | |
| | | @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() |
| | | // val deviceCode = "0a0000000001" |
| | | // val deviceCode = "0a0000000002" |
| | | val deviceCode = "0d0000000001" |
| | | val timeSet = listOf( |
| | | // Pair("2021-06-10 00:00:00", "2021-06-30 23:59:59"), |
| | | Pair("2021-07-01 00:00:00", "2021-07-31 23:59:59"), |
| | | Pair("2021-08-01 00:00:00", "2021-08-31 23:59:59"), |
| | | Pair("2021-09-01 00:00:00", "2021-09-30 23:59:59"), |
| | | // 网格化监测每日 |
| | | // Pair("2021-06-02 00:00:00", "2021-06-03 23:59:59"), |
| | | // Pair("2021-06-04 00:00:00", "2021-06-05 23:59:59"), |
| | | // Pair("2021-06-06 00:00:00", "2021-06-07 23:59:59"), |
| | | // Pair("2021-06-08 00:00:00", "2021-06-09 23:59:59"), |
| | | // Pair("2021-06-10 00:00:00", "2021-06-11 23:59:59"), |
| | | // Pair("2021-06-12 00:00:00", "2021-06-13 23:59:59"), |
| | | // Pair("2021-06-14 00:00:00", "2021-06-15 23:59:59"), |
| | | // Pair("2021-06-16 00:00:00", "2021-06-17 23:59:59"), |
| | | // Pair("2021-06-18 00:00:00", "2021-06-19 23:59:59"), |
| | | // Pair("2021-06-20 17:00:00", "2021-06-21 23:59:59"), |
| | | // Pair("2021-06-22 00:00:00", "2021-06-23 23:59:59"), |
| | | // Pair("2021-06-24 00:00:00", "2021-06-25 23:59:59"), |
| | | // Pair("2021-06-26 00:00:00", "2021-06-27 23:59:59"), |
| | | // Pair("2021-06-28 00:00:00", "2021-06-29 23:59:59"), |
| | | // Pair("2021-06-30 00:00:00", "2021-06-30 23:59:59"), |
| | | |
| | | // Pair("2021-07-01 00:00:00", "2021-07-02 23:59:59"), |
| | | // Pair("2021-07-03 00:00:00", "2021-07-04 23:59:59"), |
| | | // Pair("2021-07-05 00:00:00", "2021-07-06 23:59:59"), |
| | | // Pair("2021-07-07 00:00:00", "2021-07-08 23:59:59"), |
| | | // Pair("2021-07-09 00:00:00", "2021-07-10 23:59:59"), |
| | | // Pair("2021-07-11 00:00:00", "2021-07-12 23:59:59"), |
| | | // Pair("2021-07-13 00:00:00", "2021-07-14 23:59:59"), |
| | | // Pair("2021-07-15 00:00:00", "2021-07-16 23:59:59"), |
| | | // Pair("2021-07-17 00:00:00", "2021-07-18 23:59:59"), |
| | | // Pair("2021-07-19 17:00:00", "2021-07-20 23:59:59"), |
| | | // Pair("2021-07-21 00:00:00", "2021-07-22 23:59:59"), |
| | | // Pair("2021-07-23 00:00:00", "2021-07-24 23:59:59"), |
| | | // Pair("2021-07-25 00:00:00", "2021-07-26 23:59:59"), |
| | | // Pair("2021-07-27 00:00:00", "2021-07-28 23:59:59"), |
| | | // Pair("2021-07-29 00:00:00", "2021-07-30 23:59:59"), |
| | | // Pair("2021-07-31 00:00:00", "2021-07-31 23:59:59"), |
| | | |
| | | // Pair("2021-08-01 00:00:00", "2021-08-02 23:59:59"), |
| | | // Pair("2021-08-03 00:00:00", "2021-08-04 23:59:59"), |
| | | // Pair("2021-08-05 00:00:00", "2021-08-06 23:59:59"), |
| | | // Pair("2021-08-07 00:00:00", "2021-08-08 23:59:59"), |
| | | // Pair("2021-08-09 00:00:00", "2021-08-10 23:59:59"), |
| | | // Pair("2021-08-11 00:00:00", "2021-08-12 23:59:59"), |
| | | // Pair("2021-08-13 00:00:00", "2021-08-14 23:59:59"), |
| | | // Pair("2021-08-15 00:00:00", "2021-08-16 23:59:59"), |
| | | // Pair("2021-08-17 00:00:00", "2021-08-18 23:59:59"), |
| | | // Pair("2021-08-19 17:00:00", "2021-08-20 23:59:59"), |
| | | // Pair("2021-08-21 00:00:00", "2021-08-22 23:59:59"), |
| | | // Pair("2021-08-23 00:00:00", "2021-08-24 23:59:59"), |
| | | // Pair("2021-08-25 00:00:00", "2021-08-26 23:59:59"), |
| | | // Pair("2021-08-27 00:00:00", "2021-08-28 23:59:59"), |
| | | // Pair("2021-08-29 00:00:00", "2021-08-30 23:59:59"), |
| | | // Pair("2021-08-31 00:00:00", "2021-08-31 23:59:59"), |
| | | |
| | | // Pair("2021-09-01 00:00:00", "2021-09-02 23:59:59"), |
| | | // Pair("2021-09-03 00:00:00", "2021-09-04 23:59:59"), |
| | | // Pair("2021-09-05 00:00:00", "2021-09-06 23:59:59"), |
| | | // Pair("2021-09-07 00:00:00", "2021-09-08 23:59:59"), |
| | | // Pair("2021-09-09 00:00:00", "2021-09-10 23:59:59"), |
| | | // Pair("2021-09-11 00:00:00", "2021-09-12 23:59:59"), |
| | | // Pair("2021-09-13 00:00:00", "2021-09-14 23:59:59"), |
| | | // Pair("2021-09-15 00:00:00", "2021-09-16 23:59:59"), |
| | | // Pair("2021-09-17 00:00:00", "2021-09-18 23:59:59"), |
| | | // Pair("2021-09-19 17:00:00", "2021-09-20 23:59:59"), |
| | | // Pair("2021-09-21 00:00:00", "2021-09-22 23:59:59"), |
| | | // Pair("2021-09-23 00:00:00", "2021-09-24 23:59:59"), |
| | | // Pair("2021-09-25 00:00:00", "2021-09-26 23:59:59"), |
| | | // Pair("2021-09-27 00:00:00", "2021-09-28 23:59:59"), |
| | | // Pair("2021-09-29 00:00:00", "2021-09-30 23:59:59"), |
| | | ) |
| | | timeSet.forEach {(s, e) -> |
| | | val workbook = realTimeDataService.outToWorkbook(deviceCode, s, e) |
| | | val fileName = "网格化监测_${deviceCode}_${s.substring(0, 10).replace("-", ".")}-${e.substring(8, 10)}.xls" |
| | | val filePath = "E:\\工作\\开发\\走航监测\\格式化数据\\$fileName" |
| | | val out = FileOutputStream(File(filePath)) |
| | | workbook.write(out) |
| | | workbook.close() |
| | | out.flush() |
| | | out.close() |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | fun dataPreprocessing() { |
| | | val r = realTimeDataService.dataPreprocessing() |
| | | println(r.data) |
| | | } |
| | | } |