From da431c25dfe5122e4ed70372da36ede3e4eaec4a Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 31 五月 2024 17:43:41 +0800 Subject: [PATCH] 1. 新增自动报告生成功能 --- src/main/kotlin/com/flightfeather/uav/biz/dataprocess/DataProcess.kt | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/dataprocess/DataProcess.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataprocess/DataProcess.kt similarity index 86% rename from src/main/kotlin/com/flightfeather/uav/dataprocess/DataProcess.kt rename to src/main/kotlin/com/flightfeather/uav/biz/dataprocess/DataProcess.kt index 3f39b6a..307defb 100644 --- a/src/main/kotlin/com/flightfeather/uav/dataprocess/DataProcess.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/dataprocess/DataProcess.kt @@ -1,14 +1,13 @@ -package com.flightfeather.uav.dataprocess +package com.flightfeather.uav.biz.dataprocess -import com.flightfeather.uav.common.utils.DateUtil import com.flightfeather.uav.common.utils.ExcelUtil import com.flightfeather.uav.lightshare.bean.DataVo +import com.flightfeather.uav.socket.eunm.FactorType import org.apache.poi.xssf.streaming.SXSSFWorkbook import org.apache.poi.xssf.usermodel.XSSFWorkbook import java.io.File import java.io.FileInputStream import java.io.FileOutputStream -import java.util.* /** * 鏁版嵁澶勭悊 @@ -22,7 +21,21 @@ companion object { const val SHEET1 = "灏忔椂鏁版嵁" const val SHEET2 = "鏃ユ暟鎹�" - const val SHEET3 = "鏃ュ彉鍖�" + const val SHEET3 = "鏃ュ彉鍖�"//闇�瑕佽绠楃殑椤圭洰 + val needFactor: List<FactorType> = listOf( + FactorType.NO2, + FactorType.CO, + FactorType.H2S, + FactorType.SO2, + FactorType.O3, + FactorType.PM25, + FactorType.PM10, + FactorType.VOC + ) + val items = listOf( + "璁板綍鏁�", "鍧囧��", "鏍囧噯宸�", "鏈�灏忓��", "鏈�澶у��", "10%鍒嗕綅鍊�", "25%鍒嗕綅鍊�", "50%鍒嗕綅鍊�", "75%鍒嗕綅鍊�", "90%鍒嗕綅鍊�" + ) + } //姣忔棩灏忔椂鏁版嵁 private val dateData = mutableMapOf<String?, PreData>() @@ -73,7 +86,7 @@ dayData[day]?.add(it) if (!dailyVariationData.containsKey(hour)) { - dailyVariationData[hour] = PreData(hour, false) + dailyVariationData[hour] = PreData(hour, needQuartile = false) } dailyVariationData[hour]?.add(it) } @@ -92,12 +105,12 @@ //绗竴琛屼负鏃堕棿浠ュ強鐩戞祴鍥犲瓙鍚嶇О锛屽苟涓旈渶瑕佹牴鎹笅涓�琛岀殑缁熻椤瑰悎骞跺垪 val firstRow = mutableListOf<ExcelUtil.MyCell>() firstRow.add(ExcelUtil.MyCell("鏃堕棿", 2)) - PreData.needFactor.forEach { firstRow.add(ExcelUtil.MyCell(it.des, colSpan = PreData.items.size)) } + needFactor.forEach { firstRow.add(ExcelUtil.MyCell(it.des, colSpan = items.size)) } contents.add(firstRow.toTypedArray()) //绗簩琛屼负姣忕鐩戞祴鍥犲瓙瀵瑰簲鐨勭粺璁¢」锛屽叿浣撲负璁板綍鏁般�佸潎鍊笺�佹爣鍑嗗樊銆佹渶灏忓�笺�佹渶澶у�笺��10/25/50/75/90%鍒嗕綅鍊硷紝姣忕鐩戞祴鍥犲瓙鏈�10鍒� val secondRow = mutableListOf<String>() secondRow.add("") - repeat(PreData.needFactor.size) { secondRow.addAll(PreData.items) } + repeat(needFactor.size) { secondRow.addAll(items) } contents.add(secondRow.toTypedArray()) //鍒唖heet寤虹珛鏍囬 sheetRow.forEach { (s, i) -> -- Gitblit v1.9.3