‘liusuyi’
2024-03-16 516a56260c86e1b78f13d3889f4f37cfe67d555c
增加通道查询列表排序
增加按范围多边形查井
已修改4个文件
98 ■■■■■ 文件已修改
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/controller/TaskController.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/mapper/device/ArdChannelMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -355,6 +355,7 @@
                ardChannel.setDeviceId(camera.getId());
                List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
                if (ardChannels != null) {
                    ardChannels.stream().sorted();
                    camera.setChannelList(ardChannels);
                }
                Map<String, Object> cameraMap = ArdTool.convertEntityToMap(camera);
ard-work/src/main/java/com/ruoyi/inspect/controller/TaskController.java
@@ -1,18 +1,25 @@
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
@@ -29,37 +36,35 @@
    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();
        }
@@ -98,4 +103,25 @@
        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);
    }
}
ard-work/src/main/resources/mapper/device/ArdChannelMapper.xml
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.channel.mapper.ArdChannelMapper">
    <resultMap type="ArdChannel" id="ArdChannelResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="chanNo"    column="chan_no"    />
        <result property="deviceId"    column="device_id"    />
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="chanNo" column="chan_no"/>
        <result property="deviceId" column="device_id"/>
    </resultMap>
    <sql id="selectArdChannelVo">
        select id, name, chan_no, device_id from ard_channel
        select id, name, chan_no, device_id
        from ard_channel
    </sql>
    <select id="selectArdChannelList" parameterType="ArdChannel" resultMap="ArdChannelResult">
@@ -20,13 +21,14 @@
        <where>
            <if test="deviceId!=null">device_id=#{deviceId}</if>
        </where>
        order by chan_no
    </select>
    <select id="selectArdChannelById" parameterType="String" resultMap="ArdChannelResult">
        <include refid="selectArdChannelVo"/>
        where id = #{id}
    </select>
    <insert id="insertArdChannel" parameterType="ArdChannel">
        insert into ard_channel
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -34,13 +36,13 @@
            <if test="name != null">name,</if>
            <if test="chanNo != null">chan_no,</if>
            <if test="deviceId != null">device_id,</if>
         </trim>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="name != null">#{name},</if>
            <if test="chanNo != null">#{chanNo},</if>
            <if test="deviceId != null">#{deviceId},</if>
         </trim>
        </trim>
    </insert>
    <update id="updateArdChannel" parameterType="ArdChannel">
@@ -54,16 +56,20 @@
    </update>
    <delete id="deleteArdChannelById" parameterType="String">
        delete from ard_channel where id = #{id}
        delete
        from ard_channel
        where id = #{id}
    </delete>
    <delete id="deleteArdChannelByIds" parameterType="String">
        delete from ard_channel where id in
        delete from ard_channel where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <delete id="deleteArdChannelByDeviceId" parameterType="String">
        delete from ard_channel where device_id = #{deviceId}
        delete
        from ard_channel
        where device_id = #{deviceId}
    </delete>
</mapper>
</mapper>
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -45,8 +45,7 @@
    @Autowired
    private SysPermissionService permissionService;
    @Autowired
    private SysPasswordService passwordService;
    @Autowired
    private ISysUserService userService;
    /**