From 46872a311da9480d3edb19223aca2e0833fb1e31 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 17 十二月 2024 11:41:00 +0800 Subject: [PATCH] 1. 完成数据产品中间结果基本信息和具体信息入库 2. 修改ColInspectionInfo.kt 监管时间格式修改为yyyy-mm-dd 3. 新增数据产品类型枚举类 DataProductType 4. 修改BaseTemplate实现类通过重写genData方法生成Template相关数据 5. TODO 其他未涉及到的产品对象的中间结果对象 --- src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt | 37 +++++++++++++++++++++++++++++++++---- 1 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt index ae22382..61a1cb8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt @@ -5,15 +5,31 @@ /** * 缁熻鏁版嵁鍒楀熀绫� + * @param chooseIndexList 閫夋嫨闇�瑕佽緭鍑虹殑鍒楀簭鍙凤紝涓嶅~鍐欐椂琛ㄧず榛樿杈撳嚭鎵�鏈夊垪 */ -abstract class BaseCols(){ +abstract class BaseCols(private val chooseIndexList: List<Int>){ protected var heads = mutableListOf<MutableList<ExcelUtil.MyCell>>() //鐢熸垚琛ㄥご fun getHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { heads = onHeads(dataSource) - return heads + val _heads = if (chooseIndexList.isNotEmpty()) { + val __heads = mutableListOf<MutableList<ExcelUtil.MyCell>>() + heads.forEach {head -> + val h = mutableListOf<ExcelUtil.MyCell>() + chooseIndexList.forEach {i -> + if (i < head.size) { + h.add(head[i]) + } + } + __heads.add(h) + } + __heads + } else { + heads + } + return _heads } abstract fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> @@ -27,7 +43,20 @@ // } else { // onOneRow(rowData) // } - return onOneRow(rowData) + val row = onOneRow(rowData) + val _row = if (chooseIndexList.isNotEmpty()) { + val r = mutableListOf<Any>() + chooseIndexList.forEach {i -> + if (i < row.size) { + r.add(row[i]) + } + } + r + } else { + row + } + + return _row } abstract fun onOneRow(rowData: DataSource.RowData): List<Any> @@ -40,7 +69,7 @@ * 鏂拌�佽〃澶村悎骞� */ fun combineHead(oldHeads: MutableList<MutableList<ExcelUtil.MyCell>>, dataSource: DataSource) { - //鍚堝苟琛ㄥご锛岄噰鍙栫畝鍖栭�昏緫锛屽彧鏈夌涓�琛岀殑琛ㄥご浼氳繘琛屽崟鍏冩牸鐨勮法琛屽悎骞� + // FIXME: 2023/1/31 鍚堝苟琛ㄥご锛岄噰鍙栫畝鍖栭�昏緫锛屽彧鏈夌涓�琛岀殑琛ㄥご浼氳繘琛屽崟鍏冩牸鐨勮法琛屽悎骞� val newHeads = getHeads(dataSource) if (oldHeads.isEmpty()) { newHeads.forEach { oldHeads.add(it) } -- Gitblit v1.9.3