From 509d655f6c1c70c38cb54ca3e5b0bac3dcfe0020 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 27 九月 2023 10:47:48 +0800
Subject: [PATCH] 增加获取附近井接口
---
/dev/null | 40 -------------
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 9 ++
ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java | 9 +++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 70 +++++++++++++++--------
ruoyi-admin/Dockerfile | 3
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 8 ++
6 files changed, 71 insertions(+), 68 deletions(-)
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 e091a7b..0324f85 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
@@ -211,6 +211,12 @@
//鏍规嵁deptId鑾峰彇瀵瑰簲鍏磋叮鐐规暟鎹�
return Results.succeed(ardAlarmpointsWellService.conditionList(ardAlarmpointsWellParam));
}
-
+ @PostMapping("/getNearbyWells")
+ @ApiOperation("鏌ヨ闄勮繎鐨勬墍鏈変簳")
+ public TableDataInfo getNearbyWells(Long deptId,Double[]position){
+ startPage();
+ List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(deptId,position,1000);
+ return getDataTable(nearbyWellList);
+ }
}
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 747dff2..f2432e8 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
@@ -102,7 +102,7 @@
/**
* 鏍稿浜曞彿鏄惁鍞竴
*
- * @param id 闇�瑕佹牳瀵圭殑浜曠殑涓婚敭
+ * @param well 闇�瑕佹牳瀵圭殑浜�
* @return 缁撴灉
*/
@@ -117,5 +117,10 @@
PageInfo<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam);
List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList);
-
+ /**
+ * 鑾峰彇闄勮繎鐨勪簳
+ * 鍒樿嫃涔�
+ * 2023/9/27 10:26:35
+ */
+ List<ArdAlarmpointsWell> getNearbyWellList(Long deptId,Double[] position,Integer range);
}
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 7a1d553..7b20289 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.util.ArrayList;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -19,6 +20,7 @@
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.utils.gis.GisUtil;
import lombok.ToString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,6 +44,7 @@
private ArdAlarmpointsWellMapper ardAlarmpointsWellMapper;
@Autowired
protected Validator validator;
+
/**
* 鏌ヨ浜曠鐞�
*
@@ -52,6 +55,7 @@
public ArdAlarmpointsWell selectArdAlarmpointsWellById(String id) {
return ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(id);
}
+
/**
* 鏌ヨ浜曠鐞�
*
@@ -70,18 +74,17 @@
* @return 浜曠鐞�
*/
@Override
- @DataScope(deptAlias = "d",userAlias = "u")
+ @DataScope(deptAlias = "d", userAlias = "u")
public List<ArdAlarmpointsWell> selectArdAlarmpointsWellList(ArdAlarmpointsWell ardAlarmpointsWell) {
return ardAlarmpointsWellMapper.selectArdAlarmpointsWellList(ardAlarmpointsWell);
}
/**
- *
* @param ardAlarmpointsWell 鎸変簳缂栧彿鏌ヨ
* @return
*/
@Override
- @DataScope(deptAlias = "d",userAlias = "u")
+ @DataScope(deptAlias = "d", userAlias = "u")
public List<ArdAlarmpointsWell> selectArdAlarmpointsWellByWellIdLike(ArdAlarmpointsWell ardAlarmpointsWell) {
return ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellIdLike(ardAlarmpointsWell);
}
@@ -96,8 +99,7 @@
@Transactional
public int insertArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
- if(wellIdExists)
- {
+ if (wellIdExists) {
throw new RuntimeException("浜曞彿宸插瓨鍦�");
}
ardAlarmpointsWell.setId(IdUtils.simpleUUID());
@@ -117,8 +119,7 @@
@Transactional
public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
- if(wellIdExists)
- {
+ if (wellIdExists) {
throw new RuntimeException("浜曞彿宸插瓨鍦�");
}
ardAlarmpointsWell.setUpdateBy(SecurityUtils.getUsername());
@@ -204,10 +205,8 @@
* @param well 浜曚俊鎭�
*/
@Override
- public void checkWellAllowed(ArdAlarmpointsWell well)
- {
- if (StringUtils.isNotNull(well.getId()))
- {
+ public void checkWellAllowed(ArdAlarmpointsWell well) {
+ if (StringUtils.isNotNull(well.getId())) {
throw new ServiceException("涓嶅厑璁告搷浣滀簳");
}
}
@@ -218,23 +217,21 @@
* @param userId 鐢ㄦ埛id
*/
@Override
- public void checkWellDataScope(String userId)
- {
- if (!SysUser.isAdmin(SecurityUtils.getUserId()))
- {
+ public void checkWellDataScope(String userId) {
+ if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
ArdAlarmpointsWell well = new ArdAlarmpointsWell();
well.setUserId(userId);
List<ArdAlarmpointsWell> wells = SpringUtils.getAopProxy(this).selectArdAlarmpointsWellList(well);
- if (StringUtils.isEmpty(wells))
- {
+ if (StringUtils.isEmpty(wells)) {
throw new ServiceException("娌℃湁鏉冮檺璁块棶浜曟暟鎹紒");
}
}
}
+
/**
* 鏍稿浜曞彿鏄惁鍞竴
*
- * @param wellId 闇�瑕佹牳瀵圭殑浜曞彿
+ * @param well 闇�瑕佹牳瀵圭殑浜�
* @return 缁撴灉
*/
@Override
@@ -254,7 +251,7 @@
@Override
public List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList) {
QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
- queryWrapper.in("dept_id",deptList);
+ queryWrapper.in("dept_id", deptList);
return ardAlarmpointsWellMapper.selectList(queryWrapper);
}
@@ -266,18 +263,18 @@
@Override
public List<ArdAlarmpointsWell> wellList(List<Long> deptList) {
QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
- queryWrapper.select("id","well_id","oil_production","longitude","latitude","altitude").in("dept_id",deptList);
+ queryWrapper.select("id", "well_id", "oil_production", "longitude", "latitude", "altitude").in("dept_id", deptList);
return ardAlarmpointsWellMapper.selectList(queryWrapper);
}
@Override
- public PageInfo<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam){
+ public PageInfo<ArdAlarmpointsWell> conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam) {
Integer pageNum = ardAlarmpointsWellParam.getPageNum();
Integer pageSize = ardAlarmpointsWellParam.getPageSize();
- PageHelper.startPage(pageNum,pageSize);
+ PageHelper.startPage(pageNum, pageSize);
QueryWrapper<ArdAlarmpointsWell> queryWrapper = new QueryWrapper<>();
- queryWrapper.in("dept_id",ardAlarmpointsWellParam.getDeptList())
- .like(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellId()),"well_id",ardAlarmpointsWellParam.getWellId());
+ queryWrapper.in("dept_id", ardAlarmpointsWellParam.getDeptList())
+ .like(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellId()), "well_id", ardAlarmpointsWellParam.getWellId());
// .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellNumber()),"well_number",ardAlarmpointsWellParam.getWellNumber())
// .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getOilProduction()),"oil_production",ardAlarmpointsWellParam.getOilProduction())
// .eq(!StringUtils.isBlank(ardAlarmpointsWellParam.getWellBlock()),"well_block",ardAlarmpointsWellParam.getWellBlock())
@@ -297,4 +294,29 @@
public List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList) {
return ardAlarmpointsWellMapper.wellListDept(deptList);
}
+
+ @Override
+ public List<ArdAlarmpointsWell> getNearbyWellList(Long deptId, Double[] position, Integer range) {
+ List<ArdAlarmpointsWell> nearbyWellList = new ArrayList<>();
+ try {
+ ArdAlarmpointsWell ardAlarmpointsWell = new ArdAlarmpointsWell();
+ ardAlarmpointsWell.setDeptId(deptId);
+ List<ArdAlarmpointsWell> ardAlarmpointsWells = ardAlarmpointsWellMapper.selectArdAlarmpointsWellList(ardAlarmpointsWell);
+ if (ardAlarmpointsWells.size() > 0) {
+ for (ArdAlarmpointsWell well : ardAlarmpointsWells) {
+ Double longitude = well.getLongitude();
+ Double latitude = well.getLatitude();
+ if (longitude != null && latitude != null) {
+ double distance = GisUtil.getDistance(position, new Double[]{longitude, latitude});
+ if (distance <= range) {
+ nearbyWellList.add(well);
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ log.error("鑾峰彇闄勮繎浜曞紓甯革細" + ex.getMessage());
+ }
+ return nearbyWellList;
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java b/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
index 85979a9..c8ec803 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
@@ -26,6 +26,15 @@
GlobalCoordinates target = new GlobalCoordinates(latitudeTo, longitudeTo);
return geodeticCalculator.calculateGeodeticCurve(Ellipsoid.WGS84, source, target).getEllipsoidalDistance();
}
+ public static double getDistance(Double[] From, Double[] To) {
+ double longitudeFrom = From[0];
+ double latitudeFrom = From[1];
+ double longitudeTo = To[0];
+ double latitudeTo = To[1];
+ GlobalCoordinates source = new GlobalCoordinates(latitudeFrom, longitudeFrom);
+ GlobalCoordinates target = new GlobalCoordinates(latitudeTo, longitudeTo);
+ return geodeticCalculator.calculateGeodeticCurve(Ellipsoid.WGS84, source, target).getEllipsoidalDistance();
+ }
/**
* 鏍规嵁缁忕含搴︼紝璁$畻涓ょ偣闂寸殑璺濈
*
diff --git a/ard-work/src/main/resources/templates/mediaMTX.html b/ard-work/src/main/resources/templates/mediaMTX.html
deleted file mode 100644
index 7b1680a..0000000
--- a/ard-work/src/main/resources/templates/mediaMTX.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="UTF-8">
- <title>video.js鎾斁rtmp娴�</title>
- <!--寮曞叆鎾斁鍣ㄦ牱寮�-->
- <link href="http://vjs.zencdn.net/5.19/video-js.min.css" rel="stylesheet">
- <!--寮曞叆鎾斁鍣╦s-->
- <script src="http://vjs.zencdn.net/5.19/video.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/videojs-flash@2/dist/videojs-flash.min.js"></script>
-</head>
-<body>
-<!--vjs-big-play-centered 鎾斁鎸夐挳灞呬腑-->
-<!--poster榛樿鐨勬樉绀虹晫闈紝灏辨槸杩樻病鐐规挱鏀撅紝缁欎綘鏄剧ず鐨勭晫闈�-->
-<!--controls 瑙勫畾娴忚鍣ㄥ簲璇ヤ负瑙嗛鎻愪緵鎾斁鎺т欢-->
-<!--preload="auto" 鏄惁鎻愬墠鍔犺浇-->
-<!--autoplay 鑷姩鎾斁-->
-<!--loop=true 鑷姩寰幆-->
-<!--data-setup='{"example_option":true}' 鍙互鎶婁竴浜涘睘鎬у啓鍒拌繖涓噷闈㈡潵锛屽data-setup={"autoplay":true}-->
-<video id="my-player"
- class="video-js vjs-default-skin vjs-big-play-centered" controls
- preload="auto" autoplay="autoplay"
- poster="images/logo.png" width="500" height="400"
- data-setup='{}'>
- <!--src: 瑙勫畾濯掍綋鏂囦欢鐨� URL type:瑙勫畾濯掍綋璧勬簮鐨勭被鍨�-->
- <source src='rtmp://192.168.1.194:1935/164' type='rtmp/flv' />
-</video>
-<script type="text/javascript">
- // 璁剧疆flash璺緞,鐢ㄤ簬鍦╲ideojs鍙戠幇娴忚鍣ㄤ笉鏀寔HTML5鎾斁鍣ㄧ殑鏃跺�欒嚜鍔ㄥ敜璧穎lash鎾斁鍣�
- videojs.options.flash.swf = 'https://cdn.bootcss.com/videojs-swf/5.4.1/video-js.swf';
- //my-player涓洪〉闈ideo鍏冪礌鐨刬d
- var player = videojs('my-player');
- //鎾斁
- player.play();
- // 1. 鎾斁 player.play()
- // 2. 鍋滄 player.pause()
- // 3. 鏆傚仠 player.pause()
-</script>
-</body>
-</html>
diff --git a/ruoyi-admin/Dockerfile b/ruoyi-admin/Dockerfile
index cf735a9..280c76f 100644
--- a/ruoyi-admin/Dockerfile
+++ b/ruoyi-admin/Dockerfile
@@ -4,4 +4,5 @@
ENV TimeZone=Asia/Shanghai
# 浣跨敤杞繛鎺ワ紝骞朵笖灏嗘椂鍖洪厤缃鐩�/etc/timezone
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
-ENTRYPOINT ["java","-jar","/ruoyi-admin.jar"]
\ No newline at end of file
+RUN mkdir -p /work
+ENTRYPOINT ["java","-Dloader.path=/work/libs","-jar","/ruoyi-admin.jar"]
\ No newline at end of file
--
Gitblit v1.9.3