From e42d5134188b4e93ebb0580ef60034976c987f0f Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 05 九月 2023 10:56:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/alarm/wall/service/impl/ArdAlarmWallServiceImpl.java | 1
ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java | 2
ard-work/src/main/resources/mapper/alarmpoints/ArdWallMapper.xml | 4 +
ard-work/src/main/java/com/ruoyi/alarm/wall/domain/ArdAlarmWall.java | 1
ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java | 2
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 3
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java | 35 ++++++-----
ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java | 95 ++++++++++++++++++++-----------
ard-work/src/main/resources/templates/preview.html | 12 ++-
9 files changed, 98 insertions(+), 57 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
index cf8633c..0af7c58 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
@@ -592,6 +592,7 @@
@Override
public Object updateAlarmViewTime(GlobalAlarmCondition condition) {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ SimpleDateFormat fmtms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
switch (condition.getCommand()) {
case 1001:
ArdAlarmStealelec ardAlarmStealelec = ardAlarmStealelecMapper.selectByPrimaryKey(condition.getId());
@@ -662,7 +663,7 @@
ArdAlarmWall ardAlarmWall = ardAlarmWallMapper.selectArdAlarmWallById(condition.getId());
if (StringUtils.isNotNull(ardAlarmWall)) {
String userId = ardAlarmWall.getUserId();
- String alarmTime = fmt.format(ardAlarmWall.getCreateTime());
+ String alarmTime = fmtms.format(ardAlarmWall.getAlarmTime());
ardAlarmWallMapper.updateViewTimeByUserId(userId, alarmTime, DateUtils.getTime());
return ardAlarmWall;
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/wall/domain/ArdAlarmWall.java b/ard-work/src/main/java/com/ruoyi/alarm/wall/domain/ArdAlarmWall.java
index af81600..31aa09d 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/wall/domain/ArdAlarmWall.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/wall/domain/ArdAlarmWall.java
@@ -6,6 +6,7 @@
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
/**
* 鐢靛瓙鍥存爮鎶ヨ瀵硅薄 ard_alarm_wall
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/wall/service/impl/ArdAlarmWallServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/wall/service/impl/ArdAlarmWallServiceImpl.java
index b229904..fd52b53 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/wall/service/impl/ArdAlarmWallServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/wall/service/impl/ArdAlarmWallServiceImpl.java
@@ -50,7 +50,6 @@
*/
@Override
public int insertArdAlarmWall(ArdAlarmWall ardAlarmWall) {
-
ardAlarmWall.setCreateBy(SecurityUtils.getUsername());
ardAlarmWall.setCreateTime(DateUtils.getNowDate());
return ardAlarmWallMapper.insertArdAlarmWall(ardAlarmWall);
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
index db67b30..614f958 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
@@ -21,6 +21,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -228,14 +229,15 @@
ArdWallMapper ardWallMapper;
@Resource
IArdAlarmWallService ardAlarmWallService;
- Map<String, String> userLastAlarm = new HashMap<>();
-
+ Map<String, String> userInLastAlarm = new HashMap<>();
+ Map<String, String> userOutLastAlarm = new HashMap<>();
/**
* 瀹炴椂浣嶇疆妫�娴嬪洿鏍忔姤璀�
* 鍒樿嫃涔�
* 2023/8/31 8:54:06
*/
public List<ArdAlarmWall> DetectionWallAlarm(ArdAppPosition ardAppPosition) {
+ SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<ArdAlarmWall> ardAlarmWalls=new ArrayList<>();
//鑾峰彇褰撳墠鐢ㄦ埛鐨勯儴闂�
String userId = ardAppPosition.getUserId();
@@ -248,6 +250,7 @@
if (ardWalls.size() > 0) {
for (ArdWall wall : ardWalls) {
String wallPoi = wall.getWallPoi();
+ String wallType = wall.getType();
//澶勭悊澶氳竟褰㈢殑姣忎釜鐐圭殑缁忕含搴�
String[] parts = wallPoi.split(",");
List<Point> pointList = new ArrayList<>();
@@ -257,42 +260,68 @@
point.setLatitude(Double.valueOf(parts[i + 1]));
pointList.add(point);
}
-
- //鍒ゆ柇褰撳墠鐢ㄦ埛浣嶇疆鏄惁鍦ㄥ洿鏍忓唴
- Point userPoint=new Point();
- userPoint.setLongitude(ardAppPosition.getLongitude());
- userPoint.setLatitude(ardAppPosition.getLatitude());
+ Point userPoint=new Point(ardAppPosition.getLongitude(),ardAppPosition.getLatitude());
boolean inPolygon = GisUtil.isInPolygon(userPoint, pointList);
- if (inPolygon) {
- String lastAlarmId = userLastAlarm.get(userId);
- ArdAlarmWall ardAlarmWall = new ArdAlarmWall();
- ardAlarmWall.setWallId(wall.getId());
- ardAlarmWall.setWallName(wall.getWallName());
- ardAlarmWall.setUserId(userId);
- ardAlarmWall.setAlarmTime(new Date());
- ardAlarmWall.setAlarmType(wall.getType());
- ardAlarmWall.setLongitude(ardAppPosition.getLongitude());
- ardAlarmWall.setLatitude(ardAppPosition.getLatitude());
- ardAlarmWall.setAltitude(ardAppPosition.getAltitude());
- if (lastAlarmId == null) {
- String uuid = IdUtils.simpleUUID();
- // 褰撳墠鐢ㄦ埛涓婁竴娆$姸鎬佹湭杩涘叆锛岀敓鎴愭姤璀�
- ardAlarmWall.setId(uuid);
- ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
- //鏇存柊鏈�鍚庢姤璀d
- userLastAlarm.put(userId, uuid);
- } else {
- // 涓婁竴娆$敤鎴风姸鎬佸凡杩涘叆锛屾洿鏂版渶鍚庢姤璀�
- ardAlarmWall.setId(lastAlarmId);
- ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ ArdAlarmWall ardAlarmWall = new ArdAlarmWall();
+ ardAlarmWall.setWallId(wall.getId());
+ ardAlarmWall.setWallName(wall.getWallName());
+ ardAlarmWall.setUserId(userId);
+ ardAlarmWall.setAlarmTime(DateUtils.getNowDate());
+ ardAlarmWall.setAlarmType(wall.getType());
+ ardAlarmWall.setLongitude(ardAppPosition.getLongitude());
+ ardAlarmWall.setLatitude(ardAppPosition.getLatitude());
+ ardAlarmWall.setAltitude(ardAppPosition.getAltitude());
+ //绂佸叆
+ if("1".equals(wallType)) {
+ //鍒ゆ柇褰撳墠鐢ㄦ埛浣嶇疆鏄惁鍦ㄥ洿鏍忓唴
+ if (inPolygon) {
+ String lastInAlarmId = userInLastAlarm.get(userId);
+ if (lastInAlarmId == null) {
+ String uuid = IdUtils.simpleUUID();
+ //褰撳墠鐢ㄦ埛涓婁竴娆$姸鎬佹湭杩涘叆锛岀敓鎴愭姤璀�
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //鏇存柊鏈�鍚庢姤璀d
+ userInLastAlarm.put(userId, uuid);
+ } else {
+ //涓婁竴娆$敤鎴风姸鎬佸凡杩涘叆锛屾洿鏂版渶鍚庢姤璀�
+ ardAlarmWall.setId(lastInAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
}
- ardAlarmWalls.add(ardAlarmWall);
+ else
+ {
+ //绉婚櫎鏈�鍚庢姤璀d
+ userInLastAlarm.remove(userId);
+ }
}
- else
+ else//绂佸嚭
{
- //绉婚櫎鏈�鍚庢姤璀d
- userLastAlarm.remove(userId);
+ //鍒ゆ柇褰撳墠鐢ㄦ埛浣嶇疆鏄惁鍦ㄥ洿鏍忓
+ if (!inPolygon) {
+ String lastAlarmId = userOutLastAlarm.get(userId);
+ if (lastAlarmId == null) {
+ String uuid = IdUtils.simpleUUID();
+ //褰撳墠鐢ㄦ埛涓婁竴娆$姸鎬佹湭杩涘叆锛岀敓鎴愭姤璀�
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //鏇存柊鏈�鍚庢姤璀d
+ userOutLastAlarm.put(userId, uuid);
+ } else {
+ //涓婁竴娆$敤鎴风姸鎬佸凡杩涘叆锛屾洿鏂版渶鍚庢姤璀�
+ ardAlarmWall.setId(lastAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
+ }
+ else
+ {
+ //绉婚櫎鏈�鍚庢姤璀d
+ userOutLastAlarm.remove(userId);
+ }
}
+
}
}
return ardAlarmWalls;
diff --git a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
index e91ca81..411a27f 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
@@ -101,7 +101,7 @@
@ApiOperation("绉婚櫎鎷夋祦")
@ApiOperationSupport(order =4 )
@PreAuthorize("@ss.hasPermi('media:stream:remove')")
- @DeleteMapping("/{id}")
+ @DeleteMapping("/{sessionId}")
public AjaxResult removePullStreamSession(@PathVariable String sessionId) {
List<StreamInfo> pullStreamList = mediaService.getPullStreamList();
StreamInfo streamInfo = pullStreamList.stream()
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
index c7cdcc4..bd0b588 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
@@ -11,6 +11,9 @@
import com.sun.jna.Platform;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@@ -33,7 +36,8 @@
**/
@Service
@Slf4j(topic = "cmd")
-public class MediaServiceImpl implements IMediaService {
+@Order(1)
+public class MediaServiceImpl implements IMediaService, ApplicationRunner {
@Resource
VtduMapper vtduMapper;
@Resource
@@ -47,12 +51,24 @@
String processName = "mediamtx.exe";
- static{
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+ log.info("寮�濮嬪姞杞芥祦濯掍綋鍒楄〃");
+ List<StreamInfo> paths = paths();
+ for(StreamInfo path:paths)
+ {
+ mediaClient.removePath(path.getName());
+ }
+ List<Vtdu> vtduList = vtduMapper.selectVtduList(new Vtdu());
+ for (Vtdu v : vtduList) {
+ addPath(v.getName(), v.getRtspUrl(), v.getCodeType(), v.getIsCode());
+ }
}
@PostConstruct
public void initMediaMtx() {
if (mediamtxEnabled) {
+ log.info("鍒濆鍖栧惎鍔╩ediaMTX");
if (Platform.isWindows()) {
String exePath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "mediamtx" + File.separator + "mediamtx.exe";
String ymlPath = System.getProperty("user.dir") + File.separator + "lib" + File.separator + "mediamtx" + File.separator + "mediamtx.yml";
@@ -70,20 +86,6 @@
// String[] command = {"cmd","/c","start",exePath,ymlPath};
// CmdUtils.commandStart(command);
}
- }
- try {
- Thread.sleep(2000); // 绛夊緟5绉�
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- List<StreamInfo> paths = paths();
- for(StreamInfo path:paths)
- {
- mediaClient.removePath(path.getName());
- }
- List<Vtdu> vtduList = vtduMapper.selectVtduList(new Vtdu());
- for (Vtdu v : vtduList) {
- addPath(v.getName(), v.getRtspUrl(), v.getCodeType(), v.getIsCode());
}
}
@@ -456,4 +458,5 @@
return false;
}
}
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java
index 00f5496..80d69ed 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/mqtt/MqttConsumer.java
@@ -6,6 +6,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
+import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.io.UnsupportedEncodingException;
/**
@@ -17,6 +18,7 @@
**/
@Component
@Slf4j(topic = "mqtt")
+@Order(2)
public class MqttConsumer implements ApplicationRunner {
@Value("${mqtt.enabled}")
diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdWallMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdWallMapper.xml
index da756a4..813c2d8 100644
--- a/ard-work/src/main/resources/mapper/alarmpoints/ArdWallMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdWallMapper.xml
@@ -42,8 +42,10 @@
<if test="wallPoi != null and wallPoi != ''"> and wall_poi = #{wallPoi}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="color != null and color != ''"> and color = #{color}</if>
- <if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
+ <if test="deptId != null ">and (dept_id = #{deptId} OR dept_id IN ( SELECT t.dept_id FROM sys_dept t
+ WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
+ </if>
</where>
</select>
diff --git a/ard-work/src/main/resources/templates/preview.html b/ard-work/src/main/resources/templates/preview.html
index 381edb7..9845351 100644
--- a/ard-work/src/main/resources/templates/preview.html
+++ b/ard-work/src/main/resources/templates/preview.html
@@ -151,11 +151,15 @@
var chanMap = new Map();
window.onload = function () {
changeGrid(2, 2);
- chanMap.set("video1", "http://127.0.0.1:8889/245/");
- chanMap.set("video2", "http://127.0.0.1:8889/164/");
- chanMap.set("video3", "http://127.0.0.1:8889/164/");
- chanMap.set("video4", "http://127.0.0.1:8889/165/");
+ chanMap.set("video1", "http://127.0.0.1:8889/164/");
+ chanMap.set("video2", "http://127.0.0.1:8889/165/");
+ chanMap.set("video3", "http://127.0.0.1:8889/245/");
+ chanMap.set("video4", "http://127.0.0.1:8889/164/");
chanMap.set("video5", "http://127.0.0.1:8889/165/");
+ chanMap.set("video6", "http://127.0.0.1:8889/245/");
+ chanMap.set("video7", "http://127.0.0.1:8889/164/");
+ chanMap.set("video8", "http://127.0.0.1:8889/165/");
+ chanMap.set("video9", "http://127.0.0.1:8889/245/");
console.log(chanMap);
}
const linkToIceServers = (links) => (
--
Gitblit v1.9.3