ÎļþÃû´Ó src/main/kotlin/com/flightfeather/uav/dataprocess/DataProcess.kt ÐÞ¸Ä |
| | |
| | | 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.* |
| | | |
| | | /** |
| | | * æ°æ®å¤ç |
| | |
| | | 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>() |
| | |
| | | dayData[day]?.add(it) |
| | | |
| | | if (!dailyVariationData.containsKey(hour)) { |
| | | dailyVariationData[hour] = PreData(hour, false) |
| | | dailyVariationData[hour] = PreData(hour, needQuartile = false) |
| | | } |
| | | dailyVariationData[hour]?.add(it) |
| | | } |
| | |
| | | //第ä¸è¡ä¸ºæ¶é´ä»¥åçæµå ååç§°ï¼å¹¶ä¸éè¦æ ¹æ®ä¸ä¸è¡çç»è®¡é¡¹åå¹¶å |
| | | 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()) |
| | | //åsheetå»ºç«æ é¢ |
| | | sheetRow.forEach { (s, i) -> |