From 0210a7678e3dc60279dd770e5d3071e5494c851d Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期一, 23 十月 2023 15:41:19 +0800
Subject: [PATCH] 围栏滚动数据
---
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdOilWallServiceImpl.java | 13 ++
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java | 15 ---
ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java | 18 ++++
ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java | 18 ++++
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdAccessFenceServiceImpl.java | 55 +++++++++++++
ard-work/src/main/java/com/ruoyi/sy/service/ArdOilWallService.java | 3
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 103 +++++++++++++++++++------
ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java | 2
ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java | 3
9 files changed, 185 insertions(+), 45 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 f69b2e9..2e34462 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
@@ -1,21 +1,29 @@
package com.ruoyi.sy.controller;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.UUID;
+import com.ruoyi.sy.domain.ArdAccessFence;
import com.ruoyi.sy.domain.ArdOilWall;
import com.ruoyi.sy.param.OilWallParam;
+import com.ruoyi.sy.service.ArdAccessFenceService;
import com.ruoyi.sy.service.ArdOilWallService;
import com.ruoyi.sy.domain.ArdSyCar;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.service.IArdSyCarService;
import com.ruoyi.sy.service.IArdSyUserService;
+import com.ruoyi.sy.service.impl.ArdAccessFenceServiceImpl;
+import com.ruoyi.sy.service.impl.ArdOilWallServiceImpl;
import com.ruoyi.system.service.ISysConfigService;
+import com.ruoyi.utils.gps.GeoTools;
import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -38,6 +46,9 @@
@Autowired
private ISysConfigService sysConfigService;
+
+ @Autowired
+ private ArdAccessFenceService ardAccessFenceService;
@PostMapping("/add")
@ApiOperation("娣诲姞鐢靛瓙鍥存爮")
@@ -91,5 +102,12 @@
return Results.succeed();
}
+ @GetMapping("/accessAll")
+ @ApiOperation("鏌ヨ鎵�鏈夌數瀛愬洿鏍�")
+ public Results accessAll(){
+ return Results.succeed(ardAccessFenceService.all());
+ }
+
+
}
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 c16c13e..6f0e30a 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
@@ -14,9 +14,8 @@
private String deptName;
private String lng;
private String lat;
- private String time;
private String intoShipment;
private String intoShipmentTime;
- private String intoUnload;
+ private String intoUnloadId;
private String intoUnloadTime;
}
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 20ea073..04f03c5 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
@@ -16,10 +16,7 @@
import com.ruoyi.sy.domain.ArdAccessFence;
import com.ruoyi.sy.domain.ArdOilWall;
import com.ruoyi.sy.domain.ArdSyCarLock;
-import com.ruoyi.sy.service.impl.ArdOilWallServiceImpl;
-import com.ruoyi.sy.service.impl.ArdSyCarDayServiceImpl;
-import com.ruoyi.sy.service.impl.ArdSyCarLockServiceImpl;
-import com.ruoyi.sy.service.impl.ArdSyCarServiceImpl;
+import com.ruoyi.sy.service.impl.*;
import com.ruoyi.utils.gps.GeoTools;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -81,42 +78,98 @@
String carId = (String)gpsMap.get("carId");
((ArdSyCarDayServiceImpl)SpringUtils.getBean("ardSyCarDayServiceImpl")).insertArdSyCarDay(carId);//鏂板杞﹁締涓婃姤鏃堕棿
Map<String,Object> result = ((ArdSyCarServiceImpl)SpringUtils.getBean("ardSyCarServiceImpl")).getArdSyCarAndDeptByCarId(carId);//鏌ヨ杞﹁締鍙婇儴闂�
-// log.error("---------------------"+result);
if(result != null){
- //娓呮筏瀹氫綅
+ //娓呮筏鍏ユ爮寮�濮�----------
String lng = (String) gpsMap.get("lng");//鑾峰彇缁忓害
String lat = (String) gpsMap.get("lat");//鑾峰彇绾害
String carName = (String) gpsMap.get("carName");//鑾峰彇杞︾墝鍙�
String time = (String) gpsMap.get("result");//瀹氫綅鏃堕棿
String deptNum = (String) result.get("deptId");//鑾峰彇閮ㄩ棬ID
String deptName = (String) result.get("deptName");//鑾峰彇閮ㄩ棬鍚嶇О
+// String carId = "13";
+// String lng = "124.74695492384757";
+// String lat = "46.09510768522894";
+// String carName = "榛慐21397";//鑾峰彇杞︾墝鍙�
+// String time = "20231019161815";//瀹氫綅鏃堕棿
+// String deptNum = "100";//鑾峰彇閮ㄩ棬ID
+// String deptName = "鍘傜骇";//鑾峰彇閮ㄩ棬鍚嶇О
//瀹氫箟2缁寸┖闂�
Point2D.Double point = new Point2D.Double(Double.parseDouble(lng), Double.parseDouble(lat));
List<Point2D.Double> pts = new ArrayList<Point2D.Double>();
- //鍖归厤鍏ㄩ儴鍥存爮
- List<ArdOilWall> ardOilWalls = ((ArdOilWallServiceImpl)SpringUtils.getBean("ArdOilWallServiceImpl")).all();
- 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])));
+ //鏌ヨ瀹氫綅娌硅溅琛ㄤ腑鏄惁鏈夎杞﹁締
+ ArdAccessFence ardAccessFence = ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).queryAccess(carId);
+ //濡傛灉娌℃湁璇存槑杞﹁締鏈繘鍏ヨ娌圭偣锛岄渶瑕佸尮閰嶆墍鏈夎娌圭偣鍥存爮
+ if(ardAccessFence==null){
+ //鍖归厤鍏ㄩ儴瑁呮补鐐瑰洿鏍�
+ List<ArdOilWall> ardOilWalls = ((ArdOilWallServiceImpl)SpringUtils.getBean("ArdOilWallServiceImpl")).accessAll();
+ 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 ardAccessFence1 = new ArdAccessFence();
+ ardAccessFence1.setId(String.valueOf(UUID.randomUUID()));
+ ardAccessFence1.setCarId(carId);
+ ardAccessFence1.setCarName(carName);
+ ardAccessFence1.setDeptId(deptNum);
+ ardAccessFence1.setDeptName(deptName);
+ ardAccessFence1.setIntoShipment("杩涘叆瑁呮补鐐�");
+ ardAccessFence1.setIntoShipmentTime(time);
+ ardAccessFence1.setLng(lng);
+ ardAccessFence1.setLat(lat);
+ ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).access(ardAccessFence1);
+ break;
+ }
}
- if(GeoTools.IsPtInPoly(point, pts)){
- //杩涘叆浜嗗洿鏍忓叆搴�
- ArdAccessFence ardAccessFence = new ArdAccessFence();
- ardAccessFence.setId(String.valueOf(UUID.randomUUID()));
- ardAccessFence.setCarId(carId);
- ardAccessFence.setCarName(carName);
- ardAccessFence.setDeptId(deptNum);
- ardAccessFence.setDeptName(deptName);
- ardAccessFence.setIntoShipment("杩涘叆瑁呮补鐐�");
- ardAccessFence.setIntoShipmentTime(time);
+ }else {
+ String unload = ardAccessFence.getIntoUnloadId();
+ //濡傛灉unload涓虹┖锛屽垽鏂槸鍚﹁繘鍏ュ嵏娌圭偣
+ if(unload==null){
+ //鏌ヨ鍏ㄩ儴鍗告补鐐�
+ List<ArdOilWall> ardOilWalls = ((ArdOilWallServiceImpl) SpringUtils.getBean("ArdOilWallServiceImpl")).uploadAll();
+ 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);
+ break;
+ }
+ }
ardAccessFence.setLng(lng);
ardAccessFence.setLat(lat);
- ((ArdSyCarLockServiceImpl)SpringUtils.getBean("ArdSyCarLockServiceImpl")).access(ardAccessFence);
+ ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }else {
+ //濡傛灉unload鏈夊�硷紝鍒欑户缁垽鏂槸鍚﹀嚭浜嗗嵏娌圭偣锛屽尮閰嶅嵏娌圭偣鐨勫敮涓�ID
+ 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);
+ ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }
}
+
}
+ //娓呮筏鍏ユ爮缁撴潫------------
+
gpsMap.putAll(result);
String ancestors = (String) gpsMap.get("ancestors");//鑾峰彇鐖剁骇閮ㄩ棬
String[] ancestorsArray = ancestors.split(",");
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java b/ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java
new file mode 100644
index 0000000..6291daf
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java
@@ -0,0 +1,18 @@
+package com.ruoyi.sy.service;
+
+import com.ruoyi.sy.domain.ArdAccessFence;
+
+import java.util.List;
+
+public interface ArdAccessFenceService {
+
+ int access(ArdAccessFence ardAccessFence);
+
+ ArdAccessFence queryAccess(String carId);
+
+ int updAccess(ArdAccessFence ardAccessFence);
+
+ int delAccess(String carId);
+
+ List<ArdAccessFence> all();
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/ArdOilWallService.java b/ard-work/src/main/java/com/ruoyi/sy/service/ArdOilWallService.java
index a68c36d..3b549c9 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/ArdOilWallService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/ArdOilWallService.java
@@ -15,5 +15,6 @@
int updOilWall(ArdOilWall ardOilWall);
ArdOilWall one(String id);
List<ArdOilWall> query(OilWallParam oilWallParam);
- List<ArdOilWall> all();
+ List<ArdOilWall> accessAll();
+ List<ArdOilWall> uploadAll();
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java b/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java
index ee2e272..a045f08 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/ArdSyCarLockService.java
@@ -34,5 +34,5 @@
RtuVo updRtu(String carId);
int updRtuCar(ArdSyCarRtu ardSyCarRtu);
- int access(ArdAccessFence ardAccessFence);
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdAccessFenceServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdAccessFenceServiceImpl.java
new file mode 100644
index 0000000..3c34866
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdAccessFenceServiceImpl.java
@@ -0,0 +1,55 @@
+package com.ruoyi.sy.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.sy.domain.ArdAccessFence;
+import com.ruoyi.sy.mapper.ArdAccessFenceMapper;
+import com.ruoyi.sy.service.ArdAccessFenceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ArdAccessFenceServiceImpl implements ArdAccessFenceService {
+
+ @Autowired
+ private ArdAccessFenceMapper ardAccessFenceMapper;
+
+ @Override
+ public int access(ArdAccessFence ardAccessFence) {
+ int num = 0;
+ String carId = ardAccessFence.getCarId();
+ QueryWrapper<ArdAccessFence> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("car_id",carId);
+ ArdAccessFence ardAccessFence1 = ardAccessFenceMapper.selectOne(queryWrapper);
+ if(ardAccessFence1==null){
+ num = ardAccessFenceMapper.insert(ardAccessFence);
+ }
+ return num;
+ }
+
+ @Override
+ public ArdAccessFence queryAccess(String carId) {
+ QueryWrapper<ArdAccessFence> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("car_id",carId);
+ return ardAccessFenceMapper.selectOne(queryWrapper);
+ }
+
+ @Override
+ public int updAccess(ArdAccessFence ardAccessFence) {
+ return ardAccessFenceMapper.updateById(ardAccessFence);
+ }
+
+ @Override
+ public int delAccess(String carId) {
+ QueryWrapper<ArdAccessFence> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("car_id",carId);
+ return ardAccessFenceMapper.delete(queryWrapper);
+ }
+
+ @Override
+ public List<ArdAccessFence> all() {
+ return ardAccessFenceMapper.selectList(null);
+ }
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdOilWallServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdOilWallServiceImpl.java
index 64e0b07..ff5e26a 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdOilWallServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdOilWallServiceImpl.java
@@ -48,7 +48,16 @@
}
@Override
- public List<ArdOilWall> all() {
- return ardOilWallMapper.selectList(null);
+ public List<ArdOilWall> accessAll() {
+ QueryWrapper<ArdOilWall> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("type","1");
+ return ardOilWallMapper.selectList(queryWrapper);
+ }
+
+ @Override
+ public List<ArdOilWall> uploadAll() {
+ QueryWrapper<ArdOilWall> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("type","2");
+ return ardOilWallMapper.selectList(queryWrapper);
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
index 7c1c0b2..631a1d0 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarLockServiceImpl.java
@@ -36,8 +36,7 @@
private ArdSyCarRtuMapper rtuMapper;
@Autowired
private ArdSyCarLockMapper lockMapper;
- @Autowired
- private ArdAccessFenceMapper ardAccessFenceMapper;
+
@Override
public List<CarVo> car() {
@@ -164,18 +163,6 @@
return ardSyCarMapper.updateById(ardSyCar);
}
- @Override
- public int access(ArdAccessFence ardAccessFence) {
- int num = 0;
- String carId = ardAccessFence.getCarId();
- QueryWrapper<ArdAccessFence> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("car_id",carId);
- ArdAccessFence ardAccessFence1 = ardAccessFenceMapper.selectOne(queryWrapper);
- if(ardAccessFence1==null){
- num = ardAccessFenceMapper.insert(ardAccessFence);
- }
- return num;
- }
public List<CarVo> carAnalysis(List<ArdSyCar> ardSyCars){
List<CarVo> list = new ArrayList<>();
--
Gitblit v1.9.3