package cn.flightfeather.supervision.business.bgtask
|
|
import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
|
import cn.flightfeather.supervision.common.utils.Constant
|
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
|
import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
|
import org.springframework.stereotype.Component
|
import java.util.*
|
|
/**
|
* 结束所有正在执行的巡查任务,并且对未评分的任务进行自动评分
|
*/
|
@Component
|
class TaskFinishSubtask(
|
private val subTaskRep: SubTaskRep,
|
private val evaluationRep: EvaluationRep,
|
private val aopEvaluation: AopEvaluation,
|
) {
|
|
fun handle() {
|
val list = subTaskRep.findByStatus(Constant.TaskProgress.RUNINGSTATUS2)
|
list.forEach {
|
it ?: return@forEach
|
evaluationRep.findBySubtask(it.stguid) ?: aopEvaluation.executeBySubTask(it)
|
it.status = Constant.TaskProgress.RUNINGSTATUS3.text
|
it.executionendtime = Date()
|
subTaskRep.update(it)
|
}
|
}
|
}
|