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/lightshare/service/impl/SearchServiceImpl.kt |   98 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 75 insertions(+), 23 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..1025cf9 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,8 +1,17 @@
 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.*
+import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper
+import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
+import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
 import cn.flightfeather.supervision.lightshare.service.SearchService
 import cn.flightfeather.supervision.lightshare.vo.*
 import com.github.pagehelper.PageHelper
@@ -22,33 +31,76 @@
  */
 @Service
 class SearchServiceImpl(
-    val userinfoMapper: UserinfoMapper,
-    val subtaskMapper: SubtaskMapper,
-    val scenseMapper: ScenseMapper,
-    val sceneConstructionSiteMapper: SceneConstructionSiteMapper,
-    val sceneMixingPlantMapper: SceneMixingPlantMapper,
-    val sceneStorageYardMapper: SceneStorageYardMapper,
-    val sceneWharfMapper: SceneWharfMapper,
-    val problemlistMapper: ProblemlistMapper,
-    val problemtypeMapper: ProblemtypeMapper,
-    val townMapper: TownMapper,
-    val mediafileMapper: MediafileMapper,
-    val scoreMapper: ScoreMapper,
-    val inspectionMapper: InspectionMapper,
-    val taskMapper: TaskMapper,
-    val monitorobjectversionMapper: MonitorobjectversionMapper
+        val userinfoMapper: UserinfoMapper,
+        val subtaskMapper: SubtaskMapper,
+        val scenseMapper: ScenseMapper,
+        val sceneConstructionSiteMapper: SceneConstructionSiteMapper,
+        val sceneMixingPlantMapper: SceneMixingPlantMapper,
+        val sceneStorageYardMapper: SceneStorageYardMapper,
+        val sceneWharfMapper: SceneWharfMapper,
+        val problemlistMapper: ProblemlistMapper,
+        val problemtypeMapper: ProblemtypeMapper,
+        val townMapper: TownMapper,
+        val mediafileMapper: MediafileMapper,
+        val scoreMapper: ScoreMapper,
+        val inspectionMapper: InspectionMapper,
+        val taskMapper: TaskMapper,
+        val monitorobjectversionMapper: MonitorobjectversionMapper,
+        val evaluationruleMapper: EvaluationruleMapper,
+        val evaluationsubruleMapper: EvaluationsubruleMapper2,
+        val evaluationMapper: EvaluationMapper,
+        val itemevaluationMapper: ItemevaluationMapper,
+        val ledgerSubTypeMapper: LedgerSubTypeMapper,
+        val ledgerRecordMapper: LedgerRecordMapper,
+        val userMapMapper: UserMapMapper,
 ) : 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,
+                ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
+        )
+        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 +569,7 @@
         //鍘熸湁鐨勭涓�琛岃〃澶村鍔�1琛岃璺ㄥ害,鍚屾椂鏂扮殑绗簩琛岃〃澶存坊鍔犵┖浣�
         head[0].forEach {
             (it as ExcelUtil.MyCell).rowSpan++
-            h2.add(0, "")
+//            h2.add(0, "")
         }
         //鍚堝苟琛ㄥご
         head[0].addAll(h1)

--
Gitblit v1.9.3