From b041775dae4438e428d2b70d2b22cfe8c49844fe Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 19 七月 2022 16:22:36 +0800
Subject: [PATCH] 1. 巡查汇总报告功能编写基本完成

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt |   63 +++++++++++++++++++++++++++----
 1 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
index dbcdd84..647b09e 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -1,5 +1,11 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
+import cn.flightfeather.supervision.business.report.DataSource
+import cn.flightfeather.supervision.business.report.DbMapper
+import cn.flightfeather.supervision.business.report.file.ReportOne
+import cn.flightfeather.supervision.business.report.file.ReportThree
+import cn.flightfeather.supervision.business.report.file.ReportTwo
+import cn.flightfeather.supervision.business.report.template.*
 import cn.flightfeather.supervision.common.utils.*
 import cn.flightfeather.supervision.domain.ds1.entity.*
 import cn.flightfeather.supervision.domain.ds1.mapper.*
@@ -36,19 +42,58 @@
     val scoreMapper: ScoreMapper,
     val inspectionMapper: InspectionMapper,
     val taskMapper: TaskMapper,
-    val monitorobjectversionMapper: MonitorobjectversionMapper
+    val monitorobjectversionMapper: MonitorobjectversionMapper,
+    val evaluationruleMapper: EvaluationruleMapper,
+    val evaluationsubruleMapper: EvaluationsubruleMapper2,
+    val evaluationMapper: EvaluationMapper,
+    val itemevaluationMapper: ItemevaluationMapper
 ) : SearchService {
 
     private val dateUtil = DateUtil()
 
-    override fun writeToFile(config: ExcelConfigVo) {
-        val fileName = "target/${dateUtil.DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
+    override fun writeToFile(config: ExcelConfigVo, mode:Int) {
+        val dbMapper = DbMapper(
+            scenseMapper,
+            problemlistMapper,
+            problemtypeMapper,
+            subtaskMapper,
+            monitorobjectversionMapper,
+            sceneConstructionSiteMapper,
+            sceneMixingPlantMapper,
+            sceneStorageYardMapper,
+            sceneWharfMapper,
+            taskMapper,
+            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper
+        )
+        val dataSource = DataSource(config, dbMapper)
+        val t = when (mode) {
+//            //闂涓庢暣鏀硅窡韪眹鎬昏〃
+//            0 -> ProDetailSummary(dataSource)
+//            //鍒嗚闀囬棶棰樻暣鏀瑰垎鏋愭眹鎬昏〃
+//            1 -> ProAnalysisSummary(dataSource)
+//
+//            //瑙勮寖鎬ц瘎浼拌鎯呰〃
+//            2 -> ScoreDetailSummary(dataSource)
+//            //鍒嗚闀囪鑼冩�у垎鏋愯〃
+//            3 -> ScoreAnalysisSummary(dataSource)
+//
+//            //闂涓庢暣鏀瑰垎绫荤粺璁¤〃
+//            4 -> ProTypeDetailSummary(dataSource)
+//            //闂涓庢暣鏀瑰垎绫绘帓鍚�
+//            5 -> ProTypeRankSummary(dataSource)
+//            //鏈堝害涓昏鎴栧吀鍨嬮棶棰樺垎鏋愯〃
+//            6 -> ProTypeRankMainSummary(dataSource)
+//            //宸ュ湴鏂藉伐闃舵闂鍒嗙被鍒嗘瀽琛�
+//            7 -> ProTypeStatusSummary(dataSource)
 
-        val out = FileOutputStream(fileName)
-//        val heads = getTableTitles(config.sceneType, config.districtCode)
-//        val contents = getTableContents(config, heads.size)
-        val r = getTable(2, config)
-        ExcelUtil.write2(out, r.first, r.second)
+            8 -> ReportOne(dataSource)
+            9 -> ReportTwo(dataSource)
+            10 -> ReportThree(dataSource)
+
+            else -> null
+        }
+//        t?.execute()
+        t?.toFile("target/")
     }
 
     override fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse {
@@ -517,7 +562,7 @@
         //鍘熸湁鐨勭涓�琛岃〃澶村鍔�1琛岃璺ㄥ害,鍚屾椂鏂扮殑绗簩琛岃〃澶存坊鍔犵┖浣�
         head[0].forEach {
             (it as ExcelUtil.MyCell).rowSpan++
-            h2.add(0, "")
+//            h2.add(0, "")
         }
         //鍚堝苟琛ㄥご
         head[0].addAll(h1)

--
Gitblit v1.9.3