From 2d10f00422f1c501f2cffec29fef1c6a8eba3a55 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期三, 31 一月 2024 13:57:44 +0800
Subject: [PATCH] 禁出电子围栏报警逻辑bug修改提交
---
ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java | 51 ++++++++++++++++++---------------------------------
1 files changed, 18 insertions(+), 33 deletions(-)
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 2a3b7ca..b6105ec 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
@@ -338,7 +338,7 @@
List<ArdWall> ardWallsNoIn = new ArrayList();//绂佸叆鐢靛瓙鍥存爮
List<ArdWall> ardWallsNoOut = new ArrayList();//绂佸嚭鐢靛瓙鍥存爮
ardWallsNoIn = ardWalls.stream().filter(ardWall -> ardWall.getType().equals("1")).collect(Collectors.toList());
- ardWallsNoOut = ardWalls.stream().filter(ardWall -> ardWall.getType().equals("0")).collect(Collectors.toList());
+ ardWallsNoOut = ardWalls.stream().filter(ardWall -> ardWall.getType().equals("2")).collect(Collectors.toList());
//褰撳墠鐢ㄦ埛鐨勪綅缃�
Point userPoint = new Point(ardAppPosition.getLongitude(), ardAppPosition.getLatitude());
if(ardWallsNoIn.size() > 0){//鍒ゆ柇绂佸叆
@@ -408,23 +408,13 @@
noOutFlag = true;
} else {
noOutFlag = false;
+ break;
}
}
}
if(noOutFlag){//鍏ㄩ儴绂佸嚭鐢靛瓙鍥存爮閮藉嚭鍘讳簡
for(ArdWall wall : ardWallsNoOut){
String wallId = wall.getId();//鍥存爮ID
- //String wallPoi = wall.getWallPoi();//鍥存爮鍧愭爣闆嗗悎
- //澶勭悊澶氳竟褰㈢殑姣忎釜鐐圭殑缁忕含搴�
- /*String[] parts = wallPoi.split(",");
- List<Point> pointList = new ArrayList<>();
- for (int i = 0; i < parts.length; i += 3) {
- Point point = new Point();
- point.setLongitude(Double.valueOf(parts[i]));
- point.setLatitude(Double.valueOf(parts[i + 1]));
- pointList.add(point);
- }
- boolean inPolygon = GisUtil.isInPolygon(userPoint, pointList);*///鍒ゆ柇鏄惁鍦ㄥ洿鏍忓唴
//鍒涘缓鍥存爮鎶ヨ瀹炰綋瀵硅薄
ArdAlarmWall ardAlarmWall = new ArdAlarmWall();
ardAlarmWall.setWallId(wall.getId());
@@ -436,27 +426,22 @@
ardAlarmWall.setLatitude(ardAppPosition.getLatitude());
ardAlarmWall.setAltitude(ardAppPosition.getAltitude());
String key = userId + "_" + wallId;//鏈�鍚庝竴娆℃姤璀︾紦瀛榢ey
- //if (!inPolygon) {
- //绂佸嚭鍥存爮鍒欒嫢鍦ㄥ洿鏍忓,鑾峰彇棣栨璧板嚭鍥存爮鎶ヨID
- String lastAlarmId = firstAlarmMap.get(key);
- //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁棣栨鍦ㄥ洿鏍忓
- if (lastAlarmId == null) {
- String uuid = IdUtils.simpleUUID();
- //褰撳墠鐢ㄦ埛棣栨鍑哄洿鏍忕敓鎴愭姤璀�
- ardAlarmWall.setId(uuid);
- ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
- //璁板綍棣栨鎶ヨid
- firstAlarmMap.put(key, uuid);
- } else {
- //鐢ㄦ埛宸茬粡鍦ㄥ洿鏍忓鏇存柊鎶ヨ
- ardAlarmWall.setId(lastAlarmId);
- ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
- }
- ardAlarmWalls.add(ardAlarmWall);
- /*} else {
- //绉婚櫎棣栨鎶ヨ缂撳瓨
- firstAlarmMap.remove(key);
- }*/
+ //绂佸嚭鍥存爮鍒欒嫢鍦ㄥ洿鏍忓,鑾峰彇棣栨璧板嚭鍥存爮鎶ヨID
+ String lastAlarmId = firstAlarmMap.get(key);
+ //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁棣栨鍦ㄥ洿鏍忓
+ if (lastAlarmId == null) {
+ String uuid = IdUtils.simpleUUID();
+ //褰撳墠鐢ㄦ埛棣栨鍑哄洿鏍忕敓鎴愭姤璀�
+ ardAlarmWall.setId(uuid);
+ ardAlarmWallService.insertArdAlarmWall(ardAlarmWall);
+ //璁板綍棣栨鎶ヨid
+ firstAlarmMap.put(key, uuid);
+ } else {
+ //鐢ㄦ埛宸茬粡鍦ㄥ洿鏍忓鏇存柊鎶ヨ
+ ardAlarmWall.setId(lastAlarmId);
+ ardAlarmWallService.updateArdAlarmWall(ardAlarmWall);
+ }
+ ardAlarmWalls.add(ardAlarmWall);
}
}else{
for(ArdWall wall : ardWallsNoOut){
--
Gitblit v1.9.3