From 5f5cf5b1b4683a56fd0c85a0d89d14a4c0268cde Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期五, 07 七月 2023 17:08:49 +0800
Subject: [PATCH] 增加外联报警数据接收入库和引导就近光电 增加外联报警业务功能
---
ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/impl/ArdAlarmExternalServiceImpl.java | 87 +++++
ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/GlobalAlarmServiceImpl.java | 226 ++++++++++----
ard-work/src/main/java/com/ruoyi/constant/CamPriority.java | 1
ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/mapper/ArdAlarmExternalMapper.java | 69 ++++
ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/IArdAlarmExternalService.java | 62 ++++
ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueManager.java | 3
ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueTaskExecutor.java | 15
ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/domain/ArdAlarmExternal.java | 127 ++++++++
ard-work/src/main/resources/mapper/alarm/ArdAlarmExternalMapper.xml | 185 ++++++++++++
ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml | 6
ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/controller/ArdAlarmExternalController.java | 105 +++++++
11 files changed, 814 insertions(+), 72 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/controller/ArdAlarmExternalController.java b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/controller/ArdAlarmExternalController.java
new file mode 100644
index 0000000..fff6139
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/controller/ArdAlarmExternalController.java
@@ -0,0 +1,105 @@
+package com.ruoyi.alarm.externalAlarm.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
+import com.ruoyi.alarm.externalAlarm.service.IArdAlarmExternalService;
+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-07-07
+ */
+@RestController
+@RequestMapping("/alarm/external")
+public class ArdAlarmExternalController extends BaseController
+{
+ @Autowired
+ private IArdAlarmExternalService ardAlarmExternalService;
+
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:external:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdAlarmExternal ardAlarmExternal)
+ {
+ startPage();
+ List<ArdAlarmExternal> list = ardAlarmExternalService.selectArdAlarmExternalList(ardAlarmExternal);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭澶栬仈鎶ヨ鍒楄〃
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:external:export')")
+ @Log(title = "澶栬仈鎶ヨ", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdAlarmExternal ardAlarmExternal)
+ {
+ List<ArdAlarmExternal> list = ardAlarmExternalService.selectArdAlarmExternalList(ardAlarmExternal);
+ ExcelUtil<ArdAlarmExternal> util = new ExcelUtil<ArdAlarmExternal>(ArdAlarmExternal.class);
+ util.exportExcel(response, list, "澶栬仈鎶ヨ鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇澶栬仈鎶ヨ璇︾粏淇℃伅
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:external:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(ardAlarmExternalService.selectArdAlarmExternalById(id));
+ }
+
+ /**
+ * 鏂板澶栬仈鎶ヨ
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:external:add')")
+ @Log(title = "澶栬仈鎶ヨ", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdAlarmExternal ardAlarmExternal)
+ {
+ return toAjax(ardAlarmExternalService.insertArdAlarmExternal(ardAlarmExternal));
+ }
+
+ /**
+ * 淇敼澶栬仈鎶ヨ
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:external:edit')")
+ @Log(title = "澶栬仈鎶ヨ", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdAlarmExternal ardAlarmExternal)
+ {
+ return toAjax(ardAlarmExternalService.updateArdAlarmExternal(ardAlarmExternal));
+ }
+
+ /**
+ * 鍒犻櫎澶栬仈鎶ヨ
+ */
+ @PreAuthorize("@ss.hasPermi('alarm:external:remove')")
+ @Log(title = "澶栬仈鎶ヨ", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(ardAlarmExternalService.deleteArdAlarmExternalByIds(ids));
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/domain/ArdAlarmExternal.java b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/domain/ArdAlarmExternal.java
new file mode 100644
index 0000000..e5b6d06
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/domain/ArdAlarmExternal.java
@@ -0,0 +1,127 @@
+package com.ruoyi.alarm.externalAlarm.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+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_external
+ *
+ * @author ard
+ * @date 2023-07-07
+ */
+@Data
+public class ArdAlarmExternal extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * id
+ */
+ private String id;
+
+ /**
+ * 鎶ヨID
+ */
+ @Excel(name = "鎶ヨID")
+ private String alarmId;
+
+ /**
+ * 鎶ヨ鍚嶇О
+ */
+ @Excel(name = "鎶ヨ鍚嶇О")
+ private String alarmName;
+
+ /**
+ * 闃插尯ID
+ */
+ @Excel(name = "闃插尯ID")
+ private String defenseId;
+
+ /**
+ * 闃插尯鍚嶇О
+ */
+ @Excel(name = "闃插尯鍚嶇О")
+ private String defenseName;
+
+ /**
+ * 鎶ヨ绫诲埆
+ */
+ @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;
+
+ /**
+ * 楂樺眰
+ */
+ @Excel(name = "楂樺眰")
+ private Double altitude;
+
+ /**
+ * 寮曞褰曞儚url
+ */
+ @Excel(name = "寮曞褰曞儚url")
+ private String recordUrl;
+ /**
+ * 瀛愮郴缁烮D
+ */
+ @Excel(name = "瀛愮郴缁烮D")
+ private String subSysNo;
+
+ /**
+ * 鎶ヨ涓绘満ID
+ */
+ @Excel(name = "鎶ヨ涓绘満ID")
+ private String alarmHostId;
+
+ /**
+ * 鏌ョ湅鏃堕棿
+ */
+ @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 deptId;
+
+ /**
+ * 鐢ㄦ埛ID
+ */
+ @Excel(name = "鐢ㄦ埛ID")
+ private String userId;
+
+ /**
+ * 鎶ヨ鎬绘暟
+ */
+ private Integer total;
+ /**
+ * 鏈鎶ヨ鏁伴噺
+ */
+ private Integer count;
+
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/mapper/ArdAlarmExternalMapper.java b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/mapper/ArdAlarmExternalMapper.java
new file mode 100644
index 0000000..671aa75
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/mapper/ArdAlarmExternalMapper.java
@@ -0,0 +1,69 @@
+package com.ruoyi.alarm.externalAlarm.mapper;
+
+import java.util.List;
+import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
+import com.ruoyi.alarm.radarAlarm.domain.ArdAlarmRadar;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 澶栬仈鎶ヨMapper鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-07-07
+ */
+public interface ArdAlarmExternalMapper
+{
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ
+ *
+ * @param id 澶栬仈鎶ヨ涓婚敭
+ * @return 澶栬仈鎶ヨ
+ */
+ public ArdAlarmExternal selectArdAlarmExternalById(String id);
+
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ鍒楄〃
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 澶栬仈鎶ヨ闆嗗悎
+ */
+ public List<ArdAlarmExternal> selectArdAlarmExternalList(ArdAlarmExternal ardAlarmExternal);
+
+ /**
+ * 鏂板澶栬仈鎶ヨ
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 缁撴灉
+ */
+ public int insertArdAlarmExternal(ArdAlarmExternal ardAlarmExternal);
+
+ /**
+ * 淇敼澶栬仈鎶ヨ
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 缁撴灉
+ */
+ public int updateArdAlarmExternal(ArdAlarmExternal ardAlarmExternal);
+
+ /**
+ * 鍒犻櫎澶栬仈鎶ヨ
+ *
+ * @param id 澶栬仈鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmExternalById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎澶栬仈鎶ヨ
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmExternalByIds(String[] ids);
+
+ int selectCountByAlarmTime(@Param("refreshTime") String refreshTime, @Param("alarmType") String alarmType);
+
+ public List<ArdAlarmExternal> selectListAllByCommand(@Param("refreshTime") String refreshTime, @Param("alarmType") String alarmType);
+
+ public int updateViewTimeByCondition(@Param("defenseName")String defenseName,@Param("alarmType")String alarmType,@Param("alarmTime") String alarmTime,@Param("viewTime") String viewTime);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/IArdAlarmExternalService.java b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/IArdAlarmExternalService.java
new file mode 100644
index 0000000..f04ec9c
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/IArdAlarmExternalService.java
@@ -0,0 +1,62 @@
+package com.ruoyi.alarm.externalAlarm.service;
+
+import java.util.List;
+import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
+
+
+/**
+ * 澶栬仈鎶ヨService鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-07-07
+ */
+public interface IArdAlarmExternalService
+{
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ
+ *
+ * @param id 澶栬仈鎶ヨ涓婚敭
+ * @return 澶栬仈鎶ヨ
+ */
+ public ArdAlarmExternal selectArdAlarmExternalById(String id);
+
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ鍒楄〃
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 澶栬仈鎶ヨ闆嗗悎
+ */
+ public List<ArdAlarmExternal> selectArdAlarmExternalList(ArdAlarmExternal ardAlarmExternal);
+
+ /**
+ * 鏂板澶栬仈鎶ヨ
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 缁撴灉
+ */
+ public int insertArdAlarmExternal(ArdAlarmExternal ardAlarmExternal);
+
+ /**
+ * 淇敼澶栬仈鎶ヨ
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 缁撴灉
+ */
+ public int updateArdAlarmExternal(ArdAlarmExternal ardAlarmExternal);
+
+ /**
+ * 鎵归噺鍒犻櫎澶栬仈鎶ヨ
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑澶栬仈鎶ヨ涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmExternalByIds(String[] ids);
+
+ /**
+ * 鍒犻櫎澶栬仈鎶ヨ淇℃伅
+ *
+ * @param id 澶栬仈鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteArdAlarmExternalById(String id);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/impl/ArdAlarmExternalServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/impl/ArdAlarmExternalServiceImpl.java
new file mode 100644
index 0000000..f650309
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarm/externalAlarm/service/impl/ArdAlarmExternalServiceImpl.java
@@ -0,0 +1,87 @@
+package com.ruoyi.alarm.externalAlarm.service.impl;
+
+import java.util.List;
+import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
+import com.ruoyi.alarm.externalAlarm.mapper.ArdAlarmExternalMapper;
+import com.ruoyi.alarm.externalAlarm.service.IArdAlarmExternalService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 澶栬仈鎶ヨService涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2023-07-07
+ */
+@Service
+public class ArdAlarmExternalServiceImpl implements IArdAlarmExternalService {
+ @Autowired
+ private ArdAlarmExternalMapper ardAlarmExternalMapper;
+
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ
+ *
+ * @param id 澶栬仈鎶ヨ涓婚敭
+ * @return 澶栬仈鎶ヨ
+ */
+ @Override
+ public ArdAlarmExternal selectArdAlarmExternalById(String id) {
+ return ardAlarmExternalMapper.selectArdAlarmExternalById(id);
+ }
+
+ /**
+ * 鏌ヨ澶栬仈鎶ヨ鍒楄〃
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 澶栬仈鎶ヨ
+ */
+ @Override
+ public List<ArdAlarmExternal> selectArdAlarmExternalList(ArdAlarmExternal ardAlarmExternal) {
+ return ardAlarmExternalMapper.selectArdAlarmExternalList(ardAlarmExternal);
+ }
+
+ /**
+ * 鏂板澶栬仈鎶ヨ
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertArdAlarmExternal(ArdAlarmExternal ardAlarmExternal) {
+ return ardAlarmExternalMapper.insertArdAlarmExternal(ardAlarmExternal);
+ }
+
+ /**
+ * 淇敼澶栬仈鎶ヨ
+ *
+ * @param ardAlarmExternal 澶栬仈鎶ヨ
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateArdAlarmExternal(ArdAlarmExternal ardAlarmExternal) {
+ return ardAlarmExternalMapper.updateArdAlarmExternal(ardAlarmExternal);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎澶栬仈鎶ヨ
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑澶栬仈鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdAlarmExternalByIds(String[] ids) {
+ return ardAlarmExternalMapper.deleteArdAlarmExternalByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎澶栬仈鎶ヨ淇℃伅
+ *
+ * @param id 澶栬仈鎶ヨ涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdAlarmExternalById(String id) {
+ return ardAlarmExternalMapper.deleteArdAlarmExternalById(id);
+ }
+}
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 f84040c..9ac6470 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
@@ -3,6 +3,8 @@
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.alarm.cameraAlarm.domain.ArdAlarmCamera;
import com.ruoyi.alarm.cameraAlarm.mapper.ArdAlarmCameraMapper;
+import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
+import com.ruoyi.alarm.externalAlarm.mapper.ArdAlarmExternalMapper;
import com.ruoyi.alarm.globalAlarm.domain.GlobalAlarmCondition;
import com.ruoyi.alarm.globalAlarm.domain.GlobalAlarmData;
import com.ruoyi.alarm.globalAlarm.domain.GuidePriorityQueue;
@@ -21,6 +23,7 @@
import com.ruoyi.alarmpoints.tube.mapper.ArdTubesMapper;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
+import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
@@ -38,6 +41,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
+
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -55,6 +59,8 @@
@Slf4j(topic = "mqtt")
public class GlobalAlarmServiceImpl implements IGlobalAlarmService {
//region 渚濊禆娉ㄥ叆
+ @Resource
+ private ArdAlarmExternalMapper ardAlarmExternalMapper;
@Resource
private ArdAlarmRadarMapper ardAlarmRadarMapper;
@Resource
@@ -102,6 +108,8 @@
countMap.put("1004", count1004);
int count1007 = ardAlarmRadarMapper.selectCountByAlarmTime(refreshTime, "闆疯揪鎶芥补鏈哄仠鏈�");
countMap.put("1007", count1007);
+ int count1005 = ardAlarmExternalMapper.selectCountByAlarmTime(refreshTime, "闃插尯鎶ヨ");
+ countMap.put("1005", count1005);
int count1014 = ardAlarmTubeMapper.selectCountByAlarmTime(refreshTime);
countMap.put("1014", count1014);
map.put("20000", countMap);
@@ -175,6 +183,20 @@
.setLatitude(ardAlarmRadar.getLatitude())
.setCount(ardAlarmRadar.getCount())
.setTotal(ardAlarmRadar.getTotal());
+ return globalAlarmData;
+ }).collect(Collectors.toList());
+ case 1005:
+ List<ArdAlarmExternal> ardAlarmExternals = ardAlarmExternalMapper.selectListAllByCommand(refreshTime, "闃插尯鎶ヨ");
+ return ardAlarmExternals.stream()
+ .map(ardAlarmExternal -> {
+ GlobalAlarmData globalAlarmData = new GlobalAlarmData()
+ .setId(ardAlarmExternal.getId())
+ .setName(ardAlarmExternal.getAlarmName())
+ .setAlarmTime(ardAlarmExternal.getAlarmTime())
+ .setLongitude(ardAlarmExternal.getLongitude())
+ .setLatitude(ardAlarmExternal.getLatitude())
+ .setCount(ardAlarmExternal.getCount())
+ .setTotal(ardAlarmExternal.getTotal());
return globalAlarmData;
}).collect(Collectors.toList());
case 1007:
@@ -258,6 +280,13 @@
aarrr.setPageSize(pageSize);
aarrr.setAlarmType("闆疯揪鎶芥补鏈哄仠鏈�");
return ardAlarmRadarMapper.selectArdAlarmRadarList(aarrr);
+ case 1005:
+ ArdAlarmExternal aae = new ArdAlarmExternal();
+ aae.setParams(params);
+ aae.setPageNum(pageNum);
+ aae.setPageSize(pageSize);
+ aae.setAlarmType("闃插尯鎶ヨ");
+ return ardAlarmExternalMapper.selectArdAlarmExternalList(aae);
case 1014:
ArdAlarmTube aat = new ArdAlarmTube();
aat.setParams(params);
@@ -294,10 +323,19 @@
ArdAlarmRadar ardAlarmRadar = ardAlarmRadarMapper.selectArdAlarmRadarById(condition.getId());
if (StringUtils.isNotNull(ardAlarmRadar)) {
String name = ardAlarmRadar.getName();
- String alarmType=ardAlarmRadar.getAlarmType();
- String alarmTime=fmt.format(ardAlarmRadar.getAlarmTime());
- ardAlarmRadarMapper.updateViewTimeByCondition(name,alarmType, alarmTime,DateUtils.getTime());
+ String alarmType = ardAlarmRadar.getAlarmType();
+ String alarmTime = fmt.format(ardAlarmRadar.getAlarmTime());
+ ardAlarmRadarMapper.updateViewTimeByCondition(name, alarmType, alarmTime, DateUtils.getTime());
return ardAlarmRadar;
+ }
+ case 1005:
+ ArdAlarmExternal ardAlarmExternal = ardAlarmExternalMapper.selectArdAlarmExternalById(condition.getId());
+ if (StringUtils.isNotNull(ardAlarmExternal)) {
+ String defenseName = ardAlarmExternal.getDefenseName();
+ String alarmType = ardAlarmExternal.getAlarmType();
+ String alarmTime = fmt.format(ardAlarmExternal.getAlarmTime());
+ ardAlarmRadarMapper.updateViewTimeByCondition(defenseName, alarmType, alarmTime, DateUtils.getTime());
+ return ardAlarmExternal;
}
case 1014:
ArdAlarmTube ardAlarmTube = ardAlarmTubeMapper.selectArdAlarmTubeById(condition.getId());
@@ -362,17 +400,18 @@
int aat = ardAlarmTubeMapper.insertArdAlarmTube(ardAlarmTube);
if (aat > 0) {
log.debug("tube鍏ュ簱鎴愬姛锛�" + ardAlarmTube);
+ //region 寮曞褰曞儚
Double longitude = ardAlarmTube.getLongitude();
Double latitude = ardAlarmTube.getLatitude();
- if(StringUtils.isNull(longitude)||StringUtils.isNull(latitude))
- {
+ if (StringUtils.isNull(longitude) || StringUtils.isNull(latitude)) {
return;
}
- double[] coordinate=new double[]{longitude,latitude};
+ double[] coordinate = new double[]{longitude, latitude};
String nearbyCameraId = getNearbyCamera(new double[]{ardAlarmTube.getLongitude(), ardAlarmTube.getLatitude()});
if (StringUtils.isNotEmpty(nearbyCameraId)) {
- messagesEnqueued(nearbyCameraId, ardAlarmTube.getId(), "sys_tube_leak",ardAlarmTube.getCreateTime(), 1,1,coordinate);
+ messagesEnqueued(nearbyCameraId, ardAlarmTube.getId(), "sys_tube_leak", ardAlarmTube.getCreateTime(), 1, 1, coordinate);
}
+ //endregion
}
//endregion
break;
@@ -380,7 +419,6 @@
//region 澶勭悊閫氱敤鍏夌數鎶ヨ
ArdAlarmCamera ardAlarmCamera = JSONObject.parseObject(message, ArdAlarmCamera.class);
ardAlarmCamera.setId(IdUtils.simpleUUID());
-
int aac = ardAlarmCameraMapper.insertArdAlarmCamera(ardAlarmCamera);
if (aac > 0) {
log.debug("camera鍏ュ簱鎴愬姛锛�" + ardAlarmCamera);
@@ -410,17 +448,16 @@
case "闆疯揪鎶芥补鏈哄仠鏈�":
alarmType = "sys_radar_pumpshutdown";
ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(alarmpointName);
- if(StringUtils.isNotNull(ardAlarmpointsWell)) {
- ardAlarmRadar.setLongitude(ardAlarmpointsWell.getLongitude());
- ardAlarmRadar.setLatitude(ardAlarmpointsWell.getLatitude());
- }
+ if (StringUtils.isNotNull(ardAlarmpointsWell)) {
+ ardAlarmRadar.setLongitude(ardAlarmpointsWell.getLongitude());
+ ardAlarmRadar.setLatitude(ardAlarmpointsWell.getLatitude());
+ }
break;
}
- if(StringUtils.isNull(ardAlarmRadar.getLongitude())||StringUtils.isNull(ardAlarmRadar.getLatitude()))
- {
+ if (StringUtils.isNull(ardAlarmRadar.getLongitude()) || StringUtils.isNull(ardAlarmRadar.getLatitude())) {
continue;
}
- double[] coordinate=new double[]{ardAlarmRadar.getLongitude(),ardAlarmRadar.getLatitude()};//鎶ヨ鍧愭爣
+ double[] coordinate = new double[]{ardAlarmRadar.getLongitude(), ardAlarmRadar.getLatitude()};//鎶ヨ鍧愭爣
//鍒ゆ柇褰撳墠鎶ヨ鐐�5鍒嗛挓鍐呮槸鍚﹀凡寮曞
ardAlarmRadar.setGuideFlag(1);
ArdAlarmRadar AlarmRadar = ardAlarmRadarMapper.getArdAlarmRadarWithGuide(ardAlarmRadar);
@@ -430,22 +467,20 @@
//鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
String cameraIdWithTower = ardAlarmRadarMapper.getCameraByRadar(radarAlarmData.getRadarId());
if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
- log.info("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:"+cameraIdWithTower);
+ log.info("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower);
//濡傛灉闆疯揪濉斾笂鏈夊厜鐢�
- messagesEnqueued(cameraIdWithTower, uuid, alarmType, ardAlarmRadar.getCreateTime(),1,1,coordinate);
+ messagesEnqueued(cameraIdWithTower, uuid, alarmType, ardAlarmRadar.getCreateTime(), 1, 1, coordinate);
}
//鑾峰彇鎶ヨ鐐瑰叧鑱旂殑澶у厜鐢�
ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(alarmpointName);
- if(StringUtils.isNotNull(ardAlarmpointsWell) && StringUtils.isNotEmpty(ardAlarmpointsWell.getCameraId()))
- {
+ if (StringUtils.isNotNull(ardAlarmpointsWell) && StringUtils.isNotEmpty(ardAlarmpointsWell.getCameraId())) {
String cameraId = ardAlarmpointsWell.getCameraId();
- if(cameraIdWithTower.equals(cameraId))
- {
+ if (cameraIdWithTower.equals(cameraId)) {
return;
}
- log.info("鑾峰彇鍒版姤璀︾偣鍏宠仈鐨勫厜鐢�:"+cameraId);
+ log.info("鑾峰彇鍒版姤璀︾偣鍏宠仈鐨勫厜鐢�:" + cameraId);
//濡傛灉鎶ヨ鐐瑰叧鑱斾簡鍏夌數
- messagesEnqueued(cameraId, uuid, alarmType,ardAlarmRadar.getCreateTime(), 1,2,coordinate);
+ messagesEnqueued(cameraId, uuid, alarmType, ardAlarmRadar.getCreateTime(), 1, 2, coordinate);
}
} else {
//5鍒嗛挓鍐呮湁寮曞
@@ -458,28 +493,57 @@
//鑾峰彇闆疯揪鎵�鍦ㄥ涓婄殑澶у厜鐢�
String cameraIdWithTower = ardAlarmRadarMapper.getCameraByRadar(radarAlarmData.getRadarId());
if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
- log.info("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:"+cameraIdWithTower);
+ log.info("鑾峰彇鍒伴浄杈惧涓婄殑鍏夌數:" + cameraIdWithTower);
//濡傛灉闆疯揪濉斾笂鏈夊厜鐢�
- messagesEnqueued(cameraIdWithTower, uuid, alarmType,ardAlarmRadar.getCreateTime(), count,1,coordinate);
+ messagesEnqueued(cameraIdWithTower, uuid, alarmType, ardAlarmRadar.getCreateTime(), count, 1, coordinate);
}
//鑾峰彇鎶ヨ鐐瑰叧鑱旂殑澶у厜鐢�
ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(alarmpointName);
- if(StringUtils.isNotNull(ardAlarmpointsWell) && StringUtils.isNotEmpty(ardAlarmpointsWell.getCameraId()))
- {
+ if (StringUtils.isNotNull(ardAlarmpointsWell) && StringUtils.isNotEmpty(ardAlarmpointsWell.getCameraId())) {
String cameraId = ardAlarmpointsWell.getCameraId();
- if(cameraIdWithTower.equals(cameraId))
- {
+ if (cameraIdWithTower.equals(cameraId)) {
return;
}
- log.info("鑾峰彇鍒版姤璀︾偣鍏宠仈鐨勫厜鐢�:"+cameraId);
+ log.info("鑾峰彇鍒版姤璀︾偣鍏宠仈鐨勫厜鐢�:" + cameraId);
//濡傛灉鎶ヨ鐐瑰叧鑱斾簡鍏夌數
- messagesEnqueued(cameraId, uuid, alarmType,ardAlarmRadar.getCreateTime(), count,2,coordinate);
+ messagesEnqueued(cameraId, uuid, alarmType, ardAlarmRadar.getCreateTime(), count, 2, coordinate);
}
} else {
//鏈紩瀵兼湭瓒呰繃3娆★紝鐩存帴鍏ュ簱
ardAlarmRadarMapper.insertArdAlarmRadar(ardAlarmRadar);
}
}
+ }
+ //endregion
+ break;
+ case "external":
+ //region 澶勭悊澶栬仈鎶ヨ
+ ArdAlarmExternal ardAlarmExternal = JSONObject.parseObject(message, ArdAlarmExternal.class);
+ ardAlarmExternal.setId(IdUtils.simpleUUID());
+ ardAlarmExternal.setCreateTime(new Date());//鎺ユ敹鏃堕棿
+ //澶栬仈闃插尯鍚嶇О灏辨槸鍏磋叮鐐癸紝鏌ュ叴瓒g偣鍧愭爣
+ String defenseName = ardAlarmExternal.getDefenseName();
+ ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(defenseName);
+ if (StringUtils.isNotNull(ardAlarmpointsWell)) {
+ ardAlarmExternal.setLongitude(ardAlarmpointsWell.getLongitude());
+ ardAlarmExternal.setLatitude(ardAlarmpointsWell.getLatitude());
+ }
+ int aae = ardAlarmExternalMapper.insertArdAlarmExternal(ardAlarmExternal);
+ if (aae > 0) {
+ log.debug("external鍏ュ簱鎴愬姛锛�" + ardAlarmExternal);
+ //region 寮曞褰曞儚
+ if (StringUtils.isNull(ardAlarmExternal.getLongitude()) || StringUtils.isNull(ardAlarmExternal.getLatitude())) {
+ return;
+ }
+ double[] guideCoordinate = new double[]{ardAlarmExternal.getLongitude(), ardAlarmExternal.getLatitude()};//寮曞鍧愭爣
+ if (StringUtils.isNull(ardAlarmExternal.getLongitude()) || StringUtils.isNull(ardAlarmExternal.getLatitude())) {
+ return;
+ }
+ String nearbyCameraId = getNearbyCamera(new double[]{ardAlarmExternal.getLongitude(), ardAlarmExternal.getLatitude()});//鏈�杩戠浉鏈篒D
+ if (StringUtils.isNotEmpty(nearbyCameraId)) {
+ messagesEnqueued(nearbyCameraId, ardAlarmExternal.getId(), "sys_external", ardAlarmExternal.getCreateTime(), 1, 1, guideCoordinate);
+ }
+ //endregion
}
//endregion
break;
@@ -491,7 +555,7 @@
/**
* 娑堟伅鍏ラ槦
- *
+ * <p>
* cameraId 鐩告満ID
* alarmId 鎶ヨID
* alarmType 鎶ヨ绫诲瀷
@@ -499,34 +563,57 @@
* recordSn 褰曞儚瀛樺偍浣嶇疆 1-recordUrl1 2-recordUrl2
* targetPosition 鎶ヨ鐐逛綅缃潗鏍�
*/
- private void messagesEnqueued(String cameraId, String alarmId, String alarmType,Date receiveTime, Integer num, Integer recordSn,double[] targetPosition) {
- SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
- GuideTask guideTask = new GuideTask();
- //鐩告満ID
- guideTask.setCameraId(cameraId);
- //鎶ヨ绫诲瀷
- guideTask.setAlarmType(alarmType);
- //閫氶亾(閫氳繃鏃ュ鏃堕棿鐮斿垽)
- String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime");
- Integer channel = ArdTool.getChannelBydayNightTime(dayNightTime);
- guideTask.setChanNum(channel);
- //鎶ヨID
- guideTask.setAlarmId(alarmId);
- //鎺ユ敹鏃堕棿
- guideTask.setReceiveTime(fmt.format(receiveTime));
- //鎶ヨ浼樺厛绾�(閫氳繃浼樺厛绾у瓧鍏�)
- Integer priority = CamPriority.priorityMap.get(alarmType);
- guideTask.setPriority(priority);
- //鎶ヨ娆℃暟
- guideTask.setNum(num);
- //褰曞儚瀛樺偍浣嶇疆
- guideTask.setRecordSn(recordSn);
- //鐩爣缁忕含搴�
- guideTask.setTargetPosition(targetPosition);
- //娑堟伅鍏ラ槦
- queueManager.addTaskToQueue(cameraId, guideTask);
- //鎵撳嵃闃熷垪
- GuidePriorityQueue.printPriorityQueue();
+ private void messagesEnqueued(String cameraId, String alarmId, String alarmType, Date receiveTime, Integer num, Integer recordSn, double[] targetPosition) {
+ try {
+ if (!IsEnableGuide(cameraId)) {
+ log.info("鐩告満:" + cameraId + "鏈紑鍚姤璀﹀紩瀵煎姛鑳�");
+ return;
+ }
+
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ GuideTask guideTask = new GuideTask();
+ //鐩告満ID
+ guideTask.setCameraId(cameraId);
+ //鎶ヨ绫诲瀷
+ guideTask.setAlarmType(alarmType);
+ //閫氶亾(閫氳繃鏃ュ鏃堕棿鐮斿垽)
+ String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime");
+ Integer channel = ArdTool.getChannelBydayNightTime(dayNightTime);
+ guideTask.setChanNum(channel);
+ //鎶ヨID
+ guideTask.setAlarmId(alarmId);
+ //鎺ユ敹鏃堕棿
+ guideTask.setReceiveTime(fmt.format(receiveTime));
+ //鎶ヨ浼樺厛绾�(閫氳繃浼樺厛绾у瓧鍏�)
+ Integer priority = CamPriority.priorityMap.get(alarmType);
+ guideTask.setPriority(priority);
+ //鎶ヨ娆℃暟
+ guideTask.setNum(num);
+ //褰曞儚瀛樺偍浣嶇疆
+ guideTask.setRecordSn(recordSn);
+ //鐩爣缁忕含搴�
+ guideTask.setTargetPosition(targetPosition);
+ //娑堟伅鍏ラ槦
+ queueManager.addTaskToQueue(cameraId, guideTask);
+ //鎵撳嵃闃熷垪
+ GuidePriorityQueue.printPriorityQueue();
+ } catch (Exception ex) {
+ log.error("鎶ヨ鍏ラ槦寮傚父:" + ex.getMessage());
+ }
+ }
+
+ /**
+ * 鍏夌數鏄惁寮�鍚姤璀﹀紩瀵煎姛鑳�
+ * 鍒樿嫃涔�
+ * 2023/7/7 14:03
+ */
+ private Boolean IsEnableGuide(String cameraId) {
+ boolean enabled = false;
+ ArdCameras ardCameras = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId);
+ if (ardCameras.getCamAlarmGuideEnable().equals(1)) {
+ enabled = true;
+ }
+ return enabled;
}
/**
@@ -563,35 +650,36 @@
return minDistanceCameraId;
}
+
public static void main(String[] args) {
Comparator<Obj> PriorityDescCom = Comparator.comparingInt(Obj::getPriority).reversed();
Comparator<Obj> NumDescCom = Comparator.comparingInt(Obj::getNum).reversed();
Comparator<Obj> receiveTimeAscCom = Comparator.comparing(Obj::getAlarmTime);
Comparator<Obj> comparator = PriorityDescCom.thenComparing(NumDescCom).thenComparing(receiveTimeAscCom);
- PriorityBlockingQueue<Obj> priorityQueue = new PriorityBlockingQueue<>(1000,comparator);
+ PriorityBlockingQueue<Obj> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
- priorityQueue.add(new Obj(999,1,"2023-07-01 16:00:01"));
- priorityQueue.add(new Obj(999,2,"2023-07-01 16:00:01"));
- priorityQueue.add(new Obj(999,3,"2023-07-01 16:00:01"));
+ priorityQueue.add(new Obj(999, 1, "2023-07-01 16:00:01"));
+ priorityQueue.add(new Obj(999, 2, "2023-07-01 16:00:01"));
+ priorityQueue.add(new Obj(999, 3, "2023-07-01 16:00:01"));
List<Obj> elements = new ArrayList<>(priorityQueue);
elements.sort(priorityQueue.comparator()); // 浣跨敤闃熷垪鐨勬瘮杈冨櫒杩涜鎺掑簭
for (Obj task : elements) {
- log.info("姝e湪鎺掗槦銆恜riority銆�" + task.getPriority()+"銆恘um銆�" + task.getNum() + "銆恆larmTime銆�" + task.getAlarmTime());
+ log.info("姝e湪鎺掗槦銆恜riority銆�" + task.getPriority() + "銆恘um銆�" + task.getNum() + "銆恆larmTime銆�" + task.getAlarmTime());
}
log.info("===================================================================");
- priorityQueue.add(new Obj(999,5,"2023-07-01 16:00:01"));
+ priorityQueue.add(new Obj(999, 5, "2023-07-01 16:00:01"));
PriorityBlockingQueue queue = new PriorityBlockingQueue<>(priorityQueue);
while (priorityQueue.size() > 0) {
Obj task = priorityQueue.poll();
- log.info("姝e湪鎺掗槦銆恜riority銆�" + task.getPriority()+"銆恘um銆�" + task.getNum() + "銆恆larmTime銆�" + task.getAlarmTime());
+ log.info("姝e湪鎺掗槦銆恜riority銆�" + task.getPriority() + "銆恘um銆�" + task.getNum() + "銆恆larmTime銆�" + task.getAlarmTime());
}
}
+
@Data
@AllArgsConstructor
- static class Obj
- {
+ static class Obj {
Integer priority;
Integer num;
String alarmTime;
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueManager.java b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueManager.java
index edff059..1dbe0e4 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueManager.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueManager.java
@@ -64,7 +64,8 @@
PriorityBlockingQueue<GuideTask> guideTaskQueue = GuidePriorityQueue.cameraQueueMap.get(cameraId);
if(StringUtils.isNull(guideTaskQueue))
{
- log.info("鐩告満鏈櫥褰曪紝娌℃湁闃熷垪");
+ log.info("鐩告満鏈櫥褰�,娌℃湁闃熷垪,鏃犳硶鍏ラ槦寮曞");
+ return;
}
log.debug("鏂颁换鍔″叆闃�:"+task.getAlarmId());
guideTaskQueue.add(task);
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueTaskExecutor.java b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueTaskExecutor.java
index ecae683..2dc815f 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueTaskExecutor.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/globalAlarm/service/impl/QueueTaskExecutor.java
@@ -1,5 +1,7 @@
package com.ruoyi.alarm.globalAlarm.service.impl;
+import com.ruoyi.alarm.externalAlarm.domain.ArdAlarmExternal;
+import com.ruoyi.alarm.externalAlarm.service.IArdAlarmExternalService;
import com.ruoyi.alarm.globalAlarm.domain.GuideTask;
import com.ruoyi.alarm.radarAlarm.domain.ArdAlarmRadar;
import com.ruoyi.alarm.radarAlarm.service.IArdAlarmRadarService;
@@ -10,6 +12,7 @@
import com.ruoyi.device.hiksdk.service.IHikClientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
+
import javax.annotation.Resource;
/**
@@ -29,6 +32,8 @@
IArdAlarmTubeService ardAlarmTubeService;
@Resource
IArdAlarmRadarService ardAlarmRadarService;
+ @Resource
+ IArdAlarmExternalService ardAlarmExternalService;
public void processTask(GuideTask guideTask) {
try {
@@ -39,7 +44,7 @@
cmd.setOperator(guideTask.getAlarmType());
cmd.setExpired(30);
cmd.setRecordBucketName("record");
- cmd.setRecordObjectName("alarm_"+guideTask.getAlarmId());
+ cmd.setRecordObjectName("alarm_" + guideTask.getAlarmId());
log.debug("寮�濮嬪紩瀵�");
boolean guideRes = hikClientService.guideTargetPosition(cmd);
if (guideRes) {
@@ -49,7 +54,7 @@
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
- log.info("褰撳墠浠诲姟ID"+guideTask.getAlarmId()+"绾跨▼琚粓姝�");
+ log.info("褰撳墠浠诲姟ID" + guideTask.getAlarmId() + "绾跨▼琚粓姝�");
}
String url = hikClientService.recordStopToMinio(cmd);//鍋滄褰曞儚杩斿洖url
if (StringUtils.isNotEmpty(url)) {
@@ -72,6 +77,12 @@
}
ardAlarmRadarService.updateArdAlarmRadar(ardAlarmRadar);
break;
+ case "sys_external":
+ ArdAlarmExternal ardAlarmExternal = new ArdAlarmExternal();
+ ardAlarmExternal.setId(guideTask.getAlarmId());
+ ardAlarmExternal.setRecordUrl(url);
+ ardAlarmExternalService.updateArdAlarmExternal(ardAlarmExternal);
+ break;
}
}
}
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 1f6021d..ab0638c 100644
--- a/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
+++ b/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
@@ -21,6 +21,7 @@
priorityMap.put("sys_radar_move", 900);//闆疯揪绉诲姩鎶ヨ
priorityMap.put("sys_tube_leak", 800);//绠$嚎娉勯湶鎶ヨ
priorityMap.put("sys_radar_pumpshutdown", 800);//闆疯揪鎶芥补鏈哄仠鏈�
+ priorityMap.put("sys_external", 700);//澶栬仈鎶ヨ
priorityMap.put("sys_patrol_inspect", 1);//宸℃
}
}
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmExternalMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmExternalMapper.xml
new file mode 100644
index 0000000..60b843e
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmExternalMapper.xml
@@ -0,0 +1,185 @@
+<?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.externalAlarm.mapper.ArdAlarmExternalMapper">
+
+ <resultMap type="ArdAlarmExternal" id="ArdAlarmExternalResult">
+ <result property="id" column="id" />
+ <result property="alarmId" column="alarm_id" />
+ <result property="alarmName" column="alarm_name" />
+ <result property="defenseId" column="defense_id" />
+ <result property="defenseName" column="defense_name" />
+ <result property="alarmType" column="alarm_type" />
+ <result property="alarmTime" column="alarm_time" />
+ <result property="subSysNo" column="sub_sys_no" />
+ <result property="alarmHostId" column="alarm_host_id" />
+ <result property="longitude" column="longitude" />
+ <result property="latitude" column="latitude" />
+ <result property="altitude" column="altitude" />
+ <result property="recordUrl" column="record_url" />
+ <result property="viewTime" column="view_time" />
+ <result property="deptId" column="dept_id" />
+ <result property="userId" column="user_id" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ </resultMap>
+
+ <sql id="selectArdAlarmExternalVo">
+ select id, alarm_id, alarm_name, defense_id, defense_name, alarm_type, alarm_time, sub_sys_no, alarm_host_id, longitude, latitude, altitude, record_url, view_time, dept_id, user_id, create_by, create_time from ard_alarm_external
+ </sql>
+
+ <select id="selectArdAlarmExternalList" parameterType="ArdAlarmExternal" resultMap="ArdAlarmExternalResult">
+ <include refid="selectArdAlarmExternalVo"/>
+ <where>
+ <if test="alarmId != null and alarmId != ''"> and alarm_id = #{alarmId}</if>
+ <if test="alarmName != null and alarmName != ''"> and alarm_name like '%'||#{alarmName}||'%'</if>
+ <if test="defenseId != null and defenseId != ''"> and defense_id = #{defenseId}</if>
+ <if test="defenseName != null and defenseName != ''"> and defense_name like '%'||#{defenseName}||'%'</if>
+ <if test="alarmType != null and alarmType != ''"> and alarm_type = #{alarmType}</if>
+ <if test="subSysNo != null and subSysNo != ''"> and sub_sys_no = #{subSysNo}</if>
+ <if test="alarmHostId != null and alarmHostId != ''"> and alarm_host_id = #{alarmHostId}</if>
+ <if test="longitude != null and longitude != ''"> and longitude = #{longitude}</if>
+ <if test="latitude != null and latitude != ''"> and latitude = #{latitude}</if>
+ <if test="altitude != null and altitude != ''"> and altitude = #{altitude}</if>
+ <if test="recordUrl != null and recordUrl != ''"> and record_url = #{recordUrl}</if>
+ <if test="viewTime != null "> and view_time = #{viewTime}</if>
+ <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ AND alarm_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ AND alarm_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ </where>
+ </select>
+
+ <select id="selectArdAlarmExternalById" parameterType="String" resultMap="ArdAlarmExternalResult">
+ <include refid="selectArdAlarmExternalVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertArdAlarmExternal" parameterType="ArdAlarmExternal">
+ insert into ard_alarm_external
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="alarmId != null">alarm_id,</if>
+ <if test="alarmName != null">alarm_name,</if>
+ <if test="defenseId != null">defense_id,</if>
+ <if test="defenseName != null">defense_name,</if>
+ <if test="alarmType != null">alarm_type,</if>
+ <if test="alarmTime != null">alarm_time,</if>
+ <if test="subSysNo != null">sub_sys_no,</if>
+ <if test="alarmHostId != null">alarm_host_id,</if>
+ <if test="longitude != null">longitude,</if>
+ <if test="latitude != null">latitude,</if>
+ <if test="altitude != null">altitude,</if>
+ <if test="recordUrl != null">record_url,</if>
+ <if test="viewTime != null">view_time,</if>
+ <if test="deptId != null">dept_id,</if>
+ <if test="userId != null">user_id,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="alarmId != null">#{alarmId},</if>
+ <if test="alarmName != null">#{alarmName},</if>
+ <if test="defenseId != null">#{defenseId},</if>
+ <if test="defenseName != null">#{defenseName},</if>
+ <if test="alarmType != null">#{alarmType},</if>
+ <if test="alarmTime != null">#{alarmTime},</if>
+ <if test="subSysNo != null">#{subSysNo},</if>
+ <if test="alarmHostId != null">#{alarmHostId},</if>
+ <if test="longitude != null">#{longitude},</if>
+ <if test="latitude != null">#{latitude},</if>
+ <if test="altitude != null">#{altitude},</if>
+ <if test="recordUrl != null">#{recordUrl},</if>
+ <if test="viewTime != null">#{viewTime},</if>
+ <if test="deptId != null">#{deptId},</if>
+ <if test="userId != null">#{userId},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdAlarmExternal" parameterType="ArdAlarmExternal">
+ update ard_alarm_external
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="alarmId != null">alarm_id = #{alarmId},</if>
+ <if test="alarmName != null">alarm_name = #{alarmName},</if>
+ <if test="defenseId != null">defense_id = #{defenseId},</if>
+ <if test="defenseName != null">defense_name = #{defenseName},</if>
+ <if test="alarmType != null">alarm_type = #{alarmType},</if>
+ <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
+ <if test="subSysNo != null">sub_sys_no = #{subSysNo},</if>
+ <if test="alarmHostId != null">alarm_host_id = #{alarmHostId},</if>
+ <if test="longitude != null">longitude = #{longitude},</if>
+ <if test="latitude != null">latitude = #{latitude},</if>
+ <if test="altitude != null">altitude = #{altitude},</if>
+ <if test="recordUrl != null">record_url = #{recordUrl},</if>
+ <if test="viewTime != null">view_time = #{viewTime},</if>
+ <if test="deptId != null">dept_id = #{deptId},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteArdAlarmExternalById" parameterType="String">
+ delete from ard_alarm_external where id = #{id}
+ </delete>
+
+ <delete id="deleteArdAlarmExternalByIds" parameterType="String">
+ delete from ard_alarm_external where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <select id="selectCountByAlarmTime" resultType="Integer">
+ SELECT COUNT(DISTINCT aae.defense_name)
+ FROM ard_alarm_external aae
+ WHERE aae.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE
+ and aae.alarm_type = #{alarmType}
+ and aae.view_time is null
+ </select>
+ <select id="selectListAllByCommand" resultMap="ArdAlarmExternalResult">
+ SELECT T
+ .*
+ FROM
+ (
+ SELECT
+ aae.ID,
+ aae.alarm_id,
+ aae.alarm_name,
+ aae.defense_id,
+ aae.defense_name,
+ aae.alarm_type,
+ aae.alarm_time,
+ aae.longitude,
+ aae.latitude,
+ ROW_NUMBER () OVER ( PARTITION BY aae.defense_name ORDER BY aae.alarm_time DESC ) AS rn,
+ COUNT ( CASE WHEN aae.view_time IS NULL THEN 1 END ) OVER ( PARTITION BY aae.defense_name ) AS COUNT,
+ COUNT ( aae.alarm_time ) OVER ( PARTITION BY aae.defense_name ) AS total
+ FROM
+ ard_alarm_external aae
+ WHERE
+ aae.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
+ AND aae.alarm_type = #{ alarmType }
+ ORDER BY
+ aae.alarm_time DESC
+ ) T
+ WHERE
+ T.rn = 1
+ </select>
+ <update id="updateViewTimeByCondition" parameterType="String">
+ update ard_alarm_external
+ set view_time=#{viewTime}
+ where defense_name = #{defenseName}
+ and alarm_type=#{alarmType}
+ and alarm_time<=#{alarmTime}
+ and view_time is null
+ </update>
+</mapper>
\ No newline at end of file
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
index a08e0fa..2fe34eb 100644
--- a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
@@ -44,6 +44,12 @@
<if test="name != null and name != ''">and name like '%'||#{name}||'%'</if>
<if test="alarmType != null and alarmType != ''">and alarm_type = #{alarmType}</if>
<if test="deptId != null ">and dept_id = #{deptId}</if>
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ AND alarm_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ AND alarm_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
</where>
order by alarm_time desc
</select>
--
Gitblit v1.9.3