From 01ac08186355e85cab4a7c6f4403180184894f23 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期六, 09 十月 2021 14:38:44 +0800 Subject: [PATCH] 1. 新增网格化数据统计功能 --- src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt | 99 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 91 insertions(+), 8 deletions(-) diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt index 4845484..f70d06c 100644 --- a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt +++ b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImplTest.kt @@ -1,7 +1,12 @@ 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.* @@ -9,6 +14,7 @@ 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.* @@ -23,14 +29,91 @@ @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() + } } } } \ No newline at end of file -- Gitblit v1.9.3