From 9dbd1b03adca3920a249b9079153d5f53d01a47d Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期三, 01 十一月 2023 15:25:03 +0800
Subject: [PATCH] 清淤数据逻辑
---
ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessNum.java | 6
ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java | 2
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 172 ++++++++++++++++++++++++++++---------------
ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java | 5 +
4 files changed, 119 insertions(+), 66 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java
index 99ecd6d..56f7333 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java
@@ -8,7 +8,6 @@
import com.ruoyi.sy.domain.*;
import com.ruoyi.sy.param.OilWallParam;
import com.ruoyi.sy.service.*;
-import com.ruoyi.system.service.ISysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -101,6 +100,5 @@
public AjaxResult updTime(@RequestBody ArdAccessNum ardAccessNum){
return AjaxResult.success(ardAccessNumService.add(ardAccessNum));
}
-
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java
index 2f25e20..4615aa5 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java
@@ -20,6 +20,9 @@
private String intoUnloadTime;
private String outShipmentId;
private String outShipmentTime;
+ private String lastTime;
private String isWarning;
- private String isDel;
+ private String nowWallName;
+ private String alarmLng;
+ private String alarmLat;
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessNum.java b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessNum.java
index 71d8a81..e266ef9 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessNum.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessNum.java
@@ -7,7 +7,7 @@
*/
@Data
public class ArdAccessNum {
- private String id;
- private String name;
- private String num;
+ private int carousel;
+ private int call;
+ private int alarm;
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
index 0e4fbcf..71b2c3e 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java
@@ -14,6 +14,7 @@
import com.gps31.push.util.MapUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.sy.domain.ArdAccessFence;
+import com.ruoyi.sy.domain.ArdAccessNum;
import com.ruoyi.sy.domain.ArdOilWall;
import com.ruoyi.sy.domain.ArdSyCarLock;
import com.ruoyi.sy.service.ArdAccessFenceService;
@@ -24,6 +25,7 @@
import org.apache.commons.logging.LogFactory;
import java.awt.geom.Point2D;
+import java.text.SimpleDateFormat;
import java.util.*;
/**
@@ -93,10 +95,11 @@
List<Point2D.Double> pts = new ArrayList<Point2D.Double>();
//鏌ヨ瀹氫綅娌硅溅琛ㄤ腑鏄惁鏈夎杞﹁締
ArdAccessFence ardAccessFence = SpringUtils.getBean(ArdAccessFenceService.class).queryAccess(carId);
+ //鏌ヨ鎵�鏈夎娌圭偣鍥存爮
+ List<ArdOilWall> ardOilWalls = SpringUtils.getBean(ArdOilWallService.class).accessAll();
//濡傛灉娌℃湁璇存槑杞﹁締鏈繘鍏ヨ娌圭偣锛岄渶瑕佸尮閰嶆墍鏈夎娌圭偣鍥存爮
if(ardAccessFence==null){
//杞﹁締鏈繘鍏ヨ娌圭偣
- List<ArdOilWall> ardOilWalls = SpringUtils.getBean(ArdOilWallService.class).accessAll();
for (int i = 0; i < ardOilWalls.size(); i++) {
pts.clear();
ArdOilWall ardOilWall = ardOilWalls.get(i);
@@ -116,81 +119,130 @@
ardAccessFence1.setIntoShipmentTime(time);
ardAccessFence1.setLng(lng);
ardAccessFence1.setLat(lat);
+ ardAccessFence1.setLastTime(time);
+ ardAccessFence1.setNowWallName(ardOilWall.getName());
((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).access(ardAccessFence1);
break;
}
}
}else {
//濡傛灉杞﹁締鏈夋暟鎹垽鏂槸鍚︽湁杩涘叆鍥存爮ID锛屽鏋滄病鏈夋洿鏂版垨璧嬪�肩粡绾害锛屽垽鏂槸鍚﹁繘鍏ュ洿鏍�
-
- //濡傛灉鏈夎繘鍏ュ洿鏍廔D锛屽垽鏂槸鍚﹀紑鍑鸿娌圭偣
- String out = ardAccessFence.getOutShipmentId();
- if(out == null){
- //杞﹁締鏈紑鍑鸿娌圭偣
- String into = ardAccessFence.getIntoShipmentId();
- ArdOilWall ardOilWall = SpringUtils.getBean(ArdOilWallService.class).one(into);
- pts.clear();
- String[] coord = ardOilWall.getCoord().split(",");
- for (int j = 0; j < coord.length; j = j + 3) {
- pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j + 1])));
- }
- if (!GeoTools.IsPtInPoly(point, pts)) {
- //杞﹁締寮�鍑鸿娌圭偣
- ardAccessFence.setOutShipmentId(into);
- ardAccessFence.setOutShipmentTime(time);
- }
+ if(ardAccessFence.getIntoShipmentId()==null){
ardAccessFence.setLng(lng);
ardAccessFence.setLat(lat);
- SpringUtils.getBean(ArdAccessFenceService.class).updAccess(ardAccessFence);
+ for (int i = 0; i < ardOilWalls.size(); i++) {
+ pts.clear();
+ ArdOilWall ardOilWall = ardOilWalls.get(i);
+ String[] coord = ardOilWall.getCoord().split(",");
+ for (int j = 0; j < coord.length; j = j + 3) {
+ pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j+1])));
+ }
+ if(GeoTools.IsPtInPoly(point, pts)){
+ //杩涘叆瑁呮补鐐瑰叆搴�
+ ardAccessFence.setIntoShipmentId(ardOilWall.getId());
+ ardAccessFence.setIntoShipmentTime(time);
+ ardAccessFence.setNowWallName(ardOilWall.getName());
+ ardAccessFence.setLastTime(time);
+ break;
+ }
+ }
+ ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
}else {
- //杞﹁締宸茬粡寮�鍑鸿娌圭偣锛屽垽鏂槸鍚﹁繘鍏ュ嵏娌圭偣
- String unload = ardAccessFence.getIntoUnloadId();
- //濡傛灉unload涓虹┖锛屽垽鏂槸鍚﹁繘鍏ュ嵏娌圭偣
- if (unload == null) {
- //杞﹁締鏈繘鍏ュ嵏娌圭偣
- List<ArdOilWall> ardOilWalls = SpringUtils.getBean(ArdOilWallService.class).uploadAll();
- //鏄惁鍦ㄨ矾涓�
- Boolean isRoad = true;
- for (int i = 0; i < ardOilWalls.size(); i++) {
- pts.clear();
- ArdOilWall ardOilWall = ardOilWalls.get(i);
- String[] coord = ardOilWall.getCoord().split(",");
- for (int j = 0; j < coord.length; j = j + 3) {
- pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j + 1])));
- }
- if (GeoTools.IsPtInPoly(point, pts)) {
- //杩涘叆鍗告补鐐�,瀛樺叆鍗告补鐐瑰洿鏍廔D
- ardAccessFence.setIntoUnloadId(ardOilWall.getId());
- ardAccessFence.setIntoUnloadTime(time);
- ardAccessFence.setLng(lng);
- ardAccessFence.setLat(lat);
- ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
- //宸茬粡杩涘叆鍗告补鐐癸紝涓嶅湪璺笂涓嶉渶瑕佸仠杞︽姤璀�
- isRoad = false;
- break;
- }
- }
- if(isRoad){
- //濡傛灉鍦ㄨ矾涓婇渶瑕佽褰曟瘡娆″潗鏍囦笌涓婃鏄惁鐩稿悓锛屽鏋滀竴鏍锋洿鏂板仠鐣欐椂闂�
-
-
- }
- }else {
- //杞﹁締宸茬粡杩涘叆鍗告补鐐癸紝鍒ゆ柇鏄惁宸茬粡寮�鍑哄嵏娌圭偣
- ArdOilWall ardOilWall = ((ArdOilWallServiceImpl) SpringUtils.getBean("ArdOilWallServiceImpl")).one(unload);
+ //濡傛灉鏈夎繘鍏ュ洿鏍廔D锛屽垽鏂槸鍚﹀紑鍑鸿娌圭偣
+ String out = ardAccessFence.getOutShipmentId();
+ if(out == null){
+ //杞﹁締鏈紑鍑鸿娌圭偣
+ String into = ardAccessFence.getIntoShipmentId();
+ ArdOilWall ardOilWall = SpringUtils.getBean(ArdOilWallService.class).one(into);
pts.clear();
String[] coord = ardOilWall.getCoord().split(",");
for (int j = 0; j < coord.length; j = j + 3) {
pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j + 1])));
}
if (!GeoTools.IsPtInPoly(point, pts)) {
- //寮�鍑轰簡鍗告补鐐瑰洿鏍忥紝鍒犻櫎璇ユ潯杞﹁締鏁版嵁
- ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).delAccess(carId);
+ //杞﹁締寮�鍑鸿娌圭偣
+ ardAccessFence.setOutShipmentId(into);
+ ardAccessFence.setOutShipmentTime(time);
+ ardAccessFence.setNowWallName(ardOilWall.getName());
+ ardAccessFence.setLastTime(time);
+ }
+ ardAccessFence.setLng(lng);
+ ardAccessFence.setLat(lat);
+ ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }else {
+ //杞﹁締宸茬粡寮�鍑鸿娌圭偣锛屽垽鏂槸鍚﹁繘鍏ュ嵏娌圭偣
+ String unload = ardAccessFence.getIntoUnloadId();
+ //濡傛灉unload涓虹┖锛屽垽鏂槸鍚﹁繘鍏ュ嵏娌圭偣
+ if (unload == null) {
+ //杞﹁締鏈繘鍏ュ嵏娌圭偣
+ List<ArdOilWall> ardOilWallUpload = SpringUtils.getBean(ArdOilWallService.class).uploadAll();
+ //鏄惁鍦ㄨ矾涓�
+ Boolean isRoad = true;
+ for (int i = 0; i < ardOilWallUpload.size(); i++) {
+ pts.clear();
+ ArdOilWall ardOilWall = ardOilWallUpload.get(i);
+ String[] coord = ardOilWall.getCoord().split(",");
+ for (int j = 0; j < coord.length; j = j + 3) {
+ pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j + 1])));
+ }
+ if (GeoTools.IsPtInPoly(point, pts)) {
+ //杩涘叆鍗告补鐐�,瀛樺叆鍗告补鐐瑰洿鏍廔D
+ ardAccessFence.setIntoUnloadId(ardOilWall.getId());
+ ardAccessFence.setIntoUnloadTime(time);
+ ardAccessFence.setLng(lng);
+ ardAccessFence.setLat(lat);
+ ardAccessFence.setNowWallName(ardOilWall.getName());
+ ardAccessFence.setLastTime(time);
+ ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ //宸茬粡杩涘叆鍗告补鐐癸紝涓嶅湪璺笂涓嶉渶瑕佸仠杞︽姤璀�
+ isRoad = false;
+ break;
+ }
+ }
+ if(isRoad){
+ //濡傛灉鍦ㄨ矾涓婂垽鏂潗鏍囨槸鍚︿笌涓婃涓�鏍�
+ if(ardAccessFence.getLng().equals(lng) && ardAccessFence.getLat().equals(lat)){
+ //濡傛灉鍧愭爣涓�鏍锋椂闂寸浉鍑�
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Date nowTime = sdf.parse(time);
+ Date lastTime = sdf.parse(ardAccessFence.getLastTime());
+ Long diff = (nowTime.getTime() - lastTime.getTime())/1000;
+ List<ArdAccessNum> list = ((ArdAccessNumServiceImpl) SpringUtils.getBean("ArdAccessNumServiceImpl")).queryNum();
+ if(list.size()>0){
+ int alarm = list.get(0).getAlarm();
+ if(diff>=alarm){
+ ardAccessFence.setIsWarning("1");
+ ardAccessFence.setAlarmLat(lat);
+ ardAccessFence.setAlarmLng(lng);
+ ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }
+ }
+ }else {
+ //濡傛灉涓嶄竴鏍锋洿鏂板潗鏍�
+ ardAccessFence.setLat(lat);
+ ardAccessFence.setLng(lng);
+ ardAccessFence.setLastTime(time);
+ ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }
+ }
}else {
- //鏈紑鍑哄嵏娌圭偣锛屾洿鏂扮粡绾害淇濆瓨
- ardAccessFence.setLng(lng);
- ardAccessFence.setLat(lat);
- ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ //杞﹁締宸茬粡杩涘叆鍗告补鐐癸紝鍒ゆ柇鏄惁宸茬粡寮�鍑哄嵏娌圭偣
+ ArdOilWall ardOilWall = ((ArdOilWallServiceImpl) SpringUtils.getBean("ArdOilWallServiceImpl")).one(unload);
+ pts.clear();
+ String[] coord = ardOilWall.getCoord().split(",");
+ for (int j = 0; j < coord.length; j = j + 3) {
+ pts.add(new Point2D.Double(Double.parseDouble(coord[j]), Double.parseDouble(coord[j + 1])));
+ }
+ if (!GeoTools.IsPtInPoly(point, pts)) {
+ //寮�鍑轰簡鍗告补鐐瑰洿鏍忥紝鍒犻櫎璇ユ潯杞﹁締鏁版嵁
+ ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).delAccess(carId);
+ }else {
+ //鏈紑鍑哄嵏娌圭偣锛屾洿鏂扮粡绾害淇濆瓨
+ ardAccessFence.setLng(lng);
+ ardAccessFence.setLat(lat);
+ ardAccessFence.setLastTime(time);
+ ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }
}
}
}
--
Gitblit v1.9.3