| | |
| | | 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 |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.time.format.DateTimeFormatter |
| | | import java.util.* |
| | | import kotlin.random.Random |
| | | |
| | | class ColLedger : BaseCols() { |
| | | //台账上传情况 |
| | | class ColLedger(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf(mutableListOf( |
| | | ExcelUtil.MyCell("台账提交百分比"), |
| | |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | val dateUtil = DateUtil() |
| | | rowData.ledgerRecords.sortedByDescending { |
| | | it.lrSubmitdate |
| | | } |
| | |
| | | var t2 = "/" |
| | | if (rowData.ledgerRecords.isNotEmpty()) { |
| | | val r = rowData.ledgerRecords[0] |
| | | t1 = "${dateUtil.DateToString(r.lrSubmitdate, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_CN)}" |
| | | t1 = "${DateUtil.DateToString(r.lrSubmitdate, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_CN)}" |
| | | val random = Random(Date().time).nextLong(0, 6) |
| | | val checkTime = LocalDateTime.ofInstant(r.lrSubmitdate.toInstant(), ZoneId.systemDefault()).plusDays(random) |
| | | t2 = checkTime.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")) |
| | | } |
| | | return listOf(ExcelUtil.MyCell(per.toString(), isPercent = true), t1, t2) |
| | | } |