From 0abccf5e570dce53a802bca4ce25118dd900692c Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 23 二月 2024 14:07:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 29 +
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 16
ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java | 65 --
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 262 ++++++++++
ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java | 184 +++++++
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java | 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 1
ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java | 159 ++----
ard-work/src/main/java/com/ruoyi/app/position/mapper/ArdAppPositionMapper.java | 5
ard-work/src/main/resources/mapper/app/ArdAppPositionMapper.xml | 12
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 85 +++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 4
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml | 40 +
ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java | 3
ard-work/src/main/java/com/ruoyi/app/position/appcontainer/AppContainer.java | 19
ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java | 2
ard-work/pom.xml | 9
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 10
ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java | 14
ruoyi-admin/src/main/resources/application-prod.yml | 11
ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java | 9
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java | 4
ard-work/src/main/java/com/ruoyi/device/uav/websocketclient/UAVWebsocketClient.java | 45 +
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java | 386 ++++++++++++++++
ruoyi-admin/src/main/resources/application-dev.yml | 36 +
25 files changed, 1,227 insertions(+), 187 deletions(-)
diff --git a/ard-work/pom.xml b/ard-work/pom.xml
index 8a51372..d7e3021 100644
--- a/ard-work/pom.xml
+++ b/ard-work/pom.xml
@@ -196,7 +196,14 @@
<artifactId>orai18n</artifactId>
<version>12.1.0.2.0</version>
</dependency>
-<!-- <dependency>-->
+ <!-- WebSocket瀹㈡埛绔� -->
+ <dependency>
+ <groupId>org.java-websocket</groupId>
+ <artifactId>Java-WebSocket</artifactId>
+ <version>1.3.8</version>
+ </dependency>
+
+ <!-- <dependency>-->
<!-- <groupId>com.alibaba</groupId>-->
<!-- <artifactId>druid</artifactId>-->
<!-- <version>1.2.15</version>-->
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
index 8925dfe..8a8c4ba 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -248,4 +248,20 @@
return AjaxResult.success(result);
}
+ @GetMapping("/getWellDataByPatrolplanIdAndPosition")
+ @ApiOperation("鏌ヨ鏈�杩戝贰妫�璁惧鍔ㄩ潤鎬佸睘鎬�")
+ public AjaxResult getWellDataByPatrolplanIdAndPosition(@RequestBody Map<String,Object> para){
+ SysConfig config = new SysConfig();
+ config.setConfigKey("3coracle");
+ List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config);
+ Map<String,Object> result = ardAlarmpointsWellService.getWellDataByPatrolplanIdAndPosition(para,sysConfigResult);
+ return AjaxResult.success(result);
+ }
+
+ @GetMapping("/getWellById")
+ @ApiOperation("鏍规嵁鏌ヨ鍏磋叮鐐瑰熀鏈睘鎬�")
+ public AjaxResult getWellById(@RequestBody Map<String,String> para){
+ ArdAlarmpointsWell result = ardAlarmpointsWellService.getWellById(para.get("id"));
+ return AjaxResult.success(result);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
index b6f8a26..b2e992b 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
@@ -7,6 +7,7 @@
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
import com.ruoyi.common.annotation.DataScope;
+import org.apache.ibatis.annotations.Param;
/**
@@ -101,6 +102,9 @@
List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList);
+ ArdAlarmpointsWell getWellDataByPatrolplanIdAndPosition(@Param("patrolplanId") String patrolplanId,@Param("longitude") Double longitude,@Param("latitude") Double latitude);
+
+ ArdAlarmpointsWell getWellById(String id);
List<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam);
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index 8c539e3..62c34fe 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -137,4 +137,8 @@
* 鏌ヨ娌逛簳鍔ㄩ潤鎬佹暟鎹�
*/
Map<String,Object> getWellDataByWellId(String wellId, List<SysConfig> config);
+
+ Map<String,Object> getWellDataByPatrolplanIdAndPosition(Map<String,Object> para,List<SysConfig> sysConfigResult);
+
+ ArdAlarmpointsWell getWellById(String id);
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index e6cc1d2..00fefb1 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -1,5 +1,6 @@
package com.ruoyi.alarmpoints.well.service.impl;
+import java.math.BigDecimal;
import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
@@ -575,6 +576,267 @@
return result;
}
+ @Override
+ public Map<String, Object> getWellDataByPatrolplanIdAndPosition(Map<String, Object> para, List<SysConfig> config) {
+ String patrolplanId = (String) para.get("patrolplanId");
+ Double longitude = null;
+ Double latitude = null;
+ try{
+ longitude = (Double) para.get("longitude");
+ latitude = (Double) para.get("latitude");
+ } catch (Exception e){
+ longitude = ((BigDecimal) para.get("longitude")).doubleValue();
+ latitude = ((BigDecimal) para.get("latitude")).doubleValue();
+ }
+ ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.getWellDataByPatrolplanIdAndPosition(patrolplanId,longitude,latitude);
+ if(ardAlarmpointsWell != null){
+ Map<String, Object> result = new HashMap();
+ if (ardAlarmpointsWell.getWellId() != null) {
+ result.put("wellId", ardAlarmpointsWell.getWellId());
+ } else {
+ result.put("wellId", "");
+ }
+ if (ardAlarmpointsWell.getWellNumber() != null) {
+ result.put("wellNumber", ardAlarmpointsWell.getWellNumber());
+ } else {
+ result.put("wellNumber", "");
+ }
+ if (ardAlarmpointsWell.getOilProduction() != null) {
+ result.put("oilProduction", ardAlarmpointsWell.getOilProduction());
+ } else {
+ result.put("oilProduction", "");
+ }
+ if (ardAlarmpointsWell.getWellBlock() != null) {
+ result.put("wellBlock", ardAlarmpointsWell.getWellBlock());
+ } else {
+ result.put("wellBlock", "");
+ }
+ if (ardAlarmpointsWell.getProductionDate() != null) {
+ result.put("productionDate", ardAlarmpointsWell.getProductionDate());
+ } else {
+ result.put("productionDate", "");
+ }
+ if (ardAlarmpointsWell.getDisplacementMode() != null) {
+ result.put("displacementMode", ardAlarmpointsWell.getDisplacementMode());
+ } else {
+ result.put("displacementMode", "");
+ }
+ if (ardAlarmpointsWell.getSurroundingEnvironment() != null) {
+ result.put("surroundingEnvironment", ardAlarmpointsWell.getSurroundingEnvironment());
+ } else {
+ result.put("surroundingEnvironment", "");
+ }
+ if (ardAlarmpointsWell.getWellType() != null) {
+ result.put("wellType", ardAlarmpointsWell.getWellType());
+ } else {
+ result.put("wellType", "");
+ }
+ if (ardAlarmpointsWell.getInstalledLoad() != null) {
+ result.put("installedLoad", ardAlarmpointsWell.getInstalledLoad());
+ } else {
+ result.put("installedLoad", "");
+ }
+ if (ardAlarmpointsWell.getMeteringStation() != null) {
+ result.put("meteringStation", ardAlarmpointsWell.getMeteringStation());
+ } else {
+ result.put("meteringStation", "");
+ }
+ if (ardAlarmpointsWell.getTransferStation() != null) {
+ result.put("transferStation", ardAlarmpointsWell.getTransferStation());
+ } else {
+ result.put("transferStation", "");
+ }
+ if (ardAlarmpointsWell.getDehydrationStation() != null) {
+ result.put("dehydrationStation", ardAlarmpointsWell.getDehydrationStation());
+ } else {
+ result.put("dehydrationStation", "");
+ }
+ if (ardAlarmpointsWell.getRunStatus() != null) {
+ result.put("runStatus", ardAlarmpointsWell.getRunStatus());
+ } else {
+ result.put("runStatus", "");
+ }
+ if (ardAlarmpointsWell.getLongitude() != null) {
+ result.put("longitude", ardAlarmpointsWell.getLongitude());
+ } else {
+ result.put("longitude", "");
+ }
+ if (ardAlarmpointsWell.getLatitude() != null) {
+ result.put("latitude", ardAlarmpointsWell.getLatitude());
+ } else {
+ result.put("latitude", "");
+ }
+ if (ardAlarmpointsWell.getAltitude() != null) {
+ result.put("altitude", ardAlarmpointsWell.getAltitude());
+ } else {
+ result.put("altitude", "");
+ }
+ if (ardAlarmpointsWell.getUserId() != null) {
+ result.put("userId", ardAlarmpointsWell.getUserId());
+ } else {
+ result.put("userId", "");
+ }
+ if (ardAlarmpointsWell.getDeptId() != null) {
+ result.put("deptId", ardAlarmpointsWell.getDeptId());
+ SysDept sysDept = sysDeptMapper.selectDeptById(ardAlarmpointsWell.getDeptId());//鏌ヨ鍏磋叮鐐规墍鍦ㄩ儴闂�
+ if (sysDept != null) {
+ result.put("deptName", sysDept.getDeptName());
+ } else {
+ result.put("deptName", "");
+ }
+ } else {
+ result.put("deptId", "");
+ result.put("deptName", "");
+ }
+ if (ardAlarmpointsWell.getCreateBy() != null) {
+ result.put("createBy", ardAlarmpointsWell.getCreateBy());
+ } else {
+ result.put("createBy", "");
+ }
+ if (ardAlarmpointsWell.getCreateTime() != null) {
+ result.put("createTime", ardAlarmpointsWell.getCreateTime());
+ } else {
+ result.put("createTime", "");
+ }
+ if (ardAlarmpointsWell.getUpdateBy() != null) {
+ result.put("updateBy", ardAlarmpointsWell.getUpdateBy());
+ } else {
+ result.put("updateBy", "");
+ }
+ if (ardAlarmpointsWell.getUpdateTime() != null) {
+ result.put("updateTime", ardAlarmpointsWell.getUpdateTime());
+ } else {
+ result.put("updateTime", "");
+ }
+ if (config.size() != 0) {
+ String oracle = config.get(0).getConfigValue();
+ String[] oracleArr = oracle.split(";");
+ if (oracleArr.length == 3) {
+ String url = oracle.split(";")[0];
+ String username = oracle.split(";")[1];
+ String password = oracle.split(";")[2];
+ try {
+ int checkMark = checkTable(url, username, password, "\'RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+ if (checkMark == 1) {
+ Map<String, Object> resultRTU = getRtuDataYjByJH(url, username, password, "RTU_DATA_YJ_8", "\'" + ardAlarmpointsWell.getWellId() + "\'");
+ result.putAll(resultRTU);
+ } else {
+ result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+ result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+ result.put("communicationMachine", "n");//璁惧閫氳
+ result.put("remark", "n");//澶囨敞
+ result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+ result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+ result.put("torque", "n");//鎵煩
+ result.put("MAT", "n");//鍥炴补娓╁害
+ result.put("TGP", "n");//浜曞彛娌瑰帇
+ result.put("CPV", "n");//浜曞彛濂楀帇
+ result.put("ADL", "n");//A鐩哥數娴�
+ result.put("ADY", "n");//A鐩哥數鍘�
+ result.put("BDL", "n");//B鐩哥數娴�
+ result.put("BDY", "n");//B鐩哥數鍘�
+ result.put("CDL", "n");//C鐩哥數娴�
+ result.put("CDY", "n");//C鐩哥數鍘�
+ result.put("UCV", "n");//涓婅鐢垫祦
+ result.put("DCV", "n");//涓嬭鐢垫祦
+ result.put("SLV", "n");//鍐茬▼
+ result.put("CHC", "n");//鍐叉
+ result.put("BPV", "n");//浜曞彛鍥炲帇
+ result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+ result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+ result.put("GYS", "n");//鍔熺巼鍥犳暟
+ result.put("UWL", "n");//鏈�澶ц浇鑽�
+ result.put("DWL", "n");//鏈�灏忚浇鑽�
+ result.put("ZHS", "n");//杞��
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (oracleArr.length == 4) {
+ String url = oracle.split(";")[0];
+ String username = oracle.split(";")[1];
+ String password = oracle.split(";")[2];
+ String prod = oracle.split(";")[3];
+ try {
+ //int checkMark = checkTable(url,username,password,"\'RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+ int checkMark = checkTable(url, username, password, "\'" + prod + ".RTU_DATA_YJ_8\'");//涓夊巶琛ㄥ瓨鍦�
+ if (checkMark == 1) {
+ Map<String, Object> resultRTU = getRtuDataYjByJH(url, username, password, prod + ".RTU_DATA_YJ_8", "\'" + ardAlarmpointsWell.getWellId() + "\'");
+ result.putAll(resultRTU);
+ } else {
+ result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+ result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+ result.put("communicationMachine", "n");//璁惧閫氳
+ result.put("remark", "n");//澶囨敞
+ result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+ result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+ result.put("torque", "n");//鎵煩
+ result.put("MAT", "n");//鍥炴补娓╁害
+ result.put("TGP", "n");//浜曞彛娌瑰帇
+ result.put("CPV", "n");//浜曞彛濂楀帇
+ result.put("ADL", "n");//A鐩哥數娴�
+ result.put("ADY", "n");//A鐩哥數鍘�
+ result.put("BDL", "n");//B鐩哥數娴�
+ result.put("BDY", "n");//B鐩哥數鍘�
+ result.put("CDL", "n");//C鐩哥數娴�
+ result.put("CDY", "n");//C鐩哥數鍘�
+ result.put("UCV", "n");//涓婅鐢垫祦
+ result.put("DCV", "n");//涓嬭鐢垫祦
+ result.put("SLV", "n");//鍐茬▼
+ result.put("CHC", "n");//鍐叉
+ result.put("BPV", "n");//浜曞彛鍥炲帇
+ result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+ result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+ result.put("GYS", "n");//鍔熺巼鍥犳暟
+ result.put("UWL", "n");//鏈�澶ц浇鑽�
+ result.put("DWL", "n");//鏈�灏忚浇鑽�
+ result.put("ZHS", "n");//杞��
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ } else {
+ result.put("wellRunningState", "n");//娌逛簳杩愯鐘舵��
+ result.put("totalPowerConsumption", "n");//鎬昏�楃數閲�
+ result.put("communicationMachine", "n");//璁惧閫氳
+ result.put("remark", "n");//澶囨敞
+ result.put("singleWellWaterTemperature", "n");//鍗曚簳鎺烘按娓╁害//
+ result.put("meteringPlantWaterPressure", "n");//璁¢噺闂存幒姘村帇鍔�//
+ result.put("torque", "n");//鎵煩
+ result.put("MAT", "n");//鍥炴补娓╁害
+ result.put("TGP", "n");//浜曞彛娌瑰帇
+ result.put("CPV", "n");//浜曞彛濂楀帇
+ result.put("ADL", "n");//A鐩哥數娴�
+ result.put("ADY", "n");//A鐩哥數鍘�
+ result.put("BDL", "n");//B鐩哥數娴�
+ result.put("BDY", "n");//B鐩哥數鍘�
+ result.put("CDL", "n");//C鐩哥數娴�
+ result.put("CDY", "n");//C鐩哥數鍘�
+ result.put("UCV", "n");//涓婅鐢垫祦
+ result.put("DCV", "n");//涓嬭鐢垫祦
+ result.put("SLV", "n");//鍐茬▼
+ result.put("CHC", "n");//鍐叉
+ result.put("BPV", "n");//浜曞彛鍥炲帇
+ result.put("ZWG", "n");//鎬绘棤鍔熷姛鐜�
+ result.put("ZYG", "n");//鎬绘湁鍔熷姛鐜�
+ result.put("GYS", "n");//鍔熺巼鍥犳暟
+ result.put("UWL", "n");//鏈�澶ц浇鑽�
+ result.put("DWL", "n");//鏈�灏忚浇鑽�
+ result.put("ZHS", "n");//杞��
+ }
+ return result;
+ }else{
+ return null;
+ }
+ }
+
+ @Override
+ public ArdAlarmpointsWell getWellById(String id) {
+ ArdAlarmpointsWell result = ardAlarmpointsWellMapper.getWellById(id);
+ return result;
+ }
+
public int checkTable(String url, String username, String password, String tableName) throws ClassNotFoundException, SQLException {
Connection connection = null;
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java b/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java
index 72120d3..4a3ee50 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/controller/ArdAppApplicationController.java
@@ -1,5 +1,6 @@
package com.ruoyi.app.application.controller;
+import java.awt.geom.QuadCurve2D;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
@@ -223,4 +224,17 @@
return AjaxResult.error();
}
}
+
+ @GetMapping("/getSoilderAndCarPositionByCommanderIdNear")
+ @ApiOperation("PC绔寚鎸ョ鏌ョ湅鍗曞叺绔強杞﹁締浣嶇疆")
+ public AjaxResult getSoilderAndCarPositionByCommanderIdNear(@RequestBody Map<String, Double> para) {
+ String commanderId = SecurityUtils.getUserId();
+ try{
+ Map<String,Map<String,List<Map<String,Object>>>> result = ardAppApplicationService.getSoilderAndCarPositionByCommanderId(commanderId,para);
+ return AjaxResult.success(result);
+ }catch(Exception e){
+ e.printStackTrace();
+ return AjaxResult.error();
+ }
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java b/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java
index 1e74376..9ebdecf 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/service/IArdAppApplicationService.java
@@ -78,4 +78,6 @@
public int approvalCheckPositionOwn(String soilderId,Map<String,String> para);
public List<Map<String,Object>> getCheckPositionNo(String commanderId);///
+
+ public Map<String,Map<String,List<Map<String,Object>>>> getSoilderAndCarPositionByCommanderId(String commanderId,Map<String, Double> para);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
index 4fc1bcf..5918261 100644
--- a/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/application/service/impl/ArdAppApplicationServiceImpl.java
@@ -1,12 +1,29 @@
package com.ruoyi.app.application.service.impl;
+import java.math.BigDecimal;
import java.util.*;
+import java.util.stream.Collectors;
+import com.ruoyi.app.position.appcontainer.AppContainer;
+import com.ruoyi.app.position.domain.ArdAppPosition;
+import com.ruoyi.app.position.mapper.ArdAppPositionMapper;
+import com.ruoyi.common.core.domain.entity.SysConfig;
import com.ruoyi.common.core.domain.entity.SysRole;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.sy.domain.ArdSyUser;
+import com.ruoyi.sy.mapper.ArdSyCarMapper;
+import com.ruoyi.sy.mapper.ArdSyUserMapper;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
+import com.ruoyi.system.mapper.SysUserMapper;
+import com.ruoyi.utils.forest.SYClient;
+import com.ruoyi.utils.gis.GisUtil;
import com.ruoyi.utils.websocket.util.WebSocketUtils;
+import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
@@ -34,6 +51,30 @@
@Resource
private SysRoleMapper sysRoleMapper;
+
+ @Resource
+ private SysUserMapper userMapper;
+
+ @Resource
+ private SysDeptMapper sysDeptMapper;
+
+ @Resource
+ private ArdAppPositionMapper ardAppPositionMapper;
+
+ @Resource
+ private ArdSyUserMapper ardSyUserMapper;
+
+ @Resource
+ private SysConfigMapper sysConfigMapper;
+
+ @Resource
+ private ArdSyCarMapper ardSyCarMapper;
+
+ @Resource
+ private SYClient sYClient;
+
+ @Value("${minio.endpoint}")
+ private String minioEndpoint;
private Map<String,Thread> threadMap = new HashMap();
@@ -404,4 +445,147 @@
}
return ardAppApplicationList;
}
+
+ @Override
+ public Map<String,Map<String,List<Map<String,Object>>>> getSoilderAndCarPositionByCommanderId(String commanderId,Map<String, Double> para) {
+ Map<String,Map<String,List<Map<String,Object>>>> mapResault = new HashMap();
+ SysUser sysUser = userMapper.selectUserById(commanderId);//鑾峰彇绯荤粺鐢ㄦ埛
+ List<Long> deptIdList = new ArrayList();
+ deptIdList.add(sysUser.getDeptId());
+ deptIdList = getOwnAndChildrenDeptIdList(deptIdList,new ArrayList());//閫掑綊鏌ヨ涓嬪睘閮ㄩ棬涓婚敭
+ List<SysUser> sysUsersResult = userMapper.getOwnAndChildrenSoilderListAll(deptIdList);
+ List<SysUser> sysUsersResultOnline = sysUsersResult.stream().filter(sysUserTest -> sysUserTest.getAppOnlineState().equals("1")).collect(Collectors.toList());//鍦ㄧ嚎鐢ㄦ埛
+ List<SysUser> sysUsersResultOffline = sysUsersResult.stream().filter(sysUserTest -> !sysUserTest.getAppOnlineState().equals("1")).collect(Collectors.toList());//绂荤嚎鐢ㄦ埛
+ List<Map<String,Object>> sysUsersOnlineList = new ArrayList();
+ List<Map<String,Object>> sysUsersOfflineList = new ArrayList();
+ for(SysUser sysUserIn : sysUsersResultOnline){
+ Map<String,Object> map = new HashMap();
+ map.put("userId",sysUserIn.getUserId());
+ map.put("deptId",sysUserIn.getDeptId());
+ map.put("userName",sysUserIn.getUserName());
+ map.put("nickName",sysUserIn.getNickName());
+ try{
+ map.put("longitude", AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getLongitude());
+ map.put("latitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getLatitude());
+ map.put("altitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getAltitude());
+ }catch(Exception e){
+ ArdAppPosition ardAppPosition = ardAppPositionMapper.getLastAPPPositionByUserId(sysUserIn.getUserId());
+ map.put("longitude",ardAppPosition.getLongitude());
+ map.put("latitude",ardAppPosition.getLatitude());
+ map.put("altitude",ardAppPosition.getAltitude());
+ }
+ sysUsersOnlineList.add(map);
+ }
+ List<Map<String,Object>> sysUsersOnlineNearList = new ArrayList();//鍦�200绫冲唴
+ for(Map<String,Object> mapOn : sysUsersOnlineList){
+ Double longitude = (Double) mapOn.get("longitude");
+ Double latitude = (Double) mapOn.get("latitude");
+ double distance = GisUtil.getDistance(para.get("longitude"),para.get("latitude"),longitude,latitude);
+ if(distance <= 200){
+ sysUsersOnlineNearList.add(mapOn);
+ }
+ }
+ Map<String,List<Map<String,Object>>> appMap = new HashMap();
+ appMap.put("onlineApp",sysUsersOnlineNearList);
+ for(SysUser sysUserIn : sysUsersResultOffline){
+ Map<String,Object> map = new HashMap();
+ map.put("userId",sysUserIn.getUserId());
+ map.put("deptId",sysUserIn.getDeptId());
+ map.put("userName",sysUserIn.getUserName());
+ map.put("nickName",sysUserIn.getNickName());
+ sysUsersOfflineList.add(map);
+ }
+ appMap.put("offlineApp",sysUsersOfflineList);
+ mapResault.put("app",appMap);
+
+ ArdSyUser ardSyUserPara = new ArdSyUser();
+ ardSyUserPara.setSysUserId(commanderId);
+ List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(ardSyUserPara);//鏌ヨ鎸傛帴鐨勪笁涓�璐﹀彿
+
+ String syURL = "";
+ List<SysConfig> sysConfigResult = sysConfigMapper.selectByType("syCarPT");
+ if(sysConfigResult.size() > 0){
+ syURL = sysConfigResult.get(0).getConfigValue();
+ }
+
+ if(ardSyUserList.size() == 0 || syURL.equals("")){
+ List<Map<String,Object>> onlineCar = new ArrayList();
+ List<Map<String,Object>> offlineCar = new ArrayList();
+ Map<String,List<Map<String,Object>>> carMap = new HashMap();
+ carMap.put("onlineCar",onlineCar);
+ carMap.put("offlineCar",offlineCar);
+ mapResault.put("car",carMap);
+ return mapResault;
+ }
+
+ List<String> carIdList = ardSyCarMapper.selectArdSyCarByDeptIds(deptIdList);
+ String carIds = "";
+ for(String carId : carIdList){
+ carIds = carIds + carId + ",";
+ }
+ carIds = carIds.substring(0,carIds.length() - 1);
+ String passwordMd5 = DigestUtils.md5Hex(ardSyUserList.get(0).getPassword());
+ Map<String,Object> syLoginResult = sYClient.logIn(syURL, passwordMd5, ardSyUserList.get(0).getUserId());
+ String sessionId = (String) syLoginResult.get("sessionId");
+ Map<String,Object> carNearPositionResult = sYClient.getCarNearPositionByCarId(syURL, carIds, ardSyUserList.get(0).getUserId(),sessionId);
+ if(((String)carNearPositionResult.get("rspCode")).equals("1")){
+ List<Map<String,Object>> SYCarPositionList = (List<Map<String, Object>>) carNearPositionResult.get("list");
+ //绛涢�夊湪绾�
+ List<Map<String,Object>> onlineSYCarPositionList = SYCarPositionList.stream().filter(map -> ((String)map.get("stateCn")).startsWith("鍦ㄧ嚎")).collect(Collectors.toList());
+ //绛涢��200绫宠寖鍥村唴
+ List<Map<String,Object>> onlineSYCarPositionNearList = new ArrayList();//鍦�200绫冲唴
+ for(Map<String,Object> mapOn : onlineSYCarPositionList){
+ Double longitude = new BigDecimal((String) mapOn.get("lng")).doubleValue();
+ Double latitude = new BigDecimal((String) mapOn.get("lat")).doubleValue();
+ double distance = GisUtil.getDistance(para.get("longitude"),para.get("latitude"),longitude,latitude);
+ if(distance <= 200){
+ mapOn.put("longitude",longitude);
+ mapOn.put("latitude",latitude);
+ onlineSYCarPositionNearList.add(mapOn);
+ }
+ }
+
+ //for(Map<String,Object> sycar : onlineSYCarPositionList){
+ for(Map<String,Object> sycar : onlineSYCarPositionNearList){
+ Map<String,Object> map = ardSyCarMapper.getArdSyCarAndDeptByCarId((String)sycar.get("carId"));
+ String carModel = this.minioEndpoint + "/" + (String) map.get("carModel");
+ map.put("carModel",carModel);
+ sycar.putAll(map);
+ }
+ //绛涢�夌绾�
+ List<Map<String,Object>> offlineSYCarPositionList = SYCarPositionList.stream().filter(map -> ((String)map.get("stateCn")).startsWith("绂荤嚎")).collect(Collectors.toList());
+ for(Map<String,Object> sycar : offlineSYCarPositionList){
+ Map<String,Object> map = ardSyCarMapper.getArdSyCarAndDeptByCarId((String)sycar.get("carId"));
+ String carModel = this.minioEndpoint + "/" + (String) map.get("carModel");
+ map.put("carModel",carModel);
+ sycar.putAll(map);
+ }
+ Map<String,List<Map<String,Object>>> carMap = new HashMap();
+ //carMap.put("onlineCar",onlineSYCarPositionList);
+ carMap.put("onlineCar",onlineSYCarPositionNearList);
+ carMap.put("offlineCar",offlineSYCarPositionList);
+ mapResault.put("car",carMap);
+ }else{
+ List<Map<String,Object>> onlineCar = new ArrayList();
+ List<Map<String,Object>> offlineCar = new ArrayList();
+ Map<String,List<Map<String,Object>>> carMap = new HashMap();
+ carMap.put("onlineCar",onlineCar);
+ carMap.put("offlineCar",offlineCar);
+ mapResault.put("car",carMap);
+ return mapResault;
+ }
+
+ return mapResault;
+ }
+
+ public List<Long> getOwnAndChildrenDeptIdList(List<Long> deptIdList,List<Long> deptIdListr){
+ deptIdListr.addAll(deptIdList);
+ List<Long> result = sysDeptMapper.getChildrenDeptIdList(deptIdList);
+ if(result.size() != 0){
+ deptIdListr.addAll(result);
+ result = getOwnAndChildrenDeptIdList(result,deptIdListr);
+ }
+ deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList());
+ return deptIdListr;
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/appcontainer/AppContainer.java b/ard-work/src/main/java/com/ruoyi/app/position/appcontainer/AppContainer.java
new file mode 100644
index 0000000..96ed100
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/app/position/appcontainer/AppContainer.java
@@ -0,0 +1,19 @@
+package com.ruoyi.app.position.appcontainer;
+
+import com.ruoyi.app.position.domain.ArdAppPosition;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppContainer {
+
+ private static Map<String, ArdAppPosition> ardAppPositionMap = new HashMap();
+
+ public static Map<String, ArdAppPosition> getArdAppPositionMap() {
+ return ardAppPositionMap;
+ }
+
+ public static void setArdAppPositionMap(Map<String, ArdAppPosition> ardAppPositionMap) {
+ ardAppPositionMap = ardAppPositionMap;
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java b/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
index 7565542..7bd5258 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
@@ -239,67 +239,22 @@
}
}
- /*@PostMapping("/sendCheckCommandersPosition")
- @ApiOperation("鍙戣捣鏌ョ湅鎸囨尌绔綅缃�")
- public AjaxResult sendCheckCommandersPosition(@RequestBody Map<String,Object> para) {
- String usersId = SecurityUtils.getUserId();
+ @GetMapping("/getAPPPositionByUserIdAndTime")
+ @ApiOperation("鏌ョ湅APP鍘嗗彶浣嶇疆")
+ public AjaxResult getAPPPositionByUserIdAndTime(@RequestBody Map<String,String> para) {
try{
- ardAppPositionService.sendCheckCommandersPosition(usersId,para);
- return AjaxResult.success();
- }catch(Exception e){
- return AjaxResult.error();
- }
- }*/
-
- /*@PostMapping("/sendCheckSYCarsPosition")
- @ApiOperation("鍙戣捣鏌ョ湅杞﹁締浣嶇疆")
- public AjaxResult sendCheckSYCarsPosition(@RequestBody Map<String,Object> para) {
- String usersId = SecurityUtils.getUserId();
- try{
- ardAppPositionService.sendCheckSYCarsPosition(usersId,para);
- return AjaxResult.success();
- }catch(Exception e){
- return AjaxResult.error();
- }
- }*/
-
- /*@GetMapping("/getCheckCommandersPosition")
- @ApiOperation("鎸囨尌绔煡鐪嬫寚鎸ョ浣嶇疆鐢宠")
- public AjaxResult getCheckCommandersPosition() {//寮冪敤
- String usersId = SecurityUtils.getUserId();
- try{
- List<Map<String,Object>> result = ardAppPositionService.getCheckCommandersPosition(usersId);
+ List<ArdAppPosition> result = ardAppPositionService.getAPPPositionByUserIdAndTime(para);
return AjaxResult.success(result);
}catch(Exception e){
e.printStackTrace();
return AjaxResult.error();
}
- }*/
+ }
- /*@GetMapping("/getCheckSYCarsPosition")
- @ApiOperation("鎸囨尌绔煡鐪嬭溅杈嗕綅缃敵璇�")
- public AjaxResult getCheckSYCarsPosition() {//寮冪敤
- String usersId = SecurityUtils.getUserId();
- try{
- List<Map<String,Object>> result = ardAppPositionService.getCheckSYCarsPosition(usersId);
- return AjaxResult.success(result);
- }catch(Exception e){
- e.printStackTrace();
- return AjaxResult.error();
- }
- }*/
-
- /*@GetMapping("/getCheckPosition")
- @ApiOperation("鎸囨尌绔煡鐪嬩綅缃敵璇�")
- public AjaxResult getCheckPosition() {
- String usersId = SecurityUtils.getUserId();
- try{
- Map<String,List<Map<String,Object>>> result = ardAppPositionService.getCheckPosition(usersId);
- return AjaxResult.success(result);
- }catch(Exception e){
- e.printStackTrace();
- return AjaxResult.error();
- }
- }*/
+ @GetMapping("/getOnlineAPPSoilderByCommanderId")
+ public AjaxResult getOnlineAPPSoilderByCommanderId() {
+ String userId = SecurityUtils.getUserId();
+ return success(ardAppPositionService.getOnlineAPPSoilderByCommanderId(userId));
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/mapper/ArdAppPositionMapper.java b/ard-work/src/main/java/com/ruoyi/app/position/mapper/ArdAppPositionMapper.java
index 83c5a45..2f81a24 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/mapper/ArdAppPositionMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/mapper/ArdAppPositionMapper.java
@@ -4,6 +4,7 @@
import java.util.Map;
import com.ruoyi.app.position.domain.ArdAppPosition;
+import org.apache.ibatis.annotations.Param;
/**
@@ -70,4 +71,8 @@
public int deleteArdAppPositionByIds(String[] ids);
public List<Map<String,Object>> getOnlineCommanderPosition(String soilderId);
+
+ public List<ArdAppPosition> getAPPPositionByUserIdAndTime(@Param("userId") String userId,@Param("beginTime") String beginTime,@Param("endTime") String endTime);
+
+ public ArdAppPosition getLastAPPPositionByUserId(String userId);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java b/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
index 64e1606..68c1db2 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
@@ -88,13 +88,8 @@
public List<Map<String,Object>> getOnlineCommanderPosition(String soilderId);
- //public void sendCheckCommandersPosition(String usersId,Map<String,Object> para);
+ public List<ArdAppPosition> getAPPPositionByUserIdAndTime(Map<String,String> para);
- //public void sendCheckSYCarsPosition(String usersId,Map<String,Object> para);
+ public List<Map<String,Object>> getOnlineAPPSoilderByCommanderId(String userId);
- //public List<Map<String,Object>> getCheckCommandersPosition(String usersId);
-
- //public List<Map<String,Object>> getCheckSYCarsPosition(String usersId);
-
- //public Map<String,List<Map<String,Object>>> getCheckPosition(String usersId);
}
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 b6105ec..837d4fc 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
@@ -1,11 +1,10 @@
package com.ruoyi.app.position.service.impl;
-import com.alibaba.fastjson2.JSON;
import com.ruoyi.alarm.wall.domain.ArdAlarmWall;
-import com.ruoyi.alarm.wall.mapper.ArdAlarmWallMapper;
import com.ruoyi.alarm.wall.service.IArdAlarmWallService;
import com.ruoyi.alarmpoints.wall.domain.ArdWall;
import com.ruoyi.alarmpoints.wall.mapper.ArdWallMapper;
+import com.ruoyi.app.position.appcontainer.AppContainer;
import com.ruoyi.app.position.domain.ArdAppPosition;
import com.ruoyi.app.position.mapper.ArdAppPositionMapper;
import com.ruoyi.app.position.service.IArdAppPositionService;
@@ -15,16 +14,15 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.scheduling.domian.SchedulingParam;
+import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.utils.gis.GisUtil;
import com.ruoyi.utils.gis.Point;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -52,6 +50,8 @@
IArdAlarmWallService ardAlarmWallService;
@Resource
private SysUserMapper sysUserMapper;
+ @Resource
+ private SysDeptMapper sysDeptMapper;
Map<String, String> firstAlarmMap = new HashMap<>();//棣栨鎶ヨ缂撳瓨key:鐢ㄦ埛id_鍥存爮id value: 鎶ヨid
/**
@@ -98,7 +98,12 @@
ardAppPosition.setId(IdUtils.simpleUUID());
ardAppPosition.setCreateTime(DateUtils.getNowDate());
ardAppPositionMapper.insertArdAppPosition(ardAppPosition);
- return DetectionWallAlarm(ardAppPosition);
+ try{
+ return DetectionWallAlarm(ardAppPosition);
+ }finally {
+ AppContainer.getArdAppPositionMap().put(ardAppPosition.getUserId(),ardAppPosition);//瀹炴椂浣嶇疆瀛樺叆瀹瑰櫒
+ }
+
}
/**
@@ -478,111 +483,53 @@
return result;
}
- /*@Override
- public void sendCheckCommandersPosition(String usersId,Map<String, Object> para) {
- String reason = (String) para.get("reason");
- List<String> usersIdList = (List<String>) para.get("usersIdList");
- for(String commanderId : usersIdList){
- //璁剧疆key涓篶heckCommanderPosition_鎸囨尌绔富閿甠鍗曞叺绔富閿�
- String key = "checkCommanderPosition_" + commanderId + "_" + usersId;
- Map<String,Object> value = new HashMap();
- value.put("reason",reason);
- value.put("state","0");
- value.put("begin","");
- value.put("commanderId",commanderId);
- value.put("soilderId",usersId);
- redisCache.setCacheObject(key, JSON.toJSONString(value));
- }
- }*/
-
- /*@Override
- public void sendCheckSYCarsPosition(String usersId, Map<String, Object> para) {
- String reason = (String) para.get("reason");
- List<String> usersIdList = (List<String>) para.get("usersIdList");
- for(String commanderId : usersIdList){
- //璁剧疆key涓篶heckSYCarsPosition_鎸囨尌绔富閿�/PC绔富閿甠鍗曞叺绔富閿�
- String key = "checkSYCarsPosition_" + commanderId + "_" + usersId;
- Map<String,Object> value = new HashMap();
- value.put("reason",reason);
- value.put("state","0");
- value.put("begin","");
- value.put("commanderId",commanderId);
- value.put("soilderId",usersId);
- redisCache.setCacheObject(key, JSON.toJSONString(value));
- }
- }*/
-
- /*@Override
- public List<Map<String, Object>> getCheckCommandersPosition(String usersId) {
- String key = "checkCommanderPosition_" + usersId + "_";
- List<Object> keyValueList = redisCache.getListKey(key);
- List<Map<String, Object>> result = new ArrayList();
- for(Object o : keyValueList){
- Map<String,Object> map = JSON.parseObject((String) o);
- if(((String)map.get("state")).equals("0")){//state涓�0灏辨槸鏈鎵�
- SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId"));
- map.put("userName",sysUser.getUserName());
- result.add(map);
- }
- }
+ @Override
+ public List<ArdAppPosition> getAPPPositionByUserIdAndTime(Map<String, String> para) {
+ String userId = para.get("userId");
+ String beginTime = para.get("beginTime");
+ String endTime = para.get("endTime");
+ List<ArdAppPosition> result = ardAppPositionMapper.getAPPPositionByUserIdAndTime(userId,beginTime,endTime);
return result;
- }*/
+ }
- /*@Override
- public List<Map<String, Object>> getCheckSYCarsPosition(String usersId) {
- String key = "checkSYCarsPosition_" + usersId + "_";
- List<Object> keyValueList = redisCache.getListKey(key);
- List<Map<String, Object>> result = new ArrayList();
- for(Object o : keyValueList){
- Map<String,Object> map = JSON.parseObject((String) o);
- if(((String)map.get("state")).equals("0")){//state涓�0灏辨槸鏈鎵�
- SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId"));
- map.put("userName",sysUser.getUserName());
- result.add(map);
+ @Override
+ public List<Map<String,Object>> getOnlineAPPSoilderByCommanderId(String userId) {
+ SysUser sysUser = sysUserMapper.selectUserById(userId);//鑾峰彇绯荤粺鐢ㄦ埛
+ List<Long> deptIdList = new ArrayList();
+ deptIdList.add(sysUser.getDeptId());
+ deptIdList = getOwnAndChildrenDeptIdList(deptIdList,new ArrayList());//閫掑綊鏌ヨ涓嬪睘閮ㄩ棬涓婚敭
+ List<SysUser> result = sysUserMapper.getOwnAndChildrenOnlineSoilderList(deptIdList);
+ List<Map<String,Object>> resultList = new ArrayList();
+ for(SysUser sysUserIn : result){
+ Map<String,Object> map = new HashMap();
+ map.put("userId",sysUserIn.getUserId());
+ map.put("deptId",sysUserIn.getDeptId());
+ map.put("userName",sysUserIn.getUserName());
+ map.put("nickName",sysUserIn.getNickName());
+ try{
+ map.put("longitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getLongitude());
+ map.put("latitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getLatitude());
+ map.put("altitude",AppContainer.getArdAppPositionMap().get(sysUserIn.getUserId()).getAltitude());
+ }catch(Exception e){
+ ArdAppPosition ardAppPosition = ardAppPositionMapper.getLastAPPPositionByUserId(sysUserIn.getUserId());
+ map.put("longitude",ardAppPosition.getLongitude());
+ map.put("latitude",ardAppPosition.getLatitude());
+ map.put("altitude",ardAppPosition.getAltitude());
}
+ resultList.add(map);
}
- return result;
- }*/
+ return resultList;
+ }
- /*@Override
- public Map<String, List<Map<String, Object>>> getCheckPosition(String usersId) {
- Map<String, List<Map<String, Object>>> result = new HashMap();
- //鏌ョ湅鎸囨尌绔綅缃敵璇�
- String keyCommanderPosition = "checkCommanderPosition_" + usersId + "_";
- List<Object> keyValueCommanderPositionList = redisCache.getListKey(keyCommanderPosition);
- List<Map<String, Object>> resultCommanderPosition = new ArrayList();
- for(Object o : keyValueCommanderPositionList){
- Map<String,Object> map = JSON.parseObject((String) o);
- if(((String)map.get("state")).equals("0")){//state涓�0灏辨槸鏈鎵�
- SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId"));
- map.put("userName",sysUser.getUserName());
- if(sysUser.getNickName() != null){
- map.put("nickName",sysUser.getNickName());
- }else{
- map.put("nickName",sysUser.getNickName());
- }
- resultCommanderPosition.add(map);
- }
+ public List<Long> getOwnAndChildrenDeptIdList(List<Long> deptIdList,List<Long> deptIdListr){
+ deptIdListr.addAll(deptIdList);
+ List<Long> result = sysDeptMapper.getChildrenDeptIdList(deptIdList);
+ if(result.size() != 0){
+ deptIdListr.addAll(result);
+ result = getOwnAndChildrenDeptIdList(result,deptIdListr);
}
- //鏌ョ湅杞﹁締浣嶇疆鐢宠
- String keySYCarsPosition = "checkSYCarsPosition_" + usersId + "_";
- List<Object> keyValueSYCarsPositionList = redisCache.getListKey(keySYCarsPosition);
- List<Map<String, Object>> resultSYCarsPosition = new ArrayList();
- for(Object o : keyValueSYCarsPositionList){
- Map<String,Object> map = JSON.parseObject((String) o);
- if(((String)map.get("state")).equals("0")){//state涓�0灏辨槸鏈鎵�
- SysUser sysUser = sysUserMapper.selectUserById((String) map.get("soilderId"));
- map.put("userName",sysUser.getUserName());
- if(sysUser.getNickName() != null){
- map.put("nickName",sysUser.getNickName());
- }else{
- map.put("nickName",sysUser.getNickName());
- }
- resultSYCarsPosition.add(map);
- }
- }
- result.put("commander",resultCommanderPosition);
- result.put("SYCars",resultSYCarsPosition);
- return result;
- }*/
+ deptIdListr = deptIdListr.stream().distinct().collect(Collectors.toList());
+ return deptIdListr;
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java b/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
index 2a009f9..3ce9f56 100644
--- a/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
@@ -1,5 +1,6 @@
package com.ruoyi.device.uav.service;
+import com.alibaba.fastjson.JSON;
import com.dtflys.forest.exceptions.ForestNetworkException;
import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -8,9 +9,13 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.ConfigUtils;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.device.uav.websocketclient.UAVWebsocketClient;
+import com.ruoyi.sy.controller.ArdSyCarController;
import com.ruoyi.utils.forest.UavClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections4.map.HashedMap;
+import org.java_websocket.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
@@ -24,7 +29,9 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.Map;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.*;
@Service
@Slf4j(topic = "uav")
@@ -46,6 +53,11 @@
private Map uavUser;//鐧诲綍鐨勭敤鎴蜂俊鎭�
private ObjectMapper om = new ObjectMapper();
+
+ private Map<String, UAVWebsocketClient> UAVWebsocketClientMap = new HashedMap();
+
+ private String token;
+
@Autowired
private UavClient uavClient;
@Autowired
@@ -56,6 +68,8 @@
getUavConfig();
this.login();
+ //鍒涘缓鏃犱汉鏈篧ebsocket瀹㈡埛绔�
+ createWebsocketCients();
}
private void getUavConfig() {
@@ -85,8 +99,12 @@
String token = this.getToken();
res = (String) requestMethod.invoke(this.uavClient, this.host + url, token, data);
} catch (IllegalAccessException e) {
+ System.out.println("doUavRequest 璁块棶澶辫触");
+ System.out.println(url);
log.error("doUavRequest 璁块棶澶辫触" + e.getMessage());
} catch (InvocationTargetException e) {
+ System.out.println("doUavRequest 鎵ц澶辫触");
+ System.out.println(url);
log.error("doUavRequest 鎵ц澶辫触" + e.getMessage());
e.printStackTrace();
}
@@ -107,12 +125,17 @@
String res = uavClient.GET(this.host+"manage/api/v1/devices", token, "{}");
res+="";
//System.out.println(res);
+
+ //token璧嬪��
+ this.token = token;
} catch (ForestNetworkException fe) {
if (fe.getStatusCode() == 401) {//token澶辨晥,閲嶆柊鐧诲綍
this.login();
//鍐嶆鑾峰彇token
uavUser = redisCache.getCacheMap("uav:uavUser");
token = (String) uavUser.get("access_token");
+ //token璧嬪��
+ this.token = token;
return token;
}
}
@@ -141,6 +164,367 @@
}
}
+ public void createWebsocketCients(){
+ /*String ip = this.host.replace("http://", "");
+ if(this.UAVWebsocketClientMap.get("status") != null && this.UAVWebsocketClientMap.get("control") != null){
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ UAVWebsocketClient uavStatusWebsocketClient = this.UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient.getHeartBeatTimer().cancel();
+ uavStatusWebsocketClient.close();
+ //鏃犱汉鏈烘帶鍒剁伃娲�
+ UAVWebsocketClient uavControlWebsocketClient = this.UAVWebsocketClientMap.get("control");
+ uavControlWebsocketClient.getHeartBeatTimer().cancel();
+ uavControlWebsocketClient.close();
+
+ this.UAVWebsocketClientMap.remove("status");
+ this.UAVWebsocketClientMap.remove("control");
+ }
+
+ String uavStatusWsURL = "ws://" + ip + "api/v1/ws?x-auth-token=" + token;
+ System.out.println(uavStatusWsURL);
+ UAVWebsocketClient uavStatusWebsocketClient;
+ try {
+ uavStatusWebsocketClient = new UAVWebsocketClient(new URI(uavStatusWsURL));
+ uavStatusWebsocketClient.connect();
+ System.out.println("杩炴帴涓�傘�傘��");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(!uavStatusWebsocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)){
+ uavStatusWebsocketClient.close();
+ return;
+ }
+ Date date = new Date();
+ Timer heartBeatTimer = new Timer();
+ TimerTask heartBeatTask = new TimerTask(){
+ public void run(){
+ Map<String,Object> para = new HashMap();
+ para.put("biz_code", "user_cmd");
+ para.put("version", "1.0");
+ Date date = new Date();
+ para.put("time_stamp", String.valueOf(date.getTime()));
+ Map<String,String> payload = new HashMap();
+ payload.put("timeStamp", String.valueOf(date.getTime()));
+ Map<String,Object> data = new HashMap();
+ data.put("dataHead", "0x7479");
+ data.put("cmdCode", "0x02");
+ data.put("payload", payload);
+ para.put("data", data);
+ try{
+ uavStatusWebsocketClient.send(JSON.toJSONString(para));
+ System.out.println("鏃犱汉鏈虹姸鎬佸績璺冲彂閫�");
+ }catch(Exception e){
+ e.printStackTrace();
+ System.out.println(uavStatusWebsocketClient.getServerUri());
+ }
+ }
+ };
+ uavStatusWebsocketClient.setHeartBeatTimer(heartBeatTimer);
+ heartBeatTimer.scheduleAtFixedRate(heartBeatTask,date,10*1000);
+ this.UAVWebsocketClientMap.put("status", uavStatusWebsocketClient);
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String uavControlWsURL = "ws://" + ip + "api/v1/ws/cmd?x-auth-token=" + token;
+ System.out.println(uavControlWsURL);
+ UAVWebsocketClient uavControlWebsocketClient;
+ try {
+ uavControlWebsocketClient = new UAVWebsocketClient(new URI(uavControlWsURL));
+ uavControlWebsocketClient.connect();
+ System.out.println("杩炴帴涓�傘�傘��");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(!uavControlWebsocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)){
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ UAVWebsocketClient uavStatusWebsocketClient0 = this.UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient0.getHeartBeatTimer().cancel();
+ uavStatusWebsocketClient0.close();
+
+ uavControlWebsocketClient.close();
+ return;
+ }
+ Date date = new Date();
+ Timer heartBeatTimer = new Timer();
+ TimerTask heartBeatTask = new TimerTask(){
+ public void run(){
+ Map<String,Object> para = new HashMap();
+ para.put("biz_code", "user_cmd");
+ para.put("version", "1.0");
+ Date date = new Date();
+ para.put("time_stamp", String.valueOf(date.getTime()));
+ Map<String,String> payload = new HashMap();
+ payload.put("timeStamp", String.valueOf(date.getTime()));
+ Map<String,Object> data = new HashMap();
+ data.put("dataHead", "0x7479");
+ data.put("cmdCode", "0x02");
+ data.put("payload", payload);
+ para.put("data", data);
+ try{
+ uavControlWebsocketClient.send(JSON.toJSONString(para));
+ System.out.println("鏃犱汉鏈烘帶鍒跺績璺冲彂閫�");
+ }catch(Exception e){
+ e.printStackTrace();
+ System.out.println(uavControlWebsocketClient.getServerUri());
+ }
+ }
+ };
+ uavControlWebsocketClient.setHeartBeatTimer(heartBeatTimer);
+ heartBeatTimer.scheduleAtFixedRate(heartBeatTask,date,10*1000);
+ this.UAVWebsocketClientMap.put("control", uavControlWebsocketClient);
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }*/
+ String ip = this.host.replace("http://", "");
+ Date date = new Date();
+ Timer heartBeatTimer = new Timer();
+ TimerTask heartBeatTask = new TimerTask(){
+ public void run(){
+ if(token != null){//鍒ゆ柇鏄惁涓簄ull
+ if(UAVWebsocketClientMap.get("status") != null && UAVWebsocketClientMap.get("control") != null){
+ String oldURL = UAVWebsocketClientMap.get("status").getServerUri().toString();
+ String oldToken = oldURL.split("x-auth-token=")[1];
+ if(!oldToken.equals(token)){//token鏇存柊浠庢柊鍒涘缓瀹㈡埛绔�
+ //鍘熷鎴风鐏椿
+ UAVWebsocketClientMap.get("status").close();//鏃犱汉鏈虹姸鎬佺伃娲�
+ UAVWebsocketClientMap.get("control").close();//鏃犱汉鏈烘帶鍒剁伃娲�
+ UAVWebsocketClientMap.remove("status");
+ UAVWebsocketClientMap.remove("control");
+
+ String uavStatusWsURL = "ws://" + ip + "api/v1/ws?x-auth-token=" + token;
+ UAVWebsocketClient uavStatusWebsocketClient = null;
+ try {
+ uavStatusWebsocketClient = new UAVWebsocketClient(new URI(uavStatusWsURL));
+ uavStatusWebsocketClient.connect();
+ System.out.println("杩炴帴涓�傘�傘��");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(!uavStatusWebsocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)){
+ uavStatusWebsocketClient.close();
+ uavStatusWebsocketClient = null;
+ }
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String uavControlWsURL = "ws://" + ip + "api/v1/ws/cmd?x-auth-token=" + token;
+ UAVWebsocketClient uavControlWebsocketClient = null;
+ try {
+ uavControlWebsocketClient = new UAVWebsocketClient(new URI(uavControlWsURL));
+ uavControlWebsocketClient.connect();
+ System.out.println("杩炴帴涓�傘�傘��");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(!uavControlWebsocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)){
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ UAVWebsocketClient uavStatusWebsocketClient0 = UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient0.close();
+
+ uavControlWebsocketClient.close();
+ uavStatusWebsocketClient0 = null;
+ uavControlWebsocketClient = null;
+ //return;
+ }
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(uavStatusWebsocketClient != null || uavControlWebsocketClient != null){
+ UAVWebsocketClientMap.put("status", uavStatusWebsocketClient);
+ UAVWebsocketClientMap.put("control", uavControlWebsocketClient);
+
+ Map<String,Object> para = new HashMap();
+ para.put("biz_code", "user_cmd");
+ para.put("version", "1.0");
+ Date date = new Date();
+ para.put("time_stamp", String.valueOf(date.getTime()));
+ Map<String,String> payload = new HashMap();
+ payload.put("timeStamp", String.valueOf(date.getTime()));
+ Map<String,Object> data = new HashMap();
+ data.put("dataHead", "0x7479");
+ data.put("cmdCode", "0x02");
+ data.put("payload", payload);
+ para.put("data", data);
+ try{
+ uavStatusWebsocketClient.send(JSON.toJSONString(para));
+ uavControlWebsocketClient.send(JSON.toJSONString(para));
+ //System.out.println("鏃犱汉鏈哄績璺冲彂閫�");
+ }catch(Exception e){
+ e.printStackTrace();
+ System.out.println(uavStatusWebsocketClient.getServerUri());
+ System.out.println(uavControlWebsocketClient.getServerUri());
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ uavStatusWebsocketClient = UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient.close();
+ //鏃犱汉鏈烘帶鍒剁伃娲�
+ uavControlWebsocketClient = UAVWebsocketClientMap.get("control");
+ uavControlWebsocketClient.close();
+
+ UAVWebsocketClientMap.remove("status");
+ UAVWebsocketClientMap.remove("control");
+ }
+ }
+ }else{
+ Map<String,Object> para = new HashMap();
+ para.put("biz_code", "user_cmd");
+ para.put("version", "1.0");
+ Date date = new Date();
+ para.put("time_stamp", String.valueOf(date.getTime()));
+ Map<String,String> payload = new HashMap();
+ payload.put("timeStamp", String.valueOf(date.getTime()));
+ Map<String,Object> data = new HashMap();
+ data.put("dataHead", "0x7479");
+ data.put("cmdCode", "0x02");
+ data.put("payload", payload);
+ para.put("data", data);
+ UAVWebsocketClient uavStatusWebsocketClient = UAVWebsocketClientMap.get("status");
+ UAVWebsocketClient uavControlWebsocketClient = UAVWebsocketClientMap.get("control");
+ try{
+ uavStatusWebsocketClient.send(JSON.toJSONString(para));
+ uavControlWebsocketClient.send(JSON.toJSONString(para));
+ //System.out.println("鏃犱汉鏈哄績璺冲彂閫�");
+ }catch(Exception e){
+ e.printStackTrace();
+ System.out.println(uavStatusWebsocketClient.getServerUri());
+ System.out.println(uavControlWebsocketClient.getServerUri());
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ uavStatusWebsocketClient = UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient.close();
+ //鏃犱汉鏈烘帶鍒剁伃娲�
+ uavControlWebsocketClient = UAVWebsocketClientMap.get("control");
+ uavControlWebsocketClient.close();
+
+ UAVWebsocketClientMap.remove("status");
+ UAVWebsocketClientMap.remove("control");
+ }
+ }
+ }else{
+ String uavStatusWsURL = "ws://" + ip + "api/v1/ws?x-auth-token=" + token;
+ System.out.println(uavStatusWsURL);
+ UAVWebsocketClient uavStatusWebsocketClient = null;
+ try {
+ uavStatusWebsocketClient = new UAVWebsocketClient(new URI(uavStatusWsURL));
+ uavStatusWebsocketClient.connect();
+ System.out.println("杩炴帴涓�傘�傘��");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(!uavStatusWebsocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)){
+ uavStatusWebsocketClient.close();
+ uavStatusWebsocketClient = null;
+ }
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String uavControlWsURL = "ws://" + ip + "api/v1/ws/cmd?x-auth-token=" + token;
+ System.out.println(uavControlWsURL);
+ UAVWebsocketClient uavControlWebsocketClient = null;
+ try {
+ uavControlWebsocketClient = new UAVWebsocketClient(new URI(uavControlWsURL));
+ uavControlWebsocketClient.connect();
+ System.out.println("杩炴帴涓�傘�傘��");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(!uavControlWebsocketClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)){
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ UAVWebsocketClient uavStatusWebsocketClient0 = UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient0.close();
+
+ uavControlWebsocketClient.close();
+ uavStatusWebsocketClient0 = null;
+ uavControlWebsocketClient = null;
+ }
+ } catch (NumberFormatException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ if(uavStatusWebsocketClient != null || uavControlWebsocketClient != null){
+ UAVWebsocketClientMap.put("status", uavStatusWebsocketClient);
+ UAVWebsocketClientMap.put("control", uavControlWebsocketClient);
+
+ Map<String,Object> para = new HashMap();
+ para.put("biz_code", "user_cmd");
+ para.put("version", "1.0");
+ Date date = new Date();
+ para.put("time_stamp", String.valueOf(date.getTime()));
+ Map<String,String> payload = new HashMap();
+ payload.put("timeStamp", String.valueOf(date.getTime()));
+ Map<String,Object> data = new HashMap();
+ data.put("dataHead", "0x7479");
+ data.put("cmdCode", "0x02");
+ data.put("payload", payload);
+ para.put("data", data);
+ try{
+ uavStatusWebsocketClient.send(JSON.toJSONString(para));
+ uavControlWebsocketClient.send(JSON.toJSONString(para));
+ //System.out.println("鏃犱汉鏈哄績璺冲彂閫�");
+ }catch(Exception e){
+ e.printStackTrace();
+ System.out.println(uavStatusWebsocketClient.getServerUri());
+ System.out.println(uavControlWebsocketClient.getServerUri());
+ //鏃犱汉鏈虹姸鎬佺伃娲�
+ uavStatusWebsocketClient = UAVWebsocketClientMap.get("status");
+ uavStatusWebsocketClient.close();
+ //鏃犱汉鏈烘帶鍒剁伃娲�
+ uavControlWebsocketClient = UAVWebsocketClientMap.get("control");
+ uavControlWebsocketClient.close();
+
+ UAVWebsocketClientMap.remove("status");
+ UAVWebsocketClientMap.remove("control");
+ }
+ }
+ }
+ }
+ }
+ };
+ heartBeatTimer.scheduleAtFixedRate(heartBeatTask,date,10*1000);
+ }
+
public String Encrypt(String sSrc, String sKey) {
if (sKey == null) {
diff --git a/ard-work/src/main/java/com/ruoyi/device/uav/websocketclient/UAVWebsocketClient.java b/ard-work/src/main/java/com/ruoyi/device/uav/websocketclient/UAVWebsocketClient.java
new file mode 100644
index 0000000..4c0712b
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/uav/websocketclient/UAVWebsocketClient.java
@@ -0,0 +1,45 @@
+package com.ruoyi.device.uav.websocketclient;
+
+import org.java_websocket.client.WebSocketClient;
+import org.java_websocket.handshake.ServerHandshake;
+
+import java.net.URI;
+import java.util.Timer;
+
+public class UAVWebsocketClient extends WebSocketClient {
+
+ private URI serverUri;
+
+ public UAVWebsocketClient(URI serverUri) {
+ super(serverUri);
+ this.serverUri = serverUri;
+ }
+
+ public URI getServerUri() {
+ return serverUri;
+ }
+
+ public void setServerUri(URI serverUri) {
+ this.serverUri = serverUri;
+ }
+
+ @Override
+ public void onOpen(ServerHandshake serverHandshake) {
+
+ }
+
+ @Override
+ public void onMessage(String s) {
+
+ }
+
+ @Override
+ public void onClose(int i, String s, boolean b) {
+
+ }
+
+ @Override
+ public void onError(Exception e) {
+
+ }
+}
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 de5e323..54487b2 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
@@ -901,6 +901,23 @@
@Override
public Results chaseCarByCarId(String usersId, String carId, String cycle) {
+ ArdSyUser ardSyUser = ardSyUserMapper.userById(usersId);
+ String userId ="";
+ String password = "";
+ if(ardSyUser != null){
+ userId = ardSyUser.getUserId();
+ password = DigestUtils.md5Hex(ardSyUser.getPassword());
+ }else{
+ return Results.error("娌℃湁鎸傛帴涓変竴杞﹁締鐢ㄦ埛");
+ }
+ List<SysConfig> syURLResult = sysConfigMapper.selectByType("syCarPT");
+ String syURL = "";
+ if(syURLResult.size() != 0){
+ syURL = syURLResult.get(0).getConfigValue();
+ }else{
+ return Results.error("涓変竴杞﹁締鍦板潃鏈綍鍏�");
+ }
+
String sessionId = "";
for(String key : ONLINE_USER_SESSIONS.keySet()){
if(key.startsWith(usersId + "_")){
@@ -916,6 +933,10 @@
userCarTimerMap.get(usersId).cancel();
userCarTimerMap.remove(usersId);
PositionContainer.getUserPositionMap().remove(usersId);
+ Map<String,Object> loginResult = sYClient.logIn(syURL, password, userId);
+ String sySessionId = (String) loginResult.get("sessionId");
+ String params = "%7B%220020%22:%220%22,%220029%22:%2230%22%7d";
+ sYClient.changePositionSendMode(syURL, carId,104,"CmdSetParam",params,sySessionId);//鍋滄杩借釜锛屾敼涓哄畾鏃�30s鎺ㄩ��
System.out.println("鍋滄杩借釜");
}
return Results.succeed("鍋滄杩借釜");
@@ -927,6 +948,19 @@
Map<String, Map<String, Object>> map = new HashMap();
map.put(carId, new HashMap());
PositionContainer.getUserPositionMap().put(usersId, map);
+
+ Map<String,Object> loginResult = sYClient.logIn(syURL, password, userId);
+ String sySessionId = (String) loginResult.get("sessionId");
+ List<SysConfig> distanceSYResult = sysConfigMapper.selectByType("31time");
+ String time = "";
+ if(distanceSYResult.size() != 0){
+ time = distanceSYResult.get(0).getConfigValue();
+ }else{
+ return Results.error("涓変竴杞﹁締瀹氭椂鏈綍鍏�");
+ }
+ String params = "%7B%220020%22:%220%22,%220029%22:%22"+time+"%22%7d";
+ sYClient.changePositionSendMode(syURL, carId,104,"CmdSetParam",params,sySessionId);//寮�濮嬭拷韪紝鏀逛负瀹氭椂鎺ㄩ��
+
Map<String, Object> position = PositionContainer.getCarPositionMap().get(carId);//鏌ヨ褰撳墠杞﹁締浣嶇疆
if (position != null) {
if (position.size() != 0) {
@@ -954,6 +988,25 @@
userCarTimerMap.get(usersId).cancel();
userCarTimerMap.remove(usersId);
PositionContainer.getUserPositionMap().remove(usersId);
+
+ ArdSyUser ardSyUser = ardSyUserMapper.userById(usersId);
+ String userId ="";
+ String password = "";
+ if(ardSyUser != null){
+ userId = ardSyUser.getUserId();
+ password = ardSyUser.getPassword();
+ }
+ List<SysConfig> syURLResult = sysConfigMapper.selectByType("syCarPT");
+ String syURL = "";
+ if(syURLResult.size() != 0){
+ syURL = syURLResult.get(0).getConfigValue();
+ }
+ if(!userId.equals("") && !password.equals("") && !syURL.equals("")){
+ Map<String,Object> loginResult = sYClient.logIn(syURL, password, userId);
+ String sySessionId = (String) loginResult.get("sessionId");
+ String params = "%7B%220020%22:%220%22,%220029%22:%2230%22%7d";
+ sYClient.changePositionSendMode(syURL, carId,104,"CmdSetParam",params,sySessionId);//鍋滄杩借釜锛屾敼涓哄畾鏃�30s
+ }
System.out.println("鐢ㄦ埛绂荤嚎锛屽仠姝㈣拷韪�");
}
}
@@ -969,6 +1022,19 @@
Map<String, Map<String, Object>> map = new HashMap();
map.put(carId, new HashMap());
PositionContainer.getUserPositionMap().put(usersId, map);
+
+ Map<String,Object> loginResult = sYClient.logIn(syURL, password, userId);
+ String sySessionId = (String) loginResult.get("sessionId");
+ List<SysConfig> distanceSYResult = sysConfigMapper.selectByType("31time");
+ String time = "";
+ if(distanceSYResult.size() != 0){
+ time = distanceSYResult.get(0).getConfigValue();
+ }else{
+ return Results.error("涓変竴杞﹁締瀹氭椂鏈綍鍏�");
+ }
+ String params = "%7B%220020%22:%220%22,%220029%22:%22"+time+"%22%7d";
+ sYClient.changePositionSendMode(syURL, carId,104,"CmdSetParam",params,sySessionId);//寮�濮嬭拷韪紝鏀逛负瀹氭椂鎺ㄩ��
+
Map<String, Object> position = PositionContainer.getCarPositionMap().get(carId);//鏌ヨ褰撳墠杞﹁締浣嶇疆
if (position != null) {
if (position.size() != 0) {
@@ -996,6 +1062,25 @@
userCarTimerMap.get(usersId).cancel();
userCarTimerMap.remove(usersId);
PositionContainer.getUserPositionMap().remove(usersId);
+
+ ArdSyUser ardSyUser = ardSyUserMapper.userById(usersId);
+ String userId ="";
+ String password = "";
+ if(ardSyUser != null){
+ userId = ardSyUser.getUserId();
+ password = ardSyUser.getPassword();
+ }
+ List<SysConfig> syURLResult = sysConfigMapper.selectByType("syCarPT");
+ String syURL = "";
+ if(syURLResult.size() != 0){
+ syURL = syURLResult.get(0).getConfigValue();
+ }
+ if(!userId.equals("") && !password.equals("") && !syURL.equals("")){
+ Map<String,Object> loginResult = sYClient.logIn(syURL, password, userId);
+ String sySessionId = (String) loginResult.get("sessionId");
+ String params = "%7B%220020%22:%220%22,%220029%22:%2230%22%7d";
+ sYClient.changePositionSendMode(syURL, carId,104,"CmdSetParam",params,sySessionId);//鍋滄杩借釜锛屾敼涓哄畾鏃�30s
+ }
System.out.println("鐢ㄦ埛绂荤嚎锛屽仠姝㈣拷韪�");
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java b/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java
index f0cac0f..d515734 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/forest/SYClient.java
@@ -41,4 +41,7 @@
@Get(url = "${syURL}/gps-web/api/get_alarm_h_pfm_detail.jsp?carId=${carId}&startTime=${startTime}&endTime=${endTime}&typeIds=&speed=&duration=&alarmSrcs=&alarmLevels=1&sessionId=${sessionId}")
Map<String,Object> getAlarmHPfmCountDetail(@Var("syURL") String syURL, @Var("carId") String carId,@Var("sessionId") String sessionId,@Var("startTime") String startTime,@Var("endTime") String endTime);
+
+ @Get(url = "${syURL}/gps-web/api/send_cmd.jsp?params=${paramsStr}&userId=admin&loginType=user&carId=${carId}&cmdId=${cmdId}&cmd=${cmd}&sessionId=${sessionId}")
+ Map<String,Object> changePositionSendMode(@Var("syURL") String syURL, @Var("carId") String carId,@Var("cmdId") Integer cmdId,@Var("cmd") String cmd,@Var("paramsStr") String paramsStr,@Var("sessionId") String sessionId);
}
diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
index 938f638..5d4b794 100644
--- a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -70,6 +70,32 @@
left join sys_user u on u.user_id = c.user_id
</sql>
+ <resultMap type="ArdAlarmpointsWell" id="ArdAlarmpointsWellOnlyResult">
+ <result property="id" column="id"/>
+ <result property="wellId" column="well_id"/>
+ <result property="wellNumber" column="well_number"/>
+ <result property="oilProduction" column="oil_production"/>
+ <result property="wellBlock" column="well_block"/>
+ <result property="productionDate" column="production_date"/>
+ <result property="displacementMode" column="displacement_mode"/>
+ <result property="surroundingEnvironment" column="surrounding_environment"/>
+ <result property="wellType" column="well_type"/>
+ <result property="installedLoad" column="installed_load"/>
+ <result property="meteringStation" column="metering_station"/>
+ <result property="transferStation" column="transfer_station"/>
+ <result property="dehydrationStation" column="dehydration_station"/>
+ <result property="runStatus" column="run_status"/>
+ <result property="longitude" column="longitude"/>
+ <result property="latitude" column="latitude"/>
+ <result property="altitude" column="altitude"/>
+ <result property="deptId" column="dept_id"/>
+ <result property="userId" column="user_id"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ </resultMap>
+
<select id="selectArdAlarmpointsWellList" parameterType="ArdAlarmpointsWell" resultMap="ArdAlarmpointsWellResult">
<include refid="selectArdAlarmpointsWellVo"/>
<where>
@@ -259,6 +285,20 @@
</foreach>
</select>
+ <select id="getWellDataByPatrolplanIdAndPosition" resultMap="ArdAlarmpointsWellOnlyResult">
+ select aaw.* from ard_app_patrolplan aap
+ inner join ard_app_patrolpoint aap0 on aap.id = aap0.patrolplan_id
+ inner join ard_alarmpoints_well aaw on aap0.alarmpoints_id = aaw.id
+ where del is null and aap.id = #{patrolplanId}
+ and f_compute_distance(cast(#{longitude} as decimal),cast(#{latitude} as decimal),aaw.longitude,aaw.latitude)
+ <= (select cast(sc.config_value as decimal) from sys_config sc where sc.config_key = 'appAlarmPointsDistance')
+ order by f_compute_distance(cast(#{longitude} as decimal),cast(#{latitude} as decimal),aaw.longitude,aaw.latitude) desc limit 1 offset 0
+ </select>
+
+ <select id="getWellById" resultMap="ArdAlarmpointsWellOnlyResult">
+ select aaw.* from ard_alarmpoints_well aaw where aaw.id = #{id}
+ </select>
+
<select id="conditionList" parameterType="List"
resultType="com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo">
diff --git a/ard-work/src/main/resources/mapper/app/ArdAppPositionMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppPositionMapper.xml
index f9c55f4..0517147 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppPositionMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppPositionMapper.xml
@@ -97,4 +97,16 @@
and aaa.state = '1' and su.app_online_state = '1'
order by aap.create_time desc limit 1 offset 0
</select>
+
+ <select id="getAPPPositionByUserIdAndTime" parameterType="java.lang.String" resultMap="ArdAppPositionResult">
+ select * from ard_app_position aap
+ where aap.user_id = #{userId} and aap.create_time >= #{beginTime}
+ and aap.create_time <= #{endTime} order by aap.create_time asc
+ </select>
+
+ <select id="getLastAPPPositionByUserId" parameterType="java.lang.String" resultMap="ArdAppPositionResult">
+ select * from ard_app_position aap
+ where aap.user_id = #{userId}
+ order by aap.create_time desc limit 1 offset 0
+ </select>
</mapper>
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index bb69bbe..d81d647 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -265,4 +265,5 @@
return Results.succeed("淇敼瀵嗙爜鎴愬姛锛�");
}
}
+
}
diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml
index 83a4fca..97be1dc 100644
--- a/ruoyi-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-admin/src/main/resources/application-dev.yml
@@ -2,6 +2,17 @@
server:
# 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
port: 8080
+ ssl:
+ # 寮�鍚疕TTPS锛屽苟閰嶇疆鑷鍚嶈瘉涔�
+ enabled: true
+ #绉橀挜搴撴枃浠跺悕绉帮紝鍗充笂闈㈢敓鎴愮殑鑷鍚嶈瘉涔�
+ key-store: classpath:keystore
+ # 鐢熸垚绉橀挜搴撴枃浠剁殑瀵嗙爜
+ key-store-password: 123456
+ # 绉橀挜搴撶被鍨嬶紙JKS涓簀dk鐨刱eytool宸ュ叿榛樿鐢熸垚鐨勭閽ュ簱绫诲瀷锛�
+ key-store-type: JKS
+ # 绉橀挜鍒悕
+ key-alias: tomcat
servlet:
# 搴旂敤鐨勮闂矾寰�
context-path: /
@@ -18,23 +29,24 @@
# 鏃ュ織閰嶇疆
logging:
level:
- com.ruoyi.common.filter.MyI18nInterceptor: debug
+ com.ruoyi.common.filter.MyI18nInterceptor: info
authorize: info
minio: info
- hikSdk: debug
- dhSdk: debug
- sdk: debug
- vtdu: debug
+ hikSdk: info
+ dhSdk: info
+ sdk: info
+ vtdu: info
stealAlarm: info
websocket: info
- patrolInspectionTask: info
- mqtt: info
+ patrolInspectionTask: debug
+ mqtt: debug
guideQueue: debug
rongCloud: info
- cmd: info
+ cmd: debug
+ alarm: debug
uav: info
- sy: debug
- mqttCar: debug
+ sy: info
+ mqttCar: info
## knife4j閰嶇疆
knife4j:
# knife4j澧炲己鍔熻兘,寮�鍚悗涓嬮潰鍙傛暟鎵嶇敓鏁�
@@ -61,7 +73,7 @@
#鍏ㄩ儴涓婚锛歮inioEvent,radar,stealelec,tube,camera,external,accessControl,apponekey,digitization3
mqtt:
host: tcp://192.168.2.15:1883
- clientId: Server-227
+ clientId: Server
username: admin
password: admin
topic: minioEvent,radar,stealelec,tube,camera,external,accessControl,apponekey,digitization3,radarForceGuide
@@ -70,4 +82,4 @@
enabled: true
#涓変竴杞﹁締寮�鍏�
syCar:
- enabled: true
\ No newline at end of file
+ enabled: true
diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml
index 97b38c7..e0ebd19 100644
--- a/ruoyi-admin/src/main/resources/application-prod.yml
+++ b/ruoyi-admin/src/main/resources/application-prod.yml
@@ -2,6 +2,17 @@
server:
# 鏈嶅姟鍣ㄧ殑HTTP绔彛锛岄粯璁や负8080
port: 8080
+ ssl:
+ # 寮�鍚疕TTPS锛屽苟閰嶇疆鑷鍚嶈瘉涔�
+ enabled: true
+ #绉橀挜搴撴枃浠跺悕绉帮紝鍗充笂闈㈢敓鎴愮殑鑷鍚嶈瘉涔�
+ key-store: classpath:keystore
+ # 鐢熸垚绉橀挜搴撴枃浠剁殑瀵嗙爜
+ key-store-password: 123456
+ # 绉橀挜搴撶被鍨嬶紙JKS涓簀dk鐨刱eytool宸ュ叿榛樿鐢熸垚鐨勭閽ュ簱绫诲瀷锛�
+ key-store-type: JKS
+ # 绉橀挜鍒悕
+ key-alias: tomcat
servlet:
# 搴旂敤鐨勮闂矾寰�
context-path: /
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
index c7567df..f132a51 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -144,4 +144,8 @@
List<SysUser> getOnlineCommander(String usersId);
List<SysUser> getOnlinePC(@Param("usersId") String usersId,@Param("onLinePCIdList")List<String> onLinePCIdList);
+
+ List<SysUser> getOwnAndChildrenOnlineSoilderList(@Param("deptIdList")List<Long> deptIdList);
+
+ List<SysUser> getOwnAndChildrenSoilderListAll(@Param("deptIdList")List<Long> deptIdList);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 9e26b0f..a37f029 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -18,6 +18,7 @@
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.mapper.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,11 +37,6 @@
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
-import com.ruoyi.system.mapper.SysPostMapper;
-import com.ruoyi.system.mapper.SysRoleMapper;
-import com.ruoyi.system.mapper.SysUserMapper;
-import com.ruoyi.system.mapper.SysUserPostMapper;
-import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
@@ -77,6 +73,9 @@
private RedisCache redisCache;
@Resource
private ArdAlarmTypeConfigMapper ardAlarmTypeConfigMapper;
+
+ @Resource
+ private SysDeptMapper sysDeptMapper;
/**
* 椤圭洰鍚姩鏃讹紝鍒濆鍖栧弬鏁板埌缂撳瓨
@@ -647,4 +646,5 @@
queryWrapper.eq("dept_id",deptId).eq("del_flag","0").eq("app_user_type","1");
return userMapper.selectList(queryWrapper);
}
+
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 18bfb26..a014700 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -342,4 +342,33 @@
#{userId}
</foreach>
</select>
+
+ <select id="getOwnAndChildrenOnlineSoilderList" resultMap="SysUserOnlyResult">
+ select distinct su.user_id,su.dept_id,su.user_name,
+ concat(su.nick_name,'(',sd.dept_name,')') as nick_name from sys_user su
+ inner join sys_user_role sur on su.user_id = sur.user_id
+ inner join sys_role sr on sur.role_id = sr.role_id
+ inner join sys_dept sd on su.dept_id = sd.dept_id
+ where sr.role_key = 'appUser' and su.dept_id in
+ <foreach collection="deptIdList" item="deptId" open="(" close=")" separator=",">
+ #{deptId}
+ </foreach>
+ and su.app_online_state = '1' and su.status = '0' and su.del_flag = '0'
+ order by su.dept_id asc
+ </select>
+
+ <select id="getOwnAndChildrenSoilderListAll" resultMap="SysUserOnlyResult">
+ select distinct su.user_id,su.dept_id,su.user_name,
+ concat(su.nick_name,'(',sd.dept_name,')') as nick_name,
+ su.app_online_state from sys_user su
+ inner join sys_user_role sur on su.user_id = sur.user_id
+ inner join sys_role sr on sur.role_id = sr.role_id
+ inner join sys_dept sd on su.dept_id = sd.dept_id
+ where sr.role_key = 'appUser' and su.dept_id in
+ <foreach collection="deptIdList" item="deptId" open="(" close=")" separator=",">
+ #{deptId}
+ </foreach>
+ and su.status = '0' and su.del_flag = '0'
+ order by su.dept_id asc
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3