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) }