From bfc38cacac67f1bf2a5e857865d64cd49dc8175e Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: Wed, 21 Jun 2023 15:53:44 +0800
Subject: [PATCH] 增加通用光电报警接收 增加报警类型配置
---
ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/mapper/ArdAlarmCameraMapper.java | 66 ++
ard-work/src/main/java/com/ruoyi/alarm/config/domain/ArdAlarmTypeConfig.java | 81 +++
ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java | 42 +
ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/controller/ArdAlarmCameraController.java | 104 ++++
ard-work/src/main/java/com/ruoyi/alarm/config/service/IArdAlarmTypeConfigService.java | 78 +++
ard-work/src/main/java/com/ruoyi/alarm/config/controller/ArdAlarmTypeConfigController.java | 123 +++++
ard-work/src/main/java/com/ruoyi/alarm/config/service/impl/ArdAlarmTypeConfigServiceImpl.java | 131 +++++
ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/domain/ArdAlarmCamera.java | 265 +++++++++++
ard-work/src/main/java/com/ruoyi/alarm/stealAlarm/controller/ardAlarmStealElecController.java | 6
ard-work/src/main/resources/mapper/alarm/ArdAlarmTypeConfigMapper.xml | 78 +++
ard-work/src/main/java/com/ruoyi/alarm/config/mapper/ArdAlarmTypeConfigMapper.java | 69 +++
ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/IArdAlarmCameraService.java | 60 ++
ard-work/src/main/java/com/ruoyi/constant/CamPriority.java | 3
ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/impl/ArdAlarmCameraServiceImpl.java | 92 ++++
ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/controller/GlobalAlarmController.java | 2
ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml | 157 ++++++
16 files changed, 1,349 insertions(+), 8 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/controller/ArdAlarmCameraController.java b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/controller/ArdAlarmCameraController.java
new file mode 100644
index 0000000..5a52cd8
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/controller/ArdAlarmCameraController.java
@@ -0,0 +1,104 @@
+package com.ruoyi.alarm.cameraAlarm.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
+import com.ruoyi.alarm.cameraAlarm.service.IArdAlarmCameraService;
+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.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 通用光电报警Controller
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+@RestController
+@RequestMapping("/alarm/cameraAlarm")
+public class ArdAlarmCameraController extends BaseController
+{
+ @Autowired
+ private IArdAlarmCameraService ardAlarmCameraService;
+
+ /**
+ * 查询通用光电报警列表
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:cameraAlarm:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdAlarmCamera ardAlarmCamera)
+ {
+ startPage();
+ List<ArdAlarmCamera> list = ardAlarmCameraService.selectArdAlarmCameraList(ardAlarmCamera);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出通用光电报警列表
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:cameraAlarm:export')")
+ @Log(title = "通用光电报警", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdAlarmCamera ardAlarmCamera)
+ {
+ List<ArdAlarmCamera> list = ardAlarmCameraService.selectArdAlarmCameraList(ardAlarmCamera);
+ ExcelUtil<ArdAlarmCamera> util = new ExcelUtil<ArdAlarmCamera>(ArdAlarmCamera.class);
+ util.exportExcel(response, list, "通用光电报警数据");
+ }
+
+ /**
+ * 获取通用光电报警详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:cameraAlarm:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardAlarmCameraService.selectArdAlarmCameraById(id));
+ }
+
+ /**
+ * 新增通用光电报警
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:cameraAlarm:add')")
+ @Log(title = "通用光电报警", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdAlarmCamera ardAlarmCamera)
+ {
+ return toAjax(ardAlarmCameraService.insertArdAlarmCamera(ardAlarmCamera));
+ }
+
+ /**
+ * 修改通用光电报警
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:cameraAlarm:edit')")
+ @Log(title = "通用光电报警", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdAlarmCamera ardAlarmCamera)
+ {
+ return toAjax(ardAlarmCameraService.updateArdAlarmCamera(ardAlarmCamera));
+ }
+
+ /**
+ * 删除通用光电报警
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:cameraAlarm:remove')")
+ @Log(title = "通用光电报警", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardAlarmCameraService.deleteArdAlarmCameraByIds(ids));
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/domain/ArdAlarmCamera.java b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/domain/ArdAlarmCamera.java
new file mode 100644
index 0000000..ae29c08
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/domain/ArdAlarmCamera.java
@@ -0,0 +1,265 @@
+package com.ruoyi.alarm.cameraAlarm.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;
+
+/**
+ * 通用光电报警对象 ard_alarm_camera
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+public class ArdAlarmCamera extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 记录ID */
+ private String id;
+
+ /** 相机id */
+ @Excel(name = "相机id")
+ private String cameraId;
+
+ /** 相机名称 */
+ @Excel(name = "相机名称")
+ private String cameraName;
+
+ /** 相机通道 */
+ @Excel(name = "相机通道")
+ private Integer cameraChannel;
+
+ /** 相机类型 */
+ @Excel(name = "相机类型")
+ private String cameraType;
+
+ /** 报警类型 */
+ @Excel(name = "报警类型")
+ private String alarmType;
+
+ /** 报警时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date alarmTime;
+
+ /** 经度 */
+ @Excel(name = "经度")
+ private Double longitude;
+
+ /** 纬度 */
+ @Excel(name = "纬度")
+ private Double latitude;
+
+ /** 规则id */
+ @Excel(name = "规则id")
+ private Integer ruleId;
+
+ /** 图片url */
+ @Excel(name = "图片url")
+ private String picUrl;
+
+ /** 引导录像url */
+ @Excel(name = "引导录像url")
+ private String recordUrl;
+
+ /** 查看时间 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "查看时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date viewTime;
+
+ /** 用户ID */
+ @Excel(name = "用户ID")
+ private String userId;
+
+ /** 部门ID */
+ @Excel(name = "部门ID")
+ private Integer deptId;
+
+ /**
+ * 报警总数
+ */
+ private Integer total;
+ /**
+ * 未读报警数量
+ */
+ private Integer count;
+
+
+ public Integer getTotal() {
+ return total;
+ }
+
+ public void setTotal(Integer total) {
+ this.total = total;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setCameraId(String cameraId)
+ {
+ this.cameraId = cameraId;
+ }
+
+ public String getCameraId()
+ {
+ return cameraId;
+ }
+ public void setCameraName(String cameraName)
+ {
+ this.cameraName = cameraName;
+ }
+
+ public String getCameraName()
+ {
+ return cameraName;
+ }
+ public void setCameraChannel(Integer cameraChannel)
+ {
+ this.cameraChannel = cameraChannel;
+ }
+
+ public Integer getCameraChannel()
+ {
+ return cameraChannel;
+ }
+ public void setCameraType(String cameraType)
+ {
+ this.cameraType = cameraType;
+ }
+
+ public String getCameraType()
+ {
+ return cameraType;
+ }
+ public void setAlarmType(String alarmType)
+ {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmType()
+ {
+ return alarmType;
+ }
+ public void setAlarmTime(Date alarmTime)
+ {
+ this.alarmTime = alarmTime;
+ }
+
+ public Date getAlarmTime()
+ {
+ return alarmTime;
+ }
+ public void setLongitude(Double longitude)
+ {
+ this.longitude = longitude;
+ }
+
+ public Double getLongitude()
+ {
+ return longitude;
+ }
+ public void setLatitude(Double latitude)
+ {
+ this.latitude = latitude;
+ }
+
+ public Double getLatitude()
+ {
+ return latitude;
+ }
+ public void setRuleId(Integer ruleId)
+ {
+ this.ruleId = ruleId;
+ }
+
+ public Integer getRuleId()
+ {
+ return ruleId;
+ }
+ public void setPicUrl(String picUrl)
+ {
+ this.picUrl = picUrl;
+ }
+
+ public String getPicUrl()
+ {
+ return picUrl;
+ }
+ public void setRecordUrl(String recordUrl)
+ {
+ this.recordUrl = recordUrl;
+ }
+
+ public String getRecordUrl()
+ {
+ return recordUrl;
+ }
+ public void setViewTime(Date viewTime)
+ {
+ this.viewTime = viewTime;
+ }
+
+ public Date getViewTime()
+ {
+ return viewTime;
+ }
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+ public void setDeptId(Integer deptId)
+ {
+ this.deptId = deptId;
+ }
+
+ public Integer getDeptId()
+ {
+ return deptId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("cameraId", getCameraId())
+ .append("cameraName", getCameraName())
+ .append("cameraChannel", getCameraChannel())
+ .append("cameraType", getCameraType())
+ .append("alarmType", getAlarmType())
+ .append("alarmTime", getAlarmTime())
+ .append("longitude", getLongitude())
+ .append("latitude", getLatitude())
+ .append("ruleId", getRuleId())
+ .append("picUrl", getPicUrl())
+ .append("recordUrl", getRecordUrl())
+ .append("viewTime", getViewTime())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("userId", getUserId())
+ .append("deptId", getDeptId())
+ .toString();
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/mapper/ArdAlarmCameraMapper.java b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/mapper/ArdAlarmCameraMapper.java
new file mode 100644
index 0000000..3fadd7e
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/mapper/ArdAlarmCameraMapper.java
@@ -0,0 +1,66 @@
+package com.ruoyi.alarm.cameraAlarm.mapper;
+
+import java.util.List;
+import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
+import com.ruoyi.alarm.tubeAlarm.domain.ArdAlarmTube;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * 通用光电报警Mapper接口
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+public interface ArdAlarmCameraMapper
+{
+ /**
+ * 查询通用光电报警
+ *
+ * @param id 通用光电报警主键
+ * @return 通用光电报警
+ */
+ public ArdAlarmCamera selectArdAlarmCameraById(String id);
+
+ /**
+ * 查询通用光电报警列表
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 通用光电报警集合
+ */
+ public List<ArdAlarmCamera> selectArdAlarmCameraList(ArdAlarmCamera ardAlarmCamera);
+
+ /**
+ * 新增通用光电报警
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 结果
+ */
+ public int insertArdAlarmCamera(ArdAlarmCamera ardAlarmCamera);
+
+ /**
+ * 修改通用光电报警
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 结果
+ */
+ public int updateArdAlarmCamera(ArdAlarmCamera ardAlarmCamera);
+
+ /**
+ * 删除通用光电报警
+ *
+ * @param id 通用光电报警主键
+ * @return 结果
+ */
+ public int deleteArdAlarmCameraById(String id);
+
+ /**
+ * 批量删除通用光电报警
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteArdAlarmCameraByIds(String[] ids);
+
+ public List<ArdAlarmCamera> selectListAllByCommand(@Param("refreshTime")String refreshTime);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/IArdAlarmCameraService.java b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/IArdAlarmCameraService.java
new file mode 100644
index 0000000..e636a23
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/IArdAlarmCameraService.java
@@ -0,0 +1,60 @@
+package com.ruoyi.alarm.cameraAlarm.service;
+
+import java.util.List;
+import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
+/**
+ * 通用光电报警Service接口
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+public interface IArdAlarmCameraService
+{
+ /**
+ * 查询通用光电报警
+ *
+ * @param id 通用光电报警主键
+ * @return 通用光电报警
+ */
+ public ArdAlarmCamera selectArdAlarmCameraById(String id);
+
+ /**
+ * 查询通用光电报警列表
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 通用光电报警集合
+ */
+ public List<ArdAlarmCamera> selectArdAlarmCameraList(ArdAlarmCamera ardAlarmCamera);
+
+ /**
+ * 新增通用光电报警
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 结果
+ */
+ public int insertArdAlarmCamera(ArdAlarmCamera ardAlarmCamera);
+
+ /**
+ * 修改通用光电报警
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 结果
+ */
+ public int updateArdAlarmCamera(ArdAlarmCamera ardAlarmCamera);
+
+ /**
+ * 批量删除通用光电报警
+ *
+ * @param ids 需要删除的通用光电报警主键集合
+ * @return 结果
+ */
+ public int deleteArdAlarmCameraByIds(String[] ids);
+
+ /**
+ * 删除通用光电报警信息
+ *
+ * @param id 通用光电报警主键
+ * @return 结果
+ */
+ public int deleteArdAlarmCameraById(String id);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/impl/ArdAlarmCameraServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/impl/ArdAlarmCameraServiceImpl.java
new file mode 100644
index 0000000..5223ac3
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/cameraAlarm/service/impl/ArdAlarmCameraServiceImpl.java
@@ -0,0 +1,92 @@
+package com.ruoyi.alarm.cameraAlarm.service.impl;
+
+import java.util.List;
+import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
+import com.ruoyi.alarm.cameraAlarm.mapper.ArdAlarmCameraMapper;
+import com.ruoyi.alarm.cameraAlarm.service.IArdAlarmCameraService;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 通用光电报警Service业务层处理
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+@Service
+public class ArdAlarmCameraServiceImpl implements IArdAlarmCameraService {
+ @Autowired
+ private ArdAlarmCameraMapper ardAlarmCameraMapper;
+
+ /**
+ * 查询通用光电报警
+ *
+ * @param id 通用光电报警主键
+ * @return 通用光电报警
+ */
+ @Override
+ public ArdAlarmCamera selectArdAlarmCameraById(String id) {
+ return ardAlarmCameraMapper.selectArdAlarmCameraById(id);
+ }
+
+ /**
+ * 查询通用光电报警列表
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 通用光电报警
+ */
+ @Override
+ public List<ArdAlarmCamera> selectArdAlarmCameraList(ArdAlarmCamera ardAlarmCamera) {
+ return ardAlarmCameraMapper.selectArdAlarmCameraList(ardAlarmCamera);
+ }
+
+ /**
+ * 新增通用光电报警
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 结果
+ */
+ @Override
+ public int insertArdAlarmCamera(ArdAlarmCamera ardAlarmCamera) {
+ ardAlarmCamera.setCreateBy(SecurityUtils.getUsername());
+ ardAlarmCamera.setCreateTime(DateUtils.getNowDate());
+ ardAlarmCamera.setUserId(SecurityUtils.getUserId());
+ return ardAlarmCameraMapper.insertArdAlarmCamera(ardAlarmCamera);
+ }
+
+ /**
+ * 修改通用光电报警
+ *
+ * @param ardAlarmCamera 通用光电报警
+ * @return 结果
+ */
+ @Override
+ public int updateArdAlarmCamera(ArdAlarmCamera ardAlarmCamera) {
+ return ardAlarmCameraMapper.updateArdAlarmCamera(ardAlarmCamera);
+ }
+
+ /**
+ * 批量删除通用光电报警
+ *
+ * @param ids 需要删除的通用光电报警主键
+ * @return 结果
+ */
+ @Override
+ public int deleteArdAlarmCameraByIds(String[] ids) {
+ return ardAlarmCameraMapper.deleteArdAlarmCameraByIds(ids);
+ }
+
+ /**
+ * 删除通用光电报警信息
+ *
+ * @param id 通用光电报警主键
+ * @return 结果
+ */
+ @Override
+ public int deleteArdAlarmCameraById(String id) {
+ return ardAlarmCameraMapper.deleteArdAlarmCameraById(id);
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/config/controller/ArdAlarmTypeConfigController.java b/ard-work/src/main/java/com/ruoyi/alarm/config/controller/ArdAlarmTypeConfigController.java
new file mode 100644
index 0000000..dec9207
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/config/controller/ArdAlarmTypeConfigController.java
@@ -0,0 +1,123 @@
+package com.ruoyi.alarm.config.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig;
+import com.ruoyi.alarm.config.service.IArdAlarmTypeConfigService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 报警类型用户关联Controller
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+@RestController
+@RequestMapping("/alarm/alarmConfig")
+@Api(tags = "报警类型配置")
+public class ArdAlarmTypeConfigController extends BaseController
+{
+ @Autowired
+ private IArdAlarmTypeConfigService ardAlarmTypeConfigService;
+
+ /**
+ * 查询报警类型用户关联列表
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:list')")
+ @GetMapping("/list")
+ @ApiOperation("查询报警类型用户关联列表")
+ public TableDataInfo list(ArdAlarmTypeConfig ardAlarmTypeConfig)
+ {
+ startPage();
+ List<ArdAlarmTypeConfig> list = ardAlarmTypeConfigService.selectArdAlarmTypeConfigList(ardAlarmTypeConfig);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出报警类型用户关联列表
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:export')")
+ @Log(title = "报警类型用户关联", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdAlarmTypeConfig ardAlarmTypeConfig)
+ {
+ List<ArdAlarmTypeConfig> list = ardAlarmTypeConfigService.selectArdAlarmTypeConfigList(ardAlarmTypeConfig);
+ ExcelUtil<ArdAlarmTypeConfig> util = new ExcelUtil<ArdAlarmTypeConfig>(ArdAlarmTypeConfig.class);
+ util.exportExcel(response, list, "报警类型用户关联数据");
+ }
+
+ /**
+ * 获取报警类型用户关联详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardAlarmTypeConfigService.selectArdAlarmTypeConfigById(id));
+ }
+ /**
+ * 批量新增报警类型用户关联
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:add')")
+ @Log(title = "批量配置报警类型", businessType = BusinessType.INSERT)
+ @PostMapping("/batchConfig")
+ @ApiOperation("批量配置报警类型")
+ public AjaxResult addBatch(@RequestBody List<Integer> commands)
+ {
+ ardAlarmTypeConfigService.deleteArdAlarmTypeConfigByCurrentUserId();
+ return AjaxResult.success(ardAlarmTypeConfigService.insertArdAlarmTypeConfig(commands));
+ }
+
+ /**
+ * 新增报警类型用户关联
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:add')")
+ @Log(title = "报警类型用户关联", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdAlarmTypeConfig ardAlarmTypeConfig)
+ {
+ return toAjax(ardAlarmTypeConfigService.insertArdAlarmTypeConfig(ardAlarmTypeConfig));
+ }
+
+ /**
+ * 修改报警类型用户关联
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:edit')")
+ @Log(title = "报警类型用户关联", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdAlarmTypeConfig ardAlarmTypeConfig)
+ {
+ return toAjax(ardAlarmTypeConfigService.updateArdAlarmTypeConfig(ardAlarmTypeConfig));
+ }
+
+ /**
+ * 删除报警类型用户关联
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:alarmConfig:remove')")
+ @Log(title = "报警类型用户关联", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardAlarmTypeConfigService.deleteArdAlarmTypeConfigByIds(ids));
+ }
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/config/domain/ArdAlarmTypeConfig.java b/ard-work/src/main/java/com/ruoyi/alarm/config/domain/ArdAlarmTypeConfig.java
new file mode 100644
index 0000000..da7207f
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/config/domain/ArdAlarmTypeConfig.java
@@ -0,0 +1,81 @@
+package com.ruoyi.alarm.config.domain;
+
+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;
+
+/**
+ * 报警类型用户关联对象 ard_alarm_type_user
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+
+public class ArdAlarmTypeConfig extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 记录ID */
+ private String id;
+
+ /** 报警代码 */
+ private Integer command;
+
+ /** 报警类型 */
+ @Excel(name = "报警类型")
+ private String alarmType;
+
+ /** 用户ID */
+ @Excel(name = "用户ID")
+ private String userId;
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+ public void setCommand(Integer command)
+ {
+ this.command = command;
+ }
+
+ public Integer getCommand()
+ {
+ return command;
+ }
+ public void setAlarmType(String alarmType)
+ {
+ this.alarmType = alarmType;
+ }
+
+ public String getAlarmType()
+ {
+ return alarmType;
+ }
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("command", getCommand())
+ .append("alarmType", getAlarmType())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("userId", getUserId())
+ .toString();
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/config/mapper/ArdAlarmTypeConfigMapper.java b/ard-work/src/main/java/com/ruoyi/alarm/config/mapper/ArdAlarmTypeConfigMapper.java
new file mode 100644
index 0000000..9a89b27
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/config/mapper/ArdAlarmTypeConfigMapper.java
@@ -0,0 +1,69 @@
+package com.ruoyi.alarm.config.mapper;
+
+import java.util.List;
+import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig;
+
+/**
+ * 报警类型用户关联Mapper接口
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+public interface ArdAlarmTypeConfigMapper
+{
+ /**
+ * 查询报警类型用户关联
+ *
+ * @param id 报警类型用户关联主键
+ * @return 报警类型用户关联
+ */
+ public ArdAlarmTypeConfig selectArdAlarmTypeConfigById(String id);
+
+ /**
+ * 查询报警类型用户关联列表
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 报警类型用户关联集合
+ */
+ public List<ArdAlarmTypeConfig> selectArdAlarmTypeConfigList(ArdAlarmTypeConfig ardAlarmTypeConfig);
+
+ /**
+ * 新增报警类型用户关联
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 结果
+ */
+ public int insertArdAlarmTypeConfig(ArdAlarmTypeConfig ardAlarmTypeConfig);
+
+ /**
+ * 修改报警类型用户关联
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 结果
+ */
+ public int updateArdAlarmTypeConfig(ArdAlarmTypeConfig ardAlarmTypeConfig);
+
+ /**
+ * 删除报警类型用户关联
+ *
+ * @param id 报警类型用户关联主键
+ * @return 结果
+ */
+ public int deleteArdAlarmTypeConfigById(String id);
+
+ /**
+ * 批量删除报警类型用户关联
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteArdAlarmTypeConfigByIds(String[] ids);
+ /**
+ * 批量删除报警类型用户关联
+ *
+ * @param userId 关联的用户id
+ * @return 结果
+ */
+ public int deleteArdAlarmTypeConfigByCurrentUserId(String userId);
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/config/service/IArdAlarmTypeConfigService.java b/ard-work/src/main/java/com/ruoyi/alarm/config/service/IArdAlarmTypeConfigService.java
new file mode 100644
index 0000000..501a797
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/config/service/IArdAlarmTypeConfigService.java
@@ -0,0 +1,78 @@
+package com.ruoyi.alarm.config.service;
+
+import java.util.List;
+import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig;
+
+
+/**
+ * 报警类型用户关联Service接口
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+public interface IArdAlarmTypeConfigService
+{
+ /**
+ * 查询报警类型用户关联
+ *
+ * @param id 报警类型用户关联主键
+ * @return 报警类型用户关联
+ */
+ public ArdAlarmTypeConfig selectArdAlarmTypeConfigById(String id);
+
+ /**
+ * 查询报警类型用户关联列表
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 报警类型用户关联集合
+ */
+ public List<ArdAlarmTypeConfig> selectArdAlarmTypeConfigList(ArdAlarmTypeConfig ardAlarmTypeConfig);
+
+ /**
+ * 新增报警类型用户关联
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 结果
+ */
+ public int insertArdAlarmTypeConfig(ArdAlarmTypeConfig ardAlarmTypeConfig);
+
+ /**
+ * 修改报警类型用户关联
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 结果
+ */
+ public int updateArdAlarmTypeConfig(ArdAlarmTypeConfig ardAlarmTypeConfig);
+
+ /**
+ * 批量删除报警类型用户关联
+ *
+ * @param ids 需要删除的报警类型用户关联主键集合
+ * @return 结果
+ */
+ public int deleteArdAlarmTypeConfigByIds(String[] ids);
+
+ /**
+ * 删除报警类型用户关联信息
+ *
+ * @param id 报警类型用户关联主键
+ * @return 结果
+ */
+ public int deleteArdAlarmTypeConfigById(String id);
+
+ /**
+ * 批量报警类型用户关联
+ *
+ * @param command 报警类型列表
+ * @return 结果
+ */
+ public int insertArdAlarmTypeConfig(List<Integer> command);
+
+ /**
+ * 批量删除报警类型用户关联
+ *
+ * @return 结果
+ */
+ public int deleteArdAlarmTypeConfigByCurrentUserId();
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/config/service/impl/ArdAlarmTypeConfigServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/config/service/impl/ArdAlarmTypeConfigServiceImpl.java
new file mode 100644
index 0000000..1679570
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/config/service/impl/ArdAlarmTypeConfigServiceImpl.java
@@ -0,0 +1,131 @@
+package com.ruoyi.alarm.config.service.impl;
+
+
+
+import com.ruoyi.alarm.config.domain.ArdAlarmTypeConfig;
+import com.ruoyi.alarm.config.mapper.ArdAlarmTypeConfigMapper;
+import com.ruoyi.alarm.config.service.IArdAlarmTypeConfigService;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.mapper.SysDictDataMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+import java.util.Objects;
+
+
+/**
+ * 报警类型用户关联Service业务层处理
+ *
+ * @author ard
+ * @date 2023-06-21
+ */
+@Service
+public class ArdAlarmTypeConfigServiceImpl implements IArdAlarmTypeConfigService {
+ @Autowired
+ private ArdAlarmTypeConfigMapper ardAlarmTypeConfigMapper;
+ @Autowired
+ private SysDictDataMapper dictDataMapper;
+ /**
+ * 查询报警类型用户关联
+ *
+ * @param id 报警类型用户关联主键
+ * @return 报警类型用户关联
+ */
+ @Override
+ public ArdAlarmTypeConfig selectArdAlarmTypeConfigById(String id) {
+ return ardAlarmTypeConfigMapper.selectArdAlarmTypeConfigById(id);
+ }
+
+ /**
+ * 查询报警类型用户关联列表
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 报警类型用户关联
+ */
+ @Override
+ public List<ArdAlarmTypeConfig> selectArdAlarmTypeConfigList(ArdAlarmTypeConfig ardAlarmTypeConfig) {
+ return ardAlarmTypeConfigMapper.selectArdAlarmTypeConfigList(ardAlarmTypeConfig);
+ }
+
+ /**
+ * 新增报警类型用户关联
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 结果
+ */
+ @Override
+ public int insertArdAlarmTypeConfig(ArdAlarmTypeConfig ardAlarmTypeConfig) {
+ ardAlarmTypeConfig.setCreateBy(SecurityUtils.getUsername());
+ ardAlarmTypeConfig.setCreateTime(DateUtils.getNowDate());
+ ardAlarmTypeConfig.setUserId(SecurityUtils.getUserId());
+ return ardAlarmTypeConfigMapper.insertArdAlarmTypeConfig(ardAlarmTypeConfig);
+ }
+
+ /**
+ * 修改报警类型用户关联
+ *
+ * @param ardAlarmTypeConfig 报警类型用户关联
+ * @return 结果
+ */
+ @Override
+ public int updateArdAlarmTypeConfig(ArdAlarmTypeConfig ardAlarmTypeConfig) {
+ return ardAlarmTypeConfigMapper.updateArdAlarmTypeConfig(ardAlarmTypeConfig);
+ }
+
+ /**
+ * 批量删除报警类型用户关联
+ *
+ * @param ids 需要删除的报警类型用户关联主键
+ * @return 结果
+ */
+ @Override
+ public int deleteArdAlarmTypeConfigByIds(String[] ids) {
+ return ardAlarmTypeConfigMapper.deleteArdAlarmTypeConfigByIds(ids);
+ }
+
+ /**
+ * 删除报警类型用户关联信息
+ *
+ * @param id 报警类型用户关联主键
+ * @return 结果
+ */
+ @Override
+ public int deleteArdAlarmTypeConfigById(String id) {
+ return ardAlarmTypeConfigMapper.deleteArdAlarmTypeConfigById(id);
+ }
+ /**
+ * 批量报警类型用户关联
+ *
+ * @param commands 报警类型列表
+ * @return 结果
+ */
+ @Override
+ public int insertArdAlarmTypeConfig(List<Integer> commands) {
+ int resNum=0;
+ for(Integer command :commands)
+ {
+ ArdAlarmTypeConfig config=new ArdAlarmTypeConfig();
+ config.setId(IdUtils.simpleUUID());
+ config.setCommand(command);
+ List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType("alarm_type");
+ SysDictData sysDictData = dictDatas.stream().filter(s -> Objects.equals(s.getDictValue(), command.toString())).findFirst().orElse(null);
+ config.setAlarmType(sysDictData.getDictLabel());
+ config.setUserId(SecurityUtils.getUserId());
+ config.setCreateTime(DateUtils.getNowDate());
+ int i = ardAlarmTypeConfigMapper.insertArdAlarmTypeConfig(config);
+ if(i>0)
+ {
+ resNum++;
+ }
+ }
+ return resNum;
+ }
+
+ @Override
+ public int deleteArdAlarmTypeConfigByCurrentUserId() {
+ return ardAlarmTypeConfigMapper.deleteArdAlarmTypeConfigByCurrentUserId(SecurityUtils.getUserId());
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/controller/GlobalAlarmController.java b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/controller/GlobalAlarmController.java
index 11af8c0..49d56af 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/controller/GlobalAlarmController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/controller/GlobalAlarmController.java
@@ -32,7 +32,7 @@
IGlobalAlarmService globalAlarmService;
@PostMapping("/List")
- @ApiOperation(value = "报警查询接口",notes = "这里包含了所有报警类型的数据")
+ @ApiOperation(value = "实时报警聚合接口",notes = "按报警刷新时间聚合查询")
@ApiOperationSupport(includeParameters = {"command"},order = 1)
public AjaxResult selectAlarmLog(@RequestBody GlobalAlarmCondition condition) {
List<GlobalAlarmData> result = globalAlarmService.selectAlarmLogs(condition);
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
index f99f6df..71b98b5 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java
@@ -1,6 +1,8 @@
package com.ruoyi.alarm.globalAlarm.service.impl;
import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
+import com.ruoyi.alarm.cameraAlarm.mapper.ArdAlarmCameraMapper;
import com.ruoyi.alarm.globalAlarm.domain.GlobalAlarmCondition;
import com.ruoyi.alarm.globalAlarm.domain.GlobalAlarmData;
import com.ruoyi.alarm.globalAlarm.service.IGlobalAlarmService;
@@ -53,6 +55,8 @@
@Resource
ArdAlarmTubeMapper ardAlarmTubeMapper;
@Resource
+ ArdAlarmCameraMapper ardAlarmCameraMapper;
+ @Resource
ArdTubesMapper ardTubesMapper;
@Resource
ArdAlarmpointsWellMapper ardAlarmpointsWellMapper;
@@ -91,6 +95,21 @@
.setAltitude(ardAlarmStealelec.getAltitude())
.setCount(ardAlarmStealelec.getCount())
.setTotal(ardAlarmStealelec.getTotal());
+ return globalAlarmData;
+ })
+ .collect(Collectors.toList());
+ case 1002:
+ List<ArdAlarmCamera> ardAlarmCameras = ardAlarmCameraMapper.selectListAllByCommand(refreshTime);
+ return ardAlarmCameras.stream()
+ .map(ardAlarmCamera -> {
+ GlobalAlarmData globalAlarmData = new GlobalAlarmData()
+ .setId(ardAlarmCamera.getId())
+ .setName(ardAlarmCamera.getCameraName())
+ .setAlarmTime(ardAlarmCamera.getAlarmTime())
+ .setLongitude(ardAlarmCamera.getLongitude())
+ .setLatitude(ardAlarmCamera.getLatitude())
+ .setCount(ardAlarmCamera.getCount())
+ .setTotal(ardAlarmCamera.getTotal());
return globalAlarmData;
})
.collect(Collectors.toList());
@@ -232,6 +251,29 @@
}
//endregion
break;
+ case "camera":
+ //region 处理通用光电报警
+ ArdAlarmCamera ardAlarmCamera = JSONObject.parseObject(message, ArdAlarmCamera.class);
+ ardAlarmCamera.setId(simpleUUID);
+ int aac = ardAlarmCameraMapper.insertArdAlarmCamera(ardAlarmCamera);
+ if (aac > 0) {
+ log.debug("camera入库成功:" + ardAlarmCamera);
+ //引导录像
+ CameraCmd cmd = new CameraCmd();
+ cmd.setRecordBucketName("record");
+ cmd.setRecordObjectName("camera");
+ cmd.setOperator("sys_camera");
+ cmd.setExpired(30);
+ cmd.setTargetPosition(new double[]{ardAlarmCamera.getLongitude(), ardAlarmCamera.getLatitude()});
+ String url = guideCamera(cmd);
+ //更新录像
+ if (StringUtils.isNotEmpty(url)) {
+ ardAlarmCamera.setRecordUrl(url);
+ ardAlarmCameraMapper.updateArdAlarmCamera(ardAlarmCamera);
+ }
+ }
+ //endregion
+ break;
}
} catch (Exception ex) {
log.error("接收报警异常:" + ex.getMessage());
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/stealAlarm/controller/ardAlarmStealElecController.java b/ard-work/src/main/java/com/ruoyi/alarm/stealAlarm/controller/ardAlarmStealElecController.java
index 4f57655..8f8b641 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/stealAlarm/controller/ardAlarmStealElecController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/stealAlarm/controller/ardAlarmStealElecController.java
@@ -1,13 +1,7 @@
package com.ruoyi.alarm.stealAlarm.controller;
-import com.ruoyi.alarm.stealAlarm.service.IStealElecAlarmService;
import com.ruoyi.common.annotation.Anonymous;
-import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.text.SimpleDateFormat;
-import java.util.Date;
/**
* @ClassName ardAlarmStealElec
diff --git a/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java b/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
index b8e6d9f..9c96fb2 100644
--- a/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
+++ b/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
@@ -15,7 +15,8 @@
static {
priorityMap.put("sys_radar_fire",999);//雷达防火报警
priorityMap.put("sys_tube_leak",998);//管线泄露报警
- priorityMap.put("sys_steal_elec",997);//盗电报警
+ priorityMap.put("sys_camera",997);//通用光电报警
+ priorityMap.put("sys_steal_elec",996);//盗电报警
priorityMap.put("sys_patrol_inspect",1);//巡检
}
}
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml
new file mode 100644
index 0000000..9d29056
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml
@@ -0,0 +1,157 @@
+<?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.alarm.cameraAlarm.mapper.ArdAlarmCameraMapper">
+
+ <resultMap type="ArdAlarmCamera" id="ArdAlarmCameraResult">
+ <result property="id" column="id" />
+ <result property="cameraId" column="camera_id" />
+ <result property="cameraName" column="camera_name" />
+ <result property="cameraChannel" column="camera_channel" />
+ <result property="cameraType" column="camera_type" />
+ <result property="alarmType" column="alarm_type" />
+ <result property="alarmTime" column="alarm_time" />
+ <result property="longitude" column="longitude" />
+ <result property="latitude" column="latitude" />
+ <result property="ruleId" column="rule_id" />
+ <result property="picUrl" column="pic_url" />
+ <result property="recordUrl" column="record_url" />
+ <result property="viewTime" column="view_time" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="userId" column="user_id" />
+ <result property="deptId" column="dept_id" />
+ </resultMap>
+
+ <sql id="selectArdAlarmCameraVo">
+ select id, camera_id, camera_name, camera_channel, camera_type, alarm_type, alarm_time, longitude, latitude, rule_id, pic_url, record_url, view_time, create_by, create_time, user_id, dept_id from ard_alarm_camera
+ </sql>
+
+ <select id="selectArdAlarmCameraList" parameterType="ArdAlarmCamera" resultMap="ArdAlarmCameraResult">
+ <include refid="selectArdAlarmCameraVo"/>
+ <where>
+ <if test="cameraId != null and cameraId != ''"> and camera_id = #{cameraId}</if>
+ <if test="cameraName != null and cameraName != ''"> and camera_name like '%'||#{cameraName}||'%'</if>
+ <if test="cameraChannel != null "> and camera_channel = #{cameraChannel}</if>
+ <if test="cameraType != null and cameraType != ''"> and camera_type = #{cameraType}</if>
+ <if test="alarmType != null and alarmType != ''"> and alarm_type = #{alarmType}</if>
+ <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
+ <if test="longitude != null "> and longitude = #{longitude}</if>
+ <if test="latitude != null "> and latitude = #{latitude}</if>
+ <if test="ruleId != null "> and rule_id = #{ruleId}</if>
+ <if test="picUrl != null and picUrl != ''"> and pic_url = #{picUrl}</if>
+ <if test="recordUrl != null and recordUrl != ''"> and record_url = #{recordUrl}</if>
+ <if test="viewTime != null "> and view_time = #{viewTime}</if>
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
+ <if test="deptId != null "> and dept_id = #{deptId}</if>
+ </where>
+ </select>
+
+ <select id="selectArdAlarmCameraById" parameterType="String" resultMap="ArdAlarmCameraResult">
+ <include refid="selectArdAlarmCameraVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertArdAlarmCamera" parameterType="ArdAlarmCamera">
+ insert into ard_alarm_camera
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="cameraId != null">camera_id,</if>
+ <if test="cameraName != null">camera_name,</if>
+ <if test="cameraChannel != null">camera_channel,</if>
+ <if test="cameraType != null">camera_type,</if>
+ <if test="alarmType != null">alarm_type,</if>
+ <if test="alarmTime != null">alarm_time,</if>
+ <if test="longitude != null">longitude,</if>
+ <if test="latitude != null">latitude,</if>
+ <if test="ruleId != null">rule_id,</if>
+ <if test="picUrl != null">pic_url,</if>
+ <if test="recordUrl != null">record_url,</if>
+ <if test="viewTime != null">view_time,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="userId != null">user_id,</if>
+ <if test="deptId != null">dept_id,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="cameraId != null">#{cameraId},</if>
+ <if test="cameraName != null">#{cameraName},</if>
+ <if test="cameraChannel != null">#{cameraChannel},</if>
+ <if test="cameraType != null">#{cameraType},</if>
+ <if test="alarmType != null">#{alarmType},</if>
+ <if test="alarmTime != null">#{alarmTime},</if>
+ <if test="longitude != null">#{longitude},</if>
+ <if test="latitude != null">#{latitude},</if>
+ <if test="ruleId != null">#{ruleId},</if>
+ <if test="picUrl != null">#{picUrl},</if>
+ <if test="recordUrl != null">#{recordUrl},</if>
+ <if test="viewTime != null">#{viewTime},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="userId != null">#{userId},</if>
+ <if test="deptId != null">#{deptId},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdAlarmCamera" parameterType="ArdAlarmCamera">
+ update ard_alarm_camera
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="cameraId != null">camera_id = #{cameraId},</if>
+ <if test="cameraName != null">camera_name = #{cameraName},</if>
+ <if test="cameraChannel != null">camera_channel = #{cameraChannel},</if>
+ <if test="cameraType != null">camera_type = #{cameraType},</if>
+ <if test="alarmType != null">alarm_type = #{alarmType},</if>
+ <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
+ <if test="longitude != null">longitude = #{longitude},</if>
+ <if test="latitude != null">latitude = #{latitude},</if>
+ <if test="ruleId != null">rule_id = #{ruleId},</if>
+ <if test="picUrl != null">pic_url = #{picUrl},</if>
+ <if test="recordUrl != null">record_url = #{recordUrl},</if>
+ <if test="viewTime != null">view_time = #{viewTime},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ <if test="deptId != null">dept_id = #{deptId},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteArdAlarmCameraById" parameterType="String">
+ delete from ard_alarm_camera where id = #{id}
+ </delete>
+
+ <delete id="deleteArdAlarmCameraByIds" parameterType="String">
+ delete from ard_alarm_camera where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <select id="selectListAllByCommand" resultMap="ArdAlarmCameraResult">
+ SELECT T
+ .*
+ FROM
+ (
+ SELECT
+ aac.ID,
+ aac.camera_id,
+ aac.camera_name,
+ aac.alarm_time,
+ aac.longitude,
+ aac.latitude,
+ aac.record_url,
+ ROW_NUMBER () OVER ( PARTITION BY aac.camera_id ORDER BY aac.alarm_time DESC ) AS rn,
+ COUNT ( CASE WHEN aac.view_time IS NULL THEN 1 END ) OVER ( PARTITION BY aac.camera_id ) AS COUNT,
+ COUNT ( aac.alarm_time ) OVER ( PARTITION BY camera_id ) AS total
+ FROM
+ ard_alarm_camera aac
+ WHERE
+ aac.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
+ ORDER BY
+ aac.alarm_time DESC
+ ) T
+ WHERE
+ T.rn = 1
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmTypeConfigMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmTypeConfigMapper.xml
new file mode 100644
index 0000000..3f4b4a1
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmTypeConfigMapper.xml
@@ -0,0 +1,78 @@
+<?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.alarm.config.mapper.ArdAlarmTypeConfigMapper">
+
+ <resultMap type="ArdAlarmTypeConfig" id="ArdAlarmTypeConfigResult">
+ <result property="id" column="id" />
+ <result property="command" column="command" />
+ <result property="alarmType" column="alarm_type" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="userId" column="user_id" />
+ </resultMap>
+
+ <sql id="selectArdAlarmTypeConfigVo">
+ select id, command, alarm_type, create_time, user_id from ard_alarm_type_user
+ </sql>
+
+ <select id="selectArdAlarmTypeConfigList" parameterType="ArdAlarmTypeConfig" resultMap="ArdAlarmTypeConfigResult">
+ <include refid="selectArdAlarmTypeConfigVo"/>
+ <where>
+ <if test="alarmType != null and alarmType != ''"> and alarm_type = #{alarmType}</if>
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
+ </where>
+ </select>
+
+ <select id="selectArdAlarmTypeConfigById" parameterType="String" resultMap="ArdAlarmTypeConfigResult">
+ <include refid="selectArdAlarmTypeConfigVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertArdAlarmTypeConfig" parameterType="ArdAlarmTypeConfig">
+ insert into ard_alarm_type_user
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="command != null">command,</if>
+ <if test="alarmType != null">alarm_type,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="userId != null">user_id,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="command != null">#{command},</if>
+ <if test="alarmType != null">#{alarmType},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="userId != null">#{userId},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdAlarmTypeConfig" parameterType="ArdAlarmTypeConfig">
+ update ard_alarm_type_user
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="command != null">command = #{command},</if>
+ <if test="alarmType != null">alarm_type = #{alarmType},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteArdAlarmTypeConfigById" parameterType="String">
+ delete from ard_alarm_type_user where id = #{id}
+ </delete>
+
+ <delete id="deleteArdAlarmTypeConfigByIds" parameterType="String">
+ delete from ard_alarm_type_user where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <delete id="deleteArdAlarmTypeConfigByCurrentUserId">
+ delete from ard_alarm_type_user where user_id=#{userId}
+ </delete>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3