feiyu02
2025-09-30 a3cc1d220f8a1de11874bebceba0130d32157ff1
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)
        }