Browse Source

摄像头配置

LIVE_YE 1 năm trước cách đây
mục cha
commit
a639ef83ca

+ 103 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/BomanCameraController.java

@@ -0,0 +1,103 @@
+package com.ruoyi.web.controller.system;
+
+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;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.BomanCamera;
+import com.ruoyi.system.service.IBomanCameraService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 摄像机设备Controller
+ * 
+ * @author ruoyi
+ * @date 2024-01-02
+ */
+@RestController
+@RequestMapping("/system/camera")
+public class BomanCameraController extends BaseController
+{
+    @Autowired
+    private IBomanCameraService bomanCameraService;
+
+    /**
+     * 查询摄像机设备列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BomanCamera bomanCamera)
+    {
+        startPage();
+        List<BomanCamera> list = bomanCameraService.selectBomanCameraList(bomanCamera);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出摄像机设备列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:export')")
+    @Log(title = "摄像机设备", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BomanCamera bomanCamera)
+    {
+        List<BomanCamera> list = bomanCameraService.selectBomanCameraList(bomanCamera);
+        ExcelUtil<BomanCamera> util = new ExcelUtil<BomanCamera>(BomanCamera.class);
+        util.exportExcel(response, list, "摄像机设备数据");
+    }
+
+    /**
+     * 获取摄像机设备详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:query')")
+    @GetMapping(value = "/{cameraId}")
+    public AjaxResult getInfo(@PathVariable("cameraId") Long cameraId)
+    {
+        return success(bomanCameraService.selectBomanCameraByCameraId(cameraId));
+    }
+
+    /**
+     * 新增摄像机设备
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:add')")
+    @Log(title = "摄像机设备", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody BomanCamera bomanCamera)
+    {
+        return toAjax(bomanCameraService.insertBomanCamera(bomanCamera));
+    }
+
+    /**
+     * 修改摄像机设备
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:edit')")
+    @Log(title = "摄像机设备", businessType = BusinessType.UPDATE)
+    @PostMapping("/put")
+    public AjaxResult edit(@RequestBody BomanCamera bomanCamera)
+    {
+        return toAjax(bomanCameraService.updateBomanCamera(bomanCamera));
+    }
+
+    /**
+     * 删除摄像机设备
+     */
+    @PreAuthorize("@ss.hasPermi('system:camera:remove')")
+    @Log(title = "摄像机设备", businessType = BusinessType.DELETE)
+	@GetMapping("/delete/{cameraIds}")
+    public AjaxResult remove(@PathVariable Long[] cameraIds)
+    {
+        return toAjax(bomanCameraService.deleteBomanCameraByCameraIds(cameraIds));
+    }
+}

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -113,7 +113,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 .antMatchers("/login", "/register", "/captchaImage","/boman/common/**","/sendSms/**","/system/pinglun/**").permitAll()
                 .antMatchers("/system/personnel/**", "/reservat/config/**", "/reservat/time/**","/system/reservat/**","/system/news/**","/system/annex/listNo").permitAll()
-                .antMatchers("/system/dict/data/type/**","/system/app/new","/playvision/**","/wstest/**","/task/**").permitAll()
+                .antMatchers("/system/dict/data/type/**","/system/app/new","/playvision/**","/wstest/**","/task/**","/system/camera/list").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 155 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BomanCamera.java

@@ -0,0 +1,155 @@
+package com.ruoyi.system.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 摄像机设备对象 boman_camera
+ * 
+ * @author ruoyi
+ * @date 2024-01-02
+ */
+public class BomanCamera extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long cameraId;
+
+    /** 0:录像机(NVR),1:摄像头 */
+    @Excel(name = "0:录像机", readConverterExp = "NVR")
+    private String type;
+
+    /** 图片 */
+    @Excel(name = "图片")
+    private String cameraImage;
+
+    /** 设备ip */
+    @Excel(name = "设备ip")
+    private String ip;
+
+    /** 设备端口 */
+    @Excel(name = "设备端口")
+    private String prod;
+
+    /** 设备账号 */
+    @Excel(name = "设备账号")
+    private String cameraAccount;
+
+    /** 登录密码 */
+    @Excel(name = "登录密码")
+    private String cameraPwd;
+
+    /** 设备位置 */
+    @Excel(name = "设备位置")
+    private String position;
+
+    /** 排序 */
+    @Excel(name = "排序")
+    private Long sort;
+
+    public void setCameraId(Long cameraId) 
+    {
+        this.cameraId = cameraId;
+    }
+
+    public Long getCameraId() 
+    {
+        return cameraId;
+    }
+    public void setType(String type) 
+    {
+        this.type = type;
+    }
+
+    public String getType() 
+    {
+        return type;
+    }
+    public void setCameraImage(String cameraImage) 
+    {
+        this.cameraImage = cameraImage;
+    }
+
+    public String getCameraImage() 
+    {
+        return cameraImage;
+    }
+    public void setIp(String ip) 
+    {
+        this.ip = ip;
+    }
+
+    public String getIp() 
+    {
+        return ip;
+    }
+    public void setProd(String prod) 
+    {
+        this.prod = prod;
+    }
+
+    public String getProd() 
+    {
+        return prod;
+    }
+    public void setCameraAccount(String cameraAccount) 
+    {
+        this.cameraAccount = cameraAccount;
+    }
+
+    public String getCameraAccount() 
+    {
+        return cameraAccount;
+    }
+    public void setCameraPwd(String cameraPwd) 
+    {
+        this.cameraPwd = cameraPwd;
+    }
+
+    public String getCameraPwd() 
+    {
+        return cameraPwd;
+    }
+    public void setPosition(String position) 
+    {
+        this.position = position;
+    }
+
+    public String getPosition() 
+    {
+        return position;
+    }
+    public void setSort(Long sort) 
+    {
+        this.sort = sort;
+    }
+
+    public Long getSort() 
+    {
+        return sort;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("cameraId", getCameraId())
+            .append("type", getType())
+            .append("cameraImage", getCameraImage())
+            .append("ip", getIp())
+            .append("prod", getProd())
+            .append("cameraAccount", getCameraAccount())
+            .append("cameraPwd", getCameraPwd())
+            .append("position", getPosition())
+            .append("sort", getSort())
+            .append("createTime", getCreateTime())
+            .append("createBy", getCreateBy())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BomanCameraMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.BomanCamera;
+
+/**
+ * 摄像机设备Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-01-02
+ */
+public interface BomanCameraMapper 
+{
+    /**
+     * 查询摄像机设备
+     * 
+     * @param cameraId 摄像机设备主键
+     * @return 摄像机设备
+     */
+    public BomanCamera selectBomanCameraByCameraId(Long cameraId);
+
+    /**
+     * 查询摄像机设备列表
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 摄像机设备集合
+     */
+    public List<BomanCamera> selectBomanCameraList(BomanCamera bomanCamera);
+
+    /**
+     * 新增摄像机设备
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 结果
+     */
+    public int insertBomanCamera(BomanCamera bomanCamera);
+
+    /**
+     * 修改摄像机设备
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 结果
+     */
+    public int updateBomanCamera(BomanCamera bomanCamera);
+
+    /**
+     * 删除摄像机设备
+     * 
+     * @param cameraId 摄像机设备主键
+     * @return 结果
+     */
+    public int deleteBomanCameraByCameraId(Long cameraId);
+
+    /**
+     * 批量删除摄像机设备
+     * 
+     * @param cameraIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteBomanCameraByCameraIds(Long[] cameraIds);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IBomanCameraService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.BomanCamera;
+
+/**
+ * 摄像机设备Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-01-02
+ */
+public interface IBomanCameraService 
+{
+    /**
+     * 查询摄像机设备
+     * 
+     * @param cameraId 摄像机设备主键
+     * @return 摄像机设备
+     */
+    public BomanCamera selectBomanCameraByCameraId(Long cameraId);
+
+    /**
+     * 查询摄像机设备列表
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 摄像机设备集合
+     */
+    public List<BomanCamera> selectBomanCameraList(BomanCamera bomanCamera);
+
+    /**
+     * 新增摄像机设备
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 结果
+     */
+    public int insertBomanCamera(BomanCamera bomanCamera);
+
+    /**
+     * 修改摄像机设备
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 结果
+     */
+    public int updateBomanCamera(BomanCamera bomanCamera);
+
+    /**
+     * 批量删除摄像机设备
+     * 
+     * @param cameraIds 需要删除的摄像机设备主键集合
+     * @return 结果
+     */
+    public int deleteBomanCameraByCameraIds(Long[] cameraIds);
+
+    /**
+     * 删除摄像机设备信息
+     * 
+     * @param cameraId 摄像机设备主键
+     * @return 结果
+     */
+    public int deleteBomanCameraByCameraId(Long cameraId);
+}

+ 96 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanCameraServiceImpl.java

@@ -0,0 +1,96 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.BomanCameraMapper;
+import com.ruoyi.system.domain.BomanCamera;
+import com.ruoyi.system.service.IBomanCameraService;
+
+/**
+ * 摄像机设备Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-01-02
+ */
+@Service
+public class BomanCameraServiceImpl implements IBomanCameraService 
+{
+    @Autowired
+    private BomanCameraMapper bomanCameraMapper;
+
+    /**
+     * 查询摄像机设备
+     * 
+     * @param cameraId 摄像机设备主键
+     * @return 摄像机设备
+     */
+    @Override
+    public BomanCamera selectBomanCameraByCameraId(Long cameraId)
+    {
+        return bomanCameraMapper.selectBomanCameraByCameraId(cameraId);
+    }
+
+    /**
+     * 查询摄像机设备列表
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 摄像机设备
+     */
+    @Override
+    public List<BomanCamera> selectBomanCameraList(BomanCamera bomanCamera)
+    {
+        return bomanCameraMapper.selectBomanCameraList(bomanCamera);
+    }
+
+    /**
+     * 新增摄像机设备
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 结果
+     */
+    @Override
+    public int insertBomanCamera(BomanCamera bomanCamera)
+    {
+        bomanCamera.setCreateTime(DateUtils.getNowDate());
+        return bomanCameraMapper.insertBomanCamera(bomanCamera);
+    }
+
+    /**
+     * 修改摄像机设备
+     * 
+     * @param bomanCamera 摄像机设备
+     * @return 结果
+     */
+    @Override
+    public int updateBomanCamera(BomanCamera bomanCamera)
+    {
+        bomanCamera.setUpdateTime(DateUtils.getNowDate());
+        return bomanCameraMapper.updateBomanCamera(bomanCamera);
+    }
+
+    /**
+     * 批量删除摄像机设备
+     * 
+     * @param cameraIds 需要删除的摄像机设备主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBomanCameraByCameraIds(Long[] cameraIds)
+    {
+        return bomanCameraMapper.deleteBomanCameraByCameraIds(cameraIds);
+    }
+
+    /**
+     * 删除摄像机设备信息
+     * 
+     * @param cameraId 摄像机设备主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBomanCameraByCameraId(Long cameraId)
+    {
+        return bomanCameraMapper.deleteBomanCameraByCameraId(cameraId);
+    }
+}

+ 108 - 0
ruoyi-system/src/main/resources/mapper/system/BomanCameraMapper.xml

@@ -0,0 +1,108 @@
+<?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">
+<mapper namespace="com.ruoyi.system.mapper.BomanCameraMapper">
+    
+    <resultMap type="BomanCamera" id="BomanCameraResult">
+        <result property="cameraId"    column="camera_id"    />
+        <result property="type"    column="type"    />
+        <result property="cameraImage"    column="camera_image"    />
+        <result property="ip"    column="ip"    />
+        <result property="prod"    column="prod"    />
+        <result property="cameraAccount"    column="camera_account"    />
+        <result property="cameraPwd"    column="camera_pwd"    />
+        <result property="position"    column="position"    />
+        <result property="sort"    column="sort"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectBomanCameraVo">
+        select camera_id, type, camera_image, ip, prod, camera_account, camera_pwd, position, sort, create_time, create_by, update_by, update_time from boman_camera
+    </sql>
+
+    <select id="selectBomanCameraList" parameterType="BomanCamera" resultMap="BomanCameraResult">
+        <include refid="selectBomanCameraVo"/>
+        <where>  
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="cameraImage != null  and cameraImage != ''"> and camera_image = #{cameraImage}</if>
+            <if test="ip != null  and ip != ''"> and ip = #{ip}</if>
+            <if test="prod != null  and prod != ''"> and prod = #{prod}</if>
+            <if test="cameraAccount != null  and cameraAccount != ''"> and camera_account = #{cameraAccount}</if>
+            <if test="cameraPwd != null  and cameraPwd != ''"> and camera_pwd = #{cameraPwd}</if>
+            <if test="position != null  and position != ''"> and position = #{position}</if>
+            <if test="sort != null "> and sort = #{sort}</if>
+        </where>
+        order by sort asc, create_time desc
+    </select>
+    
+    <select id="selectBomanCameraByCameraId" parameterType="Long" resultMap="BomanCameraResult">
+        <include refid="selectBomanCameraVo"/>
+        where camera_id = #{cameraId}
+    </select>
+        
+    <insert id="insertBomanCamera" parameterType="BomanCamera" useGeneratedKeys="true" keyProperty="cameraId">
+        insert into boman_camera
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="type != null">type,</if>
+            <if test="cameraImage != null">camera_image,</if>
+            <if test="ip != null">ip,</if>
+            <if test="prod != null">prod,</if>
+            <if test="cameraAccount != null">camera_account,</if>
+            <if test="cameraPwd != null">camera_pwd,</if>
+            <if test="position != null">position,</if>
+            <if test="sort != null">sort,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="type != null">#{type},</if>
+            <if test="cameraImage != null">#{cameraImage},</if>
+            <if test="ip != null">#{ip},</if>
+            <if test="prod != null">#{prod},</if>
+            <if test="cameraAccount != null">#{cameraAccount},</if>
+            <if test="cameraPwd != null">#{cameraPwd},</if>
+            <if test="position != null">#{position},</if>
+            <if test="sort != null">#{sort},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateBomanCamera" parameterType="BomanCamera">
+        update boman_camera
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="type != null">type = #{type},</if>
+            <if test="cameraImage != null">camera_image = #{cameraImage},</if>
+            <if test="ip != null">ip = #{ip},</if>
+            <if test="prod != null">prod = #{prod},</if>
+            <if test="cameraAccount != null">camera_account = #{cameraAccount},</if>
+            <if test="cameraPwd != null">camera_pwd = #{cameraPwd},</if>
+            <if test="position != null">position = #{position},</if>
+            <if test="sort != null">sort = #{sort},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where camera_id = #{cameraId}
+    </update>
+
+    <delete id="deleteBomanCameraByCameraId" parameterType="Long">
+        delete from boman_camera where camera_id = #{cameraId}
+    </delete>
+
+    <delete id="deleteBomanCameraByCameraIds" parameterType="String">
+        delete from boman_camera where camera_id in 
+        <foreach item="cameraId" collection="array" open="(" separator="," close=")">
+            #{cameraId}
+        </foreach>
+    </delete>
+</mapper>