| | |
| | | package cn.flightfeather.supervision.domain.ds1.repository |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Task |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.MonitorobjectversionMapper |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.springframework.stereotype.Repository |
| | | import java.time.LocalDate |
| | | import java.time.LocalDateTime |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.ZoneId |
| | | import java.time.format.DateTimeFormatter |
| | | import java.util.* |
| | | |
| | | @Repository |
| | | class TaskRep(private val taskMapper: TaskMapper) { |
| | | class TaskRep(private val taskMapper: TaskMapper, private val monitorobjectversionMapper: MonitorobjectversionMapper) { |
| | | |
| | | private fun exampleTask(areaVo: AreaVo): Task?{ |
| | | areaVo.starttime ?: return null |
| | |
| | | endtime = Date.from(mEnd.atZone(ZoneId.systemDefault()).toInstant()) |
| | | } |
| | | } |
| | | |
| | | fun update(task: Task): Int { |
| | | return taskMapper.updateByPrimaryKeySelective(task) |
| | | } |
| | | |
| | | /** |
| | | * 查找一个总任务 |
| | | */ |
| | |
| | | val example = exampleTask(areaVo) ?: return emptyList() |
| | | return taskMapper.select(example) |
| | | } |
| | | |
| | | fun findTasks(task: Task): List<Task?> { |
| | | return taskMapper.select(task) |
| | | } |
| | | |
| | | /** |
| | | * 获取总任务对应的监管版本 |
| | | */ |
| | | fun findMonitorList(taskId: String, sceneTypeId:String?): List<Monitorobjectversion> { |
| | | val monitorList = monitorobjectversionMapper.findMonitorListByScene(taskId, sceneTypeId) |
| | | return monitorList.sortedBy { it.displayid } |
| | | } |
| | | |
| | | /** |
| | | * 获取日任务 |
| | | * @param taskId 顶层任务id |
| | | */ |
| | | fun findDayTasks(taskId: String?): List<Task?> { |
| | | return taskMapper.selectByExample(Example(Task::class.java).apply { |
| | | createCriteria().andEqualTo("tsguid", taskId) |
| | | orderBy("starttime").desc() |
| | | }) |
| | | } |
| | | } |