From 86a4c7ca3512cbe8b8d5cf9479174bfceead10db Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 27 九月 2023 11:09:32 +0800
Subject: [PATCH] 优化获取附近井接口
---
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 2 +-
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 26 ++++++++++++++------------
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 6 ++++--
3 files changed, 19 insertions(+), 15 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 0324f85..e6545e8 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
@@ -5,6 +5,7 @@
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
@@ -213,9 +214,10 @@
}
@PostMapping("/getNearbyWells")
@ApiOperation("鏌ヨ闄勮繎鐨勬墍鏈変簳")
- public TableDataInfo getNearbyWells(Long deptId,Double[]position){
+ @ApiOperationSupport(includeParameters = {"longitude","latitude","deptId","pageNum","pageSize"})
+ public TableDataInfo getNearbyWells(ArdAlarmpointsWell ardAlarmpointsWell){
startPage();
- List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(deptId,position,1000);
+ List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(ardAlarmpointsWell,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 f2432e8..364225f 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
@@ -122,5 +122,5 @@
* 鍒樿嫃涔�
* 2023/9/27 10:26:35
*/
- List<ArdAlarmpointsWell> getNearbyWellList(Long deptId,Double[] position,Integer range);
+ List<ArdAlarmpointsWell> getNearbyWellList(ArdAlarmpointsWell ardAlarmpointsWell,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 7b20289..89acfd4 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
@@ -296,20 +296,22 @@
}
@Override
- public List<ArdAlarmpointsWell> getNearbyWellList(Long deptId, Double[] position, Integer range) {
+ public List<ArdAlarmpointsWell> getNearbyWellList(ArdAlarmpointsWell ardAlarmpointsWell, 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);
+ Double longitudeCenter = ardAlarmpointsWell.getLongitude();
+ Double latitudeCenter = ardAlarmpointsWell.getLatitude();
+ if (longitudeCenter != null && latitudeCenter != null) {
+ 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(new Double[]{longitudeCenter, latitudeCenter}, new Double[]{longitude, latitude});
+ if (distance <= range) {
+ nearbyWellList.add(well);
+ }
}
}
}
--
Gitblit v1.9.3