1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cn.flightfeather.supervision.business.report.cols
 
import cn.flightfeather.supervision.business.report.BaseCols
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.ExcelUtil
import kotlin.math.round
 
class ColLedger : BaseCols() {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(mutableListOf(
            ExcelUtil.MyCell("台账提交百分比"),
            ExcelUtil.MyCell("台账提交时间"),
            ExcelUtil.MyCell("台账审核时间"),
        ))
    }
 
    override fun onOneRow(rowData: DataSource.RowData): List<Any> {
        val dateUtil = DateUtil()
        rowData.ledgerRecords.sortedByDescending {
            it.lrSubmitdate
        }
        val per = rowData.ledgerRecords.size.toDouble() / rowData.ledgerCount
        var t1 = ""
        var t2 = "/"
        if (rowData.ledgerRecords.isNotEmpty()) {
            val r = rowData.ledgerRecords[0]
            t1 = "${dateUtil.DateToString(r.lrSubmitdate, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_CN)}"
        }
        return listOf(ExcelUtil.MyCell(per.toString(), isPercent = true), t1, t2)
    }
}