From 39e208b6b0482a25c77e53590087c02d9d937563 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 20 七月 2022 09:04:48 +0800 Subject: [PATCH] 1. 巡查汇总报告功能编写完成 --- src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt | 43 +++++++++++++++++++++++++++++++++---------- 1 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt index 8317647..7a62467 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt @@ -4,6 +4,7 @@ import cn.flightfeather.supervision.business.report.BaseTemplate import cn.flightfeather.supervision.business.report.DataSource import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo +import cn.flightfeather.supervision.business.report.cols.ColTotalGrade import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.ExcelUtil import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite @@ -16,7 +17,7 @@ * 鍒嗚闀囬棶棰樻暣鏀瑰垎鏋愭眹鎬昏〃 */ class ProAnalysisSummary(dataSource: DataSource) : BaseTemplate(dataSource) { - override val cols: List<BaseCols> = listOf(ColInspectionInfo()) + override val cols: List<BaseCols> = listOf(ColInspectionInfo(), ColTotalGrade()) override val templateName: String = "鍒嗚闀囬棶棰樻暣鏀瑰垎鏋愭眹鎬昏〃" @@ -31,6 +32,7 @@ if (rowData.noRecord()) return@loop val r = cols[0].getOneRow(rowData) + val r1 = cols[1].getOneRow(rowData) val k = rowData.scene?.townname if (!districtMap.containsKey(k)) { @@ -70,6 +72,12 @@ if (pNum > 0 && cNum > 0) changeScenes++ proNum += pNum changeNum += cNum + + + val standard = r1[1] as ExcelUtil.MyCell + if (standard.text.contains("涓嶈鑼�")) { + focusSceneNum++ + } } } @@ -81,23 +89,32 @@ } districtMap.forEach { val v = it.value - v.changeScenePer = round(v.changeScenes.toDouble() / v.sceneCount * 1000) / 1000 - v.proPer = round(v.proNum.toDouble() / totalPro * 1000) / 1000 - v.changePer = round(v.changeNum.toDouble() / v.proNum * 1000) / 1000 + v.changeScenePer = v.changeScenes.toDouble() / v.sceneCount + v.proPer = v.proNum.toDouble() / totalPro + v.changePer = v.changeNum.toDouble() / v.proNum + v.focusScenePer = v.focusSceneNum.toDouble() / v.sceneCount } //鏁存敼鍗曚綅姣旀帓鍚� summarys.sortByDescending { it.changeScenePer } for (i in summarys.indices) { - summarys[i].changeSceneRank = i + 1 + if (i > 0 && summarys[i - 1].changeScenePer == summarys[i].changeScenePer) { + summarys[i].changeSceneRank = summarys[i - 1].changeSceneRank + } else { + summarys[i].changeSceneRank = i + 1 + } } //闂鏁存敼鐜囨帓鍚� summarys.sortByDescending { it.changePer } for (i in summarys.indices) { - summarys[i].proChangeRank = i + 1 + if (i > 0 && summarys[i - 1].changePer == summarys[i].changePer) { + summarys[i].proChangeRank = summarys[i - 1].proChangeRank + } else { + summarys[i].proChangeRank = i + 1 + } } //鏇存柊琛ㄥご @@ -131,12 +148,15 @@ ExcelUtil.MyCell("鎷熷垪鍏ラ噸鐐圭洃绠″崰姣�"), )) //鏇存柊鍐呭 - summarys.forEach { + summarys.sortBy { it.townCode } + for (i in summarys.indices) { + val it = summarys[i] contents.add( mutableListOf( - it.townCode, it.townName, it.type, it.sceneCount, it.inactiveScenes, it.activeScenes, it.changeScenes, - "${round(it.changeScenePer * 1000) / 10}%", - it.proNum, "${round(it.proPer * 1000) / 10}%", it.changeNum, "${round(it.changePer * 1000) / 10}%", it.changeSceneRank, it.proChangeRank + i+1, it.townName, it.type, it.sceneCount, it.inactiveScenes, it.activeScenes, it.changeScenes, + ExcelUtil.MyCell(it.changeScenePer.toString(), isPercent = true), + it.proNum, ExcelUtil.MyCell(it.proPer.toString(), isPercent = true), it.changeNum, ExcelUtil.MyCell(it.changePer.toString(), isPercent = true), it.changeSceneRank, it.proChangeRank, + it.focusSceneNum, ExcelUtil.MyCell(it.focusScenePer.toString(), isPercent = true) ) ) } @@ -165,5 +185,8 @@ var changeSceneRank = 0 var proChangeRank = 0 + + var focusSceneNum = 0 + var focusScenePer = .0 } } \ No newline at end of file -- Gitblit v1.9.3