| | |
| | | package com.ruoyi.inspect.controller; |
| | | |
| | | |
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; |
| | | import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.inspect.service.IArdVideoInspectTaskService; |
| | | import com.ruoyi.inspect.service.impl.InspectionTaskManager; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.utils.gis.GisUtil; |
| | | import com.ruoyi.utils.gis.Point; |
| | | 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 org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: 巡检任务controller |
| | |
| | | private InspectionTaskManager inspectionTaskManager; |
| | | @Autowired |
| | | IArdVideoInspectTaskService ardVideoInspectTaskService; |
| | | @Autowired |
| | | IArdAlarmpointsWellService ardAlarmpointsWellService; |
| | | @Autowired |
| | | private ISysDeptService deptService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('inspect:control:manual')") |
| | | @GetMapping("/startTask/{taskId}") |
| | | @ApiOperation("手动开启巡检") |
| | | AjaxResult startTask(@PathVariable String taskId) { |
| | | boolean enablemanualTask = ardVideoInspectTaskService.isEnablemanualTask(taskId); |
| | | if (enablemanualTask) |
| | | { |
| | | if (enablemanualTask) { |
| | | // 开启巡检任务 |
| | | inspectionTaskManager.startInspectionTask(taskId); |
| | | return AjaxResult.success(); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/startTask/{taskId}/noPerm") |
| | | @ApiOperation("手动开启巡检-不校验权限") |
| | | AjaxResult startTaskNoPerm(@PathVariable String taskId) { |
| | | boolean enablemanualTask = ardVideoInspectTaskService.isEnablemanualTask(taskId); |
| | | if (enablemanualTask) |
| | | { |
| | | if (enablemanualTask) { |
| | | // 开启巡检任务 |
| | | inspectionTaskManager.startInspectionTask(taskId); |
| | | return AjaxResult.success(); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | |
| | | Set<String> taskIds = inspectionTaskManager.getTaskMap().keySet(); |
| | | return AjaxResult.success(taskIds); |
| | | } |
| | | |
| | | @ApiOperation("查询范围内的井") |
| | | @PostMapping("/getWellListByPolygon") |
| | | AjaxResult getWellListByPolygon(@RequestBody List<Point> points) { |
| | | List<List<ArdAlarmpointsWell>> listOfLists = new ArrayList<>(); |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.stream().forEach(dept -> { |
| | | ArdAlarmpointsWell ardAlarmpointsWell = new ArdAlarmpointsWell(); |
| | | ardAlarmpointsWell.setDeptId(dept.getDeptId()); |
| | | List<ArdAlarmpointsWell> wellList = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell); |
| | | List<ArdAlarmpointsWell> wells = wellList.stream() |
| | | .filter(well -> well.getLongitude() != null && well.getLatitude() != null) |
| | | .filter(well -> GisUtil.isInPolygon(new Point(well.getLongitude(), well.getLatitude()), points) |
| | | ).collect(Collectors.toList()); |
| | | listOfLists.add(wells); |
| | | }); |
| | | List<ArdAlarmpointsWell> inPolygonWellList = listOfLists.stream() |
| | | .flatMap(List::stream) |
| | | .collect(Collectors.toList()); |
| | | return AjaxResult.success(inPolygonWellList); |
| | | } |
| | | } |