feiyu02
2025-12-22 2302c9f0336f7ae4acae0583412ddc396645a0ed
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
@@ -10,6 +10,8 @@
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.entity.Scense
import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
@@ -28,6 +30,7 @@
    private val taskRep: TaskRep,
    private val subTaskRep: SubTaskRep,
    private val sceneRep: SceneRep,
    private val scenseMapper: ScenseMapper,
) : TaskService {
    @Autowired
@@ -320,7 +323,7 @@
        return taskVoList
    }
    override fun getDayTask(taskId: String, userId: String?, userType: String): List<DayTaskProgressVo> {
    override fun getDayTask(taskId: String, userId: String?, userType: String, sceneTypeId: String?): List<DayTaskProgressVo> {
        val resultList = ArrayList<DayTaskProgressVo>()
        // 获取总任务下所有日任务
@@ -332,12 +335,18 @@
        // 获取总任务下所有的子任务
        val subTasks = subTaskRep.findAll(Subtask().apply { tguid = taskId })
        if (subTasks.isEmpty()) return emptyList()
        // 获取所有子任务涉及的巡查场景信息
        val sceneList = scenseMapper.selectByExample(Example(Scense::class.java).apply {
            createCriteria().andIn("guid", subTasks.map { it?.scenseid })
        })
        //根据sql条件查询
        dayTasks.forEach {t->
            // 筛选当前日任务下的子任务
            val filterSubTasks = subTasks.filter {s->
                s?.tsguid == t?.tguid
                val scene = sceneList.find { it?.guid == s?.scenseid }
                s?.tsguid == t?.tguid && (sceneTypeId.isNullOrBlank() || scene?.typeid.toString() == sceneTypeId)
            }
            // 获取当日所有的问题
            val subTaskIds = filterSubTasks.map { fs-> fs?.stguid }
@@ -348,6 +357,7 @@
            } else{
                emptyList()
            }
            /** 总巡查量统计 **/
            // 子任务总数
            val total = filterSubTasks.size
@@ -355,6 +365,7 @@
            val complete = filterSubTasks.count {fs->
                fs?.status == Constant.TaskProgress.RUNINGSTATUS3.text
            }
            /** 总问题整改率统计 **/
            // 总问题数和总整改数
            val totalProblemNum = problemList.size
@@ -386,7 +397,8 @@
                        // 单人巡查量累计
                        // 当多个人一起执行同一任务时,平分巡查量
                        this.totalTaskNum += 1.0 / ids.size
                        if (fst.status== Constant.TaskProgress.RUNINGSTATUS3.text)
                        if (fst.status == Constant.TaskProgress.RUNINGSTATUS3.text) {
                        }
                            this.completeTaskNum += 1.0 / ids.size
                        // 单人整改率累计(评分)