ard-work/src/main/java/com/ruoyi/inspect/controller/ArdVideoInspectTaskStepController.java
@@ -2,6 +2,7 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -23,14 +24,13 @@ /** * è§é¢å·¡æ£æ¥éª¤Controller * * * @author ruoyi * @date 2023-05-30 */ @RestController @RequestMapping("/inspect/step") public class ArdVideoInspectTaskStepController extends BaseController { public class ArdVideoInspectTaskStepController extends BaseController { @Autowired private IArdVideoInspectTaskStepService ardVideoInspectTaskStepService; @@ -39,8 +39,7 @@ */ @PreAuthorize("@ss.hasPermi('inspect:step:list')") @GetMapping("/list") public TableDataInfo list(ArdVideoInspectTaskStep ardVideoInspectTaskStep) { public TableDataInfo list(ArdVideoInspectTaskStep ardVideoInspectTaskStep) { startPage(); List<ArdVideoInspectTaskStep> list = ardVideoInspectTaskStepService.selectArdVideoInspectTaskStepList(ardVideoInspectTaskStep); return getDataTable(list); @@ -52,8 +51,7 @@ @PreAuthorize("@ss.hasPermi('inspect:step:export')") @Log(title = "è§é¢å·¡æ£æ¥éª¤", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ArdVideoInspectTaskStep ardVideoInspectTaskStep) { public void export(HttpServletResponse response, ArdVideoInspectTaskStep ardVideoInspectTaskStep) { List<ArdVideoInspectTaskStep> list = ardVideoInspectTaskStepService.selectArdVideoInspectTaskStepList(ardVideoInspectTaskStep); ExcelUtil<ArdVideoInspectTaskStep> util = new ExcelUtil<ArdVideoInspectTaskStep>(ArdVideoInspectTaskStep.class); util.exportExcel(response, list, "è§é¢å·¡æ£æ¥éª¤æ°æ®"); @@ -64,8 +62,7 @@ */ @PreAuthorize("@ss.hasPermi('inspect:step:query')") @GetMapping(value = "/{taskId}") public AjaxResult getInfo(@PathVariable("taskId") String taskId) { public AjaxResult getInfo(@PathVariable("taskId") String taskId) { return success(ardVideoInspectTaskStepService.selectArdVideoInspectTaskStepByTaskId(taskId)); } @@ -75,8 +72,7 @@ @PreAuthorize("@ss.hasPermi('inspect:step:add')") @Log(title = "è§é¢å·¡æ£æ¥éª¤", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ArdVideoInspectTaskStep ardVideoInspectTaskStep) { public AjaxResult add(@RequestBody ArdVideoInspectTaskStep ardVideoInspectTaskStep) { return toAjax(ardVideoInspectTaskStepService.insertArdVideoInspectTaskStep(ardVideoInspectTaskStep)); } @@ -85,9 +81,18 @@ */ @PreAuthorize("@ss.hasPermi('inspect:step:edit')") @Log(title = "è§é¢å·¡æ£æ¥éª¤", businessType = BusinessType.UPDATE) @GetMapping("/selectByTaskId") public List selectByTaskId(String taskId) { return ardVideoInspectTaskStepService.selectByTaskId(taskId); } /** * ä¿®æ¹è§é¢å·¡æ£æ¥éª¤ */ @PreAuthorize("@ss.hasPermi('inspect:step:edit')") @Log(title = "è§é¢å·¡æ£æ¥éª¤", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ArdVideoInspectTaskStep ardVideoInspectTaskStep) { public AjaxResult edit(@RequestBody ArdVideoInspectTaskStep ardVideoInspectTaskStep) { return toAjax(ardVideoInspectTaskStepService.updateArdVideoInspectTaskStep(ardVideoInspectTaskStep)); } @@ -96,9 +101,8 @@ */ @PreAuthorize("@ss.hasPermi('inspect:step:remove')") @Log(title = "è§é¢å·¡æ£æ¥éª¤", businessType = BusinessType.DELETE) @DeleteMapping("/{taskIds}") public AjaxResult remove(@PathVariable String[] taskIds) { @DeleteMapping("/{taskIds}") public AjaxResult remove(@PathVariable String[] taskIds) { return toAjax(ardVideoInspectTaskStepService.deleteArdVideoInspectTaskStepByTaskIds(taskIds)); } } ard-work/src/main/java/com/ruoyi/inspect/domain/ArdVideoInspectRecord.java
@@ -117,6 +117,7 @@ return userId; } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -127,6 +128,7 @@ .append("stepId", getStepId()) .append("deptId", getDeptId()) .append("userId", getUserId()) .append("wellName", getWellName()) .toString(); } } ard-work/src/main/java/com/ruoyi/inspect/mapper/ArdVideoInspectTaskStepMapper.java
@@ -1,19 +1,20 @@ package com.ruoyi.inspect.mapper; import java.util.List; import java.util.Map; import com.ruoyi.inspect.domain.ArdVideoInspectTaskStep; /** * è§é¢å·¡æ£æ¥éª¤Mapperæ¥å£ * * * @author ruoyi * @date 2023-05-30 */ public interface ArdVideoInspectTaskStepMapper { public interface ArdVideoInspectTaskStepMapper { /** * æ¥è¯¢è§é¢å·¡æ£æ¥éª¤ * * * @param taskId è§é¢å·¡æ£æ¥éª¤ä¸»é® * @return è§é¢å·¡æ£æ¥éª¤ */ @@ -21,7 +22,7 @@ /** * æ¥è¯¢è§é¢å·¡æ£æ¥éª¤å表 * * * @param ardVideoInspectTaskStep è§é¢å·¡æ£æ¥éª¤ * @return è§é¢å·¡æ£æ¥éª¤éå */ @@ -29,7 +30,7 @@ /** * æ°å¢è§é¢å·¡æ£æ¥éª¤ * * * @param ardVideoInspectTaskStep è§é¢å·¡æ£æ¥éª¤ * @return ç»æ */ @@ -37,7 +38,7 @@ /** * ä¿®æ¹è§é¢å·¡æ£æ¥éª¤ * * * @param ardVideoInspectTaskStep è§é¢å·¡æ£æ¥éª¤ * @return ç»æ */ @@ -45,7 +46,7 @@ /** * å é¤è§é¢å·¡æ£æ¥éª¤ * * * @param taskId è§é¢å·¡æ£æ¥éª¤ä¸»é® * @return ç»æ */ @@ -53,9 +54,11 @@ /** * æ¹éå é¤è§é¢å·¡æ£æ¥éª¤ * * * @param taskIds éè¦å é¤çæ°æ®ä¸»é®éå * @return ç»æ */ public int deleteArdVideoInspectTaskStepByTaskIds(String[] taskIds); public List<Map> selectByTaskId(String taskId); } ard-work/src/main/java/com/ruoyi/inspect/service/IArdVideoInspectTaskStepService.java
@@ -58,4 +58,11 @@ * @return ç»æ */ public int deleteArdVideoInspectTaskStepByTaskId(String taskId); /** * æä»»å¡ç¼å·æ¥è¯¢ * @param taskId * @return */ public List selectByTaskId(String taskId); } ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -50,6 +50,8 @@ private ArdCamerasMapper ardCamerasMapper; @Resource private IHikClientService hikClientService; @Resource private ArdCamerasMapper camerasMapper; @PostConstruct public void initTask() { @@ -172,9 +174,16 @@ */ public void insertArdVideoInspectTaskStep(ArdVideoInspectTask ardVideoInspectTask) { List<ArdVideoInspectTaskStep> ardVideoInspectTaskStepList = ardVideoInspectTask.getArdVideoInspectTaskStepList(); String id = ardVideoInspectTask.getId(); //è·åç¸æº ArdCameras camera = camerasMapper.selectArdCamerasById(ardVideoInspectTask.getCameraId()); Collections.sort(ardVideoInspectTaskStepList,new ArdVideoInspectTaskStepComparator(this.ardAlarmpointsWellMapper,camera.getLongitude(),camera.getLatitude())); String taskId = ardVideoInspectTask.getId(); for (int i = 0; i < ardVideoInspectTaskStepList.size(); i++) { ArdVideoInspectTaskStep step = ardVideoInspectTaskStepList.get(i); step.setTaskId(taskId); step.setOrderNumber(new Integer(i+1)); } if (StringUtils.isNotNull(ardVideoInspectTaskStepList)) { List<ArdVideoInspectTaskStep> list = new ArrayList<ArdVideoInspectTaskStep>(); for (ArdVideoInspectTaskStep ardVideoInspectTaskStep : ardVideoInspectTaskStepList) { if (ardVideoInspectTaskStep.getId() == null) { //æ°çæ¥éª¤,æ·»å ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskStepComparator.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,58 @@ package com.ruoyi.inspect.service.impl; import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; import com.ruoyi.device.hiksdk.util.hikSdkUtil.GisUtil; import com.ruoyi.inspect.domain.ArdVideoInspectTask; import com.ruoyi.inspect.domain.ArdVideoInspectTaskStep; import com.ruoyi.inspect.service.IArdVideoInspectTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Comparator; @Service public class ArdVideoInspectTaskStepComparator implements Comparator<ArdVideoInspectTaskStep> { private ArdAlarmpointsWellMapper ardAlarmpointsWellMapper; private double cameraLon; private double cameraLat; public ArdVideoInspectTaskStepComparator() { } public ArdVideoInspectTaskStepComparator(ArdAlarmpointsWellMapper ardAlarmpointsWellMapper,double cameraLon, double cameraLat) { this.ardAlarmpointsWellMapper = ardAlarmpointsWellMapper; this.cameraLon = cameraLon; this.cameraLat = cameraLat; } public double getCameraLon() { return cameraLon; } public void setCameraLon(double cameraLon) { this.cameraLon = cameraLon; } public double getCameraLat() { return cameraLat; } public void setCameraLat(double cameraLat) { this.cameraLat = cameraLat; } @Override public int compare(ArdVideoInspectTaskStep s1, ArdVideoInspectTaskStep s2) { ArdAlarmpointsWell well1 = this.ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(s1.getWellId()); ArdAlarmpointsWell well2 = this.ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(s2.getWellId()); //计ç®s1ç¸å¯¹è§åº¦ double angle1 = GisUtil.getNorthAngle(this.cameraLon, this.cameraLat, well1.getLongitude(), well1.getLatitude()) * 1000; //计ç®s2ç¸å¯¹è§åº¦ double angle2 = GisUtil.getNorthAngle(this.cameraLon, this.cameraLat, well2.getLongitude(), well2.getLatitude()) * 1000; return (int) (angle1 - angle2); } } ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskStepServiceImpl.java
@@ -50,8 +50,8 @@ */ @Override public int insertArdVideoInspectTaskStep(ArdVideoInspectTaskStep ardVideoInspectTaskStep) { ardVideoInspectTaskStep.setUserId(SecurityUtils.getUserId()); return ardVideoInspectTaskStepMapper.insertArdVideoInspectTaskStep(ardVideoInspectTaskStep); ardVideoInspectTaskStep.setUserId(SecurityUtils.getUserId()); return ardVideoInspectTaskStepMapper.insertArdVideoInspectTaskStep(ardVideoInspectTaskStep); } /** @@ -86,4 +86,9 @@ public int deleteArdVideoInspectTaskStepByTaskId(String taskId) { return ardVideoInspectTaskStepMapper.deleteArdVideoInspectTaskStepByTaskId(taskId); } @Override public List selectByTaskId(String taskId) { return ardVideoInspectTaskStepMapper.selectByTaskId(taskId); } } ard-work/src/main/resources/mapper/inspect/ArdVideoInspectRecordMapper.xml
@@ -22,7 +22,7 @@ <include refid="selectArdVideoInspectRecordVo"/> <where> <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if> <if test="endTime != null and endTime != ''"> and end_time = #{endTime}</if> <if test="endTime != null and endTime != ''"> and end_time = #{ejava.util.HashMapndTime}</if> <if test="recordFilePath != null and recordFilePath != ''"> and record_file_path = #{recordFilePath}</if> <if test="stepId != null and stepId != ''"> and step_id = #{stepId}</if> <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> @@ -31,6 +31,11 @@ </select> <!--ææ¥ææ¥è¯¢--> <select id="selectArdVideoInspectRecordListByStartTime" parameterType="ArdVideoInspectRecord" resultType="java.util.HashMap"> <include refid="selectArdVideoInspectRecordVo"/> <where> <if test="startTime != null and startTime != ''">and start_time like ('${startTime}%')</if> <if test="stepId != null and stepId != ''">and step_id = #{stepId}</if> </where> select r.*,s.well_id,w.well_id as well_name from ard_video_inspect_record r ,ard_video_inspect_task_step s,ard_alarmpoints_well w where start_time like ('${startTime}%') and r.step_id = s.id and s.well_id = w.id order by start_time desc @@ -81,6 +86,7 @@ <if test="stepId != null">step_id = #{stepId},</if> <if test="deptId != null">dept_id = #{deptId},</if> <if test="userId != null">user_id = #{userId},</if> <if test="wellName != null">well_name = #{wellName},</if> </trim> where id = #{id} </update> ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskMapper.xml
@@ -180,7 +180,7 @@ <!--æ¥è¯¢ä»»å¡ä¸ç¸æºå·²ä½¿ç¨æ¶æ®µ--> <select id="getTaskUsedCameraPeriods" parameterType="String" resultType="java.util.HashMap"> select t.start_time,t.end_time from ard_video_inspect_task t where t.camera_id=#{startMonth} where t.camera_id=#{cameraId} ORDER BY t.start_time </select> </mapper> ard-work/src/main/resources/mapper/inspect/ArdVideoInspectTaskStepMapper.xml
@@ -20,7 +20,7 @@ <select id="selectArdVideoInspectTaskStepList" parameterType="ArdVideoInspectTaskStep" resultMap="ArdVideoInspectTaskStepResult"> <include refid="selectArdVideoInspectTaskStepVo"/> <where> <where> <if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if> <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> <if test="userId != null and userId != ''"> and user_id = #{userId}</if> @@ -29,6 +29,13 @@ <if test="wellId != null and wellId != ''"> and well_id = #{wellId}</if> </where> </select> <select id="selectByTaskId" parameterType="String" resultType="java.util.HashMap"> select s.*, w.well_id as well_name from ard_video_inspect_task_step s, ard_alarmpoints_well w where s.task_id = #{taskId} and s.well_id = w.id </select> <select id="selectArdVideoInspectTaskStepByTaskId" parameterType="String" resultMap="ArdVideoInspectTaskStepResult"> <include refid="selectArdVideoInspectTaskStepVo"/> ruoyi-admin/src/main/resources/application.yml
@@ -36,7 +36,7 @@ # æ¥å¿é ç½® logging: level: com.ruoyi: info com.ruoyi.inspect: debug org.springframework: warn # ç¨æ·é ç½® ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/PatrolInspectionTask.java
@@ -38,6 +38,6 @@ //å·¡æ£ä»»å¡ public void scanRun() { ardVideoInspectTaskService.autoTaskRun(); /* ardVideoInspectTaskService.autoTaskRun();*/ } }