Procházet zdrojové kódy

新增安防告警日志管理

zmj před 5 dny
rodič
revize
4ef763e3eb

+ 104 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/base/AlarmLogController.java

@@ -0,0 +1,104 @@
+package com.ruoyi.web.controller.base;
+
+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.base.domain.AlarmLog;
+import com.ruoyi.base.service.IAlarmLogService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 安防告警日志Controller
+ *
+ * @author ruoyi
+ * @date 2026-05-20
+ */
+@RestController
+@RequestMapping("/base/alarmLog")
+public class AlarmLogController extends BaseController
+{
+    @Autowired
+    private IAlarmLogService alarmLogService;
+
+    /**
+     * 查询安防告警日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('base:alarmLog:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AlarmLog alarmLog)
+    {
+        startPage();
+        List<AlarmLog> list = alarmLogService.selectAlarmLogList(alarmLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出安防告警日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('base:alarmLog:export')")
+    @Log(title = "安防告警日志", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, AlarmLog alarmLog)
+    {
+        List<AlarmLog> list = alarmLogService.selectAlarmLogList(alarmLog);
+        ExcelUtil<AlarmLog> util = new ExcelUtil<AlarmLog>(AlarmLog.class);
+        util.exportExcel(response, list, "安防告警日志数据");
+    }
+
+    /**
+     * 获取安防告警日志详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('base:alarmLog:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(alarmLogService.selectAlarmLogById(id));
+    }
+
+    /**
+     * 新增安防告警日志
+     */
+    @PreAuthorize("@ss.hasPermi('base:alarmLog:add')")
+    @Log(title = "安防告警日志", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AlarmLog alarmLog)
+    {
+        return toAjax(alarmLogService.insertAlarmLog(alarmLog));
+    }
+
+    /**
+     * 修改安防告警日志
+     */
+    @PreAuthorize("@ss.hasPermi('base:alarmLog:edit')")
+    @Log(title = "安防告警日志", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AlarmLog alarmLog)
+    {
+        return toAjax(alarmLogService.updateAlarmLog(alarmLog));
+    }
+
+    /**
+     * 删除安防告警日志
+     */
+    @PreAuthorize("@ss.hasPermi('base:alarmLog:remove')")
+    @Log(title = "安防告警日志", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(alarmLogService.deleteAlarmLogByIds(ids));
+    }
+}

+ 223 - 0
ruoyi-system/src/main/java/com/ruoyi/base/domain/AlarmLog.java

@@ -0,0 +1,223 @@
+package com.ruoyi.base.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;
+
+/**
+ * 安防告警日志对象 robot_ops_alarm_log
+ * 
+ * @author ruoyi
+ * @date 2026-05-20
+ */
+public class AlarmLog extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    private Long id;
+
+    /** 告警时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "告警时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date alarmTime;
+
+    /** 告警类型 */
+    @Excel(name = "告警类型")
+    private String alarmType;
+
+    /** 告警级别 */
+    @Excel(name = "告警级别")
+    private String alarmLevel;
+
+    /** 告警来源 */
+    @Excel(name = "告警来源")
+    private String alarmSource;
+
+    /** 来源位置,如大厅入口、前台区域、走廊 */
+    @Excel(name = "来源位置,如大厅入口、前台区域、走廊")
+    private String sourcePosition;
+
+    /** 告警标题或摘要 */
+    @Excel(name = "告警标题或摘要")
+    private String alarmTitle;
+
+    /** 告警描述 */
+    @Excel(name = "告警描述")
+    private String description;
+
+    /** 抓拍图地址 */
+    @Excel(name = "抓拍图地址")
+    private String snapshotUrl;
+
+    /** 处理状态 */
+    @Excel(name = "处理状态")
+    private String handleStatus;
+
+    /** 处理人 */
+    @Excel(name = "处理人")
+    private String handleBy;
+
+    /** 处理时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date handleTime;
+
+    /** 处理备注 */
+    @Excel(name = "处理备注")
+    private String handleRemark;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+
+    public void setAlarmTime(Date alarmTime) 
+    {
+        this.alarmTime = alarmTime;
+    }
+
+    public Date getAlarmTime() 
+    {
+        return alarmTime;
+    }
+
+    public void setAlarmType(String alarmType) 
+    {
+        this.alarmType = alarmType;
+    }
+
+    public String getAlarmType() 
+    {
+        return alarmType;
+    }
+
+    public void setAlarmLevel(String alarmLevel) 
+    {
+        this.alarmLevel = alarmLevel;
+    }
+
+    public String getAlarmLevel() 
+    {
+        return alarmLevel;
+    }
+
+    public void setAlarmSource(String alarmSource) 
+    {
+        this.alarmSource = alarmSource;
+    }
+
+    public String getAlarmSource() 
+    {
+        return alarmSource;
+    }
+
+    public void setSourcePosition(String sourcePosition) 
+    {
+        this.sourcePosition = sourcePosition;
+    }
+
+    public String getSourcePosition() 
+    {
+        return sourcePosition;
+    }
+
+    public void setAlarmTitle(String alarmTitle) 
+    {
+        this.alarmTitle = alarmTitle;
+    }
+
+    public String getAlarmTitle() 
+    {
+        return alarmTitle;
+    }
+
+    public void setDescription(String description) 
+    {
+        this.description = description;
+    }
+
+    public String getDescription() 
+    {
+        return description;
+    }
+
+    public void setSnapshotUrl(String snapshotUrl) 
+    {
+        this.snapshotUrl = snapshotUrl;
+    }
+
+    public String getSnapshotUrl() 
+    {
+        return snapshotUrl;
+    }
+
+    public void setHandleStatus(String handleStatus) 
+    {
+        this.handleStatus = handleStatus;
+    }
+
+    public String getHandleStatus() 
+    {
+        return handleStatus;
+    }
+
+    public void setHandleBy(String handleBy) 
+    {
+        this.handleBy = handleBy;
+    }
+
+    public String getHandleBy() 
+    {
+        return handleBy;
+    }
+
+    public void setHandleTime(Date handleTime) 
+    {
+        this.handleTime = handleTime;
+    }
+
+    public Date getHandleTime() 
+    {
+        return handleTime;
+    }
+
+    public void setHandleRemark(String handleRemark) 
+    {
+        this.handleRemark = handleRemark;
+    }
+
+    public String getHandleRemark() 
+    {
+        return handleRemark;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("alarmTime", getAlarmTime())
+            .append("alarmType", getAlarmType())
+            .append("alarmLevel", getAlarmLevel())
+            .append("alarmSource", getAlarmSource())
+            .append("sourcePosition", getSourcePosition())
+            .append("alarmTitle", getAlarmTitle())
+            .append("description", getDescription())
+            .append("snapshotUrl", getSnapshotUrl())
+            .append("handleStatus", getHandleStatus())
+            .append("handleBy", getHandleBy())
+            .append("handleTime", getHandleTime())
+            .append("handleRemark", getHandleRemark())
+            .append("remark", getRemark())
+            .append("createTime", getCreateTime())
+            .toString();
+    }
+}

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

@@ -0,0 +1,61 @@
+package com.ruoyi.base.mapper;
+
+import java.util.List;
+import com.ruoyi.base.domain.AlarmLog;
+
+/**
+ * 安防告警日志Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2026-05-20
+ */
+public interface AlarmLogMapper 
+{
+    /**
+     * 查询安防告警日志
+     * 
+     * @param id 安防告警日志主键
+     * @return 安防告警日志
+     */
+    public AlarmLog selectAlarmLogById(Long id);
+
+    /**
+     * 查询安防告警日志列表
+     * 
+     * @param alarmLog 安防告警日志
+     * @return 安防告警日志集合
+     */
+    public List<AlarmLog> selectAlarmLogList(AlarmLog alarmLog);
+
+    /**
+     * 新增安防告警日志
+     * 
+     * @param alarmLog 安防告警日志
+     * @return 结果
+     */
+    public int insertAlarmLog(AlarmLog alarmLog);
+
+    /**
+     * 修改安防告警日志
+     * 
+     * @param alarmLog 安防告警日志
+     * @return 结果
+     */
+    public int updateAlarmLog(AlarmLog alarmLog);
+
+    /**
+     * 删除安防告警日志
+     * 
+     * @param id 安防告警日志主键
+     * @return 结果
+     */
+    public int deleteAlarmLogById(Long id);
+
+    /**
+     * 批量删除安防告警日志
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteAlarmLogByIds(Long[] ids);
+}

+ 95 - 0
ruoyi-system/src/main/java/com/ruoyi/base/service/impl/AlarmLogServiceImpl.java

@@ -0,0 +1,95 @@
+package com.ruoyi.base.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.base.mapper.AlarmLogMapper;
+import com.ruoyi.base.domain.AlarmLog;
+import com.ruoyi.base.service.IAlarmLogService;
+
+/**
+ * 安防告警日志Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2026-05-20
+ */
+@Service
+public class AlarmLogServiceImpl implements IAlarmLogService 
+{
+    @Autowired
+    private AlarmLogMapper alarmLogMapper;
+
+    /**
+     * 查询安防告警日志
+     * 
+     * @param id 安防告警日志主键
+     * @return 安防告警日志
+     */
+    @Override
+    public AlarmLog selectAlarmLogById(Long id)
+    {
+        return alarmLogMapper.selectAlarmLogById(id);
+    }
+
+    /**
+     * 查询安防告警日志列表
+     * 
+     * @param alarmLog 安防告警日志
+     * @return 安防告警日志
+     */
+    @Override
+    public List<AlarmLog> selectAlarmLogList(AlarmLog alarmLog)
+    {
+        return alarmLogMapper.selectAlarmLogList(alarmLog);
+    }
+
+    /**
+     * 新增安防告警日志
+     * 
+     * @param alarmLog 安防告警日志
+     * @return 结果
+     */
+    @Override
+    public int insertAlarmLog(AlarmLog alarmLog)
+    {
+        alarmLog.setCreateTime(DateUtils.getNowDate());
+        return alarmLogMapper.insertAlarmLog(alarmLog);
+    }
+
+    /**
+     * 修改安防告警日志
+     * 
+     * @param alarmLog 安防告警日志
+     * @return 结果
+     */
+    @Override
+    public int updateAlarmLog(AlarmLog alarmLog)
+    {
+        return alarmLogMapper.updateAlarmLog(alarmLog);
+    }
+
+    /**
+     * 批量删除安防告警日志
+     * 
+     * @param ids 需要删除的安防告警日志主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAlarmLogByIds(Long[] ids)
+    {
+        return alarmLogMapper.deleteAlarmLogByIds(ids);
+    }
+
+    /**
+     * 删除安防告警日志信息
+     * 
+     * @param id 安防告警日志主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAlarmLogById(Long id)
+    {
+        return alarmLogMapper.deleteAlarmLogById(id);
+    }
+}

+ 119 - 0
ruoyi-system/src/main/resources/mapper/base/AlarmLogMapper.xml

@@ -0,0 +1,119 @@
+<?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.base.mapper.AlarmLogMapper">
+    
+    <resultMap type="AlarmLog" id="AlarmLogResult">
+        <result property="id"    column="id"    />
+        <result property="alarmTime"    column="alarm_time"    />
+        <result property="alarmType"    column="alarm_type"    />
+        <result property="alarmLevel"    column="alarm_level"    />
+        <result property="alarmSource"    column="alarm_source"    />
+        <result property="sourcePosition"    column="source_position"    />
+        <result property="alarmTitle"    column="alarm_title"    />
+        <result property="description"    column="description"    />
+        <result property="snapshotUrl"    column="snapshot_url"    />
+        <result property="handleStatus"    column="handle_status"    />
+        <result property="handleBy"    column="handle_by"    />
+        <result property="handleTime"    column="handle_time"    />
+        <result property="handleRemark"    column="handle_remark"    />
+        <result property="remark"    column="remark"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectAlarmLogVo">
+        select id, alarm_time, alarm_type, alarm_level, alarm_source, source_position, alarm_title, description, snapshot_url, handle_status, handle_by, handle_time, handle_remark, remark, create_time from robot_ops_alarm_log
+    </sql>
+
+    <select id="selectAlarmLogList" parameterType="AlarmLog" resultMap="AlarmLogResult">
+        <include refid="selectAlarmLogVo"/>
+        <where>  
+            <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
+            <if test="alarmType != null  and alarmType != ''"> and alarm_type = #{alarmType}</if>
+            <if test="alarmLevel != null  and alarmLevel != ''"> and alarm_level = #{alarmLevel}</if>
+            <if test="alarmSource != null  and alarmSource != ''"> and alarm_source = #{alarmSource}</if>
+            <if test="sourcePosition != null  and sourcePosition != ''"> and source_position = #{sourcePosition}</if>
+            <if test="alarmTitle != null  and alarmTitle != ''"> and alarm_title = #{alarmTitle}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="snapshotUrl != null  and snapshotUrl != ''"> and snapshot_url = #{snapshotUrl}</if>
+            <if test="handleStatus != null  and handleStatus != ''"> and handle_status = #{handleStatus}</if>
+            <if test="handleBy != null  and handleBy != ''"> and handle_by = #{handleBy}</if>
+            <if test="handleTime != null "> and handle_time = #{handleTime}</if>
+            <if test="handleRemark != null  and handleRemark != ''"> and handle_remark = #{handleRemark}</if>
+        </where>
+    </select>
+    
+    <select id="selectAlarmLogById" parameterType="Long" resultMap="AlarmLogResult">
+        <include refid="selectAlarmLogVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertAlarmLog" parameterType="AlarmLog" useGeneratedKeys="true" keyProperty="id">
+        insert into robot_ops_alarm_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="alarmTime != null">alarm_time,</if>
+            <if test="alarmType != null">alarm_type,</if>
+            <if test="alarmLevel != null">alarm_level,</if>
+            <if test="alarmSource != null">alarm_source,</if>
+            <if test="sourcePosition != null">source_position,</if>
+            <if test="alarmTitle != null">alarm_title,</if>
+            <if test="description != null">description,</if>
+            <if test="snapshotUrl != null">snapshot_url,</if>
+            <if test="handleStatus != null">handle_status,</if>
+            <if test="handleBy != null">handle_by,</if>
+            <if test="handleTime != null">handle_time,</if>
+            <if test="handleRemark != null">handle_remark,</if>
+            <if test="remark != null">remark,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="alarmTime != null">#{alarmTime},</if>
+            <if test="alarmType != null">#{alarmType},</if>
+            <if test="alarmLevel != null">#{alarmLevel},</if>
+            <if test="alarmSource != null">#{alarmSource},</if>
+            <if test="sourcePosition != null">#{sourcePosition},</if>
+            <if test="alarmTitle != null">#{alarmTitle},</if>
+            <if test="description != null">#{description},</if>
+            <if test="snapshotUrl != null">#{snapshotUrl},</if>
+            <if test="handleStatus != null">#{handleStatus},</if>
+            <if test="handleBy != null">#{handleBy},</if>
+            <if test="handleTime != null">#{handleTime},</if>
+            <if test="handleRemark != null">#{handleRemark},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAlarmLog" parameterType="AlarmLog">
+        update robot_ops_alarm_log
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
+            <if test="alarmType != null">alarm_type = #{alarmType},</if>
+            <if test="alarmLevel != null">alarm_level = #{alarmLevel},</if>
+            <if test="alarmSource != null">alarm_source = #{alarmSource},</if>
+            <if test="sourcePosition != null">source_position = #{sourcePosition},</if>
+            <if test="alarmTitle != null">alarm_title = #{alarmTitle},</if>
+            <if test="description != null">description = #{description},</if>
+            <if test="snapshotUrl != null">snapshot_url = #{snapshotUrl},</if>
+            <if test="handleStatus != null">handle_status = #{handleStatus},</if>
+            <if test="handleBy != null">handle_by = #{handleBy},</if>
+            <if test="handleTime != null">handle_time = #{handleTime},</if>
+            <if test="handleRemark != null">handle_remark = #{handleRemark},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAlarmLogById" parameterType="Long">
+        delete from robot_ops_alarm_log where id = #{id}
+    </delete>
+
+    <delete id="deleteAlarmLogByIds" parameterType="String">
+        delete from robot_ops_alarm_log where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>