From baf2cc2ce3dfd1235c012a3750132769fcd9ad2f Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 18 九月 2025 17:02:05 +0800
Subject: [PATCH] 2025.9.18 1. 联合前端调试数据产品接口(待完成)

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
index 70db70c..f103925 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
@@ -10,6 +10,7 @@
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.common.utils.DateUtil
 import cn.flightfeather.supervision.common.utils.UUIDGenerator
+import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
 import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
 import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
 import cn.flightfeather.supervision.lightshare.service.*
@@ -26,6 +27,7 @@
     val taskMapper: TaskMapper,
     private val taskRep: TaskRep,
     private val subTaskRep: SubTaskRep,
+    private val sceneRep: SceneRep,
 ) : TaskService {
 
     @Autowired
@@ -766,14 +768,33 @@
                 districtName = t.districtname
                 townCode = t.towncode
                 townName = t.townname
+
                 var count = 0
+                val countByScene = mutableMapOf<String?, Int>()
+                val allScenes = sceneRep.findSceneList(t.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
                 taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach {
-                    val c = if (it.extension1 != null) it.extension1!!.toInt() else 1
+                    val c = it.monitornum ?: 1
                     count += c
+
+                    allScenes.find { s-> s?.guid == it.sguid }?.let { s->
+//                        if (!countByScene.containsKey(s.type)) {
+//                            countByScene[s.type] = 0
+//                        }
+                        countByScene[s.type] = (countByScene[s.type] ?: 0) + c
+                    }
                 }
                 totaltask = count
-                subTaskSummary = subTaskRep.findSummary(areaVo)
+                totaltaskByScene = countByScene
+
+                subTaskSummary = subTaskRep.findSummary(AreaVo().apply {
+                    topTaskId = t.tguid
+                })
+                val completeByScene = mutableMapOf<String?, Int>()
+                subTaskSummary?.forEach {
+                    completeByScene[it.sceneType] = (completeByScene[it.sceneType] ?: 0) + 1
+                }
                 completetask = this.subTaskSummary?.size
+                completetaskByScene = completeByScene
             }
             res.add(pro)
         }

--
Gitblit v1.9.3