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/template/ProTypeRankMainSummary.kt |   47 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
index 1eec3c3..7b8bb95 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
@@ -1,20 +1,36 @@
 package cn.flightfeather.supervision.business.report.template
 
 import cn.flightfeather.supervision.business.report.DataSource
+import cn.flightfeather.supervision.business.report.bean.BaseTemplateResult
+import cn.flightfeather.supervision.business.report.bean.ProTypeRankMainSummaryResult
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.common.utils.ExcelUtil
-import kotlin.math.round
 
 class ProTypeRankMainSummary(dataSource: DataSource) : ProTypeRankSummary(dataSource) {
     override val templateName: String = "鏈堝害涓昏鎴栧吀鍨嬮棶棰樺垎鏋愯〃"
-
+    override var resultObjects: MutableList<BaseTemplateResult> = mutableListOf(ProTypeRankMainSummaryResult())
     override fun formatTable(summarys: MutableList<Summary>) {
+        //鎺掑悕闈犲墠鐨刴ax涓棶棰樿璁ゅ畾涓轰富瑕佹垨鍏稿瀷闂
         val max = when (dataSource.config.sceneType.toString()) {
-            Constant.ScenseType.TYPE1.value -> 5
+            Constant.SceneType.TYPE1.value -> 5
             else -> 4
         }
 
         summarys.sortByDescending { it.count }
+
+        var tPros = 0
+        var mainTPros = 0
+        var pDes = ""
+        for (i in summarys.indices) {
+            val it = summarys[i]
+            tPros += it.count
+            if (i < max) {
+                val lr = if (i > 0) "\n" else ""
+                mainTPros += it.count
+                pDes += "${lr}${i+1}銆�${it.proDes}"
+            }
+        }
+        var per = if (tPros == 0) .0 else mainTPros.toDouble() / tPros
 
         head.clear()
         head.add(
@@ -41,16 +57,23 @@
                 ExcelUtil.MyCell("涓昏闂鍗犳瘮"),
             )
         )
-        for (i in summarys.indices) {
-            if (i >= max) break
+//        for (i in summarys.indices) {
+//            if (i >= max) break
+//
+//            val s = summarys[i]
+//            contents.add(
+//                mutableListOf(
+//                    i + 1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, s.count,
+//                    s.proDes, s.count, ExcelUtil.MyCell(s.countPer.toString(), isPercent = true)
+//                )
+//            )
+//        }
 
-            val s = summarys[i]
-            contents.add(
-                mutableListOf(
-                    i + 1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, s.count,
-                    s.proDes, s.count, ExcelUtil.MyCell(s.countPer.toString(), isPercent = true)
-                )
+        contents.add(
+            mutableListOf(
+                1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, tPros,
+                pDes, mainTPros, ExcelUtil.MyCell(per.toString(), isPercent = true)
             )
-        }
+        )
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3