From a8fa8c5473d8bd4dc509d9f4b0bb370f443d15ad Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 07 十一月 2023 16:23:03 +0800
Subject: [PATCH] 清淤
---
ard-work/src/main/java/com/ruoyi/sy/param/AddCarParam.java | 12 ++
ard-work/src/main/java/com/ruoyi/sy/controller/OilWallController.java | 7 +
ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java | 4
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java | 14 +-
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdAccessFenceServiceImpl.java | 14 +
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 2
ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java | 29 +++-
ard-work/src/main/java/com/ruoyi/sy/gps31/PushClientImplPosition.java | 241 ++++++++++++++++++++++-----------------
ard-work/src/main/java/com/ruoyi/sy/domain/ArdAccessFence.java | 1
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 12 +-
10 files changed, 201 insertions(+), 135 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
index 314679f..a372488 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarController.java
@@ -108,7 +108,6 @@
}
};
carPositionTimer.scheduleAtFixedRate(carPositionTask,date,3*1000);//鍚敤
-
//杞﹁締瀹炴椂浣嶇疆绾跨▼
PushClientImplAlarm pushClientImplAlarm = new PushClientImplAlarm(ip,ardSyUserList.get(0).getUserId(),ardSyUserList.get(0).getPassword());
Thread pushClientImplAlarmThread = new Thread(pushClientImplAlarm);
@@ -343,6 +342,8 @@
return Results.succeed();
}else {
map.put("userId",ardSyUser.getUserId());
+ map.put("password",ardSyUser.getPassword());
+ map.put("passwords",DigestUtils.md5Hex(ardSyUser.getPassword()));
}
return Results.succeed(map);
}
@@ -371,7 +372,7 @@
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
String carId = map.get("carId");
String syURL = sysConfigService.getSYURL();
- return ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
+ return Results.succeed(ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser));
}
@PreAuthorize("@ss.hasPermi('sy:syCar:chaseCarByCarId')")
@@ -402,12 +403,11 @@
long tenSeconds = 1000L;
Date beforeTenSeconds = new Date(currentTime.getTime() - tenSeconds);
String startTime = sdf.format(beforeTenSeconds);
- System.out.println(startTime);
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
String syURL = sysConfigService.getSYURL();
String sessionId = ardSyCarService.getSessionId(syURL,ardSyUser);
- System.out.println(sessionId);
+ System.out.println("sessionId:"+sessionId);
//鑾峰彇鎽勫儚閫氶亾淇℃伅
Map<String, Object> result = ardSyCarService.getCarPicture(carId,syURL,sessionId);
String vs = "";
@@ -415,7 +415,7 @@
//鎻愬彇閫氶亾淇℃伅
Map<String,Object> map = ((List<Map<String,Object>>)result.get("list")).get(0);
Map<String, Object> videos = (Map<String, Object>) JSON.parse((String) map.get("videos"));
- System.out.println(videos);
+ System.out.println("閫氶亾锛�"+videos);
vs = (String) videos.get("vs");
} catch (Exception e) {
return AjaxResult.error("璇ヨ溅杈嗘病鏈夋憚鍍忛�氶亾鏃犵収鐗囨暟鎹紒");
@@ -428,10 +428,10 @@
}
//鎷嶇収
Map<String,Object> sendCmdMap = ardSyCarService.sendCmd(ardSyUser.getUserId(),syURL,sessionId,carId,channelList);
- System.out.println(sendCmdMap);
+ System.out.println("鎷嶇収锛�"+sendCmdMap);
//鑾峰彇鐓х墖
Map<String,Object> photoMap = ardSyCarService.getPhoto(syURL,carId,sessionId,startTime);
- System.out.println(photoMap);
+ System.out.println("鑾峰彇鐓х墖锛�"+photoMap);
return AjaxResult.success(photoMap);
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
index c73e34b..17d103d 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/controller/ArdSyCarLockController.java
@@ -8,6 +8,7 @@
import com.ruoyi.sy.domain.ArdSyCarRtu;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.mapper.ArdAccessFenceMapper;
+import com.ruoyi.sy.param.AddCarParam;
import com.ruoyi.sy.service.ArdAccessFenceService;
import com.ruoyi.sy.service.ArdSyCarLockService;
import com.ruoyi.sy.service.IArdSyCarService;
@@ -79,8 +80,7 @@
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
String syURL = sysConfigService.getSYURL();
- Results results = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
- Map<String,Object> map = (Map<String, Object>) results.getData();
+ Map<String,Object> map = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
List list1 = (List) map.get("list");
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
String carPlate = (String) jsonObject.get("carPlate");
@@ -116,8 +116,7 @@
String usersId = SecurityUtils.getUserId();
ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
String syURL = sysConfigService.getSYURL();
- Results results = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
- Map<String,Object> map = (Map<String, Object>) results.getData();
+ Map<String,Object> map = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
List list1 = (List) map.get("list");
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
String carPlate = (String) jsonObject.get("carPlate");
@@ -138,7 +137,8 @@
@GetMapping("/queryCar")
@ApiOperation("娓呮筏鎵嬪姩娣诲姞杞﹁締鏌ヨ")
public AjaxResult queryCar(){
- List<ArdAccessFence> ardAccessFences = ardAccessFenceService.all();
+ String url = sysConfigService.selectConfigByKey("minioIn")+"/";
+ List<ArdAccessFence> ardAccessFences = ardAccessFenceService.all(url);
List<String> carIdList = new ArrayList<>();
for (int i = 0; i < ardAccessFences.size(); i++) {
String carId = ardAccessFences.get(i).getCarId();
@@ -151,11 +151,19 @@
@PostMapping("/addCar")
@ApiOperation("娓呮筏鎵嬪姩娣诲姞杞﹁締淇濆瓨")
- public AjaxResult addCar(String carId){
- List<CarVo> list = ardSyCarLockService.addCarBefore(carId);
+ public AjaxResult addCar(@RequestBody AddCarParam addCarParam){
+ List<CarVo> list = ardSyCarLockService.addCarBefore(addCarParam.getCarId());
analysis(list);
if(list.size()>0){
- return AjaxResult.success(ardAccessFenceService.addCar(list.get(0)));
+ String usersId = SecurityUtils.getUserId();
+ ArdSyUser ardSyUser = iArdSyUserService.userById(usersId);
+ String syURL = sysConfigService.getSYURL();
+ Map<String, Object> map = ardSyCarService.getCarGPSBycarId(usersId,addCarParam.getCarId(),syURL,ardSyUser);
+ List list1 = (List) map.get("list");
+ JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
+ String lng = (String) jsonObject.get("lng");
+ String lat = (String) jsonObject.get("lat");
+ return AjaxResult.success(ardAccessFenceService.addCar(list.get(0),addCarParam.getIsAlarm(),lng,lat));
}
return AjaxResult.success();
}
@@ -166,7 +174,7 @@
return AjaxResult.success(ardAccessFenceService.delCar(id));
}
- @PutMapping("/addCar")
+ @PutMapping("/cleanAlarm")
@ApiOperation("娓呯┖鎶ヨ")
public AjaxResult updCarAlarm(String id){
return AjaxResult.success(ardAccessFenceService.updCarAlarm(id));
@@ -180,8 +188,7 @@
for (int i = 0; i < list.size(); i++) {
CarVo carVo = list.get(i);
String carId = carVo.getCarId();
- Results results = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
- Map<String,Object> map = (Map<String, Object>) results.getData();
+ Map<String,Object> map = ardSyCarService.getCarGPSBycarId(usersId,carId,syURL,ardSyUser);
List list1 = (List) map.get("list");
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(list1.get(0)));
String carPlate = (String) jsonObject.get("carPlate");
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 79ba2c3..987456f 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,6 +8,7 @@
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;
@@ -32,6 +33,9 @@
@Autowired
private ArdAccessNumService ardAccessNumService;
+
+ @Autowired
+ private ISysConfigService sysConfigService;
@PostMapping("/add")
@ApiOperation("娣诲姞鐢靛瓙鍥存爮")
@@ -86,7 +90,8 @@
@GetMapping("/wallCar")
@ApiOperation("鎵�鏈夎繘鍏ュ洿鏍忕殑杞﹁締")
public AjaxResult wallCar(){
- return AjaxResult.success(ardAccessFenceService.all());
+ String url = sysConfigService.selectConfigByKey("minioIn")+"/";
+ return AjaxResult.success(ardAccessFenceService.all(url));
}
@GetMapping("/rollTime")
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 bff2667..a87e44b 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
@@ -27,4 +27,5 @@
private String alarmLat;
private String carModel;
private String drct;
+ private Integer isAlarm;
}
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 bb6911b..0c01de8 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
@@ -131,129 +131,162 @@
}
}
}else {
- //濡傛灉杞﹁締鏈夋暟鎹垽鏂槸鍚︽湁杩涘叆鍥存爮ID锛屽鏋滄病鏈夋洿鏂版垨璧嬪�肩粡绾害锛屽垽鏂槸鍚﹁繘鍏ュ洿鏍�
- if(ardAccessFence.getIntoShipmentId()==null){
+ //鍒ゆ柇鏄惁涓烘墜鍔ㄦ坊鍔犺溅杈�
+ if(ardAccessFence.getIsAlarm()==0){
ardAccessFence.setLng(lng);
ardAccessFence.setLat(lat);
- 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 if(ardAccessFence.getIsAlarm() == 1){
+ ardAccessFence.setNowWallName(null);
+ //濡傛灉鍦ㄨ矾涓婂垽鏂潗鏍囨槸鍚︿笌涓婃涓�鏍�
+ 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;
+ ArdAccessNum list = ((ArdAccessNumServiceImpl) SpringUtils.getBean("ArdAccessNumServiceImpl")).queryNum();
+ if(list==null){
+ int alarm = list.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 {
- //濡傛灉鏈夎繘鍏ュ洿鏍廔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);
- ardAccessFence.setNowWallName(ardOilWall.getName());
- ardAccessFence.setLastTime(time);
- }
+ //濡傛灉杞﹁締鏈夋暟鎹垽鏂槸鍚︽湁杩涘叆鍥存爮ID锛屽鏋滄病鏈夋洿鏂版垨璧嬪�肩粡绾害锛屽垽鏂槸鍚﹁繘鍏ュ洿鏍�
+ if(ardAccessFence.getIntoShipmentId()==null){
ardAccessFence.setLng(lng);
ardAccessFence.setLat(lat);
- ((ArdAccessFenceServiceImpl) SpringUtils.getBean("ArdAccessFenceServiceImpl")).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> 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){
- ardAccessFence.setNowWallName(null);
- //濡傛灉鍦ㄨ矾涓婂垽鏂潗鏍囨槸鍚︿笌涓婃涓�鏍�
- 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;
- ArdAccessNum list = ((ArdAccessNumServiceImpl) SpringUtils.getBean("ArdAccessNumServiceImpl")).queryNum();
- if(list==null){
- int alarm = list.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 {
- //杞﹁締宸茬粡杩涘叆鍗告补鐐癸紝鍒ゆ柇鏄惁宸茬粡寮�鍑哄嵏娌圭偣
- 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);
- }else {
- //鏈紑鍑哄嵏娌圭偣锛屾洿鏂扮粡绾害淇濆瓨
- ardAccessFence.setLng(lng);
- ardAccessFence.setLat(lat);
+ //杞﹁締寮�鍑鸿娌圭偣
+ ardAccessFence.setOutShipmentId(into);
+ ardAccessFence.setOutShipmentTime(time);
+ ardAccessFence.setNowWallName(ardOilWall.getName());
ardAccessFence.setLastTime(time);
- ((ArdAccessFenceServiceImpl)SpringUtils.getBean("ArdAccessFenceServiceImpl")).updAccess(ardAccessFence);
+ }
+ 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){
+ ardAccessFence.setNowWallName(null);
+ //濡傛灉鍦ㄨ矾涓婂垽鏂潗鏍囨槸鍚︿笌涓婃涓�鏍�
+ 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;
+ ArdAccessNum list = ((ArdAccessNumServiceImpl) SpringUtils.getBean("ArdAccessNumServiceImpl")).queryNum();
+ if(list==null){
+ int alarm = list.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 {
+ //杞﹁締宸茬粡杩涘叆鍗告补鐐癸紝鍒ゆ柇鏄惁宸茬粡寮�鍑哄嵏娌圭偣
+ 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);
+ }
}
}
}
}
}
- //娓呮筏鍏ユ爮缁撴潫------------
+ //娓呮筏缁撴潫------------
gpsMap.putAll(result);
String ancestors = (String) gpsMap.get("ancestors");//鑾峰彇鐖剁骇閮ㄩ棬
diff --git a/ard-work/src/main/java/com/ruoyi/sy/param/AddCarParam.java b/ard-work/src/main/java/com/ruoyi/sy/param/AddCarParam.java
new file mode 100644
index 0000000..cc351d7
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/sy/param/AddCarParam.java
@@ -0,0 +1,12 @@
+package com.ruoyi.sy.param;
+
+import lombok.Data;
+
+/**
+ * @author Administrator
+ */
+@Data
+public class AddCarParam {
+ private String carId;
+ private Integer isAlarm;
+}
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
index b6c6024..1c919ea 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/ArdAccessFenceService.java
@@ -17,11 +17,11 @@
int delAccess(String carId);
- List<ArdAccessFence> all();
+ List<ArdAccessFence> all(String url);
int delCar(String id);
int updCarAlarm(String id);
- int addCar(CarVo carVo);
+ int addCar(CarVo carVo,Integer isAlarm,String lng,String lat);
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
index d8e9a5d..ff834a1 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -127,7 +127,7 @@
Results getCarGPSTrack(Map<String,String> map,String syURL, ArdSyUser ardSyUser);
- Results getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser);
+ Map<String, Object> getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser);
String getSessionId(String syURL,ArdSyUser ardSyUser);
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
index 54d03ed..da8ce6e 100644
--- 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
@@ -55,8 +55,13 @@
}
@Override
- public List<ArdAccessFence> all() {
- return ardAccessFenceMapper.selectList(null);
+ public List<ArdAccessFence> all(String url) {
+ List<ArdAccessFence> list = ardAccessFenceMapper.selectList(null);
+ for (int i = 0; i < list.size(); i++) {
+ ArdAccessFence ardAccessFence = list.get(i);
+ ardAccessFence.setCarModel(url+ardAccessFence.getCarModel());
+ }
+ return list;
}
@Override
@@ -72,7 +77,7 @@
}
@Override
- public int addCar(CarVo carVo) {
+ public int addCar(CarVo carVo,Integer isAlarm,String lng,String lat) {
ArdAccessFence ardAccessFence = new ArdAccessFence();
ardAccessFence.setId(String.valueOf(UUID.randomUUID()));
ardAccessFence.setCarId(carVo.getCarId());
@@ -81,6 +86,9 @@
ardAccessFence.setDeptName(carVo.getDeptName());
ardAccessFence.setCarModel(carVo.getCarModel());
ardAccessFence.setIsWarning(0);
+ ardAccessFence.setIsAlarm(isAlarm);
+ ardAccessFence.setLng(lng);
+ ardAccessFence.setLat(lat);
return ardAccessFenceMapper.insert(ardAccessFence);
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index 0cd276d..2efbc05 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -782,7 +782,7 @@
}
@Override
- public Results getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser) {
+ public Map<String, Object> getCarGPSBycarId(String usersId, String carId, String syURL, ArdSyUser ardSyUser) {
Map<String, String> result = logInMap.get(Integer.parseInt(usersId));
//31鐢ㄦ埛鍚嶅瘑鐮�
String username31 = ardSyUser.getUserId();
@@ -792,9 +792,7 @@
result = new HashMap();
result.put("userId", username31);
result.put("sessionId", (String) result1.get("sessionId"));
- Map<String, Object> result0 = new HashMap();
- result0 = sYClient.getCarNearPositionByCarId(syURL, carId, result.get("userId"), result.get("sessionId"));
- return Results.succeed(result0);
+ return sYClient.getCarNearPositionByCarId(syURL, carId, result.get("userId"), result.get("sessionId"));
}
@Override
@@ -822,7 +820,7 @@
params.put("action", "0");//涓婁紶妯″紡
String paramsStr = com.alibaba.fastjson2.JSON.toJSONString(params);
paramsStr = URLEncoder.encode(paramsStr,"UTF-8");
- System.out.println(paramsStr);
+ System.out.println("鎷嶇収鍙傛暟锛�"+paramsStr);
return sYClient.sendCmd(syURL,userId,carId,301,"MediaTake",paramsStr,sessionId);
// }
// return sendCmdMap;
@@ -831,7 +829,9 @@
@Override
public Map<String, Object> getPhoto(String syURL, String carId, String sessionId,String startTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
- return sYClient.getPhoto(syURL,carId,startTime,sdf.format(new Date()),sessionId);
+ String endTime = sdf.format(new Date());
+ System.out.println("寮�濮嬫椂闂达細"+startTime+" 缁撴潫鏃堕棿锛�"+endTime);
+ return sYClient.getPhoto(syURL,carId,startTime,endTime,sessionId);
}
@Override
--
Gitblit v1.9.3