From 909fd8929d7906f1dca68acc05e36e29b0b9192c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 15 十一月 2022 10:57:30 +0800
Subject: [PATCH] 2022.11.15

---
 src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt |   38 ++++++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
index 71f5ce4..3d715f9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -39,12 +39,12 @@
     val rowData = RowData()
 
     init {
-        if (config.districtCode == null) {
-            throw IllegalStateException("鍙傛暟缂哄皯鍖哄幙缂栫爜:[districtCode]")
-        }
-        if (config.sceneType == null) {
-            throw IllegalStateException("鍙傛暟缂哄皯鍦烘櫙绫诲瀷:[sceneType]")
-        }
+//        if (config.districtCode == null) {
+//            throw IllegalStateException("鍙傛暟缂哄皯鍖哄幙缂栫爜:[districtCode]")
+//        }
+//        if (config.sceneType == null) {
+//            throw IllegalStateException("鍙傛暟缂哄皯鍦烘櫙绫诲瀷:[sceneType]")
+//        }
         getSource(config)
     }
 
@@ -76,10 +76,10 @@
     }
 
     /**
-     * 鑾峰彇鎶ュ憡鏁版嵁婧�
+     * 鑾峰彇鎶ュ憡鏁版嵁婧愶紙宸℃煡浠诲姟锛�
      */
     private fun getSource(config: ExcelConfigVo) {
-        if (config.sceneType == null) return
+//        if (config.sceneType == null) return
 
         val result = mutableListOf<Subtask>()
 
@@ -108,6 +108,8 @@
                     }
                     config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                     config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
+                    config.districtCode?.let { andEqualTo("districtcode", it) }
+//                    andEqualTo("tguid", config.topTaskGuid)
                 }
             })
         } else {
@@ -142,6 +144,8 @@
         var index = 0
 
         var subTask: Subtask? = null
+
+        private var lastScene: Scense? = null
 
         //鍦烘櫙鍩烘湰淇℃伅
         val scene: Scense?
@@ -192,6 +196,7 @@
             }
         private var _problems = mutableListOf<Problemlist>()
 
+        //璇勪及鎬诲垎
         val evaluation: Evaluation?
             get() {
                 if (_evaluation == null) {
@@ -205,6 +210,7 @@
             }
         private var _evaluation: Evaluation? = null
 
+        //璇勪及缁嗗垯寰楀垎
         val itemevaluationList: MutableList<Itemevaluation>
             get() {
                 if (_itemevaluationList.isEmpty()) {
@@ -223,8 +229,8 @@
             get() {
                 if (_problemTypes.isEmpty()) {
                     val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply {
-                        createCriteria().andEqualTo("scensetypeid", config.sceneType)
-                            .andEqualTo("districtcode", config.districtCode)
+                        createCriteria().andEqualTo("scensetypeid", scene?.typeid)
+                            .andEqualTo("districtcode", scene?.districtcode)
                         orderBy("extension1")
                     })
                     _problemTypes.addAll(r)
@@ -240,7 +246,7 @@
                     val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
                         createCriteria()
                             .andEqualTo("tasktypeid", 99)
-                            .andEqualTo("scensetypeid", config.sceneType)
+                            .andEqualTo("scensetypeid", scene?.typeid)
                     })
                     if (rule.isNotEmpty()) {
                         val ruleId = rule[0].guid
@@ -299,7 +305,7 @@
         val ledgerCount: Int
             get() {
                 if (_ledgerCount == -1) {
-                    val tzSceneType = Constant.ScenseType.typeMap(config.sceneType?.toByte())
+                    val tzSceneType = Constant.ScenseType.typeMap(scene?.typeid)
                     _ledgerCount = dbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
                         createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true)
                     })
@@ -356,6 +362,14 @@
          * 娓呯┖褰撳墠澶勭悊鐨勫璞$殑鐩稿叧鏁版嵁婧�
          */
         fun clear() {
+            if (lastScene != null && lastScene?.typeid != _scene?.typeid) {
+                _problemTypes.clear()
+                _topItems.clear()
+                _rules.clear()
+                _ledgerCount = -1
+            } else {
+                lastScene = _scene
+            }
             _scene = null
             _baseScene = null
             _problems.clear()

--
Gitblit v1.9.3