| | |
| | | package com.ruoyi.inspect.controller; |
| | | |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.inspect.domain.ArdVideoInspectTask; |
| | | import com.ruoyi.inspect.service.IArdVideoInspectTaskService; |
| | | import com.ruoyi.inspect.service.impl.InspectionTaskManager; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @Description: 巡检任务 |
| | | * @Description: 巡检任务controller |
| | | * @ClassName: TaskController |
| | | * @Author: 刘苏义 |
| | | * @Date: 2023年06月01日9:19 |
| | |
| | | **/ |
| | | @RestController |
| | | @Api(tags = "巡检任务") |
| | | @Anonymous |
| | | @RequestMapping("/inspect/control") |
| | | public class TaskController { |
| | | @Autowired |
| | | private InspectionTaskManager inspectionTaskManager; |
| | | |
| | | @Autowired |
| | | IArdVideoInspectTaskService ardVideoInspectTaskService; |
| | | @PreAuthorize("@ss.hasPermi('inspect:control:manual')") |
| | | @GetMapping("/startTask/{taskId}") |
| | | @ApiOperation("手动开启巡检") |
| | | AjaxResult startTask(@PathVariable String taskId) { |
| | | // 开启巡检任务 |
| | | inspectionTaskManager.startInspectionTask(taskId); |
| | | return AjaxResult.success(); |
| | | boolean enablemanualTask = ardVideoInspectTaskService.isEnablemanualTask(taskId); |
| | | if (enablemanualTask) |
| | | { |
| | | // 开启巡检任务 |
| | | inspectionTaskManager.startInspectionTask(taskId); |
| | | return AjaxResult.success(); |
| | | } |
| | | else |
| | | { |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('inspect:control:manual')") |
| | | @ApiOperation("手动停止巡检") |
| | | @GetMapping("/stopTask/{taskId}") |
| | | AjaxResult stopTask(@PathVariable String taskId) { |
| | |
| | | inspectionTaskManager.stopInspectionTask(taskId); |
| | | return AjaxResult.success(); |
| | | } |
| | | @PreAuthorize("@ss.hasPermi('inspect:control:manual')") |
| | | @ApiOperation("查询已启动任务") |
| | | @GetMapping("/getTaskList") |
| | | AjaxResult getTaskList() { |